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

    https://github.com/apache/spark/pull/19825#discussion_r153345990
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala ---
    @@ -208,6 +208,21 @@ class JoinSuite extends QueryTest with 
SharedSQLContext {
         }
       }
     
    +  test("SPARK-22615: Empty relation child in left outer/right outer join 
should pass" +
    +    " Cartesian product check") {
    +    val x = testData2.where($"a" === 2).as("x")
    +    val y = testData2.where($"a" === 1 && !($"a" === 1)).as("y")
    +    checkAnswer(x.join(y, Seq.empty, "left_outer"),
    +      Row(2, 1, null, null) ::
    +      Row(2, 2, null, null) :: Nil
    +    )
    +
    +    checkAnswer(y.join(x, Seq.empty, "right_outer"),
    +      Row(null, null, 2, 1) ::
    +      Row(null, null, 2, 2) :: Nil
    +    )
    +  }
    --- End diff --
    
    The fix looks good to me. Instead of adding it here, to be safer, could you 
write a suite `joinEmptyRelation.sql` in `SQLQueryTestSuite`? Then, we can 
easily run all them against the other DBMS for ensuring the results are correct.


---

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

Reply via email to