You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Lei Jiang (Jira)" <ji...@apache.org> on 2020/01/02 08:14:00 UTC
[jira] [Updated] (CALCITE-3662) Generate wrong SQL when plan
contains Project(Sort(Aggregate)) and aggregate field has no alias
[ https://issues.apache.org/jira/browse/CALCITE-3662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lei Jiang updated CALCITE-3662:
-------------------------------
Summary: Generate wrong SQL when plan contains Project(Sort(Aggregate)) and aggregate field has no alias (was: Generate wrong SQL when plan contains Project(Sort(Aggregate)) and aggreagated field has no alias)
> Generate wrong SQL when plan contains Project(Sort(Aggregate)) and aggregate field has no alias
> -----------------------------------------------------------------------------------------------
>
> Key: CALCITE-3662
> URL: https://issues.apache.org/jira/browse/CALCITE-3662
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.21.0
> Reporter: Lei Jiang
> Assignee: Lei Jiang
> Priority: Major
> Fix For: next
>
>
> Input SQL:
> {code:java}
> select sum(sal) from scott.emp group by ename limit 10
> {code}
> Optimized Plan:
> {code:java}
> JdbcToEnumerableConverter
> JdbcProject(EXPR$0=[$1])
> JdbcSort(fetch=[10])
> JdbcAggregate(group=[{1}], EXPR$0=[SUM($5)])
> JdbcTableScan(table=[[SCOTT, EMP]])
> {code}
> Output wrong SQL: outter select list is wrong.
> {code:java}
> SELECT SUM("SAL")
> FROM (SELECT "ENAME", SUM("SAL")
> FROM "SCOTT"."EMP"
> GROUP BY "ENAME"
> LIMIT 10) AS "t0" {code}
> It should be:
> {code:java}
> SELECT SUM("SAL")
> FROM "SCOTT"."EMP"
> GROUP BY "ENAME"
> LIMIT 10
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)