You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "willemv (via GitHub)" <gi...@apache.org> on 2025/12/03 20:05:29 UTC
[I] `starts_with` function are simplified incorrectly when the prefix contains an underscore [datafusion]
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] `starts_with` function are simplified incorrectly when the prefix contains an underscore [datafusion]
Posted by "willemv (via GitHub)" <gi...@apache.org>.
willemv commented on issue #19076:
URL: https://github.com/apache/datafusion/issues/19076#issuecomment-3608658208
take
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] `starts_with` function are simplified incorrectly when the prefix contains an underscore [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #19076: `starts_with` function are simplified incorrectly when the prefix contains an underscore
URL: https://github.com/apache/datafusion/issues/19076
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org