Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 36B09118F6 for ; Mon, 16 Jun 2014 03:32:04 +0000 (UTC) Received: (qmail 93738 invoked by uid 500); 16 Jun 2014 03:32:01 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 93666 invoked by uid 500); 16 Jun 2014 03:32:01 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 93654 invoked by uid 99); 16 Jun 2014 03:32:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2014 03:32:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yuzhihong@gmail.com designates 209.85.160.177 as permitted sender) Received: from [209.85.160.177] (HELO mail-yk0-f177.google.com) (209.85.160.177) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2014 03:31:58 +0000 Received: by mail-yk0-f177.google.com with SMTP id 10so3713958ykt.8 for ; Sun, 15 Jun 2014 20:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=mIGoMmE6RdYPm9iMC6rknppWlorAndCywa8yx+Tq6E8=; b=0oc1x8xsVaTSpaa5t4DEIxowook7CVT7OSrsD5/f3cECMpBPt3SYmLMJnSW0AbmDrv 1/MJ/r5PDaPslqm5laWEWTNcLokZMe42Tg2Sh9SWiFS9GM9w7IOKYmrU4nakNgLTJJtS VTk9SHVafE/YWMttUO0qQn8R2LeT1iAZ0tB+GnTLv1K0VhJF/zJEwng4BV9Uo1OcmcWd yfPkTqORxZ1KD5nNDrw2Irib/OTzf+MuGEw3eQ0Ze/OqzNlBfKAuHHqTg7ENWV8B3Q3Z lp5ksMcBF3y9J3b/+LxqvG0alrSo08Z/VbQDF19uMc9iDqzHU9gBj3cVnIUaHS3vy8Ap WlSw== MIME-Version: 1.0 X-Received: by 10.236.0.200 with SMTP id 48mr29830775yhb.72.1402889493714; Sun, 15 Jun 2014 20:31:33 -0700 (PDT) Received: by 10.170.55.137 with HTTP; Sun, 15 Jun 2014 20:31:33 -0700 (PDT) In-Reply-To: <53DC189E5FAEFA43BFA1BC02431031DB740B0F5400@WECTMLBOX.winbond.com.tw> References: <53DC189E5FAEFA43BFA1BC02431031DB740B0F5400@WECTMLBOX.winbond.com.tw> Date: Sun, 15 Jun 2014 20:31:33 -0700 Message-ID: Subject: Re: RegexStringComparator problem: Why pattern "u" has the same result as ".*u.*" ? From: Ted Yu To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=089e0153712eee9d6d04fbeba9ed X-Virus-Checked: Checked by ClamAV on apache.org --089e0153712eee9d6d04fbeba9ed Content-Type: text/plain; charset=UTF-8 "u" is part of "hung", producing a match. Do you want to find string whose value is "u" (not a substring) ? In that case you can specify "^u$" Cheers On Sun, Jun 15, 2014 at 8:20 PM, Henry Hung wrote: > > I have this data set and the value I want to test is "cf:c" = "hung": > > hbase(main):001:0> scan 'TEST' > ROW COLUMN+CELL > \x00\x00\x00\x03abc\x00\x00\x00\x02 column=cf:a, > timestamp=1402649511909, value=abc > \x00\x00\x00\x03abc\x00\x00\x00\x02 column=cf:b, > timestamp=1402649511909, value=\x00\x00\x00\x02 > \x00\x00\x00\x03abc\x00\x00\x00\x02 column=cf:c, > timestamp=1402649511909, value=def > \x00\x00\x00\x03abc\x00\x00\x00\x02 column=cf:d, > timestamp=1402649511909, value=\x00\x00\x01F\x93\x81s\xA8 > \x00\x00\x00\x03abc\x00\x00\x00\x03 column=cf:a, > timestamp=1402649610557, value=abc > \x00\x00\x00\x03abc\x00\x00\x00\x03 column=cf:b, > timestamp=1402649610557, value=\x00\x00\x00\x03 > \x00\x00\x00\x03abc\x00\x00\x00\x03 column=cf:c, > timestamp=1402649610557, value=def > \x00\x00\x00\x03abc\x00\x00\x00\x03 column=cf:d, > timestamp=1402649610557, value=\x00\x00\x01F\x93\x81s\xA8 > \x00\x00\x00\x03abc\x00\x00\x00\x04 column=cf:a, > timestamp=1402650015602, value=abc > \x00\x00\x00\x03abc\x00\x00\x00\x04 column=cf:b, > timestamp=1402650015602, value=\x00\x00\x00\x04 > \x00\x00\x00\x03abc\x00\x00\x00\x04 column=cf:c, > timestamp=1402650015602, value=def > \x00\x00\x00\x03abc\x00\x00\x00\x04 column=cf:d, > timestamp=1402650015602, value=\x00\x00\x01F\x93\x81s\xA8 > \x00\x00\x00\x05henry\x00\x00\x00\x06 column=cf:a, > timestamp=1402886404698, value=henry > \x00\x00\x00\x05henry\x00\x00\x00\x06 column=cf:b, > timestamp=1402886404698, value=\x00\x00\x00\x06 > \x00\x00\x00\x05henry\x00\x00\x00\x06 column=cf:c, > timestamp=1402886404698, value=hung > \x00\x00\x00\x05henry\x00\x00\x00\x06 column=cf:d, > timestamp=1402886404698, value=\x00\x00\x01F\xA2\x8A\xBD\xA0 > \x00\x00\x00\x06abcdef\x00\x00\x00\x01 column=cf:a, > timestamp=1402650022755, value=abcdef > \x00\x00\x00\x06abcdef\x00\x00\x00\x01 column=cf:b, > timestamp=1402650022755, value=\x00\x00\x00\x01 > \x00\x00\x00\x06abcdef\x00\x00\x00\x01 column=cf:c, > timestamp=1402650022755, value=def > \x00\x00\x00\x06abcdef\x00\x00\x00\x01 column=cf:d, > timestamp=1402650022755, value=\x00\x00\x01F\x93\x81s\xA8 > \x00\x00\x00\x06abcdef\x00\x00\x00\x02 column=cf:a, > timestamp=1402650025763, value=abcdef > \x00\x00\x00\x06abcdef\x00\x00\x00\x02 column=cf:b, > timestamp=1402650025763, value=\x00\x00\x00\x02 > \x00\x00\x00\x06abcdef\x00\x00\x00\x02 column=cf:c, > timestamp=1402650025763, value=def > \x00\x00\x00\x06abcdef\x00\x00\x00\x02 column=cf:d, > timestamp=1402650025763, value=\x00\x00\x01F\x93\x81s\xA8 > 6 row(s) in 0.1090 seconds > > > I wrote some program to test it: > > HTable conn = new HTable(HBaseConfiguration.create(), "TEST"); > try { > Scan scan = new Scan(); > RegexStringComparator comp = new > RegexStringComparator("u"); > SingleColumnValueFilter filter =new > SingleColumnValueFilter(Bytes.toBytes("cf"), Bytes.toBytes("c"), > CompareOp.EQUAL, comp); > FilterList filters = new > FilterList(Operator.MUST_PASS_ALL); > filters.addFilter(filter); > scan.setFilter(filters); > ResultScanner rs = conn.getScanner(scan); > try { > Result r = rs.next(); > > System.out.println(Bytes.toString(r.getValue(Bytes.toBytes("cf"), > Bytes.toBytes("c")))); > } > finally { > rs.close(); > } > } > finally { > conn.close(); > } > > Because I use regex "u" as the value comparator, the program should throw > a null value exception. > But when execute it, the result is "hung". > > Question is why the SingleColumnValueFilter do not abide the regex > comparator? Or why is regex comparator "u" is the same as ".*u.*"? > > Best regards, > Henry Hung > > ________________________________ > The privileged confidential information contained in this email is > intended for use only by the addressees as indicated by the original sender > of this email. If you are not the addressee indicated in this email or are > not responsible for delivery of the email to such a person, please kindly > reply to the sender indicating this fact and delete all copies of it from > your computer and network server immediately. Your cooperation is highly > appreciated. It is advised that any unauthorized use of confidential > information of Winbond is strictly prohibited; and any information in this > email irrelevant to the official business of Winbond shall be deemed as > neither given nor endorsed by Winbond. > --089e0153712eee9d6d04fbeba9ed--