chamikaramj commented on a change in pull request #16923:
URL: https://github.com/apache/beam/pull/16923#discussion_r814284324



##########
File path: 
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
##########
@@ -776,11 +777,11 @@ private static Coder resolveCoder(Class deserializer) {
               continue;
             }
             if (returnType.equals(byte[].class)) {
-              return ByteArrayCoder.of();
+              return NullableCoder.of(ByteArrayCoder.of());
             } else if (returnType.equals(Integer.class)) {
-              return VarIntCoder.of();
+              return NullableCoder.of(VarIntCoder.of());
             } else if (returnType.equals(Long.class)) {
-              return VarLongCoder.of();
+              return NullableCoder.of(VarLongCoder.of());

Review comment:
       Another option is to update URN_WITH_METADATA transforms to support 
nulls: 
https://github.com/apache/beam/blob/90dd44e81b14bd5a35f808c8962cf22cd69497c8/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java#L803
   
   Seems like Go SDK uses "URN_WITHOUT_METADATA" transform: 
https://github.com/apache/beam/blob/90dd44e81b14bd5a35f808c8962cf22cd69497c8/sdks/go/pkg/beam/io/xlang/kafkaio/kafka.go#L84




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