-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ES|QL] Add variations of standard deviation functions #129129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
0630a50 to
9a5b800
Compare
2690c24 to
08feb83
Compare
08feb83 to
58d858a
Compare
58d858a to
6450343
Compare
6450343 to
4b3866a
Compare
4b3866a to
2b7feb0
Compare
2b7feb0 to
356dec3
Compare
|
🔍 Preview links for changed docs: 🔔 The preview site may take up to 3 minutes to finish building. These links will become live once it completes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Larisa!
| def(Top.class, tri(Top::new), "top"), | ||
| def(Values.class, uni(Values::new), "values"), | ||
| def(VariancePopulation.class, uni(VariancePopulation::new), "variance_population"), | ||
| def(VarianceSample.class, uni(VarianceSample::new), "variance_sample"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be sample_variance?
| def(Sum.class, uni(Sum::new), "sum"), | ||
| def(Top.class, tri(Top::new), "top"), | ||
| def(Values.class, uni(Values::new), "values"), | ||
| def(VariancePopulation.class, uni(VariancePopulation::new), "variance_population"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be population_variance?
| import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.ParamOrdinal.DEFAULT; | ||
| import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isType; | ||
|
|
||
| public class $Variation$ extends AggregateFunction implements ToAggregator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| public final AggregatorFunctionSupplier supplier() { | ||
| DataType type = field().dataType(); | ||
| if (type == DataType.LONG) { | ||
| return new $Variation$LongAggregatorFunctionSupplier(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a new parameter for the variance type to the aggregator (see CountDistinctIntAggregator) so we don't have to generate similar classes multiple times? This approach is also fine.
The bulk of this PR is generated code
For ease of reading, the first 4 commits are split into the following components:
STD_DEV_SAMPLE,VARIANCE_POPULATION, andVARIANCE_SAMPLE(all new functions)STD_DEV(the previously existing function)Currently ES|QL only has a population standard deviation aggregation
STD_DEVavailable.This PR adds in
STD_DEV_SAMPLE,VARIANCE_POPULATION, andVARIANCE_SAMPLEfunctions by expanding the originalX-StdDevAggregator.java.sttemplate to output each of the 4 variations, as well as introducing aX-StdDev.java.stto generate the AggregateFunction classes for all 4.