willemv opened a new issue, #19076:
URL: https://github.com/apache/datafusion/issues/19076
### Describe the bug
`starts_with(expr, 'literal')` functions are simplified to `expr LIKE
'literal%'`
The simplification process correctly escapes percent signs (`%`) in the
pattern, but forgets to escape underscores (`_`). Underscores also have a
special meaning in the LIKE operator: match any single character.
### To Reproduce
Easy to reproduce with this query:
```
# use a
SELECT starts_with('foobar', 'foo_'), starts_with('foo_bar', 'foo_')
```
----
# current, incorrect result:
true, true
```
### Expected behavior
The query above should result in
```
false, true
```
In other words, simplification of the `starts_with` function should escape
underscores in patterns
### Additional context
The `ends_with` is not simplified, so is not affected by this bug
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]