stankiewicz commented on code in PR #33626:
URL: https://github.com/apache/beam/pull/33626#discussion_r1920132163
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/CombineFns.java:
##########
@@ -674,6 +674,26 @@ public void encode(Object[] value, OutputStream outStream,
Coder.Context context
coders.get(lastIndex).encode(value[lastIndex], outStream, context);
}
+ @Override
+ public long getEncodedElementByteSize(Object[] value) throws Exception {
+ if (value.length == 0) {
+ return 0;
+ }
+ long size = 0;
+ for (int i = 0; i < value.length; ++i) {
+ Coder<Object> objectCoder = coders.get(i);
+ if (objectCoder instanceof StructuredCoder) {
Review Comment:
I've seen this type of
condition[here](https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/LengthPrefixCoder.java#L106).
StructuredCoder doesn't enforce overriding getEncodedElementByteSize so I'm
not sure if this is best practice. Ideally I would like to loop and invoke this
method for every coder (extending CustomCoder/StructuredCoder/Coder) on the
list. If underlying coder has default implementation, it will just serialize as
is.
--
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]