org.apache.hadoop.hbase.filter
Class DependentColumnFilter

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.Filter
      extended by org.apache.hadoop.hbase.filter.FilterBase
          extended by org.apache.hadoop.hbase.filter.CompareFilter
              extended by org.apache.hadoop.hbase.filter.DependentColumnFilter

@InterfaceAudience.Public
@InterfaceStability.Stable
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 class 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
 
Fields inherited from class org.apache.hadoop.hbase.filter.Filter
reversed
 
Constructor Summary
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, ByteArrayComparable 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
static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)
           
 boolean dropDependentColumn()
           
 boolean filterAllRemaining()
          Filters that never filter all remaining can inherit this implementation that never stops the filter early.
 Filter.ReturnCode filterKeyValue(Cell c)
          Filters that dont filter by key value can inherit this implementation that includes all Cells.
 boolean filterRow()
          Filters that never filter by rows based on previously gathered state from FilterBase.filterKeyValue(Cell) can inherit this implementation that never filters a row.
 void filterRowCells(List<Cell> kvs)
          Filters that never filter by modifying the returned List of Cells 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 getDropDependentColumn()
           
 byte[] getFamily()
           
 byte[] getQualifier()
           
 boolean hasFilterRow()
          Fitlers that never filter by modifying the returned List of Cells can inherit this implementation that does nothing.
static DependentColumnFilter parseFrom(byte[] pbBytes)
           
 void reset()
          Filters that are purely stateless and do nothing in their reset() methods can inherit this null/empty implementation.
 byte[] toByteArray()
          Return length 0 byte array for Filters that don't require special serialization
 String toString()
          Return filter's info for debugging and logging purpose.
 
Methods inherited from class org.apache.hadoop.hbase.filter.CompareFilter
doCompare, extractArguments, getComparator, getOperator
 
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
filterRow, getNextCellHint, getNextKeyHint, isFamilyEssential, transform, transformCell
 
Methods inherited from class org.apache.hadoop.hbase.filter.Filter
isReversed, setReversed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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(byte[] family,
                             byte[] qualifier,
                             boolean dropDependentColumn,
                             CompareFilter.CompareOp valueCompareOp,
                             ByteArrayComparable 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. Cells where a Cell 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. Cells where a Cell 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 Cells should be discarded
Method Detail

getFamily

public byte[] getFamily()
Returns:
the column family

getQualifier

public byte[] getQualifier()
Returns:
the column qualifier

dropDependentColumn

public boolean dropDependentColumn()
Returns:
true if we should drop the dependent column, false otherwise

getDropDependentColumn

public boolean getDropDependentColumn()

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.

Overrides:
filterAllRemaining in class FilterBase
Returns:
true to end scan, false to continue.

filterKeyValue

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

Overrides:
filterKeyValue in class FilterBase
Parameters:
c - the Cell in question
Returns:
code as described below
See Also:
Filter.ReturnCode

filterRowCells

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

Overrides:
filterRowCells in class FilterBase
Parameters:
kvs - the list of Cells to be filtered

hasFilterRow

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

Overrides:
hasFilterRow in class FilterBase
Returns:
True if this filter actively uses filterRow(List) or filterRow().

filterRow

public boolean filterRow()
Description copied from class: FilterBase
Filters that never filter by rows based on previously gathered state from FilterBase.filterKeyValue(Cell) can inherit this implementation that never filters a row.

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).

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.

Overrides:
reset in class FilterBase

createFilterFromArguments

public static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)

toByteArray

public byte[] toByteArray()
Description copied from class: FilterBase
Return length 0 byte array for Filters that don't require special serialization

Overrides:
toByteArray in class FilterBase
Returns:
The filter serialized using pb

parseFrom

public static DependentColumnFilter parseFrom(byte[] pbBytes)
                                       throws DeserializationException
Parameters:
pbBytes - A pb serialized DependentColumnFilter instance
Returns:
An instance of DependentColumnFilter made from bytes
Throws:
DeserializationException
See Also:
toByteArray()

toString

public String toString()
Description copied from class: FilterBase
Return filter's info for debugging and logging purpose.

Overrides:
toString in class CompareFilter


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.