You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by kun yan <ya...@gmail.com> on 2013/10/11 10:22:43 UTC

how to use SingleColumnValueFilter

Hi all
This is part of my hbase code, I want to query longitude greater than 144,
but I can not get the correct results
My question is whether the comparison is based on dictionary order. If I
want to filter it based on a comparison of type double what to do, that is,
the numerical comparison

thanks a lot

 HTablePool pool = new HTablePool();
          HTableInterface table = pool.getTable(data_rh);
SingleColumnValueFilter filter1 = new SingleColumnValueFilter(
Bytes.toBytes("s"), Bytes.toBytes("LONGITUDE"),
CompareFilter.CompareOp.GREATER,
Bytes.toBytes(LONGTIUDE_DOUBLE));
Scan scan = new Scan();
scan.addColumn(Bytes.toBytes("s"), Bytes.toBytes("LONGITUDE"));
scan.setFilter(filter1);
-- 

In the Hadoop world, I am just a novice, explore the entire Hadoop
ecosystem, I hope one day I can contribute their own code

YanBit
yankunhadoop@gmail.com

Re: how to use SingleColumnValueFilter

Posted by haosdent <ha...@gmail.com>.
CompareFilter.CompareOp.GREATER is based on number comparison when the type of field is double. 

-- 
Best Regards,
Haosong Huang


On Friday, October 11, 2013 at 4:22 PM, kun yan wrote:

> Hi all
> This is part of my hbase code, I want to query longitude greater than 144,
> but I can not get the correct results
> My question is whether the comparison is based on dictionary order. If I
> want to filter it based on a comparison of type double what to do, that is,
> the numerical comparison
> 
> thanks a lot
> 
> HTablePool pool = new HTablePool();
> HTableInterface table = pool.getTable(data_rh);
> SingleColumnValueFilter filter1 = new SingleColumnValueFilter(
> Bytes.toBytes("s"), Bytes.toBytes("LONGITUDE"),
> CompareFilter.CompareOp.GREATER,
> Bytes.toBytes(LONGTIUDE_DOUBLE));
> Scan scan = new Scan();
> scan.addColumn(Bytes.toBytes("s"), Bytes.toBytes("LONGITUDE"));
> scan.setFilter(filter1);
> -- 
> 
> In the Hadoop world, I am just a novice, explore the entire Hadoop
> ecosystem, I hope one day I can contribute their own code
> 
> YanBit
> yankunhadoop@gmail.com (mailto:yankunhadoop@gmail.com)
> 
>