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/26 04:28:06 UTC

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

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



##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/nodes/common/CommonPhysicalSink.scala
##########
@@ -99,11 +105,33 @@ class CommonPhysicalSink (
 
         val operator = new SinkOperator(env.clean(sinkFunction), rowtimeFieldIndex, enforcer)
 
+        val inputParallelism = inputTransformation.getParallelism
+        val taskParallelism = env.getParallelism
+        val parallelism = if (runtimeProvider.isInstanceOf[ParallelismProvider]) runtimeProvider.asInstanceOf[ParallelismProvider].getParallelism.orElse(inputParallelism).intValue()
+        else inputParallelism
+
+        if (implicitly[Ordering[Int]].lteq(parallelism, 0)) throw new RuntimeException(s"the configured sink parallelism: $parallelism should not be less than zero or equal to zero")
+        if (implicitly[Ordering[Int]].gt(parallelism, taskParallelism)) throw new RuntimeException(s"the configured sink parallelism: $parallelism is larger than the task max parallelism: $taskParallelism")
+
+        val primaryKeys = TableSchemaUtils.getPrimaryKeyIndices(catalogTable.getSchema)
+        val containedRowKinds = changelogMode.getContainedKinds.toSet
+        val theFinalInputTransformation = if(inputParallelism == parallelism) inputTransformation //if the parallelism is not changed, do nothing
+        else (containedRowKinds, primaryKeys.toList) match {
+        // fixme : if rowKinds only contains  delete, is there somethinng to do with? Currently do nothing.

Review comment:
       Actually, this part should be under well discussed. 
   For every changelog mode, from my perspective, should be treated differently. Now I only figured out what should be done in "UPSERT MODE" or `INSERT_ONLY` mode.
   
   What shall we do for other changelog?
   WDYT?




----------------------------------------------------------------
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