Skip to content
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

opt: ensure NULLs folded out of a CASE are typed #35188

Merged
merged 1 commit into from
Feb 26, 2019

Conversation

justinj
Copy link
Contributor

@justinj justinj commented Feb 25, 2019

Fixes #34930.

Previously, we could have two well-typed CASE statements that had a
valid binary overload and thus would pass semantic analysis. However,
via SimplifyCaseWhenConstValue, we could fold away the CASEs, leaving us
with only two untyped NULLs (which will not have a valid overload).

The "right" thing to do might be to change the type-checker to have the
NULLs come in through the AST as typed, but this is a bigger change
since the current AST has no notion of a typed null (there's only a
singleton NULL).

Release note (bug fix): fix a panic that could occur via certain
patterns of folding CASE statements containing NULLs.

cc @mjibson

Fixes cockroachdb#34930.

Previously, we could have two well-typed CASE statements that had a
valid binary overload and thus would pass semantic analysis. However,
via SimplifyCaseWhenConstValue, we could fold away the CASEs, leaving us
with only two untyped NULLs (which will not have a valid overload).

The "right" thing to do might be to change the type-checker to have the
NULLs come in through the AST as typed, but this is a bigger change
since the current AST has no notion of a typed null (there's only a
singleton NULL).

Release note (bug fix): fix a panic that could occur via certain
patterns of folding CASE statements containing NULLs.
@justinj justinj requested a review from rytaft February 25, 2019 20:50
@justinj justinj requested a review from a team as a code owner February 25, 2019 20:50
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rytaft)

@justinj
Copy link
Contributor Author

justinj commented Feb 26, 2019

TFTR!

bors r+

craig bot pushed a commit that referenced this pull request Feb 26, 2019
35188: opt: ensure NULLs folded out of a CASE are typed r=justinj a=justinj

Fixes #34930.

Previously, we could have two well-typed CASE statements that had a
valid binary overload and thus would pass semantic analysis. However,
via SimplifyCaseWhenConstValue, we could fold away the CASEs, leaving us
with only two untyped NULLs (which will not have a valid overload).

The "right" thing to do might be to change the type-checker to have the
NULLs come in through the AST as typed, but this is a bigger change
since the current AST has no notion of a typed null (there's only a
singleton NULL).

Release note (bug fix): fix a panic that could occur via certain
patterns of folding CASE statements containing NULLs.

cc @mjibson 

Co-authored-by: Justin Jaffray <justin@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Feb 26, 2019

Build succeeded

@craig craig bot merged commit a32cafd into cockroachdb:master Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: panic: could not find overload for binary expression minus
4 participants