You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2015/09/04 09:46:45 UTC
[jira] [Resolved] (CALCITE-841) Redundant windows when window
function arguments are expressions
[ https://issues.apache.org/jira/browse/CALCITE-841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde resolved CALCITE-841.
---------------------------------
Resolution: Fixed
Fix Version/s: 1.5.0-incubating
Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/c1fb8299. Thanks for the patch, [~seanhychu]!
> Redundant windows when window function arguments are expressions
> ----------------------------------------------------------------
>
> Key: CALCITE-841
> URL: https://issues.apache.org/jira/browse/CALCITE-841
> Project: Calcite
> Issue Type: Bug
> Reporter: Sean Hsuan-Yi Chu
> Assignee: Julian Hyde
> Fix For: 1.5.0-incubating
>
>
> Firstly of all, this issue happens when HepPlanner is used with ProjectToWindowRule.PROJECT rule.
> A query with this pattern:
> {code}
> select fn(col) over w, fn(expr) over w
> from ...
> {code}
> will generate two "LogicalWindow" even if we have only an identical window frame.
> For example,
> {code}
> select sum(deptno) over(partition by deptno order by sal) as sum1,
> sum(deptno + deptno) over(partition by deptno order by sal) as sum2
> from emp
> {code}
> gives:
> {code}
> LogicalProject($0=[$2], $1=[$4])
> LogicalWindow(window#0=[window(partition {1} order by [0] range between UNBOUNDED PRECEDING and CURRENT ROW aggs [SUM($3)])])
> LogicalProject(SAL=[$0], DEPTNO=[$1], $2=[$2], $3=[+($1, $1)])
> LogicalProject(SAL=[$5], DEPTNO=[$7], $2=[$9])
> LogicalWindow(window#0=[window(partition {7} order by [5] range between UNBOUNDED PRECEDING and CURRENT ROW aggs [SUM($7)])])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)