You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Cheng Lian (JIRA)" <ji...@apache.org> on 2016/03/18 09:48:33 UTC

[jira] [Created] (SPARK-14002) SQLBuilder should add subquery to Aggregate child when necessary

Cheng Lian created SPARK-14002:
----------------------------------

             Summary: SQLBuilder should add subquery to Aggregate child when necessary
                 Key: SPARK-14002
                 URL: https://issues.apache.org/jira/browse/SPARK-14002
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.0.0
            Reporter: Cheng Lian
            Assignee: Cheng Lian


Adding the following test case to {{LogicalPlanToSQLSuite}} to reproduce this issue:
{code}
  test("bug") {
    checkHiveQl(
      """SELECT COUNT(id)
        |FROM
        |(
        |  SELECT id FROM t0
        |) subq
      """.stripMargin
    )
  }
{code}
Generated wrong SQL is:
{code:sql}
SELECT `gen_attr_46` AS `count(id)`
FROM
(
    SELECT count(`gen_attr_45`) AS `gen_attr_46`
    FROM
        SELECT `gen_attr_45`                -- 
        FROM                                --
        (                                   -- A subquery
            SELECT `id` AS `gen_attr_45`    -- is missing
            FROM `default`.`t0`             --
        ) AS gen_subquery_0                 --
) AS gen_subquery_1
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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