Github user mgaido91 commented on a diff in the pull request: https://github.com/apache/spark/pull/22957#discussion_r238460901 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala --- @@ -145,9 +145,14 @@ case class EnsureRequirements(conf: SQLConf) extends Rule[SparkPlan] { assert(requiredChildDistributions.length == children.length) assert(requiredChildOrderings.length == children.length) + val aliasMap = AttributeMap[Expression](children.flatMap(_.expressions.collect { + case a: Alias => (a.toAttribute, a) + })) + // Ensure that the operator's children satisfy their output distribution requirements. children = children.zip(requiredChildDistributions).map { - case (child, distribution) if child.outputPartitioning.satisfies(distribution) => + case (child, distribution) if child.outputPartitioning.satisfies( + distribution.mapExpressions(replaceAlias(_, aliasMap))) => --- End diff -- this is not dealing with the aliases in the `outputPartitioning` but with the ones in the `requiredChildDistribution`. Anyway, I wouldn't do it there, because this would mean moving also the logic for collecting the aliases from the children there, which seems to me an operations which belong to a rule/transforming operator, rather than to the plan operator itself (eg. now these methods are in `PredicateHelper`...).
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org