How to get a column value based on criteria like where clause in Hbase shell -


i new hbase.

i have scenario need pull filename based on status , current date.

so have created 3 columns; filename, status , date in hbase table.

how can filename based on condition status=true , date today?

this query needs executed on hbase shell.

achieving in concise way difficult. here did. hbase shell jruby shell, enables following example.

import org.apache.hadoop.hbase.filter.singlecolumnvaluefilter import org.apache.hadoop.hbase.filter.comparefilter import org.apache.hadoop.hbase.filter.substringcomparator import org.apache.hadoop.hbase.filter.filterlist  filter1 = singlecolumnvaluefilter.new(bytes.tobytes('cf'), bytes.tobytes('qualifier'), comparefilter::compareop.valueof('equal'), substringcomparator.new('valuetosearch')); filter2 = singlecolumnvaluefilter.new(bytes.tobytes('cf'), bytes.tobytes('qualifier2'), comparefilter::compareop.valueof('equal'), substringcomparator.new('valuetosearch2'));  filterlist = filterlist.new([filter1, filter2]);  scan 'table', {filter =>  filterlist} 

you import other filters, comparator, java objects etc

i have used substringcomparator testing.
in case should binarycomparator (probably better performance wise well).

refer this question if want read more similar hack.

hope helps.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -