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

    https://github.com/apache/spark/pull/11403#discussion_r55453277
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala 
---
    @@ -237,4 +237,65 @@ abstract class QueryPlan[PlanType <: 
TreeNode[PlanType]] extends TreeNode[PlanTy
       }
     
       override def innerChildren: Seq[PlanType] = subqueries
    +
    +  /**
    +   * Canonicalized copy of this query plan.
    +   */
    +  protected lazy val canonicalized: PlanType = this
    +
    +  /**
    +   * Returns true when the given query plan will return the same results 
as this query plan.
    +   *
    +   * Since its likely undecidable to generally determine if two given 
plans will produce the same
    +   * results, it is okay for this function to return false, even if the 
results are actually
    +   * the same.  Such behavior will not affect correctness, only the 
application of performance
    +   * enhancements like caching.  However, it is not acceptable to return 
true if the results could
    +   * possibly be different.
    +   *
    +   * By default this function performs a modified version of equality that 
is tolerant of cosmetic
    +   * differences like attribute naming and or expression id differences. 
Operators that
    +   * can do better should override this function.
    +   */
    +  def sameResult(plan: PlanType): Boolean = {
    +    val cleanLeft = this.canonicalized
    --- End diff --
    
    Should this be renamed to `canonicalizedLeft`?


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

Reply via email to