是否可以对 hbase 中的两个结果集进行暗示过滤;
假设我有以下场景:
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);
现在我有两个结果集,result1 和 result2。应该采取什么方法对这些结果集进行联合以删除重复项?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有现成的方法可以做到这一点。您可以从
Result
中获取NavigableMap
并将其放入TreeMap
中,然后使用putAll
合并地图。在执行“获取”或“扫描”之前,最好只创建一个包含所有所需
过滤器
的FilterList
。There is no canned method to do this. You can grab the
NavigableMap
from theResult
and put that into aTreeMap
and useputAll
to merge the maps.It's probably better to just create a
FilterList
with all theFilters
you want before you do the Get or Scan.