Skip to content

Commit 7594d5a

Browse files
committed
Add a standard deviation function
Uses Welford's online algorithm, as well as the parallel version, to calculate standard deviation.
1 parent 90600bf commit 7594d5a

File tree

35 files changed

+3500
-1
lines changed

35 files changed

+3500
-1
lines changed

docs/reference/esql/functions/aggregation-functions.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The <<esql-stats-by>> command supports these aggregate functions:
1717
* <<esql-min>>
1818
* <<esql-percentile>>
1919
* experimental:[] <<esql-st_centroid_agg>>
20+
* <<esql-std_deviation>>
2021
* <<esql-sum>>
2122
* <<esql-top>>
2223
* <<esql-values>>
@@ -32,6 +33,7 @@ include::layout/median_absolute_deviation.asciidoc[]
3233
include::layout/min.asciidoc[]
3334
include::layout/percentile.asciidoc[]
3435
include::layout/st_centroid_agg.asciidoc[]
36+
include::layout/std_deviation.asciidoc[]
3537
include::layout/sum.asciidoc[]
3638
include::layout/top.asciidoc[]
3739
include::layout/values.asciidoc[]

docs/reference/esql/functions/description/std_deviation.asciidoc

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/examples/std_deviation.asciidoc

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/definition/std_deviation.json

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/docs/std_deviation.md

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/layout/std_deviation.asciidoc

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/parameters/std_deviation.asciidoc

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/signature/std_deviation.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/reference/esql/functions/types/std_deviation.asciidoc

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/compute/build.gradle

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,27 @@ tasks.named('stringTemplates').configure {
608608
it.outputFile = "org/elasticsearch/compute/aggregation/RateDoubleAggregator.java"
609609
}
610610

611+
File stdDeviationAggregatorInputFile = file("src/main/java/org/elasticsearch/compute/aggregation/X-StdDeviationAggregator.java.st")
612+
template {
613+
it.properties = intProperties
614+
it.inputFile = stdDeviationAggregatorInputFile
615+
it.outputFile = "org/elasticsearch/compute/aggregation/StdDeviationIntAggregator.java"
616+
}
617+
template {
618+
it.properties = longProperties
619+
it.inputFile = stdDeviationAggregatorInputFile
620+
it.outputFile = "org/elasticsearch/compute/aggregation/StdDeviationLongAggregator.java"
621+
}
622+
template {
623+
it.properties = floatProperties
624+
it.inputFile = stdDeviationAggregatorInputFile
625+
it.outputFile = "org/elasticsearch/compute/aggregation/StdDeviationFloatAggregator.java"
626+
}
627+
template {
628+
it.properties = doubleProperties
629+
it.inputFile = stdDeviationAggregatorInputFile
630+
it.outputFile = "org/elasticsearch/compute/aggregation/StdDeviationDoubleAggregator.java"
631+
}
611632

612633
File topAggregatorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st")
613634
template {

0 commit comments

Comments
 (0)