Class DependentColumnFilter


@Public 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
  • Field Details

  • Constructor Details

    • DependentColumnFilter

      @Deprecated public DependentColumnFilter(byte[] family, byte[] qualifier, boolean dropDependentColumn, CompareFilter.CompareOp valueCompareOp, ByteArrayComparable valueComparator)
      Deprecated.
      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, boolean dropDependentColumn, CompareOperator op, 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
      op - Value 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 Details

    • 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. If this returns true, the scan will terminate. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      filterAllRemaining in class FilterBase
      Returns:
      true to end scan, false to continue.
    • filterKeyValue

      Deprecated.
      Description copied from class: Filter
      A way to filter based on the column family, column qualifier and/or the column value. Return code is described below. This allows filters to filter only certain number of columns, then terminate without matching ever column. If filterRowKey returns true, filterKeyValue needs to be consistent with it. filterKeyValue can assume that filterRowKey has already been called for the row. If your filter returns ReturnCode.NEXT_ROW, it should return ReturnCode.NEXT_ROW until Filter.reset() is called just in case the caller calls for the next row. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      filterKeyValue in class Filter
      Parameters:
      c - the Cell in question
      Returns:
      code as described below, Filter.ReturnCode.INCLUDE by default
      See Also:
    • filterCell

      Description copied from class: Filter
      A way to filter based on the column family, column qualifier and/or the column value. Return code is described below. This allows filters to filter only certain number of columns, then terminate without matching ever column. If filterRowKey returns true, filterCell needs to be consistent with it. filterCell can assume that filterRowKey has already been called for the row. If your filter returns ReturnCode.NEXT_ROW, it should return ReturnCode.NEXT_ROW until Filter.reset() is called just in case the caller calls for the next row. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      filterCell in class Filter
      Parameters:
      c - the Cell in question
      Returns:
      code as described below
      See Also:
    • 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. Chance to alter the list of Cells to be submitted. Modifications to the list will carry on Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      filterRowCells in class FilterBase
      Parameters:
      kvs - the list of Cells to be filtered
    • hasFilterRow

      public boolean hasFilterRow()
      Description copied from class: FilterBase
      Filters that never filter by modifying the returned List of Cells can inherit this implementation that does nothing. Primarily used to check for conflicts with scans(such as scans that do not read a full row at a time).
      Overrides:
      hasFilterRow in class FilterBase
      Returns:
      True if this filter actively uses filterRowCells(List) or filterRow().
    • filterRow

      public boolean filterRow()
      Description copied from class: FilterBase
      Filters that never filter by rows based on previously gathered state from Filter.filterCell(Cell) can inherit this implementation that never filters a row. Last chance to veto row based on previous Filter.filterCell(Cell) calls. The filter needs to retain state then return a particular value for this call if they wish to exclude a row if a certain column is missing (for example). Concrete implementers can signal a failure condition in their code by throwing an IOException.
      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). Filters a row based on the row key. If this returns true, the entire row will be excluded. If false, each KeyValue in the row will be passed to Filter.filterCell(Cell) below. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      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. Reset the state of the filter between rows. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      reset in class FilterBase
    • createFilterFromArguments

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

      public byte[] toByteArray()
      Returns The filter serialized using pb
      Overrides:
      toByteArray in class FilterBase
      Returns:
      The filter serialized using pb
    • parseFrom

      public static DependentColumnFilter parseFrom(byte[] pbBytes) throws DeserializationException
      Parse a seralized representation of DependentColumnFilter
      Parameters:
      pbBytes - A pb serialized DependentColumnFilter instance
      Returns:
      An instance of DependentColumnFilter made from bytes
      Throws:
      DeserializationException - if an error occurred
      See Also:
    • areSerializedFieldsEqual

      Returns true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other. Used for testing.
      Overrides:
      areSerializedFieldsEqual in class CompareFilter
      Returns:
      true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other. Used for testing.
    • toString

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

      public boolean equals(Object obj)
      Overrides:
      equals in class CompareFilter
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CompareFilter