Skip to content
Closed
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 @@ -1192,7 +1192,7 @@ public UTF8String repeat(int times) {
* @return the position of the first occurrence of the empty substr (now, always 0)
*/
public int indexOfEmpty(int start) {
return 0; // TODO: Fix this behaviour (SPARK-48284)
return start >= numChars() ? 0 : start;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ public void indexOf() {
assertEquals(0, EMPTY_UTF8.indexOf(EMPTY_UTF8, 0));
assertEquals(-1, EMPTY_UTF8.indexOf(fromString("l"), 0));
assertEquals(0, fromString("hello").indexOf(EMPTY_UTF8, 0));
assertEquals(2, fromString("hello").indexOf(EMPTY_UTF8, 2));
assertEquals(0, fromString("hello").indexOf(EMPTY_UTF8, 9));
assertEquals(2, fromString("hello").indexOf(fromString("l"), 0));
assertEquals(3, fromString("hello").indexOf(fromString("l"), 3));
assertEquals(-1, fromString("hello").indexOf(fromString("a"), 0));
Expand Down