org.apache.hadoop.hbase.filter
Class FilterBase

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.FilterBase
All Implemented Interfaces:
Filter, org.apache.hadoop.io.Writable
Direct Known Subclasses:
ColumnCountGetFilter, ColumnPaginationFilter, ColumnPrefixFilter, CompareFilter, FirstKeyOnlyFilter, InclusiveStopFilter, KeyOnlyFilter, PageFilter, PrefixFilter, SingleColumnValueFilter, SkipFilter, TimestampsFilter, WhileMatchFilter

public abstract class FilterBase
extends Object
implements Filter

Abstract base class to help you implement new Filters. Common "ignore" or NOOP type methods can go here, helping to reduce boiler plate in an ever-expanding filter library. If you could instantiate FilterBase, it would end up being a "null" filter - that is one that never filters anything.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Constructor Summary
FilterBase()
           
 
Method Summary
 boolean filterAllRemaining()
          Filters that never filter all remaining can inherit this implementation that never stops the filter early.
 Filter.ReturnCode filterKeyValue(KeyValue ignored)
          Filters that dont filter by key value can inherit this implementation that includes all KeyValues.
 boolean filterRow()
          Filters that never filter by rows based on previously gathered state from filterKeyValue(KeyValue) can inherit this implementation that never filters a row.
 void filterRow(List<KeyValue> ignored)
          Filters that never filter by modifying the returned List of KeyValues can inherit this implementation that does nothing.
 boolean filterRowKey(byte[] buffer, int offset, int length)
          Filters that do not filter by row key can inherit this implementation that never filters anything.
 KeyValue getNextKeyHint(KeyValue currentKV)
          Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null KeyValue.
 boolean hasFilterRow()
          Fitlers that never filter by modifying the returned List of KeyValues can inherit this implementation that does nothing.
 void reset()
          Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.io.Writable
readFields, write
 

Constructor Detail

FilterBase

public FilterBase()
Method Detail

reset

public void reset()
Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation.

Specified by:
reset in interface Filter

filterRowKey

public boolean filterRowKey(byte[] buffer,
                            int offset,
                            int length)
Filters that do not filter by row key can inherit this implementation that never filters anything. (ie: returns false).

Specified by:
filterRowKey in interface Filter
Parameters:
buffer - buffer containing row key
offset - offset into buffer where row key starts
length - length of the row key
Returns:
true, remove entire row, false, include the row (maybe).

filterAllRemaining

public boolean filterAllRemaining()
Filters that never filter all remaining can inherit this implementation that never stops the filter early.

Specified by:
filterAllRemaining in interface Filter
Returns:
true to end scan, false to continue.

filterKeyValue

public Filter.ReturnCode filterKeyValue(KeyValue ignored)
Filters that dont filter by key value can inherit this implementation that includes all KeyValues.

Specified by:
filterKeyValue in interface Filter
Parameters:
ignored - the KeyValue in question
Returns:
code as described below
See Also:
Filter.ReturnCode

filterRow

public void filterRow(List<KeyValue> ignored)
Filters that never filter by modifying the returned List of KeyValues can inherit this implementation that does nothing.

Specified by:
filterRow in interface Filter
Parameters:
ignored - the list of keyvalues to be filtered

hasFilterRow

public boolean hasFilterRow()
Fitlers that never filter by modifying the returned List of KeyValues can inherit this implementation that does nothing.

Specified by:
hasFilterRow in interface Filter
Returns:
True if this filter actively uses filterRow(List). Primarily used to check for conflicts with scans(such as scans that do not read a full row at a time)

filterRow

public boolean filterRow()
Filters that never filter by rows based on previously gathered state from filterKeyValue(KeyValue) can inherit this implementation that never filters a row.

Specified by:
filterRow in interface Filter
Returns:
true to exclude row, false to include row.

getNextKeyHint

public KeyValue getNextKeyHint(KeyValue currentKV)
Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null KeyValue.

Specified by:
getNextKeyHint in interface Filter
Returns:
KeyValue which must be next seeked. return null if the filter is not sure which key to seek to next.


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.