File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,15 @@ trait QueryPlanConstraints { self: LogicalPlan =>
9797 // Collect aliases from expressions of the whole tree rooted by the current QueryPlan node, so
9898 // we may avoid producing recursive constraints.
9999 private lazy val aliasMap : AttributeMap [Expression ] = {
100- val aliases = expressions.collect {
100+ val childrenAliases = children.flatMap { child =>
101+ val childOutputSet = child.outputSet
102+ child.asInstanceOf [QueryPlanConstraints ].aliasMap.filter {
103+ case (_, c) => c.references.nonEmpty && c.references.subsetOf(childOutputSet)
104+ }
105+ }
106+ AttributeMap (expressions.collect {
101107 case a : Alias if ! a.child.isInstanceOf [Literal ] => (a.toAttribute, a.child)
102- } ++ children.flatMap(_.asInstanceOf [QueryPlanConstraints ].aliasMap)
103- AttributeMap (aliases.filter {
104- case (_, child) => child.references.nonEmpty && child.references.subsetOf(outputSet)
105- })
108+ } ++ childrenAliases)
106109 }
107110
108111 // Note: the explicit cast is necessary, since Scala compiler fails to infer the type.
You can’t perform that action at this time.
0 commit comments