You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/08/12 08:22:57 UTC

[GitHub] [kafka] yashmayya commented on a diff in pull request #12502: KAFKA-14162: HoistField SMT should not return an immutable map for schemaless key/value

yashmayya commented on code in PR #12502:
URL: https://github.com/apache/kafka/pull/12502#discussion_r944228193


##########
connect/transforms/src/test/java/org/apache/kafka/connect/transforms/HoistFieldTest.java:
##########
@@ -58,4 +59,17 @@ public void withSchema() {
         assertEquals(42, ((Struct) transformedRecord.key()).get("magic"));
     }
 
+    @Test
+    public void testSchemalessMapIsMutable() {
+        xform.configure(Collections.singletonMap("field", "magic"));
+
+        final SinkRecord record = new SinkRecord("test", 0, null, 420, null, null, 0);
+        final SinkRecord transformedRecord = xform.apply(record);
+
+        assertNull(transformedRecord.keySchema());
+        @SuppressWarnings("unchecked")
+        Map<String, Object> key = (Map<String, Object>) transformedRecord.key();
+        key.put("k", "v");

Review Comment:
   The test would anyway fail if it were to throw `UnsupportedOperation` 😄
   
   But I guess this way it's more obvious what the test is doing 👍  



-- 
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-unsubscribe@kafka.apache.org

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