spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viirya <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-13321][SQL] Support nested UNION in par...
Date Tue, 16 Feb 2016 04:35:19 GMT
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11204#discussion_r52968390
  
    --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/CatalystQlSuite.scala
---
    @@ -201,4 +201,68 @@ class CatalystQlSuite extends PlanTest {
         parser.parsePlan("select sum(product + 1) over (partition by (product + (1)) order
by 2) " +
           "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,
    +      Subquery("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(
    --- End diff --
    
    Recursively nested UNION.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message