0

I am trying to filter out columns after using a WholeRowIterator to filter rows. This is to remove columns that were useful in determining which row to keep, but not useful in the data returned by the scan.

The WholeRowIterator does not appear to play nice as the source of another iterator such as a RegExFilter. I know the keys/values are encoded by the WholeRowIterator.

Are there any possible solutions to get this iterator stack to work?

Thanks.

4

1 回答 1

1

通常,WholeRowIterator 是“堆栈”中的最后一个迭代器,因为它涉及将行(许多键值)序列化为单个键值。您可能不想多次这样做。但是,让我们假设你想这样做:

您可能想要编写一个 Iterator,它使用 WholeRowIterator 方法将每个 Key-Value 反序列化为 SortedMap,修改 SortedMap,将其重新序列化回单个 Key-Value,然后返回它。需要为该迭代器分配比赋予 WholeRowIterator 的优先级更高的优先级。

或者,您可以扩展WholeRowIterator并覆盖该encodeRow(List<Key>,List<Value>)方法以首先不序列化您不需要的列。这将节省第一种方法的额外序列化和反序列化。

于 2015-01-20T21:08:39.680 回答