Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11647#discussion_r55958696
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
 ---
    @@ -598,3 +601,61 @@ abstract class TernaryExpression extends Expression {
         }
       }
     }
    +
    +/**
    + * Rewrites an expression using rules that are guaranteed preserve the 
result while attempting
    + * to remove cosmetic variations. Deterministic expressions that are 
`equal` after canonicalization
    + * will always return the same answer given the same input (i.e. false 
positives should not be
    + * possible). However, it is possible that two canonical expressions that 
are not equal will in fact
    + * return the same answer given any input (i.e. false negatives are 
possible).
    + *
    + * The following rules are applied:
    + *  - Names and nullability hints for 
[[org.apache.spark.sql.types.DataType]]s are stripped.
    + *  - Commutative and associative operations ([[Add]] and [[Multiply]]) 
have their children ordered
    + *    by `hashCode`.
    +*   - [[EqualTo]] and [[EqualNullSafe]] are reordered by `hashCode`.
    + *  - Other comparisons ([[GreaterThan]], [[LessThan]]) are reversed by 
`hashCode`.
    + */
    +object Canonicalize extends {
    --- End diff --
    
    fwiw, if you are keeping this class, i think we should just have it in its 
own file. The Expression.scala file is getting pretty long.


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

Reply via email to