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 2019/07/17 06:22:27 UTC
[GitHub] [flink] wuchong commented on a change in pull request #8966: [FLINK-13074][table-planner-blink] Add PartitionableTableSink bridge logic to flink&blink …
wuchong commented on a change in pull request #8966: [FLINK-13074][table-planner-blink] Add PartitionableTableSink bridge logic to flink&blink …
URL: https://github.com/apache/flink/pull/8966#discussion_r304216446
##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/rules/physical/stream/StreamExecSinkRule.scala
##########
@@ -35,8 +40,29 @@ class StreamExecSinkRule extends ConverterRule(
def convert(rel: RelNode): RelNode = {
val sinkNode = rel.asInstanceOf[FlinkLogicalSink]
val newTrait = rel.getTraitSet.replace(FlinkConventions.STREAM_PHYSICAL)
- // TODO Take PartitionableSink into consideration after FLINK-11993 is done
- val newInput = RelOptRule.convert(sinkNode.getInput, FlinkConventions.STREAM_PHYSICAL)
+ var requiredTraitSet = sinkNode.getInput.getTraitSet.replace(FlinkConventions.STREAM_PHYSICAL)
+ sinkNode.sink match {
+ case partitionSink: PartitionableTableSink
+ if partitionSink.getPartitionFieldNames != null &&
+ partitionSink.getPartitionFieldNames.nonEmpty =>
+ val partitionIndices = partitionSink
+ .getPartitionFieldNames
+ .map(partitionSink.getTableSchema.getFieldNames.indexOf(_))
+ // validate
+ partitionIndices.foreach { idx =>
+ if (idx < 0) {
+ throw new TableException("Partition fields must be in the schema.")
+ }
+ }
Review comment:
Try to configure partition grouping, even if it is streaming mode. And check the return values. It would be more safe if we check it.
```scala
if (partitionSink.configurePartitionGrouping(false)) {
throw exception...
}
```
----------------------------------------------------------------
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
With regards,
Apache Git Services