本文介绍了将多个前缀行筛选器设置为扫描器hbase java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个扫描器,它会给我带2个前缀过滤器的结果

例如,我希望所有行的键以字符串x开头或以字符串y开头, 。
目前我知道只用一个前缀按以下方式完成:


I want to create one scanner that will give me result with 2 prefix filters
For example I want all the rows that their key starts with the string "x" or start with the string "y".
Currently I know to do it only with one prefix with the following way:

scan.setRowPrefixFilter(prefixFiltet)


推荐答案

使用 setRowPrefixFilter API,您必须使用更一般的 setFilter API,如下所示:

In this case you can't use the setRowPrefixFilter API, you have to use the more general setFilter API, something like:

scan.setFilter(
  new FilterList(
    FilterList.Operator.MUST_PASS_ONE, 
    new PrefixFilter('xx'), 
    new PrefixFilter('yy')
  )
);

这篇关于将多个前缀行筛选器设置为扫描器hbase java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 01:43