This is an automated email from the ASF dual-hosted git repository. hyuan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push: new b9a2075 [CALCITE-3950] Doc of SqlGroupingFunction contradicts its behavior b9a2075 is described below commit b9a2075ae125c318b6909b95d7ff0192fcec9149 Author: jinxing64 <jinxing.co...@gmail.com> AuthorDate: Thu Apr 23 21:10:16 2020 +0800 [CALCITE-3950] Doc of SqlGroupingFunction contradicts its behavior --- .../org/apache/calcite/sql/fun/SqlGroupingFunction.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlGroupingFunction.java b/core/src/main/java/org/apache/calcite/sql/fun/SqlGroupingFunction.java index 522ba35..3fed6a6 100644 --- a/core/src/main/java/org/apache/calcite/sql/fun/SqlGroupingFunction.java +++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlGroupingFunction.java @@ -22,14 +22,16 @@ import org.apache.calcite.sql.type.OperandTypes; import org.apache.calcite.sql.type.ReturnTypes; /** - * The {@code GROUPING} function. + * The {@code GROUPING} function. It accepts 1 or more arguments and they must be + * from the GROUP BY list. The result is calculated from a bitmap (the right most bit + * is the lowest), which indicates whether an argument is aggregated or grouped + * -- The N-th bit is lit if the N-th argument is aggregated. * - * <p>Accepts 1 or more arguments. - * Example: {@code GROUPING(deptno, gender)} returns - * 3 if both deptno and gender are being grouped, - * 2 if only deptno is being grouped, - * 1 if only gender is being groped, - * 0 if neither deptno nor gender are being grouped. + * <p>Example: {@code GROUPING(deptno, gender)} returns + * 0 if both deptno and gender are being grouped, + * 1 if only deptno is being grouped, + * 2 if only gender is being grouped, + * 3 if neither deptno nor gender are being grouped. * * <p>This function is defined in the SQL standard. * {@code GROUPING_ID} is a non-standard synonym.