calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jincheng sun <>
Subject Why not optimize the parameters of COUNT (1) in OVER window ?
Date Sun, 07 Jan 2018 12:00:02 GMT
Hi Julian,

I'm a bit confused by the different optimization of COUNT (1) in OVER
window and tumble window.

When we parse a SQL:

select COUNT(1) from T tumble(rowtime, interval 2 seconds)

 In RexBuild.addAggCall will do the optimize as follows:

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);

After the code logic above, the COUNT(1) -> COUNT().

But when we parser a SQL:

select COUNT(1) OVER(...) from T.

we do not do the optimize, So, I want to know why not optimize the
parameter of COUNT (1) in OVER window?

If we need do the optimize, can we do the optimize after SqlToRelConverter?

Best, Jincheng

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message