Repository: spark Updated Branches: refs/heads/master 65805ab6e -> f92f53fae
Revert "[SPARK-13321][SQL] Support nested UNION in parser" This reverts commit 55d6fdf22d1d6379180ac09f364c38982897d9ff. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/f92f53fa Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/f92f53fa Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/f92f53fa Branch: refs/heads/master Commit: f92f53faeea020d80638a06752d69ca7a949cdeb Parents: 65805ab Author: Reynold Xin <[email protected]> Authored: Wed Feb 24 12:25:02 2016 -0800 Committer: Reynold Xin <[email protected]> Committed: Wed Feb 24 12:25:02 2016 -0800 ---------------------------------------------------------------------- .../spark/sql/catalyst/parser/SparkSqlParser.g | 20 ------ .../spark/sql/catalyst/CatalystQlSuite.scala | 64 -------------------- 2 files changed, 84 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/f92f53fa/sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlParser.g ---------------------------------------------------------------------- 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 3010d3a..1db3aed 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] http://git-wip-us.apache.org/repos/asf/spark/blob/f92f53fa/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystQlSuite.scala ---------------------------------------------------------------------- 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 812aa5a..53a8d6e 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)") --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
