-
Notifications
You must be signed in to change notification settings - Fork 25.5k
First last #122176
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
First last #122176
Conversation
# Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/AggregateMapper.java
first_grouped | ||
required_capability: fn_first_last | ||
FROM sample_data | ||
| STATS event_duration = first_value(event_duration), message = first_value(message) BY hourly = BUCKET(@timestamp, 1 hour) |
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.
I was hoping the function could be called first
but this conflicts with nulls ordering keywords:
elasticsearch/x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4
Lines 232 to 234 in aaa5ce8
orderExpression | |
: booleanExpression ordering=(ASC | DESC)? (NULLS nullOrdering=(FIRST | LAST))? | |
; |
Please let me know if it is worth to workaround it somehow (may be parsing first/last only in the sorting mode?)
Although it might not be trivial since sort uses expression mode as it is theoretically possible to:
| SORT first_value(event_duration) nulls first
Outdated |
This is my preliminary experiment targeted implementing
first(value, @timestamp)
function.This is still WIP while I am finalizing related changes.
Depends on #122174
Resolves #108385