lukecwik commented on code in PR #22780:
URL: https://github.com/apache/beam/pull/22780#discussion_r949578284
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/PubsubSink.java:
##########
@@ -161,13 +163,11 @@ public long add(WindowedValue<T> data) throws IOException
{
if (formatted.getAttributeMap() != null) {
pubsubMessageBuilder.putAllAttributes(formatted.getAttributeMap());
}
- ByteStringOutputStream output = new ByteStringOutputStream();
- pubsubMessageBuilder.build().writeTo(output);
- byteString = output.toByteString();
+ pubsubMessageBuilder.build().writeTo(stream);
Review Comment:
Done
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillSink.java:
##########
@@ -129,16 +129,17 @@ public SinkWriter<WindowedValue<T>> writer() {
class WindmillStreamWriter implements SinkWriter<WindowedValue<T>> {
private Map<ByteString, Windmill.KeyedMessageBundle.Builder> productionMap;
private final String destinationName;
+ private final ByteStringOutputStream stream;
private WindmillStreamWriter(String destinationName) {
this.destinationName = destinationName;
productionMap = new HashMap<>();
+ stream = new ByteStringOutputStream();
}
private <EncodeT> ByteString encode(Coder<EncodeT> coder, EncodeT object)
throws IOException {
- ByteStringOutputStream stream = new ByteStringOutputStream();
coder.encode(object, stream, Coder.Context.OUTER);
Review Comment:
Done
--
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]