You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "PENG Zhengshuai (Jira)" <ji...@apache.org> on 2019/09/05 08:57:00 UTC

[jira] [Updated] (KYLIN-4158) Query failed for GroupBy an expression of column with limit in SQL

     [ https://issues.apache.org/jira/browse/KYLIN-4158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

PENG Zhengshuai updated KYLIN-4158:
-----------------------------------
    Description: 
When executing a sql query, the limit should not be pushdown to storage scan level if group by clause is an expression of columns.

For example:

{code:java}
SELECT (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" IN ('Auction', 'FP-GTC')) THEN 'Auction' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END) AS "LSTG_FORMAT_NAME__group_",
  SUM("TEST_KYLIN_FACT"."PRICE") AS "sum_PRICE_ok"
FROM "TEST_KYLIN_FACT" "TEST_KYLIN_FACT"
GROUP BY (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" IN ('Auction', 'FP-GTC')) THEN 'Auction' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END)
limit 4
{code}

In this SQL, group by clause is an expression, the limit should NOT be push-down to storage scan level, otherwise, the result is incorrect

  was:
Sql limit should not be pushdown to storage level if group by clause is an expression of columns.

For example:

{code:java}
SELECT (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" IN ('Auction', 'FP-GTC')) THEN 'Auction' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END) AS "LSTG_FORMAT_NAME__group_",
  SUM("TEST_KYLIN_FACT"."PRICE") AS "sum_PRICE_ok"
FROM "TEST_KYLIN_FACT" "TEST_KYLIN_FACT"
GROUP BY (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" IN ('Auction', 'FP-GTC')) THEN 'Auction' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END)
limit 4
{code}

In this SQL, group by clause is an expression, the limit should NOT be push-down to storage level, otherwise, the result is incorrect


> Query failed for GroupBy an expression of column with limit in SQL
> ------------------------------------------------------------------
>
>                 Key: KYLIN-4158
>                 URL: https://issues.apache.org/jira/browse/KYLIN-4158
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: v2.6.2
>            Reporter: PENG Zhengshuai
>            Assignee: PENG Zhengshuai
>            Priority: Major
>
> When executing a sql query, the limit should not be pushdown to storage scan level if group by clause is an expression of columns.
> For example:
> {code:java}
> SELECT (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" IN ('Auction', 'FP-GTC')) THEN 'Auction' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END) AS "LSTG_FORMAT_NAME__group_",
>   SUM("TEST_KYLIN_FACT"."PRICE") AS "sum_PRICE_ok"
> FROM "TEST_KYLIN_FACT" "TEST_KYLIN_FACT"
> GROUP BY (CASE WHEN ("TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" IN ('Auction', 'FP-GTC')) THEN 'Auction' ELSE "TEST_KYLIN_FACT"."LSTG_FORMAT_NAME" END)
> limit 4
> {code}
> In this SQL, group by clause is an expression, the limit should NOT be push-down to storage scan level, otherwise, the result is incorrect



--
This message was sent by Atlassian Jira
(v8.3.2#803003)