This is an automated email from the ASF dual-hosted git repository. lijibing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new fbdb4f401c3 [fix](function)Fix split_by_regexp function integer parameter couldn't set bug. (#47676) fbdb4f401c3 is described below commit fbdb4f401c38365bc49b787c65eb8e75b57e78cf Author: James <lijib...@selectdb.com> AuthorDate: Mon Feb 10 15:34:43 2025 +0800 [fix](function)Fix split_by_regexp function integer parameter couldn't set bug. (#47676) ### What problem does this PR solve? split_by_regexp function's third parameter doesn't support tinyint. This pr is to fix it. ``` mysql> select split_by_regexp('aa,bb,cc', ',', 1); ERROR 1105 (HY000): errCode = 2, detailMessage = the third parameter of split_by_regexp function must be a positive constant: split_by_regexp('aa,bb,cc', ',', 1) ``` --- .../expressions/functions/scalar/SplitByRegexp.java | 6 +++--- .../string_functions/test_split_by_regexp.out | Bin 764 -> 987 bytes .../string_functions/test_split_by_regexp.groovy | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SplitByRegexp.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SplitByRegexp.java index 8d1d0145d71..a72ed434cc3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SplitByRegexp.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/SplitByRegexp.java @@ -22,7 +22,7 @@ import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable; -import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; +import org.apache.doris.nereids.trees.expressions.literal.IntegerLikeLiteral; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; import org.apache.doris.nereids.types.ArrayType; import org.apache.doris.nereids.types.IntegerType; @@ -77,8 +77,8 @@ public class SplitByRegexp extends ScalarFunction @Override public void checkLegalityBeforeTypeCoercion() { if (children().size() == 3) { - if (!child(2).isConstant() || !(child(2) instanceof IntegerLiteral) - || (((IntegerLiteral) child(2)).getValue() < 0)) { + if (!child(2).isConstant() || !(child(2) instanceof IntegerLikeLiteral) + || (((IntegerLikeLiteral) child(2)).getIntValue() < 0)) { throw new AnalysisException("the third parameter of " + getName() + " function must be a positive constant: " + toSql()); } diff --git a/regression-test/data/query_p0/sql_functions/string_functions/test_split_by_regexp.out b/regression-test/data/query_p0/sql_functions/string_functions/test_split_by_regexp.out index 588ad7fa5cb..1fb99f58ab1 100644 Binary files a/regression-test/data/query_p0/sql_functions/string_functions/test_split_by_regexp.out and b/regression-test/data/query_p0/sql_functions/string_functions/test_split_by_regexp.out differ diff --git a/regression-test/suites/query_p0/sql_functions/string_functions/test_split_by_regexp.groovy b/regression-test/suites/query_p0/sql_functions/string_functions/test_split_by_regexp.groovy index c9ace391b5b..4b9719068e6 100644 --- a/regression-test/suites/query_p0/sql_functions/string_functions/test_split_by_regexp.groovy +++ b/regression-test/suites/query_p0/sql_functions/string_functions/test_split_by_regexp.groovy @@ -64,5 +64,11 @@ suite("test_split_by_regexp") { qt_select5 "select split_by_regexp(v1, ',') from test_split_by_regexp order by k1;" qt_select6 "select split_by_regexp('do,ris', v2) from test_split_by_regexp order by k1;" qt_select7 "select split_by_regexp(v1, v2) from test_split_by_regexp order by k1;" + qt_select8 "select split_by_regexp('aa,bbb,cccc', ',', 1);" + qt_select9 "select split_by_regexp('aa,bbb,cccc', ',', 2);" + qt_select10 "select split_by_regexp('aa,bbb,cccc', ',', 3);" + qt_select11 "select split_by_regexp('aa,bbb,cccc', ',', 4);" + qt_select12 "select split_by_regexp('aa,bbb,cccc', ',', 100000000);" + qt_select13 "select split_by_regexp('aa,bbb,cccc', ',', 10000000000000);" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org