Skip to content

fix: escape underscores when simplifying starts_with (#19077)#392

Merged
avantgardnerio merged 1 commit intotp_46from
bg_cherry_pick
Jan 12, 2026
Merged

fix: escape underscores when simplifying starts_with (#19077)#392
avantgardnerio merged 1 commit intotp_46from
bg_cherry_pick

Conversation

@avantgardnerio
Copy link

Which issue does this PR close?

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)

Which issue does this PR close?

Closes #.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

## 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)
@avantgardnerio avantgardnerio merged commit b4e6d5f into tp_46 Jan 12, 2026
32 of 33 checks passed
@avantgardnerio avantgardnerio deleted the bg_cherry_pick branch January 12, 2026 16:44
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.

3 participants