ES|QL: fix folding of case() function with date period and time duration#141157
Merged
luigidellaquila merged 9 commits intoelastic:mainfrom Jan 26, 2026
Merged
Conversation
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
idegtiarenko
approved these changes
Jan 23, 2026
Collaborator
|
Hi @luigidellaquila, I've created a changelog YAML for you. |
ivancea
approved these changes
Jan 23, 2026
| @Override | ||
| public Object fold(FoldContext ctx) { | ||
| DataType type = dataType(); | ||
| if (type == DataType.DATE_PERIOD || type == DataType.TIME_DURATION) { |
Contributor
There was a problem hiding this comment.
At this point, do we need this if? This fold looks generic enough. I'm not much into having custom fold()s if the Evaluator one works, but this one here is required anyway, so I would go with it (Still, leaving the comment so we don't remove it in the future)
Contributor
Author
There was a problem hiding this comment.
That's a valid point, let me simplify it
Contributor
Author
There was a problem hiding this comment.
Unfortunately the "custom" approach loses all the warnings, I'll have to fall back to the evaluator as much as possible for now (until I find a way to replicate the same warnings here)
luigidellaquila
added a commit
to luigidellaquila/elasticsearch
that referenced
this pull request
Jan 27, 2026
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jan 27, 2026
luigidellaquila
added a commit
to luigidellaquila/elasticsearch
that referenced
this pull request
Jan 27, 2026
luigidellaquila
added a commit
to luigidellaquila/elasticsearch
that referenced
this pull request
Jan 27, 2026
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jan 27, 2026
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jan 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temporal amounts (
date_period,time_duration) don't have an associatedElementType(yet), so we can't use evaluators to foldcase()when they are involved. We have to do it manually.Fixes: #138415