JingsongLi commented on a change in pull request #9195: [FLINK-13289][table-planner-blink] Blink-planner should setKeyFields to upsert table sink URL: https://github.com/apache/flink/pull/9195#discussion_r307093662
########## File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamExecSink.scala ########## @@ -97,6 +97,22 @@ class StreamExecSink[T]( // check for append only table val isAppendOnlyTable = UpdatingPlanChecker.isAppendOnly(this) upsertSink.setIsAppendOnly(isAppendOnlyTable) + + // extract unique key fields + // Now we pick shortest one to sink + // TODO UpsertStreamTableSink setKeyFields interface should be Array[Array[String]] + val tableKeys: Option[Array[String]] = + UpdatingPlanChecker.getUniqueKeys(getInput, planner).sortBy(_.length).headOption Review comment: I think we can return `Option[Array[Array[String]]]`, let `sortBy and headOption` still remain in caller, keep the TODO with `UpsertStreamTableSink.setKeyFields` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services