fix: escape underscores when simplifying starts_with (#19077)#392
Merged
avantgardnerio merged 1 commit intotp_46from Jan 12, 2026
Merged
fix: escape underscores when simplifying starts_with (#19077)#392avantgardnerio merged 1 commit intotp_46from
starts_with (#19077)#392avantgardnerio merged 1 commit intotp_46from
Conversation
## Which issue does this PR close? - Closes apache#19076. ## What changes are included in this PR? The `simplify` implementation for `StartsWithFunc` is adjusted to also escape underscores instead of only percent signs. ## Are these changes tested? Yes, new sql logic tests were added testing `starts_with` functions with string literals and patterns that contain an underscore. Similar tests were added for `ends_with`, even though that function has no simplification and is not affected by this bug. If simplification is ever introduced there, escaping the underscore cannot be overlooked then. ## Are there any user-facing changes? No Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> (cherry picked from commit 340a28c)
dispanser
approved these changes
Jan 12, 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.
Which issue does this PR close?
starts_withfunction are simplified incorrectly when the prefix contains an underscore apache/datafusion#19076.What changes are included in this PR?
The
simplifyimplementation forStartsWithFuncis adjusted to also escape underscores instead of only percent signs.Are these changes tested?
Yes, new sql logic tests were added testing
starts_withfunctions with string literals and patterns that contain an underscore.Similar tests were added for
ends_with, even though that function has no simplification and is not affected by this bug. If simplification is ever introduced there, escaping the underscore cannot be overlooked then.Are there any user-facing changes?
No
Co-authored-by: Andrew Lamb andrew@nerdnetworks.org
(cherry picked from commit 340a28c)
Which issue does this PR close?
Closes #.
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?