hello-stephen commented on code in PR #71251:
URL: https://github.com/apache/doris/pull/71251#discussion_r4764560526


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java:
##########
@@ -149,7 +150,7 @@ public static Expression lengthVarchar(StringLikeLiteral 
first) {
      */
     @ExecFunction(name = "lower")
     public static Expression lowerVarchar(StringLikeLiteral first) {
-        return castStringLikeLiteral(first, 
first.getValue().toLowerCase(Locale.ROOT));
+        return castStringLikeLiteral(first, 
UCharacter.toLowerCase(ULocale.ROOT, first.getValue()));

Review Comment:
   [P2] Match the BE Unicode data before folding case conversions
   
   The repository pins ICU4J 78.1 in `fe/pom.xml:444`, but builds BE with ICU4C 
69.1 (`thirdparty/vars.sh:602-604`, `build_icu`), whose [Unicode data is 
version 
13](https://raw.githubusercontent.com/unicode-org/icu/release-69-1/icu4c/source/common/unicode/uchar.h).
 This introduces different results for literals and stored column values. For a 
physical table `t` whose STRING column `v` contains `Ᲊ` (U+1C89), the 
source-derived reproducer is:
   
   ```sql
   SELECT HEX(LOWER('Ᲊ')), HEX(LOWER(v)) FROM t;
   ```
   
   FE folds the first expression to `E1B28A` (U+1C8A), following the [ICU 78.1 
mapping](https://raw.githubusercontent.com/unicode-org/icu/release-78.1/icu4c/source/data/unidata/UnicodeData.txt);
 BE's `TransferImpl::to_lower_utf8` leaves the column value as `E1B289` under 
the pinned ICU 69.1. These characters were [first assigned in Unicode 
16](https://www.unicode.org/Public/16.0.0/ucd/DerivedAge.txt), so the previous 
Java 17 implementation also left them unchanged. The changed `initCap` 
similarly folds U+1C8A to U+1C89 while BE leaves it unchanged. Please use case 
data compatible with the BE and add literal-versus-stored-column parity 
coverage for newer case pairs. This example was verified from source, not 
executed.



-- 
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]

Reply via email to