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 ea905d0f26c branch-3.0: [bugfix](nerids) complete the implementation
of the concat method. #51141 (#51223)
ea905d0f26c is described below
commit ea905d0f26c8b55b467a8884808d87443c83a365
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue May 27 09:50:19 2025 +0800
branch-3.0: [bugfix](nerids) complete the implementation of the concat
method. #51141 (#51223)
Cherry-picked from #51141
Co-authored-by: XLPE <[email protected]>
Co-authored-by: weiwh1 <[email protected]>
---
.../trees/expressions/functions/executable/StringArithmetic.java | 9 ++++++---
.../test/java/org/apache/doris/catalog/CreateFunctionTest.java | 4 ++--
2 files changed, 8 insertions(+), 5 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 4ebb822255e..3d14895868e 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
@@ -74,9 +74,12 @@ public class StringArithmetic {
* Executable arithmetic functions concat
*/
@ExecFunction(name = "concat")
- public static Expression concatVarcharVarchar(StringLikeLiteral first,
StringLikeLiteral second) {
- String result = first.getValue() + second.getValue();
- return castStringLikeLiteral(first, result);
+ public static Expression concatVarchar(StringLikeLiteral... values) {
+ final StringBuilder sb = new StringBuilder();
+ for (StringLikeLiteral value : values) {
+ sb.append(value.getValue());
+ }
+ return castStringLikeLiteral(values[0], sb.toString());
}
private static String substringImpl(String first, int second, int third) {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateFunctionTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateFunctionTest.java
index 7368e6fb592..ba194fded0a 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateFunctionTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateFunctionTest.java
@@ -106,7 +106,7 @@ public class CreateFunctionTest {
List<List<Expr>> constExprLists = Deencapsulation.getField(unionNode,
"constExprLists");
Assert.assertEquals(1, constExprLists.size());
Assert.assertEquals(1, constExprLists.get(0).size());
- Assert.assertTrue(constExprLists.get(0).get(0) instanceof
FunctionCallExpr);
+ Assert.assertTrue(constExprLists.get(0).get(0) instanceof
StringLiteral);
queryStr = "select db1.id_masking(k1) from db1.tbl1";
Assert.assertTrue(containsIgnoreCase(dorisAssert.query(queryStr).explainQuery(),
@@ -143,7 +143,7 @@ public class CreateFunctionTest {
Assert.assertEquals(1, functions.size());
String queryStr = "select id_masking(13888888888);";
- testFunctionQuery(ctx, queryStr, false);
+ testFunctionQuery(ctx, queryStr, true);
queryStr = "select id_masking(k1) from db2.tbl1";
Assert.assertTrue(containsIgnoreCase(dorisAssert.query(queryStr).explainQuery(),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]