Hbase 多條件過(guò)濾
使用FilterListWithOR 時(shí)會(huì)報(bào)錯(cuò)儡陨,不想去糾結(jié),查閱的了FilterList的API辙售,API 鏈接
api 原文
Implementation of
Filter
that represents an ordered List of Filters which will be evaluated with a specified boolean operator FilterList.Operator.MUST_PASS_ALL (AND
) or FilterList.Operator.MUST_PASS_ONE (OR
). Since you can use Filter Lists as children of Filter Lists, you can create a hierarchy of filters to be evaluated.
FilterList.Operator.MUST_PASS_ALL
evaluates lazily: evaluation stops as soon as one filter does not include the Cell.
FilterList.Operator.MUST_PASS_ONE
evaluates non-lazily: all filters are always evaluated.
Defaults toFilterList.Operator.MUST_PASS_ALL
.
- 個(gè)人翻譯
Filter的實(shí)現(xiàn)是指定的布爾運(yùn)算符FilterList.Operator.MUST_PASS_ALL(AND)或FilterList.Operator.MUST_PASS_ONE(OR)進(jìn)行過(guò)濾的
有序
列表艺智。 由于你可以FilterList套FilterList,所以你可以創(chuàng)建層次結(jié)構(gòu)
的過(guò)濾器圾亏。`
FilterList.Operator.MUST_PASS_ALL
evaluates lazily: 當(dāng)其中一個(gè)過(guò)濾器沒(méi)有匹配到值則停止繼續(xù)匹配
FilterList.Operator.MUST_PASS_ONE
:所有的過(guò)濾器都會(huì)進(jìn)行匹配十拣,(匹配到就會(huì)返回Cell)
- 代碼
Filter filterList = null;
// ... rowFilters.add(new RowFilter())....
filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE, rowFilters);
scan.setFilter(filterList);