You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by ji...@apache.org on 2020/05/19 02:55:45 UTC

[calcite] branch master updated: [CALCITE-3950] Doc of SqlGroupingFunction contradicts its behavior

This is an automated email from the ASF dual-hosted git repository.

jinxing 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 fbd3654  [CALCITE-3950] Doc of SqlGroupingFunction contradicts its behavior
fbd3654 is described below

commit fbd36541b26e3c42df6be7988ed954bd0802a37f
Author: jinxing64 <ji...@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.