hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henry Hung <YTHu...@winbond.com>
Subject RegexStringComparator problem: Why pattern "u" has the same result as ".*u.*" ?
Date Mon, 16 Jun 2014 03:20:44 GMT

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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message