org.apache.hadoop.hbase.filter
Class DependentColumnFilter

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.FilterBase
      extended by org.apache.hadoop.hbase.filter.CompareFilter
          extended by org.apache.hadoop.hbase.filter.DependentColumnFilter
All Implemented Interfaces:
Filter, org.apache.hadoop.io.Writable

public class DependentColumnFilter
extends CompareFilter

A filter for adding inter-column timestamp matching Only cells with a correspondingly timestamped entry in the target column will be retained Not compatible with Scan.setBatch as operations need full rows for correct filtering


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.CompareFilter
CompareFilter.CompareOp
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Field Summary
protected  byte[] columnFamily
           
protected  byte[] columnQualifier
           
protected  boolean dropDependentColumn
           
protected  Set<Long> stampSet
           
 
Fields inherited from class org.apache.hadoop.hbase.filter.CompareFilter
comparator, compareOp
 
Constructor Summary
DependentColumnFilter()
          Should only be used for writable
DependentColumnFilter(byte[] family, byte[] qualifier)
          Constructor for DependentColumn filter.
DependentColumnFilter(byte[] family, byte[] qualifier, boolean dropDependentColumn)
          Constructor for DependentColumn filter.
DependentColumnFilter(byte[] family, byte[] qualifier, boolean dropDependentColumn, CompareFilter.CompareOp valueCompareOp, WritableByteArrayComparable valueComparator)
          Build a dependent column filter with value checking dependent column varies will be compared using the supplied compareOp and comparator, for usage of which refer to CompareFilter
 
Method Summary
 boolean filterAllRemaining()
          Filters that never filter all remaining can inherit this implementation that never stops the filter early.
 Filter.ReturnCode filterKeyValue(KeyValue v)
          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 FilterBase.filterKeyValue(KeyValue) can inherit this implementation that never filters a row.
 void filterRow(List<KeyValue> kvs)
          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.
 boolean hasFilterRow()
          Fitlers that never filter by modifying the returned List of KeyValues can inherit this implementation that does nothing.
 void readFields(DataInput in)
           
 void reset()
          Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation.
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.hadoop.hbase.filter.CompareFilter
doCompare, getComparator, getOperator
 
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
getNextKeyHint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnFamily

protected byte[] columnFamily

columnQualifier

protected byte[] columnQualifier

dropDependentColumn

protected boolean dropDependentColumn

stampSet

protected Set<Long> stampSet
Constructor Detail

DependentColumnFilter

public DependentColumnFilter()
Should only be used for writable


DependentColumnFilter

public DependentColumnFilter(byte[] family,
                             byte[] qualifier,
                             boolean dropDependentColumn,
                             CompareFilter.CompareOp valueCompareOp,
                             WritableByteArrayComparable valueComparator)
Build a dependent column filter with value checking dependent column varies will be compared using the supplied compareOp and comparator, for usage of which refer to CompareFilter

Parameters:
family - dependent column family
qualifier - dependent column qualifier
dropDependentColumn - whether the column should be discarded after
valueCompareOp - comparison op
valueComparator - comparator

DependentColumnFilter

public DependentColumnFilter(byte[] family,
                             byte[] qualifier)
Constructor for DependentColumn filter. Keyvalues where a keyvalue from target column with the same timestamp do not exist will be dropped.

Parameters:
family - name of target column family
qualifier - name of column qualifier

DependentColumnFilter

public DependentColumnFilter(byte[] family,
                             byte[] qualifier,
                             boolean dropDependentColumn)
Constructor for DependentColumn filter. Keyvalues where a keyvalue from target column with the same timestamp do not exist will be dropped.

Parameters:
family - name of dependent column family
qualifier - name of dependent qualifier
dropDependentColumn - whether the dependent columns keyvalues should be discarded
Method Detail

filterAllRemaining

public boolean filterAllRemaining()
Description copied from class: FilterBase
Filters that never filter all remaining can inherit this implementation that never stops the filter early.

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

filterKeyValue

public Filter.ReturnCode filterKeyValue(KeyValue v)
Description copied from class: FilterBase
Filters that dont filter by key value can inherit this implementation that includes all KeyValues.

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

filterRow

public void filterRow(List<KeyValue> kvs)
Description copied from class: FilterBase
Filters that never filter by modifying the returned List of KeyValues can inherit this implementation that does nothing.

Specified by:
filterRow in interface Filter
Overrides:
filterRow in class FilterBase
Parameters:
kvs - the list of keyvalues to be filtered

hasFilterRow

public boolean hasFilterRow()
Description copied from class: FilterBase
Fitlers that never filter by modifying the returned List of KeyValues can inherit this implementation that does nothing.

Specified by:
hasFilterRow in interface Filter
Overrides:
hasFilterRow in class FilterBase
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()
Description copied from class: FilterBase
Filters that never filter by rows based on previously gathered state from FilterBase.filterKeyValue(KeyValue) can inherit this implementation that never filters a row.

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

filterRowKey

public boolean filterRowKey(byte[] buffer,
                            int offset,
                            int length)
Description copied from class: FilterBase
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
Overrides:
filterRowKey in class FilterBase
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).

reset

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

Specified by:
reset in interface Filter
Overrides:
reset in class FilterBase

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Overrides:
readFields in class CompareFilter
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class CompareFilter
Throws:
IOException


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