uros-db commented on code in PR #47771:
URL: https://github.com/apache/spark/pull/47771#discussion_r1718673446
##########
common/unsafe/src/test/java/org/apache/spark/unsafe/types/CollationSupportSuite.java:
##########
@@ -896,76 +912,110 @@ public void testInitCap() throws SparkException {
assertInitCap("", "UNICODE", "");
assertInitCap("", "UNICODE_CI", "");
// Basic tests
- assertInitCap("ABCDE", "UTF8_BINARY", "Abcde");
+ assertInitCap("ABCDE", "UTF8_BINARY", "Abcde", "Abcde");
assertInitCap("ABCDE", "UTF8_LCASE", "Abcde");
assertInitCap("ABCDE", "UNICODE", "Abcde");
assertInitCap("ABCDE", "UNICODE_CI", "Abcde");
// Uppercase present
- assertInitCap("AbCdE", "UTF8_BINARY", "Abcde");
- assertInitCap("aBcDe", "UTF8_BINARY", "Abcde");
+ assertInitCap("AbCdE", "UTF8_BINARY", "Abcde", "Abcde");
+ assertInitCap("aBcDe", "UTF8_BINARY", "Abcde", "Abcde");
assertInitCap("AbCdE", "UTF8_LCASE", "Abcde");
assertInitCap("aBcDe", "UTF8_LCASE", "Abcde");
assertInitCap("AbCdE", "UNICODE", "Abcde");
assertInitCap("aBcDe", "UNICODE", "Abcde");
assertInitCap("AbCdE", "UNICODE_CI", "Abcde");
assertInitCap("aBcDe", "UNICODE_CI", "Abcde");
// Accent letters
- assertInitCap("AbĆdE", "UTF8_BINARY", "Abćde");
+ assertInitCap("AbĆdE", "UTF8_BINARY", "Abćde", "Abćde");
assertInitCap("AbĆdE", "UTF8_LCASE", "Abćde");
assertInitCap("AbĆdE", "UNICODE", "Abćde");
assertInitCap("AbĆdE", "UNICODE_CI", "Abćde");
// Variable byte length characters
- assertInitCap("aB 世 De", "UTF8_BINARY", "Ab 世 De");
- assertInitCap("ÄBĆΔE", "UTF8_BINARY", "Äbćδe");
+ assertInitCap("aB 世 De", "UTF8_BINARY", "Ab 世 De", "Ab 世 De");
+ assertInitCap("ÄBĆΔE", "UTF8_BINARY", "Äbćδe", "Äbćδe");
assertInitCap("aB 世 De", "UTF8_LCASE", "Ab 世 De");
assertInitCap("ÄBĆΔE", "UTF8_LCASE", "Äbćδe");
assertInitCap("aB 世 De", "UNICODE", "Ab 世 De");
assertInitCap("ÄBĆΔE", "UNICODE", "Äbćδe");
assertInitCap("aB 世 de", "UNICODE_CI", "Ab 世 De");
assertInitCap("ÄBĆΔE", "UNICODE_CI", "Äbćδe");
// Case-variable character length
- assertInitCap("İo", "UTF8_BINARY", "I\u0307o");
+ assertInitCap("İo", "UTF8_BINARY", "İo","I\u0307o");
assertInitCap("İo", "UTF8_LCASE", "İo");
assertInitCap("İo", "UNICODE", "İo");
assertInitCap("İo", "UNICODE_CI", "İo");
- assertInitCap("i\u0307o", "UTF8_BINARY", "I\u0307o");
+ assertInitCap("i\u0307o", "UTF8_BINARY", "I\u0307o", "I\u0307o");
assertInitCap("i\u0307o", "UTF8_LCASE", "I\u0307o");
assertInitCap("i\u0307o", "UNICODE", "I\u0307o");
assertInitCap("i\u0307o", "UNICODE_CI", "I\u0307o");
// Different possible word boundaries
- assertInitCap("a b c", "UTF8_BINARY", "A B C");
+ assertInitCap("a b c", "UTF8_BINARY", "A B C", "A B C");
assertInitCap("a b c", "UNICODE", "A B C");
assertInitCap("a b c", "UTF8_LCASE", "A B C");
assertInitCap("a b c", "UNICODE_CI", "A B C");
- assertInitCap("a.b,c", "UTF8_BINARY", "A.b,c");
+ assertInitCap("a.b,c", "UTF8_BINARY", "A.b,c", "A.b,c");
assertInitCap("a.b,c", "UNICODE", "A.b,C");
assertInitCap("a.b,c", "UTF8_LCASE", "A.b,C");
assertInitCap("a.b,c", "UNICODE_CI", "A.b,C");
- assertInitCap("a. b-c", "UTF8_BINARY", "A. B-c");
+ assertInitCap("a. b-c", "UTF8_BINARY", "A. B-c", "A. B-c");
assertInitCap("a. b-c", "UNICODE", "A. B-C");
assertInitCap("a. b-c", "UTF8_LCASE", "A. B-C");
assertInitCap("a. b-c", "UNICODE_CI", "A. B-C");
- assertInitCap("a?b世c", "UTF8_BINARY", "A?b世c");
+ assertInitCap("a?b世c", "UTF8_BINARY", "A?b世c", "A?b世c");
assertInitCap("a?b世c", "UNICODE", "A?B世C");
assertInitCap("a?b世c", "UTF8_LCASE", "A?B世C");
assertInitCap("a?b世c", "UNICODE_CI", "A?B世C");
// Titlecase characters that are different from uppercase characters
- assertInitCap("dzDZDz", "UTF8_BINARY", "Dzdzdz");
+ assertInitCap("dzDZDz", "UTF8_BINARY", "Dzdzdz", "Dzdzdz");
assertInitCap("dzDZDz", "UNICODE", "Dzdzdz");
assertInitCap("dzDZDz", "UTF8_LCASE", "Dzdzdz");
assertInitCap("dzDZDz", "UNICODE_CI", "Dzdzdz");
- assertInitCap("džaba Ljubav NJegova", "UTF8_BINARY", "Džaba Ljubav Njegova");
+ assertInitCap("džaba Ljubav NJegova", "UTF8_BINARY", "Džaba Ljubav Njegova",
"Džaba Ljubav Njegova");
assertInitCap("džaba Ljubav NJegova", "UNICODE", "Džaba Ljubav Njegova");
assertInitCap("džaba Ljubav NJegova", "UTF8_LCASE", "Džaba Ljubav Njegova");
assertInitCap("džaba Ljubav NJegova", "UNICODE_CI", "Džaba Ljubav Njegova");
assertInitCap("ß fi ffi ff st ΣΗΜΕΡΙΝΟΣ ΑΣΗΜΕΝΙΟΣ İOTA", "UTF8_BINARY",
- "ß fi ffi ff st Σημερινος Ασημενιος I\u0307ota");
+ "Ss Fi Ffi Ff St Σημερινος Ασημενιος İota","ß fi ffi ff st Σημερινος
Ασημενιος I\u0307ota");
Review Comment:
and this is good, here we can see the actual diff
but if ICU and JVM output is the same, 1 parameter should be enough for such
UTF8_BINARY test cases
--
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]