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

    https://github.com/apache/spark/pull/11768#discussion_r56413200
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/LogicalPlanToSQLSuite.scala 
---
    @@ -568,4 +582,84 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest 
with SQLTestUtils {
             |HAVING MAX(a.KEY) > 0
           """.stripMargin)
       }
    +
    +  test("generator in project list without FROM clause") {
    +    checkHiveQl("SELECT EXPLODE(ARRAY(1,2,3))")
    +    checkHiveQl("SELECT EXPLODE(ARRAY(1,2,3)) AS val")
    +  }
    +
    +  test("generator in project list with non-referenced table") {
    +    checkHiveQl("SELECT EXPLODE(ARRAY(1,2,3)) FROM t0")
    +    checkHiveQl("SELECT EXPLODE(ARRAY(1,2,3)) AS val FROM t0")
    +  }
    +
    +  test("generator in project list with referenced table") {
    +    checkHiveQl("SELECT EXPLODE(arr) FROM parquet_t3")
    +    checkHiveQl("SELECT EXPLODE(arr) AS val FROM parquet_t3")
    +  }
    +
    +  test("generator in project list with non-UDTF expressions") {
    +    checkHiveQl("SELECT EXPLODE(arr), id FROM parquet_t3")
    +    checkHiveQl("SELECT EXPLODE(arr) AS val, id as a FROM parquet_t3")
    +  }
    +
    +  test("generator in lateral view") {
    +    checkHiveQl("SELECT val, id FROM parquet_t3 LATERAL VIEW EXPLODE(arr) 
exp AS val")
    +    checkHiveQl("SELECT val, id FROM parquet_t3 LATERAL VIEW OUTER 
EXPLODE(arr) exp AS val")
    +  }
    +
    +  test("generator in lateral view with ambiguous names") {
    +    checkHiveQl(
    +      """
    +        |SELECT exp.id, parquet_t3.id
    +        |FROM parquet_t3
    +        |LATERAL VIEW EXPLODE(arr) exp AS id
    +      """.stripMargin)
    +    checkHiveQl(
    +      """
    +        |SELECT exp.id, parquet_t3.id
    +        |FROM parquet_t3
    +        |LATERAL VIEW OUTER EXPLODE(arr) exp AS id
    +      """.stripMargin)
    +  }
    +
    +  test("nested generator in lateral view") {
    +    checkHiveQl(
    +      """
    +        |SELECT val, id
    +        |FROM parquet_t3
    +        |LATERAL VIEW EXPLODE(arr2) exp1 AS nested_array
    +        |LATERAL VIEW EXPLODE(nested_array) exp1 AS val
    +      """.stripMargin)
    +
    +    checkHiveQl(
    +      """
    +        |SELECT val, id
    +        |FROM parquet_t3
    +        |LATERAL VIEW EXPLODE(arr2) exp1 AS nested_array
    +        |LATERAL VIEW OUTER EXPLODE(nested_array) exp1 AS val
    +      """.stripMargin)
    +  }
    +
    +  test("generate with other operators") {
    --- End diff --
    
    Seems this query does not generate deterministic results (generate with 
other operators). 


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