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

Casts from and to BIT type #7941

Merged
merged 23 commits into from
Jul 6, 2023
Merged

Casts from and to BIT type #7941

merged 23 commits into from
Jul 6, 2023

Conversation

nickgerrets
Copy link
Contributor

Solves #7640

Adds casting from numeric types, BOOLEAN type and BLOB type to BIT type and vice versa.
List of added casts:

  • BOOLEAN
  • TINYINT
  • UTINYINT
  • SMALLINT
  • USMALLINT
  • INTEGER
  • UINTEGER
  • BIGINT
  • UBIGINT
  • HUGEINT
  • FLOAT
  • DOUBLE
  • BLOB

From bit to numerical types will throw an exception if there is not enough space to hold all the bits. From bit to boolean will convert the boolean value to become either 1 or 0 (true or false).

Copy link
Contributor

@Tishj Tishj left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

It looks really good, I just had a few comments, after those are addressed I think it's good to go :)

src/common/types/bit.cpp Outdated Show resolved Hide resolved
src/common/types/bit.cpp Outdated Show resolved Hide resolved
src/common/types/bit.cpp Show resolved Hide resolved
src/include/duckdb/common/types/bit.hpp Outdated Show resolved Hide resolved
test/sql/cast/test_bit_cast.test Show resolved Hide resolved
test/sql/cast/test_bit_cast.test Show resolved Hide resolved
src/common/types/bit.cpp Outdated Show resolved Hide resolved
@Mytherin Mytherin changed the base branch from master to feature June 15, 2023 12:17
Copy link
Contributor

@Tishj Tishj left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, I think it's nearly ready to be merged.

I did have one small comment that I missed earlier

@nickgerrets nickgerrets marked this pull request as draft June 23, 2023 07:31
@nickgerrets nickgerrets marked this pull request as ready for review June 23, 2023 07:32
@github-actions github-actions bot marked this pull request as draft June 23, 2023 14:01
@nickgerrets nickgerrets marked this pull request as ready for review June 23, 2023 14:28
@github-actions github-actions bot marked this pull request as draft June 26, 2023 07:44
@nickgerrets nickgerrets marked this pull request as ready for review June 26, 2023 10:52
@Mytherin Mytherin changed the base branch from feature to master June 26, 2023 11:47
@Mytherin Mytherin changed the base branch from master to feature June 26, 2023 11:47
@Mytherin Mytherin changed the base branch from feature to master July 4, 2023 13:17
@Mytherin
Copy link
Collaborator

Mytherin commented Jul 6, 2023

@Tishj is this PR good to go?

@Tishj
Copy link
Contributor

Tishj commented Jul 6, 2023

@Tishj is this PR good to go?

@Mytherin yea I think it's ready

@Mytherin Mytherin merged commit f7e7dce into duckdb:master Jul 6, 2023
54 checks passed
@Mytherin
Copy link
Collaborator

Mytherin commented Jul 6, 2023

Thanks @nickgerrets, well done!

@nickgerrets nickgerrets deleted the bitstring branch July 10, 2023 13:24
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.

None yet

3 participants