Module org.elasticsearch.compute
Record Class FilteredGroupingAggregatorFunction
java.lang.Object
java.lang.Record
org.elasticsearch.compute.aggregation.FilteredGroupingAggregatorFunction
- All Implemented Interfaces:
Closeable,AutoCloseable,GroupingAggregatorFunction,Releasable
public record FilteredGroupingAggregatorFunction(GroupingAggregatorFunction next, ExpressionEvaluator filter)
extends Record
implements GroupingAggregatorFunction
A
GroupingAggregatorFunction that wraps another, filtering which positions
are supplied to the aggregator.
This filtering works by setting all of the group ids for filtered positions to
null. GroupingAggregatorFunction will then skip collecting those
positions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.compute.aggregation.GroupingAggregatorFunction
GroupingAggregatorFunction.AddInput, GroupingAggregatorFunction.IntermediateAddInput, GroupingAggregatorFunction.PreparedForEvaluation -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of aFilteredGroupingAggregatorFunctionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIntermediateInput(int positionOffset, IntArrayBlock groupIdVector, Page page) voidaddIntermediateInput(int positionOffset, IntBigArrayBlock groupIdVector, Page page) voidaddIntermediateInput(int positionOffset, IntVector groupIdVector, Page page) voidclose()final booleanIndicates whether some other object is "equal to" this one.filter()Returns the value of thefilterrecord component.final inthashCode()Returns a hash code value for this object.intThe number of blocks used by intermediate state.next()Returns the value of thenextrecord component.prepareEvaluateFinal(IntVector selected, GroupingAggregatorEvaluationContext ctx) Prepare to build the final results for this aggregation.Prepare to build the intermediate results for this aggregation.prepareProcessIntermediateInputPage(SeenGroupIds seenGroupIds, Page page) Prepare to process a single page of intermediate input.prepareProcessRawInputPage(SeenGroupIds seenGroupIds, Page page) Prepare to process a single page of raw input.voidselectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) Call this to signal to the aggregation that theselectedparameter that's passed toGroupingAggregatorFunction.prepareEvaluateIntermediate(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext)orGroupingAggregatorFunction.prepareEvaluateFinal(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext)may reference groups that haven't been seen.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FilteredGroupingAggregatorFunction
public FilteredGroupingAggregatorFunction(GroupingAggregatorFunction next, ExpressionEvaluator filter) Creates an instance of aFilteredGroupingAggregatorFunctionrecord class.- Parameters:
next- the value for thenextrecord componentfilter- the value for thefilterrecord component
-
-
Method Details
-
prepareProcessRawInputPage
public GroupingAggregatorFunction.AddInput prepareProcessRawInputPage(SeenGroupIds seenGroupIds, Page page) Description copied from interface:GroupingAggregatorFunctionPrepare to process a single page of raw input.This should load the input
ReturnsBlocks and check their types and select an optimal path and return that path as anGroupingAggregatorFunction.AddInput.nullto opt out of the callback loop for this page entirely, e.g. when the values block is all-null and contributes nothing to the aggregation.- Specified by:
prepareProcessRawInputPagein interfaceGroupingAggregatorFunction
-
selectedMayContainUnseenGroups
Description copied from interface:GroupingAggregatorFunctionCall this to signal to the aggregation that theselectedparameter that's passed toGroupingAggregatorFunction.prepareEvaluateIntermediate(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext)orGroupingAggregatorFunction.prepareEvaluateFinal(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext)may reference groups that haven't been seen. This puts the underlying storage into a mode where it'll track which group ids have been seen, even if that increases the overhead.- Specified by:
selectedMayContainUnseenGroupsin interfaceGroupingAggregatorFunction
-
prepareProcessIntermediateInputPage
public GroupingAggregatorFunction.AddInput prepareProcessIntermediateInputPage(SeenGroupIds seenGroupIds, Page page) Description copied from interface:GroupingAggregatorFunctionPrepare to process a single page of intermediate input. This should load the inputBlocks and check their types and select an optimal path and return that path as anGroupingAggregatorFunction.AddInput. Returnsnullto opt out of the callback loop for this page entirely, e.g. when the values block is all-null and contributes nothing to the aggregation.- Specified by:
prepareProcessIntermediateInputPagein interfaceGroupingAggregatorFunction
-
addIntermediateInput
Description copied from interface:GroupingAggregatorFunctionAdd data produced byGroupingAggregatorFunction.prepareEvaluateIntermediate(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext).- Specified by:
addIntermediateInputin interfaceGroupingAggregatorFunction
-
addIntermediateInput
Description copied from interface:GroupingAggregatorFunctionAdd data produced byGroupingAggregatorFunction.prepareEvaluateIntermediate(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext).- Specified by:
addIntermediateInputin interfaceGroupingAggregatorFunction
-
addIntermediateInput
Description copied from interface:GroupingAggregatorFunctionAdd data produced byGroupingAggregatorFunction.prepareEvaluateIntermediate(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext).- Specified by:
addIntermediateInputin interfaceGroupingAggregatorFunction
-
prepareEvaluateIntermediate
public GroupingAggregatorFunction.PreparedForEvaluation prepareEvaluateIntermediate(IntVector selected, GroupingAggregatorEvaluationContext ctx) Description copied from interface:GroupingAggregatorFunctionPrepare to build the intermediate results for this aggregation.- Specified by:
prepareEvaluateIntermediatein interfaceGroupingAggregatorFunction- Parameters:
selected- the groupIds that have been selected to be included in the results. Always ascending.
-
prepareEvaluateFinal
public GroupingAggregatorFunction.PreparedForEvaluation prepareEvaluateFinal(IntVector selected, GroupingAggregatorEvaluationContext ctx) Description copied from interface:GroupingAggregatorFunctionPrepare to build the final results for this aggregation.- Specified by:
prepareEvaluateFinalin interfaceGroupingAggregatorFunction- Parameters:
selected- the groupIds that have been selected to be included in the results. Always ascending.This function is called in the coordinator node after all intermediate results have been gathered from the worker nodes, and aggregated into intermediate blocks.
-
intermediateBlockCount
public int intermediateBlockCount()Description copied from interface:GroupingAggregatorFunctionThe number of blocks used by intermediate state.- Specified by:
intermediateBlockCountin interfaceGroupingAggregatorFunction
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
next
Returns the value of thenextrecord component.- Returns:
- the value of the
nextrecord component
-
filter
Returns the value of thefilterrecord component.- Returns:
- the value of the
filterrecord component
-