zentol commented on a change in pull request #6367: [FLINK-9850] Add a string 
to the print method to identify output for DataStream
URL: https://github.com/apache/flink/pull/6367#discussion_r210252035
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/PrintSinkFunction.java
 ##########
 @@ -18,81 +18,74 @@
 package org.apache.flink.streaming.api.functions.sink;
 
 import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.common.functions.util.TaskOutputWriter;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
 
-import java.io.PrintStream;
-
 /**
  * Implementation of the SinkFunction writing every tuple to the standard
  * output or standard error stream.
  *
- * @param <IN>
- *            Input record type
+ * <p>
+ * Four possible format options:
+ *     {@code sinkIdentifier}:taskId> output  <- {@code sinkIdentifier} 
provided, parallelism > 1
+ *     {@code sinkIdentifier}> output         <- {@code sinkIdentifier} 
provided, parallelism == 1
+ *  taskId> output                                        <- no {@code 
sinkIdentifier} provided, parallelism > 1
+ *  output                                                <- no {@code 
sinkIdentifier} provided, parallelism == 1
+ * </p>
+ *
+ * @param <IN> Input record type
  */
 @PublicEvolving
 public class PrintSinkFunction<IN> extends RichSinkFunction<IN> {
-       private static final long serialVersionUID = 1L;
 
-       private static final boolean STD_OUT = false;
-       private static final boolean STD_ERR = true;
+       private static final long serialVersionUID = 1L;
 
-       private boolean target;
-       private transient PrintStream stream;
-       private transient String prefix;
+       private final TaskOutputWriter<IN> writer;
 
        /**
         * Instantiates a print sink function that prints to standard out.
         */
-       public PrintSinkFunction() {}
+       public PrintSinkFunction() {
+               writer = new TaskOutputWriter<>();
 
 Review comment:
   call the other constructor instead

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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