How can we fetch the data for a given condition in HBase?


3 Answer(s)


Hey Swati,
Use query (get '', '', ':') to get any particular row in Hbase table, showed table contents and then query used in my system:

============================
hbase(main):013:0> scan 'student'
ROW COLUMN+CELL
first column=details:age, timestamp=1445562227112, value=39
first column=details:gender, timestamp=1445562236261, value=M
first column=details:name, timestamp=1445562205022, value=prashanth
second column=details:name, timestamp=1445562317027, value=Mary
2 row(s) in 0.0110 seconds

hbase(main):014:0> get 'student', 'second', 'details:name'
COLUMN CELL
details:name timestamp=1445562317027, value=Mary
1 row(s) in 0.0100 seconds
==========================

For complex or conditional queries normally we have to write small java functions.

Hope this helps!

Thanks!
Surendra

sorry in last reply as I used Less than and Greater than symbols, all values are not showing in generic query.. below is the generic query I tried to sent:

Generic query to get any particular row in Hbase table:

get 'tablename', 'rowid', 'columnFamily:columnName'

you can use STARTROW and STOPROW to fetch records between ranges.