Skip to content

Commit

Permalink
fix empty delim case
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyangxiaozhu committed Jun 19, 2024
1 parent 9196ebc commit c38458a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion velox/functions/sparksql/SplitFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Split final : public exec::VectorFunction {
offset += 1;
}

if (offset > input.size()) {
if (offset >= input.size()) {
break;
}

Expand Down
4 changes: 2 additions & 2 deletions velox/functions/sparksql/tests/SplitFunctionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ TEST_F(SplitTest, split) {
// Check the empty delimiter special case.
delim = "";
auto expected = makeArrayVector<StringView>({
{"I", ",", "h", "e", ",", "s", "h", "e", ",", "t", "h", "e", "y", ""},
{"o", "n", "e", ",", ",", ",", "f", "o", "u", "r", ",", ""},
{"I", ",", "h", "e", ",", "s", "h", "e", ",", "t", "h", "e", "y"},
{"o", "n", "e", ",", ",", ",", "f", "o", "u", "r", ","},
{""},
});
assertEqualVectors(expected, run(inputStrings, delim, "split(C0, C1)"));
Expand Down

0 comments on commit c38458a

Please sign in to comment.