importccl: fix panic when importing CSV with virtual columns#66730
Merged
craig[bot] merged 1 commit intoJun 23, 2021
Merged
Conversation
Member
adityamaru
approved these changes
Jun 22, 2021
adityamaru
left a comment
Contributor
There was a problem hiding this comment.
Heh timely - #66732. Thanks for doing this!
Previously, `IMPORT TABLE` would panic for a CSV import when the table included a virtual computed column. This was caused by empty `SessionData` being passed to `sql.NewTableDesc` in `importccl.MakeSimpleTableDescriptor` which consults session data to determine if all nodes in the cluster are running a version that supports virtual computed columns. This commit fixes the issue by returning an error in `importccl.MakeSimpleTableDescriptor` before calling `sql.NewTableDesc` if the `IMPORT TABLE` statement specifies a virtual computed column. This is acceptable behavior because stored computed columns are also not supported in the `IMPORT TABLE` statement. Fixes cockroachdb#66694 Release note (bug fix): A bug has been fixed which caused internal errors when running an `IMPORT TABLE` statement with a virtual computed column to import a CSV file. This bug has been present since virtual computed columns were introduced in version 21.1.0.
5876a12 to
9f7af87
Compare
Contributor
Author
|
@adityamaru made some minor changes, PTAL. |
adityamaru
approved these changes
Jun 22, 2021
Contributor
Author
|
TFTR! bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
IMPORT TABLEwould panic for a CSV import when the tableincluded a virtual computed column. This was caused by empty
SessionDatabeing passed tosql.NewTableDescinimportccl.MakeSimpleTableDescriptorwhich consults session data todetermine if all nodes in the cluster are running a version that
supports virtual computed columns.
This commit fixes the issue by returning an error in
importccl.MakeSimpleTableDescriptorbefore callingsql.NewTableDescif the
IMPORT TABLEstatement specifies a virtual computedcolumn. This is acceptable behavior because stored computed columns are
also not supported in the
IMPORT TABLEstatement.Fixes #66694
Release note (bug fix): A bug has been fixed which caused internal
errors when running an
IMPORT TABLEstatement with a virtual computedcolumn to import a CSV file. This bug has been present since virtual
computed columns were introduced in version 21.1.0.