You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by JiaTao Tao <ta...@gmail.com> on 2020/12/10 08:41:47 UTC

Why we repalce the literals in RexWindowBound with RexInputRef and put these literals to Window#constants

Hi
Current we got like this in Window#Group if we wrote SQL like `rows between
0 preceding and 2 following`
$3 PRECEDING
$4 FOLLOWING

$3 and $4 is input ref, and we had to find $3 and $4 in Window#constant,
and all digest about Window#Group doesn't replace the ref back to literal,
so it lost the info:

It's a plan in RelOptRuleTest:

LogicalProject(EMPNO=[$0], DEPTNO=[$1], W_COUNT=[$2])
  LogicalFilter(condition=[IS NULL($2)])
    LogicalWindow(window#0=[window(partition {} order by [] rows
between $2 PRECEDING and $3 PRECEDING aggs [COUNT($0)])])
      LogicalProject(EMPNO=[$0], DEPTNO=[$7])
        LogicalTableScan(table=[[CATALOG, SALES, EMP]])

Regards!

Aron Tao