Poorvankbhatia commented on code in PR #26298: URL: https://github.com/apache/flink/pull/26298#discussion_r1997166671
########## flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/PrintSink.java: ########## @@ -80,14 +80,11 @@ public PrintSink(final String sinkIdentifier) { * @param stdErr True if the sink should print to STDERR instead of STDOUT. */ public PrintSink(final String sinkIdentifier, final boolean stdErr) { - this.sinkIdentifier = sinkIdentifier; - this.stdErr = stdErr; + this.writer = new PrintSinkOutputWriter<>(sinkIdentifier, stdErr); Review Comment: Instantiating the SinkWriter inside the constructor could lead to premature serialization issues. Flink may serialize the sink before execution starts, and if the writer is already created at this point, it might include non-serializable resources. _While PrintSink is generally used for testing purposes, and PrintSinkOutputWriter itself is stateless and wouldn't necessarily break_, I think placing the instantiation inside createWriter ensures consistency with other sinks. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org