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

Fix LIKE expressions for CHAR #22076

Merged
merged 1 commit into from
Mar 4, 2024
Merged

Fix LIKE expressions for CHAR #22076

merged 1 commit into from
Mar 4, 2024

Conversation

tdcmeehan
Copy link
Contributor

@tdcmeehan tdcmeehan commented Mar 4, 2024

Description

Currently, SqlToRowExpressionTranslator will attempt to optimize queries that contain like that begin and end with % as follows:

select x like '%abc' from char_col

as

select cardinality(split(...charcol...)) 

This doesn't work because split is only registered for VARCHAR, not CHAR.

Motivation and Context

Any query that attempts to do LIKE '%text%' over a char column is broken.

Impact

Restore functionality and backport into 0.284, 0.285 and prepare for 0.286.

Test Plan

Attached unit tests.

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* Fix queries that filter with LIKE '%...%' over char columns

@tdcmeehan tdcmeehan requested a review from a team as a code owner March 4, 2024 16:04
@tdcmeehan tdcmeehan requested review from presto-oss and kaikalur March 4, 2024 16:04
@kaikalur
Copy link
Contributor

kaikalur commented Mar 4, 2024

Can we add a task to add SPLIT for CHAR type as well?

Copy link
Contributor

@kaikalur kaikalur left a comment

Choose a reason for hiding this comment

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

LGTM

@tdcmeehan tdcmeehan merged commit 5afd695 into prestodb:master Mar 4, 2024
56 checks passed
@wanglinsong wanglinsong mentioned this pull request May 1, 2024
48 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LIKE expressions with initial and ending % do not work on char columns
3 participants