-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CALCITE-6559] Query with measure that applies AVG to SMALLINT throws AssertionError "Cannot add expression of different type to set" #3950
Conversation
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.) Close apache/calcite#xxxx
|
||
!ok | ||
|
||
!if (false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an issue filed for this other problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amarkowitz, PTAL |
@@ -179,6 +179,53 @@ from empm; | |||
|
|||
!ok | |||
|
|||
# [CALCITE-6559] LogicalCorrelate Type mismatch | |||
# Occurs when AVG measure is applied to SMALLINT or TINYINT column. | |||
# A CAST is added internally to the result of SUM / COUNT, but this cast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's difficult to tell from this comment whether this was the cause of the bug or whether this is the new expectation after fixing. Have you considered moving this comment to CALCITE-6559 instead?
|
No description provided.