AHeise commented on a change in pull request #7713: [FLINK-10995][runtime] Copy 
intermediate serialization results only once for broadcast mode
URL: https://github.com/apache/flink/pull/7713#discussion_r327059906
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/BroadcastRecordWriter.java
 ##########
 @@ -18,30 +18,163 @@
 
 package org.apache.flink.runtime.io.network.api.writer;
 
+import org.apache.flink.annotation.VisibleForTesting;
 import org.apache.flink.core.io.IOReadableWritable;
+import org.apache.flink.runtime.io.network.buffer.BufferBuilder;
+import org.apache.flink.runtime.io.network.buffer.BufferConsumer;
 
 import java.io.IOException;
+import java.util.Optional;
+
+import static org.apache.flink.util.Preconditions.checkState;
 
 /**
  * A special record-oriented runtime result writer only for broadcast mode.
  *
- * <p>The BroadcastRecordWriter extends the {@link RecordWriter} and handles 
{@link #emit(IOReadableWritable)}
- * operation via {@link #broadcastEmit(IOReadableWritable)} directly in a more 
efficient way.
+ * <p>The BroadcastRecordWriter extends the {@link RecordWriter} and maintain 
a single {@link BufferBuilder}
+ * for all the channels. Then the serialization results need be copied only 
once to this buffer which would be
+ * shared for all the channels in a more efficient way.
  *
  * @param <T> the type of the record that can be emitted with this record 
writer
  */
 public class BroadcastRecordWriter<T extends IOReadableWritable> extends 
RecordWriter<T> {
 
+       /** The current buffer builder shared for all the channels. */
+       private Optional<BufferBuilder> bufferBuilder = Optional.empty();
 
 Review comment:
   Optional fields are 
[discouraged](http://mail-archives.apache.org/mod_mbox/flink-dev/201908.mbox/%3CCAA_61Xo9oif8RjJgvxFNo%2Bua7_DoFksCy_5c_NOnQLWfS4-8qA%40mail.gmail.com%3E).
   

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


With regards,
Apache Git Services

Reply via email to