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

importccl: enable importing MySQL BIT columns #32561

Closed
knz opened this issue Nov 22, 2018 · 4 comments
Closed

importccl: enable importing MySQL BIT columns #32561

knz opened this issue Nov 22, 2018 · 4 comments
Labels
A-disaster-recovery C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) good first issue T-disaster-recovery X-anchored-telemetry The issue number is anchored by telemetry references.
Milestone

Comments

@knz
Copy link
Contributor

knz commented Nov 22, 2018

https://dev.mysql.com/doc/refman/5.7/en/bit-type.html

The BIT data type is used to store bit values. A type of BIT(M) enables storage of M-bit values. M can range from 1 to 64.

Under the hood MySQL's BIT is really just a 64-bit integer and behaves as such with regards to arithmetic.

This is very different from postgres' BIT type (a bit array of arbitrary length with special operators).

This type can be imported into CockroachDB as an integer.

Epic CRDB-8825

Jira issue: CRDB-4730

@knz knz added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-disaster-recovery X-anchored-telemetry The issue number is anchored by telemetry references. labels Nov 22, 2018
@knz knz added this to the Later milestone Nov 22, 2018
knz added a commit to knz/cockroach that referenced this issue Nov 22, 2018
knz added a commit to knz/cockroach that referenced this issue Nov 26, 2018
knz added a commit to knz/cockroach that referenced this issue Nov 28, 2018
@rolandcrosby
Copy link

The error message on this is also misspelled:
pq: unimplemented: cannot improt BIT columns at this time

This should be simple to automatically map to a 64-bit integer. I'm adding good first issue in case anyone in the community feels like taking this on.

@devdil
Copy link

devdil commented Jan 24, 2020

@rolandcrosby can I pick this up?

@knz
Copy link
Contributor Author

knz commented Jan 24, 2020

@devdil you can give it a try

@dikshant
Copy link

dikshant commented Feb 2, 2023

With IMPORT MYSQLDUMP being deprecated: #93660 and Schema Conversion Tool being better for schema migrations this is no longer needed and can now be closed.

@dikshant dikshant closed this as completed Feb 2, 2023
tmercieca added a commit to tmercieca/cockroach that referenced this issue May 12, 2023
Release note (sql change): Support importing MySQL BIT columns as
CockroachDB 64-bit integers. The user no longer needs to perform
this cast before importing MySQL data.

Previously, importing MySQL BIT type columns was unsupported. This
was being indicated with an error and a hint suggesting that the user
should cast to a 64-bit integer before starting the import process.

To address this, the imported MySQL BIT type is no longer being
rejected and is instead being read as a 64-bit integer.

Addresses cockroachdb#32561.
tmercieca added a commit to tmercieca/cockroach that referenced this issue May 12, 2023
Release note (performance improvement): Import MySQL BIT(1) column
as a Boolean, rather than as a 64-bit integer. This special case
consumes 1 byte rather than the minimum value of 2 bytes.

Previously, MySQL BIT(1) columns were being inserted as a 64-bit
integer regardless of bit length, which is more bits than needed
to represent MySQL BIT(1).

To address this, the BIT length is being considered before
importing a MySQL BIT column. If the BIT length is of 1, the value
is imported as a Boolean; otherwise, as a 64-bit integer (as in
the previous case).

Build on cockroachdb#32561.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-disaster-recovery C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) good first issue T-disaster-recovery X-anchored-telemetry The issue number is anchored by telemetry references.
Projects
No open projects
Archived in project
Development

No branches or pull requests

5 participants