Class FilterListWithAND


@Private public class FilterListWithAND extends FilterListBase
FilterListWithAND represents an ordered list of filters which will be evaluated with an AND operator.
  • Field Details

  • Constructor Details

  • Method Details

    • addFilterLists

      public void addFilterLists(List<Filter> filters)
      Specified by:
      addFilterLists in class FilterListBase
    • formatLogFilters

      protected String formatLogFilters(List<Filter> logFilters)
      Specified by:
      formatLogFilters in class FilterListBase
    • mergeReturnCode

      FilterList with MUST_PASS_ALL choose the maximal forward step among sub-filters in filter list. Let's call it: The Maximal Step Rule. So if filter-A in filter list return INCLUDE and filter-B in filter list return INCLUDE_AND_NEXT_COL, then the filter list should return INCLUDE_AND_NEXT_COL. For SEEK_NEXT_USING_HINT, it's more special, and in method filterCellWithMustPassAll(), if any sub-filter return SEEK_NEXT_USING_HINT, then our filter list will return SEEK_NEXT_USING_HINT. so we don't care about the SEEK_NEXT_USING_HINT here.

      The jump step will be:
       INCLUDE < SKIP < INCLUDE_AND_NEXT_COL < NEXT_COL < INCLUDE_AND_SEEK_NEXT_ROW < NEXT_ROW
           < SEEK_NEXT_USING_HINT
       
      Here, we have the following map to describe The Maximal Step Rule. if current return code (for previous sub-filters in filter list) is ReturnCode, and current filter returns localRC, then we should return map[ReturnCode][localRC] for the merged result, according to The Maximal Step Rule.
       LocalCode\ReturnCode       INCLUDE                    INCLUDE_AND_NEXT_COL      INCLUDE_AND_SEEK_NEXT_ROW  SKIP                  NEXT_COL              NEXT_ROW              SEEK_NEXT_USING_HINT
       INCLUDE                    INCLUDE                    INCLUDE_AND_NEXT_COL      INCLUDE_AND_SEEK_NEXT_ROW  SKIP                  NEXT_COL              NEXT_ROW              SEEK_NEXT_USING_HINT
       INCLUDE_AND_NEXT_COL       INCLUDE_AND_NEXT_COL       INCLUDE_AND_NEXT_COL      INCLUDE_AND_SEEK_NEXT_ROW  NEXT_COL              NEXT_COL              NEXT_ROW              SEEK_NEXT_USING_HINT
       INCLUDE_AND_SEEK_NEXT_ROW  INCLUDE_AND_SEEK_NEXT_ROW  INCLUDE_AND_SEEK_NEXT_ROW INCLUDE_AND_SEEK_NEXT_ROW  NEXT_ROW              NEXT_ROW              NEXT_ROW              SEEK_NEXT_USING_HINT
       SKIP                       SKIP                       NEXT_COL                  NEXT_ROW                   SKIP                  NEXT_COL              NEXT_ROW              SEEK_NEXT_USING_HINT
       NEXT_COL                   NEXT_COL                   NEXT_COL                  NEXT_ROW                   NEXT_COL              NEXT_COL              NEXT_ROW              SEEK_NEXT_USING_HINT
       NEXT_ROW                   NEXT_ROW                   NEXT_ROW                  NEXT_ROW                   NEXT_ROW              NEXT_ROW              NEXT_ROW              SEEK_NEXT_USING_HINT
       SEEK_NEXT_USING_HINT       SEEK_NEXT_USING_HINT       SEEK_NEXT_USING_HINT      SEEK_NEXT_USING_HINT       SEEK_NEXT_USING_HINT  SEEK_NEXT_USING_HINT  SEEK_NEXT_USING_HINT  SEEK_NEXT_USING_HINT
       
      Parameters:
      rc - Return code which is calculated by previous sub-filter(s) in filter list.
      localRC - Return code of the current sub-filter in filter list.
      Returns:
      Return code which is merged by the return code of previous sub-filter(s) and the return code of current sub-filter.
    • isIncludeRelatedReturnCode

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

      public void reset() throws IOException
      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
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • filterRowKey

      public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException
      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:
      rowKey - 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).
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • filterRowKey

      public boolean filterRowKey(Cell firstRowCell) throws IOException
      Description copied from class: Filter
      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. If Filter.filterAllRemaining() returns true, then Filter.filterRowKey(Cell) should also return true. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      filterRowKey in class FilterBase
      Parameters:
      firstRowCell - The first cell coming in the new row
      Returns:
      true, remove entire row, false, include the row (maybe).
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • filterAllRemaining

      public boolean filterAllRemaining() throws IOException
      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.
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • filterRow

      public boolean filterRow() throws IOException
      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.
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • getNextCellHint

      public Cell getNextCellHint(Cell currentCell) throws IOException
      Description copied from class: FilterBase
      Filters that are not sure which key must be next seeked to, can inherit this implementation that, by default, returns a null Cell. If the filter returns the match code SEEK_NEXT_USING_HINT, then it should also tell which is the next key it must seek to. After receiving the match code SEEK_NEXT_USING_HINT, the QueryMatcher would call this function to find out which key it must next seek to. Concrete implementers can signal a failure condition in their code by throwing an IOException.
      Overrides:
      getNextCellHint in class FilterBase
      Returns:
      KeyValue which must be next seeked. return null if the filter is not sure which key to seek to next.
      Throws:
      IOException - in case an I/O or an filter specific failure needs to be signaled.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object