You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "sunjincheng (JIRA)" <ji...@apache.org> on 2018/01/09 15:18:00 UTC

[jira] [Created] (CALCITE-2126) Optimization of COUNT (1) in OVER window

sunjincheng created CALCITE-2126:
------------------------------------

             Summary:  Optimization of COUNT (1) in OVER window
                 Key: CALCITE-2126
                 URL: https://issues.apache.org/jira/browse/CALCITE-2126
             Project: Calcite
          Issue Type: Improvement
            Reporter: sunjincheng
            Assignee: Julian Hyde


When we parse a SQL:
{code}
select COUNT(1) from T tumble(rowtime, interval 2 seconds)
{code}

 In RexBuild.addAggCall will do the optimize as follows:
{code}
if(aggCall.getAggregation() instanceof SqlCountAggFunction && !aggCall.isDistinct()) {
    List rex = aggCall.getArgList();
    List index = nullableArgs(rex, aggArgTypes);
    if(!index.equals(rex)) {
        aggCall = aggCall.copy(index, aggCall.filterArg);
    }
}
{code}
After the code logic above, the COUNT(1) -> COUNT().

But when we parser a SQL:
{code}
select COUNT(1) OVER(...) from T.
{code}
we do not do the optimized the parameter. So in this JIRA. want add optimize for OVER constant parameter.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)