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

    https://github.com/apache/spark/pull/8652#discussion_r42272725
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
 ---
    @@ -69,6 +71,58 @@ class HiveQuerySuite extends HiveComparisonTest with 
BeforeAndAfter {
         }
       }
     
    +  // Testing the Broadcast based join for cartesian join (cross join)
    +  // We assume that the Broadcast Join Threshold will works since the src 
is a small table
    +    private val spark_10484_1 = """
    +                                | SELECT a.key, b.key
    +                                | FROM src a LEFT JOIN src b WHERE a.key > 
b.key + 300
    +                                | ORDER BY b.key, a.key
    +                                | LIMIT 20
    +                              """.stripMargin
    +  private val spark_10484_2 = """
    +                                | SELECT a.key, b.key
    +                                | FROM src a RIGHT JOIN src b WHERE a.key 
> b.key + 300
    +                                | ORDER BY a.key, b.key
    +                                | LIMIT 20
    +                              """.stripMargin
    +  private val spark_10484_3 = """
    +                                | SELECT a.key, b.key
    +                                | FROM src a FULL OUTER JOIN src b WHERE 
a.key > b.key + 300
    +                                | ORDER BY a.key, b.key
    +                                | LIMIT 20
    +                              """.stripMargin
    +  private val spark_10484_4 = """
    +                                | SELECT a.key, b.key
    +                                | FROM src a JOIN src b WHERE a.key > 
b.key + 300
    +                                | ORDER BY a.key, b.key
    +                                | LIMIT 20
    +                              """.stripMargin
    +
    +  createQueryTest("SPARK-10484 Optimize the Cartesian (Cross) Join with 
broadcast based JOIN #1",
    +    spark_10484_1)
    +
    +  createQueryTest("SPARK-10484 Optimize the Cartesian (Cross) Join with 
broadcast based JOIN #2",
    +    spark_10484_2)
    +
    +  createQueryTest("SPARK-10484 Optimize the Cartesian (Cross) Join with 
broadcast based JOIN #3",
    +    spark_10484_3)
    +
    +  createQueryTest("SPARK-10484 Optimize the Cartesian (Cross) Join with 
broadcast based JOIN #4",
    +    spark_10484_4)
    +
    +  test("SPARK-10484 Optimize the Cartesian (Cross) Join with broadcast 
based JOIN") {
    +    def assertBroadcastNestedLoopJoin(sqlText: String): Boolean = {
    +      sql(sqlText).queryExecution.sparkPlan.collect {
    +        case _: BroadcastNestedLoopJoin => 1
    +      }.size > 0
    --- End diff --
    
    Nit: `.size > 0` => `nonEmpty`


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