Skip to content

[ES|QL] fix COALESCE validation#222425

Merged
drewdaemon merged 39 commits intoelastic:mainfrom
drewdaemon:fix-coalesce
Jun 4, 2025
Merged

[ES|QL] fix COALESCE validation#222425
drewdaemon merged 39 commits intoelastic:mainfrom
drewdaemon:fix-coalesce

Conversation

@drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Jun 3, 2025

Summary

A resolution to #192255 (comment)

There is no limit to the number of parameters that COALESCE will accept. This is expressed with the variadic option in the function definition from Elasticsearch.

The problem with variadic is that it specifies a single data type for all subsequent parameters. The function definition could include these two mixed signatures:

  • keyword, text*
  • text, keyword*

(where the asterisk marks variadic)

And that would cover

  • keyword, text, text, text, ....
  • text, keyword, keyword, keyword, ....

But not keyword, text, keyword for example.

To do that you'd we would need keyword, text, keyword* in the function definition. But then that wouldn't cover keyword, text, keyword, text.

Ad infinitum.

Checklist

@drewdaemon drewdaemon added release_note:fix Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana t// backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Jun 4, 2025
@drewdaemon drewdaemon marked this pull request as ready for review June 4, 2025 04:23
@drewdaemon drewdaemon requested a review from a team as a code owner June 4, 2025 04:23
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@stratoula stratoula mentioned this pull request Jun 4, 2025
13 tasks
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fixed! I left a small comment for code readability but I am approving as it won't need to look into it again (and I consider it a nit)

return true;
}

if (item.literalType === 'keyword' && argType === 'text') {
Copy link
Contributor

@stratoula stratoula Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems as this check can be a helper function as you are doing the same check multiple times. It will make it a bit more readable too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give this a try!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 93e1dc6

I originally didn't do this because the checks are slightly different for functions and other cases. But we don't need to be this picky. The result is the same and this is much nicer. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks much better, thanx Drew!

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.7MB 3.7MB +131.0B

History

@drewdaemon
Copy link
Contributor Author

Forgot to mention, the same thing should be done for autocomplete, but it got a bit more involved so I will do it later. The validation bug is the priority.

@drewdaemon drewdaemon merged commit 90a7436 into elastic:main Jun 4, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15449494849

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 4, 2025
## Summary

A resolution to
elastic#192255 (comment)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
(cherry picked from commit 90a7436)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 4, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [[ES|QL] fix COALESCE validation
(#222425)](#222425)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Drew
Tate","email":"drew.tate@elastic.co"},"sourceCommit":{"committedDate":"2025-06-04T18:07:46Z","message":"[ES|QL]
fix COALESCE validation (#222425)\n\n## Summary\n\nA resolution
to\nhttps://github.com//issues/192255#issuecomment-2844145398\n\n###
Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios\n\n---------\n\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"90a7436ecb771edca0542ab52434a60e69b65cf3","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:ES|QL","Team:ESQL","backport:version","v9.1.0","v8.19.0"],"title":"[ES|QL]
fix COALESCE
validation","number":222425,"url":"https://github.com/elastic/kibana/pull/222425","mergeCommit":{"message":"[ES|QL]
fix COALESCE validation (#222425)\n\n## Summary\n\nA resolution
to\nhttps://github.com//issues/192255#issuecomment-2844145398\n\n###
Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios\n\n---------\n\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"90a7436ecb771edca0542ab52434a60e69b65cf3"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/222425","number":222425,"mergeCommit":{"message":"[ES|QL]
fix COALESCE validation (#222425)\n\n## Summary\n\nA resolution
to\nhttps://github.com//issues/192255#issuecomment-2844145398\n\n###
Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios\n\n---------\n\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"90a7436ecb771edca0542ab52434a60e69b65cf3"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Drew Tate <drew.tate@elastic.co>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
drewdaemon added a commit that referenced this pull request Jun 5, 2025
## Summary

The autocomplete side of #222425

Also, cleans up and simplifies some unnecessarily-complicated
autocomplete function test code, following the same pattern we used for
function validation testing 💪


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 5, 2025
## Summary

The autocomplete side of elastic#222425

Also, cleans up and simplifies some unnecessarily-complicated
autocomplete function test code, following the same pattern we used for
function validation testing 💪

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 1279bc9)
pmuellr pushed a commit to pmuellr/kibana that referenced this pull request Jun 11, 2025
## Summary

The autocomplete side of elastic#222425

Also, cleans up and simplifies some unnecessarily-complicated
autocomplete function test code, following the same pattern we used for
function validation testing 💪


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
nickpeihl pushed a commit to nickpeihl/kibana that referenced this pull request Jun 12, 2025
## Summary

A resolution to
elastic#192255 (comment)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
nickpeihl pushed a commit to nickpeihl/kibana that referenced this pull request Jun 12, 2025
## Summary

The autocomplete side of elastic#222425

Also, cleans up and simplifies some unnecessarily-complicated
autocomplete function test code, following the same pattern we used for
function validation testing 💪


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:ES|QL ES|QL related features in Kibana release_note:fix Team:ESQL ES|QL related features in Kibana t// v8.19.0 v9.1.0

4 participants