diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala index e81c956fe11b..181ea49ab3ee 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/ScalarFunctionsValidateSuite.scala @@ -1211,4 +1211,39 @@ class ScalarFunctionsValidateSuite extends FunctionsValidateTest { checkGlutenOperatorMatch[ProjectExecTransformer] } } + + test("Test substring_index") { + withTempView("substring_index_table") { + withTempPath { + path => + Seq[(String, String, Int)]( + ("www.apache.org", ".", 3), + ("www.apache.org", ".", 2), + ("www.apache.org", ".", 1), + ("www.apache.org", ".", 0), + ("www.apache.org", ".", -1), + ("www.apache.org", ".", -2), + ("www.apache.org", ".", -3), + ("www.apache.org", "", 1), + ("www.apache.org", "#", 1), + ("www||apache||org", "||", 2), + ("www||apache||org", "||", -2), + ("", ".", 1), + ("||||||", "|||", 3), + ("||||||", "|||", -4) + ) + .toDF("str", "delim", "count") + .write + .parquet(path.getCanonicalPath) + spark.read.parquet(path.getCanonicalPath).createOrReplaceTempView("substring_index_table") + runQueryAndCompare( + """ + |select substring_index(str, delim, count) from substring_index_table + |""".stripMargin + ) { + checkGlutenOperatorMatch[ProjectExecTransformer] + } + } + } + } } diff --git a/docs/velox-backend-support-progress.md b/docs/velox-backend-support-progress.md index 5a2d53376396..a2a2093fc903 100644 --- a/docs/velox-backend-support-progress.md +++ b/docs/velox-backend-support-progress.md @@ -185,7 +185,7 @@ Gluten supports 199 functions. (Drag to right to see all data types) | startswith | | startsWith | | | | | | | | | | | | | | | | | | | | | | substr, substring | substr | substring | S | | | | | | | | | | | S | | | | | | | | | | substring, substr | substr | substring | S | | | | | | | | | | | S | | | | | | | | | -| substring_index | | | | | | | | | | | | | | | | | | | | | | | +| substring_index | | substring_index | S | | | | | | | | | | | | | | | | | | | | | translate | | | | | | | | | | | | | | | | | | | | | | | | trim | trim | trim | S | | | | | | | | | | | S | | | | | | | | | | ucase, upper | upper | upper | S | | | | | | | | | | | S | | | | | | | | |