stevomitric commented on code in PR #47871:
URL: https://github.com/apache/spark/pull/47871#discussion_r1731408947
##########
common/unsafe/src/test/java/org/apache/spark/unsafe/types/CollationSupportSuite.java:
##########
@@ -2329,6 +2329,19 @@ public void testStringLocate() throws SparkException {
assertStringLocate("b", "a🙃x🙃b", 4, "UTF8_LCASE", 5);
assertStringLocate("b", "a🙃x🙃b", 4, "UNICODE", 5);
assertStringLocate("b", "a🙃x🙃b", 4, "UNICODE_CI", 5);
+ // Out of bounds test cases.
+ assertStringLocate("a", "asd", 4, "UTF8_BINARY", 0);
+ assertStringLocate("a", "asd", 4, "UTF8_LCASE", 0);
+ assertStringLocate("a", "asd", 4, "UNICODE", 0);
+ assertStringLocate("a", "asd", 4, "UNICODE_CI", 0);
Review Comment:
Also the suggested edit here is wrong, the expected result should be 1 (as
per the UTF8 Binary collation).
##########
common/unsafe/src/test/java/org/apache/spark/unsafe/types/CollationSupportSuite.java:
##########
@@ -2329,6 +2329,19 @@ public void testStringLocate() throws SparkException {
assertStringLocate("b", "a🙃x🙃b", 4, "UTF8_LCASE", 5);
assertStringLocate("b", "a🙃x🙃b", 4, "UNICODE", 5);
assertStringLocate("b", "a🙃x🙃b", 4, "UNICODE_CI", 5);
+ // Out of bounds test cases.
+ assertStringLocate("a", "asd", 4, "UTF8_BINARY", 0);
+ assertStringLocate("a", "asd", 4, "UTF8_LCASE", 0);
+ assertStringLocate("a", "asd", 4, "UNICODE", 0);
+ assertStringLocate("a", "asd", 4, "UNICODE_CI", 0);
Review Comment:
These tests (with empty strings) won't hit the codepath, but i will include
them since it falls into the category i stated in the comment above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]