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

    https://github.com/apache/spark/pull/22284#discussion_r215620739
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/PlannerSuite.scala ---
    @@ -704,6 +704,23 @@ class PlannerSuite extends SharedSQLContext {
         df.queryExecution.executedPlan.execute()
       }
     
    +  test("SPARK-25278: physical nodes should be different instances for same 
logical nodes") {
    +    val range = Range(1, 1, 1, 1)
    +    val df = Union(range, range)
    +    val ranges = df.queryExecution.optimizedPlan.collect {
    +      case r: Range => r
    +    }
    +    assert(ranges.length == 2)
    +    // Ensure the two Range instances are equal according to their equal 
method
    +    assert(ranges.head == ranges.last)
    +    val execRanges = df.queryExecution.sparkPlan.collect {
    +      case r: RangeExec => r
    +    }
    +    assert(execRanges.length == 2)
    +    // Ensure the two RangeExec instances are different instances
    +    assert(!execRanges.head.eq(execRanges.last))
    --- End diff --
    
    e.g.,
    ```
    case class DummyPlanner() extends QueryPlanner[LogicalPlan] { ... }
    
    assert(DummyPlanner().plan(eqTestPlan) === expectedPlan))
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to