Skip to content

Commit d456876

Browse files
committed
revise as per comments
1 parent 7b414fa commit d456876

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/QueryPlanConstraints.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ trait QueryPlanConstraints { self: LogicalPlan =>
123123
/**
124124
* Replace the aliased expression in [[Alias]] with the alias name if both exist in constraints.
125125
* Thus non-converging inference can be prevented.
126-
* E.g. `a = f(a, b)`, `a = f(b, c) && c = g(a, b)`.
126+
* E.g. `Alias(b, f(a)), a = b` infers `f(a) = f(f(a))` without eliminating aliased expressions.
127127
* Also, the size of constraints is reduced without losing any information.
128128
* When the inferred filters are pushed down the operators that generate the alias,
129129
* the alias names used in filters are replaced by the aliased expressions.
@@ -145,9 +145,9 @@ trait QueryPlanConstraints { self: LogicalPlan =>
145145
}
146146

147147
private def replaceConstraints(
148-
constraints: Set[Expression],
149-
source: Expression,
150-
destination: Attribute): Set[Expression] = constraints.map(_ transform {
148+
constraints: Set[Expression],
149+
source: Expression,
150+
destination: Attribute): Set[Expression] = constraints.map(_ transform {
151151
case e: Expression if e.semanticEquals(source) => destination
152152
})
153153
}

0 commit comments

Comments
 (0)