aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorReynold Xin <rxin@databricks.com>2016-02-24 12:25:02 -0800
committerReynold Xin <rxin@databricks.com>2016-02-24 12:25:02 -0800
commitf92f53faeea020d80638a06752d69ca7a949cdeb (patch)
tree060c28a4ccd676bd357943d345c2ff1e0800a2cf /sql
parent65805ab6eaa6b0ed1dc7f6cbd3c3368eb750b375 (diff)
downloadspark-f92f53faeea020d80638a06752d69ca7a949cdeb.tar.gz
spark-f92f53faeea020d80638a06752d69ca7a949cdeb.tar.bz2
spark-f92f53faeea020d80638a06752d69ca7a949cdeb.zip
Revert "[SPARK-13321][SQL] Support nested UNION in parser"
This reverts commit 55d6fdf22d1d6379180ac09f364c38982897d9ff.
Diffstat (limited to 'sql')
-rw-r--r--sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlParser.g20
-rw-r--r--sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystQlSuite.scala64
2 files changed, 0 insertions, 84 deletions
diff --git a/sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlParser.g b/sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlParser.g
index 3010d3ae0d..1db3aed658 100644
--- a/sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlParser.g
+++ b/sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlParser.g
@@ -2320,26 +2320,6 @@ regularBody[boolean topLevel]
)
|
selectStatement[topLevel]
- |
- (LPAREN selectStatement0[true]) => nestedSetOpSelectStatement[topLevel]
- ;
-
-nestedSetOpSelectStatement[boolean topLevel]
- :
- (
- LPAREN s=selectStatement0[topLevel] RPAREN -> {$s.tree}
- )
- (set=setOpSelectStatement[$nestedSetOpSelectStatement.tree, topLevel])
- -> {set == null}?
- {$nestedSetOpSelectStatement.tree}
- -> {$set.tree}
- ;
-
-selectStatement0[boolean topLevel]
- :
- (selectStatement[true]) => selectStatement[topLevel]
- |
- (nestedSetOpSelectStatement[true]) => nestedSetOpSelectStatement[topLevel]
;
selectStatement[boolean topLevel]
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystQlSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystQlSuite.scala
index 812aa5acd8..53a8d6e53e 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystQlSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystQlSuite.scala
@@ -202,70 +202,6 @@ class CatalystQlSuite extends PlanTest {
"from windowData")
}
- test("nesting UNION") {
- val parsed = parser.parsePlan(
- """
- |SELECT `u_1`.`id` FROM (((SELECT `t0`.`id` FROM `default`.`t0`)
- |UNION ALL (SELECT `t0`.`id` FROM `default`.`t0`)) UNION ALL
- |(SELECT `t0`.`id` FROM `default`.`t0`)) AS u_1
- """.stripMargin)
-
- val expected = Project(
- UnresolvedAlias(UnresolvedAttribute("u_1.id"), None) :: Nil,
- SubqueryAlias("u_1",
- Union(
- Union(
- Project(
- UnresolvedAlias(UnresolvedAttribute("t0.id"), None) :: Nil,
- UnresolvedRelation(TableIdentifier("t0", Some("default")), None)),
- Project(
- UnresolvedAlias(UnresolvedAttribute("t0.id"), None) :: Nil,
- UnresolvedRelation(TableIdentifier("t0", Some("default")), None))),
- Project(
- UnresolvedAlias(UnresolvedAttribute("t0.id"), None) :: Nil,
- UnresolvedRelation(TableIdentifier("t0", Some("default")), None)))))
-
- comparePlans(parsed, expected)
-
- val parsedSame = parser.parsePlan(
- """
- |SELECT `u_1`.`id` FROM ((SELECT `t0`.`id` FROM `default`.`t0`)
- |UNION ALL (SELECT `t0`.`id` FROM `default`.`t0`) UNION ALL
- |(SELECT `t0`.`id` FROM `default`.`t0`)) AS u_1
- """.stripMargin)
-
- comparePlans(parsedSame, expected)
-
- val parsed2 = parser.parsePlan(
- """
- |SELECT `u_1`.`id` FROM ((((SELECT `t0`.`id` FROM `default`.`t0`)
- |UNION ALL (SELECT `t0`.`id` FROM `default`.`t0`)) UNION ALL
- |(SELECT `t0`.`id` FROM `default`.`t0`))
- |UNION ALL (SELECT `t0`.`id` FROM `default`.`t0`)) AS u_1
- """.stripMargin)
-
- val expected2 = Project(
- UnresolvedAlias(UnresolvedAttribute("u_1.id"), None) :: Nil,
- SubqueryAlias("u_1",
- Union(
- Union(
- Union(
- Project(
- UnresolvedAlias(UnresolvedAttribute("t0.id"), None) :: Nil,
- UnresolvedRelation(TableIdentifier("t0", Some("default")), None)),
- Project(
- UnresolvedAlias(UnresolvedAttribute("t0.id"), None) :: Nil,
- UnresolvedRelation(TableIdentifier("t0", Some("default")), None))),
- Project(
- UnresolvedAlias(UnresolvedAttribute("t0.id"), None) :: Nil,
- UnresolvedRelation(TableIdentifier("t0", Some("default")), None))),
- Project(
- UnresolvedAlias(UnresolvedAttribute("t0.id"), None) :: Nil,
- UnresolvedRelation(TableIdentifier("t0", Some("default")), None)))))
-
- comparePlans(parsed2, expected2)
- }
-
test("subquery") {
parser.parsePlan("select (select max(b) from s) ss from t")
parser.parsePlan("select * from t where a = (select b from s)")