Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/16719#discussion_r98346062 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionSetSuite.scala --- @@ -32,6 +32,38 @@ class ExpressionSetSuite extends SparkFunSuite { val aAndBSet = AttributeSet(aUpper :: bUpper :: Nil) + // An [AttributeReference] with almost the maximum hashcode, to make testing canonicalize rules + // like `case GreaterThan(l, r) if l.hashcode > r.hashcode => GreaterThan(r, l)` easier + val maxHash = + Canonicalize.ignoreNamesTypes( + AttributeReference("maxHash", IntegerType)(exprId = + new ExprId(4, NamedExpression.jvmId) { + // maxHash's hashcode is calculated based on this exprId's hashcode, so we set this + // exprId's hashCode to this specific value to make sure maxHash's hashcode is almost + // `Int.MaxValue` + override def hashCode: Int = 826929706 --- End diff -- Why not `override def hashCode: Int = Int.MaxValue`?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org