Skip to content

[8.x] ESQL: Rewrite TO_UPPER/TO_LOWER comparisons (#118870)#119207

Merged
elasticsearchmachine merged 3 commits intoelastic:8.xfrom
bpintea:backport/8.x/pr-118870
Dec 23, 2024
Merged

[8.x] ESQL: Rewrite TO_UPPER/TO_LOWER comparisons (#118870)#119207
elasticsearchmachine merged 3 commits intoelastic:8.xfrom
bpintea:backport/8.x/pr-118870

Conversation

@bpintea
Copy link
Copy Markdown
Contributor

@bpintea bpintea commented Dec 23, 2024

Backports the following commits to 8.x:

This adds an optimization rule to rewrite TO_UPPER/TO_LOWER comparisons
against a string into an InsensitiveEquals comparison. The rewrite can
also result right away into a TRUE/FALSE, in case the string doesn't
match the caseness of the function.

This also allows later pushing down the predicate to lucene as a
case-insensitive term-query.

Fixes elastic#118304.
@bpintea bpintea added :Analytics/ES|QL AKA ESQL >enhancement auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Dec 23, 2024
TO_UPPER/TO_LOWER resolution incorrectly returned child's type (that
could also be `null`, type `NULL`), instead of KEYWORD/TEXT. So a test
like `TO_UPPER(null) == "..."` fails on type mismatch. This was fixed
collaterally by elastic#114334 (8.17.0)

Also, correct some of the tests skipping (that had however no impact,
due to testing range).

(cherry picked from commit edb3818)
@elasticsearchmachine elasticsearchmachine merged commit aeda3ed into elastic:8.x Dec 23, 2024
@bpintea bpintea deleted the backport/8.x/pr-118870 branch December 23, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants