是否可以对 hbase 中的两个结果集进行暗示过滤;

发布于 2024-12-28 09:17:12 字数 663 浏览 2 评论 0原文

假设我有以下场景:

        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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

递刀给你 2025-01-04 09:17:12

没有现成的方法可以做到这一点。您可以从 Result 中获取 NavigableMap 并将其放入 TreeMap 中,然后使用 putAll 合并地图。

在执行“获取”或“扫描”之前,最好只创建一个包含所有所需过滤器FilterList

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文