I started investigating but didn't get a chance to follow up.
I don't know whether Calcite or Postgres is correct. I suspect the
difference is due to the expression 'comm is null'. Because I don't
know whether GROUPING_ID's behavior is defined if its arguments are
not all columns. But I think the
I have been staring at a particular Quidem test from agg.iq:
https://github.com/apache/calcite/blame/b412fa4ac0b1340a9f4e50c1d7ae4c869dcd1d2f/core/src/test/resources/sql/agg.iq#L1304
select sum(sal) as s,
grouping_id(job, deptno, comm is null) as g,
group_id() as i
from "scott".emp
group by