-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CALCITE-6555] RelBuilder.aggregateRex wrongly thinks aggregate funct…
…ions of "GROUP BY ()" queries are NOT NULL In RelBuilder, the aggregateRex method (added in CALCITE-5802) wrongly thinks that aggregate functions in a `GROUP BY ()` query are NOT NULL. Consider the query SELECT SUM(empno) AS s, COUNT(empno) AS c FROM emp GROUP BY () `SUM(empno)` should be nullable, even though `empno` has type `SMALLINT NOT NULL`, because `GROUP BY ()` will return one row even if `emp` has no rows, and therefore `SUM` will be evaluated over the empty set. A RelBuilder test that attempts to build an equivalent query gets the following error stack: java.lang.AssertionError: type mismatch: ref: SMALLINT NOT NULL input: SMALLINT We add a test case for measure queries, because measures are the only code path that uses `aggregateRex` at present.
- Loading branch information
1 parent
30304bb
commit 8771e3f
Showing
3 changed files
with
119 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters