You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/10/28 03:03:48 UTC

[GitHub] [flink] JingsongLi commented on a change in pull request #13789: [FLINK-19727][table-runtime] Implement ParallelismProvider for sink i…

JingsongLi commented on a change in pull request #13789:
URL: https://github.com/apache/flink/pull/13789#discussion_r513151711



##########
File path: flink-table/flink-table-api-java-bridge/src/main/java/org/apache/flink/table/connector/sink/SinkFunctionProvider.java
##########
@@ -20,19 +20,39 @@
 
 import org.apache.flink.annotation.PublicEvolving;
 import org.apache.flink.streaming.api.functions.sink.SinkFunction;
+import org.apache.flink.table.connector.ParallelismProvider;
 import org.apache.flink.table.data.RowData;
 
+import java.util.Optional;
+
 /**
  * Provider of a {@link SinkFunction} instance as a runtime implementation for {@link DynamicTableSink}.
  */
 @PublicEvolving
-public interface SinkFunctionProvider extends DynamicTableSink.SinkRuntimeProvider {
+public interface SinkFunctionProvider extends DynamicTableSink.SinkRuntimeProvider, ParallelismProvider {
 
 	/**
 	 * Helper method for creating a static provider.
 	 */
 	static SinkFunctionProvider of(SinkFunction<RowData> sinkFunction) {
-		return () -> sinkFunction;
+		return of(sinkFunction, Optional.empty());
+	}
+
+	/**
+	 * Helper method for creating a static provider, sink parallelism will be configured if non-empty parallelism is passed in.
+	 */
+	static SinkFunctionProvider of(SinkFunction<RowData> sinkFunction, Optional<Integer> parallelism) {

Review comment:
       I think we don't need provide method.
   https://flink.apache.org/contributing/code-style-and-quality-java.html#java-optional
   In Flink code style, it is recommended to use the Optional only in method return values.




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