y1chi commented on code in PR #17818:
URL: https://github.com/apache/beam/pull/17818#discussion_r888463072


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java:
##########
@@ -1196,7 +1196,7 @@ public static <DestinationT> 
FileResultCoder<DestinationT> of(
 
     @Override
     public List<? extends Coder<?>> getCoderArguments() {
-      return Arrays.asList(windowCoder);
+      return Arrays.asList(windowCoder, destinationCoder);

Review Comment:
   When registering a StructuredCoder, the component coders are hashed and 
compared in order to avoid duplicate. That means if we have one 
FileResultCoder(IntervalWindowCoder, VoidCoder) and another 
FileResultCoder(GlobalWIndowCoder, VoidCoder) they'll still cause collision if 
we use Arrays.asList(destinationCoder) as components.
   
   I didn't see the window coder is being used to encode/decode the 
destinationT, the first registered FileResultCoder has serialized payload and 
then deserialized correctly and was able to decode the FileResult type 
correctly. But the other FileResultCoder will be deserialized from the same 
payload will throw exception because the destination coder does not match.



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