From 7225f8f3dc0266874fcbf2e65702600b19ad58d4 Mon Sep 17 00:00:00 2001 From: mcdull-zhang Date: Tue, 18 Jun 2024 16:54:59 +0800 Subject: [PATCH 1/2] split --- .../apache/gluten/expression/ExpressionTransformer.scala | 4 ++-- .../gluten/execution/VeloxStringFunctionsSuite.scala | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala b/backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala index 51b19ab140d9..eb34610aba72 100644 --- a/backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala +++ b/backends-velox/src/main/scala/org/apache/gluten/expression/ExpressionTransformer.scala @@ -129,9 +129,9 @@ case class VeloxStringSplitTransformer( val limit = limitExpr.doTransform(args).asInstanceOf[IntLiteralNode].getValue val regex = regexExpr.doTransform(args).asInstanceOf[StringLiteralNode].getValue - if (limit > 0 || regex.length > 1) { + if (limit > 0 || regex.length != 1 || regex.charAt(0) > 127) { throw new GlutenNotSupportException( - s"$original supported single-length regex and negative limit, but given $limit and $regex") + s"$original supported single-length ASCII regex and negative limit, but given $limit and $regex") } super.doTransform(args) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala index 2aedde12a5a9..7674cee2b1c7 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala @@ -536,6 +536,14 @@ class VeloxStringFunctionsSuite extends VeloxWholeStageTransformerSuite { runQueryAndCompare( s"select l_orderkey, split(l_comment, 'h') " + s"from $LINEITEM_TABLE limit 5") { _ => } + + runQueryAndCompare( + s"select l_orderkey, split(l_comment, '') " + + s"from $LINEITEM_TABLE limit 5", noFallBack = false) { _ => } + + runQueryAndCompare( + s"select l_orderkey, split(l_comment, ',') " + + s"from $LINEITEM_TABLE limit 5", noFallBack = false) { _ => } } test("substr") { From e0eeb5b62341b6d65886919f6a57bcf4b15701ae Mon Sep 17 00:00:00 2001 From: mcdull-zhang Date: Tue, 18 Jun 2024 17:47:02 +0800 Subject: [PATCH 2/2] split --- .../org/apache/gluten/execution/VeloxStringFunctionsSuite.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala index 7674cee2b1c7..f8ff57238d71 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxStringFunctionsSuite.scala @@ -541,9 +541,11 @@ class VeloxStringFunctionsSuite extends VeloxWholeStageTransformerSuite { s"select l_orderkey, split(l_comment, '') " + s"from $LINEITEM_TABLE limit 5", noFallBack = false) { _ => } + // scalastyle:off nonascii runQueryAndCompare( s"select l_orderkey, split(l_comment, ',') " + s"from $LINEITEM_TABLE limit 5", noFallBack = false) { _ => } + // scalastyle:on nonascii } test("substr") {