Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VL] Add a test to validate substring_index #6393

Merged
merged 3 commits into from
Jul 12, 2024
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 @@ -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]
}
}
}
}
}
2 changes: 1 addition & 1 deletion docs/velox-backend-support-progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | | | | | | | | |
Expand Down
Loading