Infinity
Infinity

Reputation: 683

Is it possible to imply filter on two resultset in hbase;

Suppose I have following scenario:

        Get get1 = new Get(Bytes.toBytes("row-5"));
        get1.setFilter(filter1);
        Result result1 = table.get(get1); 
        System.out.println("Result of get(): " + result1);

        Filter filter2 = new FamilyFilter(CompareFilter.CompareOp.EQUAL,
          new BinaryComparator(Bytes.toBytes("colfam3")));
        Get get2 = new Get(Bytes.toBytes("row-5")); 
        get2.addFamily(Bytes.toBytes("colfam1"));
        get2.setFilter(filter2);
        Result result2 = table.get(get2); 
        System.out.println("Result of get(): " + result2); 

So now I have two result sets, result1 and result2. What should be approach to put union on these result sets to remove duplicates?

Upvotes: 0

Views: 74

Answers (1)

MattMcKnight
MattMcKnight

Reputation: 8290

There is no canned method to do this. You can grab the NavigableMap from the Result and put that into a TreeMap and use putAll to merge the maps.

It's probably better to just create a FilterList with all the Filters you want before you do the Get or Scan.

Upvotes: 1

Related Questions