Itsuki Toyota created HBASE-22833:
-------------------------------------
Summary: MultiRowRangeFilter should provide a method for creating
a filter which is functionally equivalent to multiple prefix filters
Key: HBASE-22833
URL: https://issues.apache.org/jira/browse/HBASE-22833
Project: HBase
Issue Type: Wish
Components: Client
Affects Versions: 3.0.0
Reporter: Itsuki Toyota
HI,
I think current formal way to make multiple prefix filters is to create a
_FilterList_ and add _PrefixFilter_ instances to the list:
{code:java}
FilterList allFilters = new FilterList(FilterList.Operator.MUST_PASS_ONE);
allFilters.addFilter(new PrefixFilter(Bytes.toBytes("123")));
allFilters.addFilter(new PrefixFilter(Bytes.toBytes("456")));
allFilters.addFilter(new PrefixFilter(Bytes.toBytes("678")));
scan.setFilter(allFilters);
{code}
(c.f.,
https://stackoverflow.com/questions/41074213/hbase-how-to-specify-multiple-prefix-filters-in-a-single-scan-operation
)
However, in the case of creating a single prefix filter, HBase provides
_scan.setRowPrefixFilter_ method.
This method creates a range filter by setting a start row and a stop row.
The value of a stop row is decided by calling
_calculateTheClosestNextRowKeyForPrefix_ ( c.f.,
https://github.com/apache/hbase/blob/master/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java#L574-L597
)
_MultiRowRangeFilter_ could leverage a list of start row and stop row pairs and
_calculateTheClosestNextRowKeyForPrefix_ could compute the stop row value
corresponding to given start row (i.e., a prefix).
I think this kind of filter (a filter which is functionally equivalent to
multiple prefix filters) should be creatable by _MultiRowRangeFilter_ and it's
better than the current formal way.
Cheers,
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)