C0urante commented on code in PR #15379:
URL: https://github.com/apache/kafka/pull/15379#discussion_r1570907754


##########
connect/transforms/src/test/java/org/apache/kafka/connect/transforms/ValueToKeyTest.java:
##########
@@ -60,6 +62,30 @@ public void schemaless() {
         assertEquals(expectedKey, transformedRecord.key());
     }
 
+    @Test
+    public void schemalessAndNestedFields() {
+        Map<String, Object> configs = new HashMap<>();
+        configs.put("fields", "a,b.c");
+        configs.put(FieldSyntaxVersion.FIELD_SYNTAX_VERSION_CONFIG, 
FieldSyntaxVersion.V2.name());
+        xform.configure(configs);
+
+        final HashMap<String, Object> value = new HashMap<>();
+        value.put("a", 1);
+        final HashMap<String, Integer> nested = new HashMap<>();
+        nested.put("c", 3);
+        value.put("b", nested);
+
+        final SinkRecord record = new SinkRecord("", 0, null, null, null, 
value, 0);
+        final SinkRecord transformedRecord = xform.apply(record);
+
+        final HashMap<String, Integer> expectedKey = new HashMap<>();
+        expectedKey.put("a", 1);
+        expectedKey.put("b.c", 3);

Review Comment:
   Hmmm... I thought that the nesting structure of the value would be matched 
in the derived key. Does the KIP go into detail anywhere about this? I'm not a 
huge fan of reusing the dot notation here but I can't remember if this was 
discussed on the KIP thread or not.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to