Skip to content

Commit f0e3938

Browse files
committed
update
1 parent b3a89d7 commit f0e3938

File tree

1 file changed

+35
-38
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate

1 file changed

+35
-38
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/package-info.java

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -115,44 +115,41 @@
115115
* Annotate it with {@link org.elasticsearch.compute.ann.Aggregator} and {@link org.elasticsearch.compute.ann.GroupingAggregator}
116116
* The first one is responsible for an entire data set aggregation, while the second one is responsible for grouping within buckets.
117117
* </p>
118-
* <p>
119-
* Before you start implementing it, please note that:
120-
* <ul>
121-
* <li>All methods must be public static</li>
122-
* <li>
123-
* combine, combineStates, combineIntermediate, evaluateFinal methods (see below) could be omitted and generated automatically
124-
* when both input type I and mutable accumulator state SS and GS are primitive (DOUBLE, INT).
125-
* </li>
126-
* <li>TBD explain {@code IntermediateState}</li>
127-
* <li>TBD explain special internal state `seen`</li>
128-
* </ul>
129-
* </p>
130-
* <p>
131-
* Aggregation expects:
132-
* <ul>
133-
* <li>type SS (a mutable state used to accumulate result of the aggregation) to be public, not inner and implements {@link org.elasticsearch.compute.aggregation.AggregatorState}</li>
134-
* <li>type I (input to your aggregation function), usually primitive types and {@link org.apache.lucene.util.BytesRef}</li>
135-
* <li>{@code SS init()} or {@code SS initSingle()} returns empty initialized aggregation state</li>
136-
* <li>{@code void combine(SS state, I input)} or {@code SS combine(SS state, I input)} adds input entry to the aggregation state</li>
137-
* <li>{@code void combineIntermediate(SS state, intermediate states)} adds serialized aggregation state to the current aggregation state (used to combine results across different nodes)</li>
138-
* <li>{@code Block evaluateFinal(SS state, BigArrays? DriverContext?)} converts the inner state of the aggregation to the result column</li>
139-
* </ul>
140-
* </p>
141-
* <p>
142-
* Grouping aggregation expects:
143-
* <ul>
144-
* <li>type GS (a mutable state used to accumulate result of the grouping aggregation) to be public, not inner and implements {@link org.elasticsearch.compute.aggregation.GroupingAggregatorState}</li>
145-
* <li>type I (input to your aggregation function), usually primitive types and {@link org.apache.lucene.util.BytesRef}</li>
146-
* <li>{@code GS init()} or {@code GS initGrouping()} returns empty initialized grouping aggregation state</li>
147-
* <li>{@code void combine(GS state, int groupId, T input)} adds input entry to the corresponding group (bucket) of the grouping aggregation state</li>
148-
* <li>{@code void combineStates(GS targetState, int targetGroupId, GS otherState, int otherGroupId)} merges other grouped aggregation state into the first one</li>
149-
* <li>{@code void combineIntermediate(GS current, int groupId, intermediate states)} adds serialized aggregation state to the current grouped aggregation state (used to combine results across different nodes)</li>
150-
* <li>{@code Block evaluateFinal(GS state, IntVectorSelected, BigArrays? DriverContext?)} converts the inner state of the grouping aggregation to the result column</li>
151-
* </ul>
152-
* </p>
153-
* <p>
154-
*
155-
* </p>
118+
* <h4>Before you start implementing it, please note that:</h4>
119+
* <ul>
120+
* <li>All methods must be public static</li>
121+
* <li>
122+
* init, initSingle, initGrouping could declare optional BigArrays, DriverContext arguments that are going to be injected automatically.
123+
* It is also possible to declare any number of arbitrary arguments that must be provided via generated Supplier.
124+
* </li>
125+
* <li>
126+
* combine, combineStates, combineIntermediate, evaluateFinal methods (see below) could be omitted and generated automatically
127+
* when both input type I and mutable accumulator state SS and GS are primitive (DOUBLE, INT).
128+
* </li>
129+
* <li>
130+
* </li>
131+
* <li>TBD explain {@code IntermediateState}</li>
132+
* <li>TBD explain special internal state `seen`</li>
133+
* </ul>
134+
* <h4>Aggregation expects:</h4>
135+
* <ul>
136+
* <li>type SS (a mutable state used to accumulate result of the aggregation) to be public, not inner and implements {@link org.elasticsearch.compute.aggregation.AggregatorState}</li>
137+
* <li>type I (input to your aggregation function), usually primitive types and {@link org.apache.lucene.util.BytesRef}</li>
138+
* <li>{@code SS init()} or {@code SS initSingle()} returns empty initialized aggregation state</li>
139+
* <li>{@code void combine(SS state, I input)} or {@code SS combine(SS state, I input)} adds input entry to the aggregation state</li>
140+
* <li>{@code void combineIntermediate(SS state, intermediate states)} adds serialized aggregation state to the current aggregation state (used to combine results across different nodes)</li>
141+
* <li>{@code Block evaluateFinal(SS state, DriverContext)} converts the inner state of the aggregation to the result column</li>
142+
* </ul>
143+
* <h4>Grouping aggregation expects:</h4>
144+
* <ul>
145+
* <li>type GS (a mutable state used to accumulate result of the grouping aggregation) to be public, not inner and implements {@link org.elasticsearch.compute.aggregation.GroupingAggregatorState}</li>
146+
* <li>type I (input to your aggregation function), usually primitive types and {@link org.apache.lucene.util.BytesRef}</li>
147+
* <li>{@code GS init()} or {@code GS initGrouping()} returns empty initialized grouping aggregation state</li>
148+
* <li>{@code void combine(GS state, int groupId, T input)} adds input entry to the corresponding group (bucket) of the grouping aggregation state</li>
149+
* <li>{@code void combineStates(GS targetState, int targetGroupId, GS otherState, int otherGroupId)} merges other grouped aggregation state into the first one</li>
150+
* <li>{@code void combineIntermediate(GS current, int groupId, intermediate states)} adds serialized aggregation state to the current grouped aggregation state (used to combine results across different nodes)</li>
151+
* <li>{@code Block evaluateFinal(GS state, IntVectorSelected, DriverContext)} converts the inner state of the grouping aggregation to the result column</li>
152+
* </ul>
156153
* <ol>
157154
* <li>
158155
* Copy an existing aggregator to use as a base. You'll usually make one per type. Check other classes to see the naming pattern.

0 commit comments

Comments
 (0)