[BUG] PPL LIKE function: no way to escape the escape character (\) - #5653
Conversation
PR Reviewer Guide 🔍(Review updated until commit 531e974)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
2f23ee3 to
15ab747
Compare
|
Persistent review updated to latest commit 15ab747 |
Signed-off-by: Ajimelec Gonzalez <ajimelec@amazon.com>
15ab747 to
531e974
Compare
|
Persistent review updated to latest commit 531e974 |
Description
When the
DEFAULT_ESCAPE(\) case is hit, the code setsescaped = truewithout checking whether escaped is alreadytrue. This means a sequence of two backslashes (\\, which represents a literal backslash inLIKEsyntax) setsescaped = truetwice, the second backslash does not consume the escape state from the first. As a result, escaped remains true after both backslashes, causing the next character (e.g.,%) to be incorrectly treated as escaped (literal) instead of as a wildcard.The fix adds a check: if escaped is already true when we encounter another backslash, we know this backslash is being escaped by the previous one. We treat it as a literal backslash (removing the escape prefix from the output) and reset escaped to false.
Related Issues
Resolves #5627
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.