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)

Reply via email to