peter-toth commented on code in PR #41677:
URL: https://github.com/apache/spark/pull/41677#discussion_r1384989063
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala:
##########
@@ -243,28 +414,43 @@ class EquivalentExpressions(
/**
* Wrapper around an Expression that provides semantic equality.
*/
-case class ExpressionEquals(e: Expression) {
+case class ExpressionEquals(expr: Expression) {
private def getHeight(tree: Expression): Int = {
tree.children.map(getHeight).reduceOption(_ max _).getOrElse(0) + 1
}
// This is used to do a fast pre-check for child-parent relationship. For
example, expr1 can
// only be a parent of expr2 if expr1.height is larger than expr2.height.
- lazy val height = getHeight(e)
+ lazy val height = getHeight(expr)
override def equals(o: Any): Boolean = o match {
- case other: ExpressionEquals => e.semanticEquals(other.e) && height ==
other.height
+ case other: ExpressionEquals =>
+ expr.canonicalized == other.expr.canonicalized && height == other.height
case _ => false
}
- override def hashCode: Int = Objects.hash(e.semanticHash(): Integer, height:
Integer)
+ override def hashCode: Int = Objects.hash(expr.semanticHash(): Integer,
height: Integer)
}
/**
- * A wrapper in place of using Seq[Expression] to record a group of equivalent
expressions.
+ * This class stores the expected evaluation count of expressions split into
`evalCount` +
+ * `realEvalCount` that records sure evaluations and `condEvalCount` +
`realCondEvalCount` that
+ * records conditional evaluations. The `real...` fields are filled up during
`inflate()`.
Review Comment:
I agree, `direct` and `transitive` are better prefixes.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]