Wednesday, June 25, 2014

Filter query in HBase Shell

For a quick reference, to filter a column in HBase Shell, we can run the command as below,

import org.apache.hadoop.hbase.filter.CompareFilter
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter
import org.apache.hadoop.hbase.filter.SubstringComparator
import org.apache.hadoop.hbase.util.Bytes
scan 'table_name', {FILTER =>'family'),Bytes.toBytes('qualifier'),CompareFilter::CompareOp.valueOf('EQUAL'),'filter_value')), COLUMNS => ['family:qualifier']}

Hope this helps.

Saturday, June 21, 2014

Case Insensitive Check in List

Java does not provide a ignore case comparison of Strings in a List. I have a pretty simple implementation for the same,

public static boolean listContainsIgnoreCase(List listToCheck, String stringToCheck)
for (String s : listToCheck) 
       if (stringToCheck.equalsIgnoreCase(s)) return true;
return false;