Ruben Q L created CALCITE-6531:
----------------------------------
Summary: Correct Javadoc example in SqlStaticAggFunction#constant
Key: CALCITE-6531
URL: https://issues.apache.org/jira/browse/CALCITE-6531
Project: Calcite
Issue Type: Task
Components: core
Affects Versions: 1.37.0
Reporter: Ruben Q L
Fix For: 1.38.0
The Javadoc in SqlStaticAggFunction#constant says:
{noformat}
GROUPING(deptno) expands to literal 1 if the aggregate has GROUP BY deptno
{noformat}
However, this "1" seems incorrect (it should rather be "0"). If we look at the
actual implementation of this logic in
[SqlGroupingFunction#constant|https://github.com/apache/calcite/blob/e4bbcd6f53ff6be2e2be0893b94d3806e58278d2/core/src/main/java/org/apache/calcite/sql/fun/SqlGroupingFunction.java#L62],
or [this test
agg.iq|https://github.com/apache/calcite/blob/e4bbcd6f53ff6be2e2be0893b94d3806e58278d2/core/src/test/resources/sql/agg.iq#L689],
it seems in these cases the GROUPING is expanded to a constant 0.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)