[ 
https://issues.apache.org/jira/browse/HBASE-2466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859537#action_12859537
 ] 

ryan rawson commented on HBASE-2466:
------------------------------------

I think the API should be simpler, rather than providing 3 (!) ways to veto a 
row, lets stick with 2.

The current Filter.java API is like so:
  public boolean filterRow(List<KeyValue> kvs);
  public boolean filterRow();

in the interests in compatibility, i would argue we should keep call #2 for 
certain.

But the first call should be simplified to:

public void filterRow(List<KeyValue> kvs);

if an implementation wants to null out a row they do:
kvs.clear(); 

in their implementation.

That will make the RegionScanner implementation go from:
      if (!returnResult && filter != null) {
        // final chance to modify row contents
        returnResult = filter.filterRow(results);
        // final chance to drop the row... This may be superfluous with the 
addition of the above?
        // still needed for backwards compatibility however
        if (returnResult || filter.filterRow()) {
          results.clear();
        }
      }

to more like yay so:
if (!returnResult && filter != null) {
   filter.filterRow(results);
   if (filter.filterRow())
     results.clear();
}



> Improving filter API to allow for modification of keyvalue list by filter
> -------------------------------------------------------------------------
>
>                 Key: HBASE-2466
>                 URL: https://issues.apache.org/jira/browse/HBASE-2466
>             Project: Hadoop HBase
>          Issue Type: Improvement
>          Components: filters, regionserver
>            Reporter: Juhani Connolly
>            Priority: Minor
>         Attachments: HBASE-2466-2.patch, HBASE-2466.patch
>
>
> As it stands, the Filter interface allows filtering by
> Filter#filterAllRemaining() -> true indicates scan is over, false, keep going 
> on.
> Filter#filterRowKey(byte[],int,int) -> true to drop this row, if false, we 
> will also call
> Filter#filterKeyValue(KeyValue) -> true to drop this key/value
> Filter#filterRow() -> last chance to drop entire row based on the sequence of 
> filterValue() calls. Eg: filter a row if it doesn't contain a specified 
> column.
> It would be useful to allow for an additional API in the form of a step to 
> prune the list of KeyValues to be sent by implementing an additional
> Filter#filterRow(List<KeyValue>)
> This would allow for a user to write a custom filter against the api that 
> drops unnecessary KeyValues according to user-defined rules.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to