Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22957#discussion_r237065506
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
 ---
    @@ -195,14 +195,26 @@ abstract class Expression extends 
TreeNode[Expression] {
       }
     
       /**
    -   * Returns true when two expressions will always compute the same 
result, even if they differ
    +   * Returns true when two expressions will always compute the same 
output, even if they differ
        * cosmetically (i.e. capitalization of names in attributes may be 
different).
        *
        * See [[Canonicalize]] for more details.
        */
       def semanticEquals(other: Expression): Boolean =
         deterministic && other.deterministic && canonicalized == 
other.canonicalized
     
    +  /**
    +   * Returns true when two expressions will always compute the same 
result, even if the output may
    +   * be different, because of different names or similar differences.
    +   * Usually this means they their canonicalized form equals, but it may 
also not be the case, as
    +   * different output expressions can evaluate to the same result as well 
(eg. when an expression
    +   * is aliased).
    +   */
    +  def sameResult(other: Expression): Boolean = other match {
    --- End diff --
    
    "erase the name" can also mean remove `Alias`. If we can't clearly tell the 
difference between `semanticEquals` and `sameResult`, and give a guideline 
about using which one in which case, I think we should just update 
`semanticEquals`(i.e. `Canonicalize`).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to