hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jian fan <xiaofanhb...@gmail.com>
Subject problem with fliter in scan
Date Fri, 26 Oct 2012 01:54:39 GMT
HI:
   Guys, I have a program to filter the data by scan, the code is as
follows:

        String familyName = "data";
        String qualifierName = "speed";
        String minValue = "0";
        String maxValue = "20121016124537";
        HTablePool pool = new HTablePool(cfg, 1000);
        HTable table = (HTable) pool.getTable(tableName);
        List<Filter> filters = new ArrayList<Filter>();
        SingleColumnValueFilter minFilter = new
SingleColumnValueFilter(familyName.getBytes(), qualifierName.getBytes(),
                CompareOp.GREATER_OR_EQUAL, minValue.getBytes());
        SingleColumnValueFilter maxFilter = new
SingleColumnValueFilter(familyName.getBytes(), qualifierName.getBytes(),
                CompareOp.LESS_OR_EQUAL, maxValue.getBytes());

        filters.add(maxFilter);
        filters.add(minFilter);
        Scan s = new Scan();
        s.setCaching(10000);
        s.setBatch(10);
        FilterList fl = new FilterList( FilterList.Operator.MUST_PASS_ALL,
filters);
        s.setFilter(fl);
        ResultScanner scanner = table.getScanner(s);
            for (Result r : scanner) {
                KeyValue[] kv = r.raw();

                for (int i = 0; i < kv.length; i++) {
                    System.out.println("RowKey:"+new String(kv[i].getRow())
+ " ");
                    System.out.print(new String(kv[i].getFamily()) + ":");
                    System.out.println(new String(kv[i].getQualifier()) +
" ");
                    System.out.println("value:"+new
String(kv[i].getValue()));

                }
            }


The result is :

RowKey:020028
data:location
value:CA
RowKey:020028
data:speed
value:20121016124537

RowKey:2068098
data:location
CA


Seems that the kv without qualiter "speed" is also include in the search
result, how to slove the problem?

Thanks

Jian Fan

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