Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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;
Expand Down Expand Up @@ -77,8 +77,8 @@ public SplitByRegexp withChildren(List<Expression> children) {
@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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,21 @@
\N
["a", "b", "c", "12345", ""]

-- !select8 --
["aa,bbb,cccc"]

-- !select9 --
["aa", "bbb,cccc"]

-- !select10 --
["aa", "bbb", "cccc"]

-- !select11 --
["aa", "bbb", "cccc"]

-- !select12 --
["aa", "bbb", "cccc"]

-- !select13 --
["aa", "bbb", "cccc"]

Original file line number Diff line number Diff line change
Expand Up @@ -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);"
}

Loading