Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/16785#discussion_r100484586 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LogicalPlan.scala --- @@ -314,19 +322,29 @@ abstract class UnaryNode extends LogicalPlan { * expressions with the corresponding alias */ protected def getAliasedConstraints(projectList: Seq[NamedExpression]): Set[Expression] = { - var allConstraints = child.constraints.asInstanceOf[Set[Expression]] - projectList.foreach { - case a @ Alias(e, _) => - // For every alias in `projectList`, replace the reference in constraints by its attribute. - allConstraints ++= allConstraints.map(_ transform { - case expr: Expression if expr.semanticEquals(e) => - a.toAttribute - }) - allConstraints += EqualNullSafe(e, a.toAttribute) - case _ => // Don't change. - } - - allConstraints -- child.constraints + val relativeReferences = AttributeSet(projectList.collect { + case a: Alias => a + }.flatMap(_.references)) + val parAllConstraints = child.constraints.asInstanceOf[Set[Expression]].filter { constraint => + constraint.references.intersect(relativeReferences).nonEmpty + }.par + parAllConstraints.tasksupport = UnaryNode.taskSupport --- End diff -- Do they have the same parallelism level? BTW, I saw the parallel collection used in other places in Spark all take custom task support.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org