Interface ChunkFilter

All Known Implementing Classes:
ByteChunkFilter, CharChunkFilter, DoubleChunkFilter, FloatChunkFilter, IntChunkFilter, LongChunkFilter, ObjectChunkFilter, ShortChunkFilter

public interface ChunkFilter
  • Field Details

    • FALSE_FILTER_INSTANCE

      static final ChunkFilter FALSE_FILTER_INSTANCE
      A filter that always returns false.
    • TRUE_FILTER_INSTANCE

      static final ChunkFilter TRUE_FILTER_INSTANCE
      A filter that always returns true.
    • FILTER_CHUNK_SIZE

      static final int FILTER_CHUNK_SIZE
      How many values we read from a column source into a chunk before applying a filter.
      See Also:
    • INITIAL_INTERRUPTION_SIZE

      static final long INITIAL_INTERRUPTION_SIZE
      How many values we wait for before checking for interruption and throwing a cancellation exception
    • INTERRUPTION_GOAL_MILLIS

      static final long INTERRUPTION_GOAL_MILLIS
      How long we would like to take, in milliseconds between interruption checks
  • Method Details

    • filter

      void filter(Chunk<? extends Values> values, LongChunk<OrderedRowKeys> keys, WritableLongChunk<OrderedRowKeys> results)
      Filter a chunk of values, setting parallel values in results to "true" or "false".

      The results chunk must have capacity at least as large as values.size(); and the result size will be set to values.size() on return.

      Parameters:
      values - the values to filter
      results - a chunk with the key values where the result of the filter is true
    • filter

      int filter(Chunk<? extends Values> values, WritableBooleanChunk<Values> results)
      Filter a chunk of values, setting parallel values in results to the output of the filter.
      Parameters:
      values - the values to filter
      results - a boolean chunk containing the result of the filter
      Returns:
      the number of values that are true in results after the filter is applied.
    • filterAnd

      int filterAnd(Chunk<? extends Values> values, WritableBooleanChunk<Values> results)
      Filter a chunk of values, setting parallel values in results to false when the filter result is false. The filter will not be evaluated for values that are already false in the results chunk.

      To use this method effectively, the results chunk should be initialized by a call to filter(Chunk, WritableBooleanChunk) or by setting all values true before the first call. Successive calls will have the effect of AND'ing the filter results with existing results.

      Parameters:
      values - the values to filter
      results - a boolean chunk containing the result of the filter
      Returns:
      the number of values that are newly set to true in results after the filter is applied.
    • applyChunkFilter

      static WritableRowSet applyChunkFilter(RowSet selection, ColumnSource<?> columnSource, boolean usePrev, ChunkFilter chunkFilter)
      Apply a chunk filter to a RowSet and column source, producing a new WritableRowSet that is responsive to the filter.
      Parameters:
      selection - the RowSet to filter
      columnSource - the column source to filter
      usePrev - should we use previous values from the column source?
      chunkFilter - the chunk filter to apply
      Returns:
      A new WritableRowSet representing the filtered values, owned by the caller