geserdugarov commented on code in PR #12120:
URL: https://github.com/apache/hudi/pull/12120#discussion_r1810152206
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/keygen/TestKeyGenUtils.java:
##########
@@ -142,6 +145,14 @@ public void testExtractRecordKeysWithFields() {
Assertions.assertArrayEquals(new String[] {"2"}, s1);
String[] s2 = KeyGenUtils.extractRecordKeysByFields("id1:1,id2:2,2,id3:3",
fields);
- Assertions.assertArrayEquals(new String[] {"2", "2"}, s2);
+ Assertions.assertArrayEquals(new String[] {"2,2"}, s2);
+
+ String[] s3 =
KeyGenUtils.extractRecordKeysByFields("id1:1,1,1,id2:,2,2,,id3:3", fields);
+ Assertions.assertArrayEquals(new String[] {",2,2,"}, s3);
+
+ fields.addAll(Arrays.asList("id1", "id3", "id4"));
+ // tough case with a lot of ',' and ':'
+ String[] s4 =
KeyGenUtils.extractRecordKeysByFields("id1:1,,,id2:2024-10-22
14:11:53,id3:,,3,id4:::1:2::4::", fields);
Review Comment:
This test case shows the functionality of updated
`KeyGenUtils::extractRecordKeysByFields`. Any sequence of `,` and `:` is
processed correctly, which leads to proper bucketing by hash.
--
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]