Class FilterListBase

Direct Known Subclasses:
FilterListWithAND, FilterListWithOR

@Private public abstract class FilterListBase extends FilterBase
Base class for FilterList. Currently, we have two sub-classes to extend this class: FilterListWithOR, FilterListWithAND.
  • Field Details

    • MAX_LOG_FILTERS

      private static final int MAX_LOG_FILTERS
      See Also:
    • filters

      protected final ArrayList<Filter> filters
    • subFiltersIncludedCell

      For each sub-filter in filter list, we save a boolean flag to indicate that whether the return code of filterCell(c) for sub-filter is INCLUDE* (INCLUDE, INCLUDE_AND_NEXT_COL, INCLUDE_AND_SEEK_NEXT_ROW) case. if true, we need to transform cell for the sub-filter.
  • Constructor Details

  • Method Details

    • isInReturnCodes

      protected static boolean isInReturnCodes(Filter.ReturnCode testRC, Filter.ReturnCode... returnCodes)
    • checkAndGetReversed

      protected static boolean checkAndGetReversed(List<Filter> rowFilters, boolean defaultValue)
    • addFilterLists

      public abstract void addFilterLists(List<Filter> filters)
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • getFilters

    • compareCell

      protected int compareCell(Cell a, Cell b)
    • transformCell

      public Cell transformCell(Cell c) throws IOException
      For FilterList, we can consider a filter list as a node in a tree. sub-filters of the filter list are children of the relative node. The logic of transforming cell of a filter list, well, we can consider it as the process of post-order tree traverse. For a node , before we traverse the current child, we should set the traverse result (transformed cell) of previous node(s) as the initial value. (HBASE-18879).
      Overrides:
      transformCell in class FilterBase
      Parameters:
      c - The cell in question.
      Returns:
      the transformed cell.
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
      See Also:
    • filterKeyValue

      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
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
      See Also:
    • filterRowCells

      public void filterRowCells(List<Cell> cells) throws IOException
      Filters that never filter by modifying the returned List of Cells can inherit this implementation that does nothing. 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:
      cells - the list of Cells to be filtered
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • 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().
    • isFamilyEssential

      public boolean isFamilyEssential(byte[] name) throws IOException
      Description copied from class: FilterBase
      By default, we require all scan's column families to be present. Our subclasses may be more precise. Check that given column family is essential for filter to check row. Most filters always return true here. But some could have more sophisticated logic which could significantly reduce scanning process by not even touching columns until we are 100% sure that it's data is needed in result. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      isFamilyEssential in class FilterBase
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • setReversed

      public void setReversed(boolean reversed)
      Description copied from class: Filter
      alter the reversed scan flag
      Overrides:
      setReversed in class Filter
      Parameters:
      reversed - flag
    • toString

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

      protected abstract String formatLogFilters(List<Filter> logFilters)