This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 0e33923c3f0 branch-3.0: [fix](Nereids) fix initcap fe fold constant
#49061 (#49583)
0e33923c3f0 is described below
commit 0e33923c3f0e89e0e54da542aecf1550c33fc3f1
Author: LiBinfeng <[email protected]>
AuthorDate: Sun Mar 30 10:51:04 2025 +0800
branch-3.0: [fix](Nereids) fix initcap fe fold constant #49061 (#49583)
Cherry-picked from https://github.com/apache/doris/pull/49061
case of initcap has been added at:
(https://github.com/apache/doris/pull/49346)
---
.../expressions/functions/executable/StringArithmetic.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
index 411f070d24d..e714ab6a87d 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
@@ -420,12 +420,9 @@ public class StringArithmetic {
return new IntegerLiteral(first.getValue().codePointCount(0,
first.getValue().length()));
}
- private static boolean isSeparator(char c) {
- if (".$|()[{^?*+\\".indexOf(c) == -1) {
- return false;
- } else {
- return true;
- }
+ private static boolean isAlphabetic(char c) {
+ Pattern pattern = Pattern.compile("\\p{Alnum}");
+ return pattern.matcher(String.valueOf(c)).find();
}
/**
@@ -437,7 +434,7 @@ public class StringArithmetic {
boolean capitalizeNext = true;
for (char c : first.getValue().toCharArray()) {
- if (Character.isWhitespace(c) || isSeparator(c)) {
+ if (Character.isWhitespace(c) || !isAlphabetic(c)) {
result.append(c);
capitalizeNext = true; // Next character should be capitalized
} else if (capitalizeNext) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]