Skip to content
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

Backport: Fix incorrect ... LIKE '%' simplification with NULLs (#13259) #73

Conversation

findepi
Copy link
Collaborator

@findepi findepi commented Nov 6, 2024

Backport of apache#13259

  • Fix incorrect ... LIKE '%' simplification

expr LIKE '%' was previously simplified to true, but the expression returns NULL when expr is null.
The conversion was conditional on !is_null(expr) which means "is not always true, i.e. is not a null literal".

This commit adds correct simplification logic. It additionally expands the rule coverage to include string view (Utf8View) and large string (LargeUtf8). This allows writing shared test cases even despite utf8_view LIKE '%' returning incorrect results at execution time (tracked by apache#12637). I.e. the simplification masks the bug for cases where pattern is statically known.

  • fixup! Fix incorrect ... LIKE '%' simplification

  • fix tests (re review comments)

@findepi findepi requested review from vgapeyev and milevin November 6, 2024 07:40
@findepi findepi changed the base branch from findepi/41 to sdf/41 November 6, 2024 10:03
@findepi findepi requested a review from sadboy November 6, 2024 10:03
…che#13259)

* Fix incorrect `... LIKE '%'` simplification

`expr LIKE '%'` was previously simplified to `true`, but the expression
returns `NULL` when `expr` is null.
The conversion was conditional on `!is_null(expr)` which means "is not
always true, i.e. is not a null literal".

This commit adds correct simplification logic. It additionally expands
the rule coverage to include string view (Utf8View) and large string
(LargeUtf8). This allows writing shared test cases even despite
`utf8_view LIKE '%'` returning incorrect results at execution time
(tracked by apache#12637). I.e. the
simplification masks the bug for cases where pattern is statically
known.

* fixup! Fix incorrect `... LIKE '%'` simplification

* fix tests (re review comments)
@findepi findepi force-pushed the findepi/findepi/41/fix-incorrect-like-simplification-with-nulls-13259-914814 branch from 3558a8c to f97e57d Compare November 6, 2024 21:26
@findepi
Copy link
Collaborator Author

findepi commented Nov 6, 2024

rebased on current tip of the target branch

@findepi findepi merged commit 340776d into sdf/41 Nov 6, 2024
22 checks passed
@findepi findepi deleted the findepi/findepi/41/fix-incorrect-like-simplification-with-nulls-13259-914814 branch November 6, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants