-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-48441][SQL][FOLLOWUP] Fix StringTrim behaviour for UTF8_LCASE …
…collation ### What changes were proposed in this pull request? Fix how `StringTrim*` expressions handle edge cases with one-to-many case mapping, by updating the lowercase trimming logic that matches multiple characters from the `srcString` to a single character in `trimStr`. These methods now correctly follow the iterative "longest possible match" behaviour (proposed for StringTrim in the original PR). ### Why are the changes needed? Fix a subtle bug in `trim`-like functions. Example: ``` trim("ii\u0307", "İi"); -- returns: "\u0307" (wrong), instead of "" (correct) ``` ### Does this PR introduce _any_ user-facing change? Yes, trim* function behaviour is slightly altered for UTF8_LCASE. ### How was this patch tested? New tests in `CollationSupportSuite`. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #47836 from uros-db/alter-trim-followup. Authored-by: Uros Bojanic <[email protected]> Signed-off-by: Max Gekk <[email protected]>
- Loading branch information
Showing
2 changed files
with
81 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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