-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: CASE with RECORD type and NULL causes internal error with vectorized engine #109105
Comments
TODO: determine if we should fix this for 23.2 once #108387 is merged. |
From what I understand the |
This issue should also handle the internal error found in #109486. |
I think this might be similar or that same issue as #109629. |
Looks like #109635 does not fix this issue. |
Tested against final version of #109635. Closing as a dup. |
reopening since a skipped test still references this issue cockroach/pkg/sql/logictest/testdata/logic_test/tuple Lines 1204 to 1208 in ef2991c
|
This uncomments a unit test from cockroachdb#78159 which was fixed by cockroachdb#109635. Informs: cockroachdb#109105 Release note: None
Type checking of CASE expressions (and other expressions handled by typeCheckSameTypedExprs) does not type check tuples properly because typeCheckSameTypedTupleExprs checking is only done when the tuple is the first expression in `exprs`. This is fixed by finding the first tuple in `exprs`, searching the slice starting at index 0, and using that to drive typeCheckSameTypedExprs. Fixes: cockroachdb#109105 Release note: None
Function typeCheckSameTypedExprs is updated by cockroachdb#108387 and cockroachdb#109635 to apply implicit CASTs to the different expressions input to an array, tuple, case expression or other similar expression, to coerce them all to a common data type, instead of erroring out. This is not done, however, if the data types of these expressions are not equivalent with each other, causing some cases to error out. The fix is to match Postgres behavior and apply the casts even for non-equivalent types. Informs: cockroachdb#109105 Release note (sql change): This patch modifies type checking of arrays, tuples, and case statements to allow implicit casting of scalar expressions referenced in these constructs to a common data type, even for types in different type families, as long at the implicit cast is legal.
110325: tree: make typeCheckSameTypedExprs order invariant for tuples r=msirek a=msirek Type checking of CASE expressions (and other expressions handled by typeCheckSameTypedExprs) does not type check tuples properly because typeCheckSameTypedTupleExprs checking is only done when the tuple is the first expression in `exprs`. This is fixed by finding the first tuple in `exprs`, searching the slice starting at index 0, and using that to drive typeCheckSameTypedExprs. Fixes: #109105 Release note: None Co-authored-by: Mark Sirek <[email protected]>
Type checking of CASE expressions (and other expressions handled by typeCheckSameTypedExprs) does not type check tuples properly because typeCheckSameTypedTupleExprs checking is only done when the tuple is the first expression in `exprs`. This is fixed by finding the first tuple in `exprs`, searching the slice starting at index 0, and using that to drive typeCheckSameTypedExprs. Fixes: cockroachdb#109105 Release note: None
Describe the problem
Running a query with
CASE
, where one of the branches is aRECORD
type and another branch isNULL
, can cause an internal error.To Reproduce
On master or prior versions, create the following logictest:
After #108387 merges, replace the last statement with:
When running with the
fakedist
config (e.g.,./dev testlogic base --files=testfile --config=fakedist --stress
), this produces the following error:Expected behavior
This should not cause an internal error.
Jira issue: CRDB-30782
The text was updated successfully, but these errors were encountered: