HBase过滤器[FamilyFilter]

数据源见

@Test
    public void familyFilterTest(){

        try(Table table = HBaseConn.getTable("FileTable")){

            Scan scan = new Scan();

            Filter filter = new FamilyFilter(CompareOperator.EQUAL,new BinaryComparator(Bytes.toBytes("saveInfo")));


            scan.setCaching(1000);

            scan.setFilter(filter);

            ResultScanner scanner = table.getScanner(scan);


            resultlog(scanner);

            scanner.close();



        }catch (IOException e){
            e.printStackTrace();
        }



        //
        //FamilyFilter 返回特定列族的值,通常会用scan addColumn来替代
        //scan.addColumn(Bytes.toBytes(cfName),Bytes.toBytes(name));
        rowkey=rowkey0
        fileName=null
        szie=null
        creator=zhoucan
        rowkey=rowkey1
        fileName=null
        szie=null
        creator=zhoucan
        rowkey=rowkey10
        fileName=null
        szie=null
        creator=zhouhan
        rowkey=rowkey2
        fileName=null
        szie=null
        creator=zhoucan
        rowkey=rowkey3
        fileName=null
        szie=null
        creator=wuchao
        rowkey=rowkey4
        fileName=null
        szie=null
        creator=fangshuo
        rowkey=rowkey5
        fileName=null
        szie=null
        creator=wuchao


    }
    原文作者:拥抱月亮的大星星
    原文地址: https://www.jianshu.com/p/79de8bc7e446
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞