david-mollitor-db commented on code in PR #58724:
URL: https://github.com/apache/spark/pull/58724#discussion_r4022202158


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala:
##########
@@ -263,11 +261,19 @@ case class ExpressionEquals(e: Expression) {
   def height: Int = e.height
 
   override def equals(o: Any): Boolean = o match {
-    case other: ExpressionEquals => e.semanticEquals(other.e) && height == 
other.height
+    // Check the cheap `height` before the recursive `semanticEquals` (which 
implies equal height).

Review Comment:
   Good catch, thanks -- you're right. I reworded the comment so it no longer 
claims `semanticEquals` implies equal `height`; it now notes that semantically 
equal expressions can still differ in `height`, so the `height` check is a 
genuine part of equality and testing it first just short-circuits the recursive 
`semanticEquals`. I corrected the same wording in the commit message as well. 
Updated in e32fa6eb202.



-- 
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]

Reply via email to