Github user nongli commented on a diff in the pull request:
https://github.com/apache/spark/pull/9480#discussion_r44179462
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
---
@@ -151,6 +164,30 @@ abstract class Expression extends TreeNode[Expression]
{
}
/**
+ * Returns the hash for this expression. Expressions that compute the
same result, even if
+ * they differ cosmetically should return the same hash.
+ */
+ def semanticHash() : Int = {
--- End diff --
I took a quick look at 6587 and I agree with michael about semantic equals.
I think when equivalence classes are added, semantic equals is even more
different than equals.
That being said, this patch is not the motivation to do this. If we decide
to remove semanticEquals, this patch can be updated trivially to use equals.
Regarding hashCode vs semanticHash code, I think it does no? It looks to me
like the hash everything, including the cosmetic stuff but please correct me if
I'm wrong. In general, i think it makes sense to implement hash if you
implement equals.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]