KurtYoung commented on a change in pull request #8499: [FLINK-12575] [table-planner-blink] Introduce planner rules to remove redundant shuffle and collation URL: https://github.com/apache/flink/pull/8499#discussion_r287198862
########## File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/nodes/physical/batch/BatchExecHashAggregate.scala ########## @@ -94,6 +99,53 @@ class BatchExecHashAggregate( isGlobal = true)) } + override def satisfyTraits(requiredTraitSet: RelTraitSet): RelNode = { + val requiredDistribution = requiredTraitSet.getTrait(FlinkRelDistributionTraitDef.INSTANCE) + val canSatisfy = requiredDistribution.getType match { + case SINGLETON => grouping.length == 0 + case HASH_DISTRIBUTED => + val shuffleKeys = requiredDistribution.getKeys + val groupKeysList = ImmutableIntList.of(grouping.indices.toArray: _*) + if (requiredDistribution.requireStrict) { + shuffleKeys == groupKeysList Review comment: why we comparing shuffle keys with the index of group key? The groupKeysList is like (0, 1, 2, ...) ---------------------------------------------------------------- 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