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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java:
##########
@@ -500,6 +503,13 @@ public static Expression initCap(StringLikeLiteral first) {
         return castStringLikeLiteral(first, result.toString());
     }
 
+    private static void requireAsciiForCaseFolding(String value) {
+        if (!CharMatcher.ascii().matchesAllOf(value)) {
+            // BE uses ICU for Unicode case conversion.
+            throw new IllegalArgumentException("Non-ASCII case conversion must 
be evaluated by BE");

Review Comment:
   [P2] Preserve Unicode evaluation for literal-required SET assignments
   
   With the default `enable_fold_constant_by_be=false`, `SET @x = lower('Ä')` 
now fails with “must be constant value” instead of assigning `'ä'`; `SET @x = 
initcap('ä')` similarly regresses. `SetUserDefinedVarOp.validate()` calls 
`ExpressionUtils.analyzeAndFoldToLiteral()`, which requires a `Literal`, while 
`FoldConstantRule.evaluateOrThrow()` selects only FE evaluation under that 
setting. This guard makes `ExpressionEvaluator` return the original function 
expression, so the command is rejected before any BE execution can occur. Both 
assignments folded successfully at the base. Please provide a Unicode-correct 
evaluation path for literal-required callers and cover these SET cases, rather 
than assuming every caller can defer evaluation to BE.



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