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