Interface ChunkFilter
- All Known Implementing Classes:
ByteChunkFilter,CharChunkFilter,DoubleChunkFilter,FloatChunkFilter,IntChunkFilter,LongChunkFilter,ObjectChunkFilter,ShortChunkFilter
public interface ChunkFilter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChunkFilterA filter that always returns false.static final intHow many values we read from a column source into a chunk before applying a filter.static final longHow many values we wait for before checking for interruption and throwing a cancellation exceptionstatic final longHow long we would like to take, in milliseconds between interruption checksstatic final ChunkFilterA filter that always returns true. -
Method Summary
Modifier and TypeMethodDescriptionstatic WritableRowSetapplyChunkFilter(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.voidfilter(Chunk<? extends Values> values, LongChunk<OrderedRowKeys> keys, WritableLongChunk<OrderedRowKeys> results) Filter a chunk of values, setting parallel values in results to "true" or "false".intfilter(Chunk<? extends Values> values, WritableBooleanChunk<Values> results) Filter a chunk of values, setting parallel values inresultsto the output of the filter.intfilterAnd(Chunk<? extends Values> values, WritableBooleanChunk<Values> results) Filter a chunk of values, setting parallel values inresultstofalsewhen the filter result isfalse.
-
Field Details
-
FALSE_FILTER_INSTANCE
A filter that always returns false. -
TRUE_FILTER_INSTANCE
A filter that always returns true. -
FILTER_CHUNK_SIZE
static final int FILTER_CHUNK_SIZEHow 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_SIZEHow many values we wait for before checking for interruption and throwing a cancellation exception -
INTERRUPTION_GOAL_MILLIS
static final long INTERRUPTION_GOAL_MILLISHow 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 filterresults- a chunk with the key values where the result of the filter is true
-
filter
Filter a chunk of values, setting parallel values inresultsto the output of the filter.- Parameters:
values- the values to filterresults- a boolean chunk containing the result of the filter- Returns:
- the number of values that are
trueinresultsafter the filter is applied.
-
filterAnd
Filter a chunk of values, setting parallel values inresultstofalsewhen the filter result isfalse. The filter will not be evaluated for values that are alreadyfalsein 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 valuestruebefore the first call. Successive calls will have the effect of AND'ing the filter results with existing results.- Parameters:
values- the values to filterresults- a boolean chunk containing the result of the filter- Returns:
- the number of values that are newly set to
trueinresultsafter 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 filtercolumnSource- the column source to filterusePrev- 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
-