linrrzqqq opened a new pull request, #71251:
URL: https://github.com/apache/doris/pull/71251
### Background
Nereids evaluates supported string functions during planning when their
arguments are literals.
### What problem does this PR solve?
Issue Number: None
Related PR: None
PR Type: Bugfix
Problem Summary:
FE constant folding can split Unicode characters during trimming, produce
different case conversions from BE, and accept URL escapes that BE rejects.
This change makes those folds follow BE semantics.
### Details
| Functions | Change |
| --- | --- |
| `ltrim_in`, `rtrim_in`, `trim_in` | Match and trim complete Unicode code
points. |
| `lower`, `initcap` | Keep ASCII folding in FE and use BE’s ICU
implementation for non-ASCII inputs. |
| `url_decode` | Require ASCII hex digits in `%HH` escapes. Defer to BE for
malformed escapes or decoded bytes that cannot be represented as a UTF-8 string
literal. |
```sql
SET enable_fold_constant_by_be = false;
SELECT HEX(ltrim_in('😁😀x', '😁')),
HEX(rtrim_in('x🨀😀', '😀')),
HEX(trim_in('😁😀', '😁'));
SELECT lower('AΣ:A'), initcap('AΣ:A');
SELECT url_decode('%41'), url_decode('%E4%B8%AD');
SELECT url_decode('%41');
```
### Testing
- Ran `StringArithmeticTest` on the patched worktree. All 18 tests passed.
- The SQL reproducer above was not run on baseline and patched Doris
clusters.
### Release note
String constant folding preserves whole Unicode characters and follows BE
case conversion and URL escape rules.
### Check List (For Author)
- Behavior changed: Yes
- Does this need documentation: No
- Pre-submission status: Partially verified. FE unit tests passed. Cluster
SQL verification is pending.
### AI Disclosure
- Tool: Codex
- Generated: Implementation, unit tests, and description
- Human review: Pending
--
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]