Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18559#discussion_r126072760
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
    @@ -2638,4 +2638,17 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
           }
         }
       }
    +
    +  test("SPARK-21335: support un-aliased subquery") {
    +    withTempView("v") {
    +      Seq(1 -> "a").toDF("i", "j").createOrReplaceTempView("v")
    +      checkAnswer(sql("SELECT i from (SELECT i FROM v)"), Row(1))
    +
    +      val e = intercept[AnalysisException](sql("SELECT v.i from (SELECT i 
FROM v)"))
    +      assert(e.message ==
    +        "cannot resolve '`v.i`' given input columns: 
[_auto_generated_subquery_name.i]")
    --- End diff --
    
    It's supported since 2.0.X, so definitely there are existing user queires 
and apps. I'm agreeing with this PR and want to understand the scope of 
changes. It looks good to me.
    ```scala
    scala> sc.version
    res0: String = 2.0.2
    
    scala> Seq(1 -> "a").toDF("i", "j").createOrReplaceTempView("v")
    
    scala> sql("SELECT v.i from (SELECT i FROM v)").show
    +---+
    |  i|
    +---+
    |  1|
    +---+
    ```


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