peter-toth commented on a change in pull request #24495: [SPARK-27604][SQL]
Enhance constant propagation to constraint propagation
URL: https://github.com/apache/spark/pull/24495#discussion_r281626937
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/plans/PlanTest.scala
##########
@@ -95,13 +95,19 @@ trait PlanTestBase extends PredicateHelper with SQLHelper
{ self: Suite =>
protected def normalizePlan(plan: LogicalPlan): LogicalPlan = {
plan transform {
case Filter(condition: Expression, child: LogicalPlan) =>
-
Filter(splitConjunctivePredicates(condition).map(rewriteEqual).sortBy(_.hashCode())
- .reduce(And), child)
+ val newCondition =
+ splitConjunctivePredicates(condition)
+ .map(rewriteEqual)
+ .sortBy(p =>
scala.util.hashing.MurmurHash3.seqHash(Seq(p.getClass, p)))
Review comment:
I added the class of expression to the sorting order here and in
`rewriteEqual()` as hashCode() of `TreeNode` doesn't take the class of the
expression into account and
`comparePlans(testRelation.where('a < 2 && 'a === 2).analyze,
testRelation.where('a === 2 && 'a < 2).analyze)` would fail.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]