flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-9850) Add a string to the print method to identify output for DataStream
Date Wed, 15 Aug 2018 12:32:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-9850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16581010#comment-16581010
] 

ASF GitHub Bot commented on FLINK-9850:
---------------------------------------

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:
users@infra.apache.org


> Add a string to the print method to identify output for DataStream
> ------------------------------------------------------------------
>
>                 Key: FLINK-9850
>                 URL: https://issues.apache.org/jira/browse/FLINK-9850
>             Project: Flink
>          Issue Type: New Feature
>          Components: DataStream API
>            Reporter: Hequn Cheng
>            Assignee: vinoyang
>            Priority: Major
>              Labels: pull-request-available
>
> The output of the print method of {[DataSet}} allows the user to supply a String to identify
the output(see [FLINK-1486|https://issues.apache.org/jira/browse/FLINK-1486]). But {[DataStream}}
doesn't support now. It is valuable to add this feature for {{DataStream}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message