-
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-6559] Query with measure that applies AVG to SMALLINT throws…
… AssertionError "Cannot add expression of different type to set" When a query has a measure that is AVG applied to a SMALLINT or TINYINT column, we get the following assertion failure: java.lang.AssertionError: Cannot add expression of different type to set: set type is RecordType(VARCHAR(9) JOB, MEASURE<SMALLINT NOT NULL> NOT NULL $f1, SMALLINT $f0) NOT NULL expression type is RecordType(VARCHAR(9) JOB, MEASURE<SMALLINT NOT NULL> NOT NULL $f1, SMALLINT NOT NULL $f0) NOT NULL The problem is that a cast is added internally to the result of SUM / COUNT, but this cast prevents a cast to nullable for the null-generating side of the outer join. (The outer join comes from the expansion of the measure as a correlated scalar subquery.) Add method RexBuilder.makeNullable, sharing implementation with existing method makeNotNull. Add tests to scalar.iq and lateral.iq for some tricky query patterns that already work. Close #3950
- Loading branch information
1 parent
b2224a8
commit ded0651
Showing
5 changed files
with
169 additions
and
8 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
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