dajac commented on a change in pull request #9526:
URL: https://github.com/apache/kafka/pull/9526#discussion_r518187139



##########
File path: 
generator/src/main/java/org/apache/kafka/message/JsonConverterGenerator.java
##########
@@ -380,8 +380,9 @@ private void generateVariableLengthTargetToJson(Target 
target, Versions versions
                         target.sourceVariable(), target.sourceVariable())));
             }
         } else if (target.field().type().isRecords()) {
-            headerGenerator.addImport(MessageGenerator.BINARY_NODE_CLASS);
-            buffer.printf("%s;%n", target.assignmentStatement("new 
BinaryNode(new byte[]{})"));
+            headerGenerator.addImport(MessageGenerator.INT_NODE_CLASS);
+            buffer.printf("%s;%n", target.assignmentStatement(
+                    String.format("new IntNode(%s.sizeInBytes())", 
target.sourceVariable())));

Review comment:
       @lbradstreet No, it does not break anything but it is inconsistent. If 
we put our case aside, the purpose of the JSON converters is to convert to/from 
JSON so it is fair to expect that we have to maintain this contract by default. 
Changing it to return the size would break this contract.
   
   Regarding `_node.set("recordSet", new BinaryNode(new byte[]{}));`, I do 
believe that this is a bug actually...
   
   > That said, implementing a verbose mode (3) where we print out a byte array 
seems reasonable if we don't use it in the trace logging path by default?
   
   Agreed. When logging requests/responses, we should stick to the non-verbose 
mode.




----------------------------------------------------------------
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.

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


Reply via email to