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

    https://github.com/apache/spark/pull/14132#discussion_r71425497
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala
 ---
    @@ -933,4 +933,124 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest 
with SQLTestUtils {
           checkSQL("select * from orc_t", "select_orc_table")
         }
       }
    +
    +  test("broadcast hint on single table") {
    +    checkSQL("SELECT /*+ MAPJOIN(parquet_t0) */ * FROM parquet_t0",
    +      "broadcast_hint_single_table_1")
    +
    +    checkSQL("SELECT /*+ MAPJOIN(parquet_t0, parquet_t0) */ * FROM 
parquet_t0",
    +      "broadcast_hint_single_table_2")
    +
    +    checkSQL(
    +      "SELECT /*+ MAPJOIN(parquet_t0) */ * FROM parquet_t0 as a",
    +      "broadcast_hint_single_table_3")
    +
    +    checkSQL(
    +      """
    +        |SELECT /*+ MAPJOIN(parquet_t0) */ *
    +        |FROM (SELECT id tid FROM parquet_t0) T
    +        |JOIN (SELECT id uid FROM parquet_t0) U
    +        |ON tid=uid
    +      """.stripMargin,
    +      "broadcast_hint_single_4")
    +  }
    +
    +  test("broadcast hint on multiple tables") {
    +    checkSQL(
    +      "SELECT /*+ MAPJOIN(parquet_t0) */ * FROM parquet_t0, parquet_t1",
    +      "broadcast_hint_multiple_table_1")
    +    checkSQL(
    +      "SELECT /*+ MAPJOIN(parquet_t1) */ * FROM parquet_t0, parquet_t1",
    +      "broadcast_hint_multiple_table_2")
    +  }
    +
    +  test("broadcast hint on nested query 1") {
    +    checkSQL(
    +      """
    +        |SELECT /*+ MAPJOIN(parquet_t0) */ *
    +        |FROM (SELECT id tid FROM parquet_t0) T
    +        |JOIN (SELECT key uid FROM parquet_t1) U
    +        |ON tid=uid
    +      """.stripMargin,
    +      "broadcast_hint_nested_query_1")
    +  }
    +
    +  test("broadcast hint on nested query 2") {
    +    checkSQL(
    +      """
    +        |SELECT /*+ MAPJOIN(parquet_t1) */ tid
    +        |FROM (SELECT id tid FROM parquet_t0) T
    +        |JOIN (SELECT key uid FROM parquet_t1) U
    +        |ON tid=uid
    +      """.stripMargin,
    +      "broadcast_hint_nested_query_2")
    +  }
    +
    +  test("multiple broadcast hints on multiple tables") {
    +    checkSQL(
    +      "SELECT /*+ MAPJOIN(parquet_t0, parquet_t1) */ * FROM parquet_t0, 
parquet_t1",
    +      "multiple_broadcast_hints")
    +  }
    +
    +  test("broadcast hint with filter") {
    +    checkSQL(
    +      "SELECT /*+ MAPJOIN(parquet_t0) */ * FROM parquet_t0 WHERE id < 10",
    +      "broadcast_hint_with_filter")
    +  }
    +
    +  test("broadcast hint with filter/limit") {
    +    checkSQL(
    +      "SELECT /*+ MAPJOIN(parquet_t0) */ * FROM parquet_t0 WHERE id < 10 
LIMIT 10",
    +      "broadcast_hint_with_filter_limit")
    +  }
    +
    +  test("broadcast hint with generator") {
    +    checkSQL(
    +      "SELECT * FROM (SELECT /*+ MAPJOIN(parquet_t0) */ 
EXPLODE(ARRAY(1,2,3)) FROM parquet_t0) T",
    +      "broadcast_hint_generator")
    +  }
    +
    +  test("broadcast hint with groupby/having/orderby") {
    +    checkSQL(
    +      """
    +        |SELECT /*+ MAPJOIN(parquet_t0) */ *
    +        |FROM parquet_t0
    +        |WHERE id > 0
    +        |GROUP BY id
    +        |HAVING count(*) > 0
    +        |ORDER BY id
    +      """.stripMargin,
    +      "broadcast_hint_groupby_having_orderby")
    +  }
    +
    +  test("broadcast hint with window") {
    +    checkSQL(
    +      """
    +        |SELECT /*+ MAPJOIN(parquet_t1) */
    +        |       x.key, MAX(y.key) OVER (PARTITION BY x.key % 5 ORDER BY 
x.key)
    +        |FROM parquet_t1 x JOIN parquet_t1 y ON x.key = y.key
    +      """.stripMargin,
    +      "broadcast_hint_window")
    +  }
    +
    +  test("broadcast hint with rollup") {
    +    checkSQL(
    +      """
    +        |SELECT /*+ MAPJOIN(parquet_t1) */
    +        |       count(*) as cnt, key%5, grouping_id()
    +        |FROM parquet_t1
    +        |GROUP BY key % 5 WITH ROLLUP""".stripMargin,
    --- End diff --
    
    format


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to