fozzie15 commented on code in PR #34426:
URL: https://github.com/apache/beam/pull/34426#discussion_r2017754519


##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaReadSchemaTransformProvider.java:
##########
@@ -191,8 +203,64 @@ public PCollectionRowTuple expand(PCollectionRowTuple 
input) {
       }
 
       if ("RAW".equals(format)) {
-        beamSchema = Schema.builder().addField("payload", 
Schema.FieldType.BYTES).build();
-        valueMapper = getRawBytesToRowFunction(beamSchema);
+        boolean withKeyMetadata = 
Boolean.TRUE.equals(configuration.getWithKeyMetadata());
+        if (withKeyMetadata) {

Review Comment:
   This if block is really long. Can we put the logic here into its own 
function? Something like
   ```
   if (withKeyMetadata) {
     return someFnHere(beamSchema);
   } else {
     beamSchema = Schema.builder().addField("payload", 
Schema.FieldType.BYTES).build();
     valueMapper = getRawBytesToRowFunction(beamSchema);
   }
   ```



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

Reply via email to