Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/17935#discussion_r116153501 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala --- @@ -868,6 +868,29 @@ class SubquerySuite extends QueryTest with SharedSQLContext { Row(3, 3.0, 2, 3.0) :: Row(3, 3.0, 2, 3.0) :: Nil) } + test("SPARK-20690: Do not add missing attributes through subqueries") { + withTempView("onerow") { + Seq(1).toDF("c1").createOrReplaceTempView("onerow") + + val e = intercept[AnalysisException] { + sql( + """ + | select 1 + | from (select 1 from onerow t1 LIMIT 1) --- End diff -- I'm surprised we support this syntax, I think the FROM clause must have an alias. I checked with postgres, it will throw exception `subquery in FROM must have an alias`, can you check with other databases? Thanks!
--- 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