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
Support aggregations across constants #100634
Comments
Pinging @elastic/es-ql (Team:QL) |
Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL) |
Add specific check for aliased function declarations in stats Fix elastic#100634
Add specific check for aliased function declarations in stats Fix elastic#100634
…00650) Add specific check for aliased function declarations in stats Fix elastic#100634
I think this was closed on accident; just checked and running |
Pinging @elastic/es-analytics-geo (Team:Analytics) |
The second variant mentioned in the description cannot be always folded due to multi-values:
|
Let's also fix |
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Description
In ESQL it is possible to have aggregations working on a constant as long as it comes from a source, however pushing it into the aggregation fails.
This works:
row a = 1 | stats m = min(a)
but the querystats m = min(1)
does not.We've been looking at adding a dedicated rule for optimizing this ( #100182) however the issue is rather related to folding aggregations.
A somewhat variant of this is folding the aggregation when the argument is the group key itself:
stats mi = min(k), ma = max(k), c = count(k), a = avg(k) by k
which is the same asstats by k | keep k as mi, k as ma, k as c, k as a, k
agg(const)
can be expressed using a multi-value function asmv_...(const)
ESQL: Sum, Min, Max and Avg of constants #105454 ESQL: median, count and count_distinct over constants #107414PERCENTILE
,MEDIAN_ABSOLUTE_DEVIATION
ST_CENTROID_AGG
)The text was updated successfully, but these errors were encountered: