Module org.elasticsearch.compute
Class BytesRefArrayState
java.lang.Object
org.elasticsearch.compute.aggregation.BytesRefArrayState
- All Implemented Interfaces:
Closeable,AutoCloseable,GroupingAggregatorState,org.elasticsearch.core.Releasable
public final class BytesRefArrayState
extends Object
implements GroupingAggregatorState, org.elasticsearch.core.Releasable
Aggregator state for an array of BytesRefs. It is created in a mode where it
won't track the
groupIds that are sent to it and it is the
responsibility of the caller to only fetch values for groupIds
that it has sent using the selected parameter when building the
results. This is fine when there are no null values in the input
data. But once there are null values in the input data it is
much more convenient to only send non-null values and
the tracking built into the grouping code can't track that. In that case
call enableGroupIdTracking(org.elasticsearch.compute.aggregation.SeenGroupIds) to transition the state into a mode
where it'll track which groupIds have been written.
This class is a specialized version of the X-ArrayState.java.st template.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidenableGroupIdTracking(SeenGroupIds seenGroupIds) Switches this array state into tracking which group ids are set.voidtoIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) Extracts an intermediate view of the contents of this state.
-
Method Details
-
toIntermediate
public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) Extracts an intermediate view of the contents of this state.- Specified by:
toIntermediatein interfaceGroupingAggregatorState
-
enableGroupIdTracking
Switches this array state into tracking which group ids are set. This is idempotent and fast if already tracking so it's safe to, say, call it once for every block of values that arrives containingnull.This class tracks seen group IDs differently from
AbstractArrayState, as it just stores a flag to know if optimizations can be made.- Specified by:
enableGroupIdTrackingin interfaceGroupingAggregatorState
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.Releasable
-