Skip to content

dolthub/dolt#9511 - Fix SET type casting to CHAR and BINARY #3114

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

Merged
merged 3 commits into from
Jul 25, 2025

Conversation

elianddb
Copy link
Contributor

Fixes dolthub/dolt#9511

  • Added convertSetToStringForStringContext() helper function following existing patterns
  • Modified convertValue() to handle SET types in both CHAR and BINARY conversion cases

@elianddb elianddb force-pushed the elianddb/9511-fix-set-type-cast branch 3 times, most recently from f632188 to f6d221d Compare July 23, 2025 19:23
@elianddb elianddb requested a review from angelamayxie July 23, 2025 21:47
@angelamayxie
Copy link
Contributor

Can you also check how enums convert with cast (if we don't already have a test for it) and add tests if necessary?

@elianddb elianddb force-pushed the elianddb/9511-fix-set-type-cast branch from bea598f to 83bba9b Compare July 23, 2025 22:41
elianddb and others added 3 commits July 25, 2025 13:16
This commit fixes an issue where SET types were not properly converted
to their string representation when casting to CHAR or BINARY types.

The problem was that SET types use internal uint64 values to represent
bit fields, but when casting to CHAR or BINARY, the string representation
of the SET should be used instead.

Changes:
- Added special handling in convertValue() for SET types in both CHAR and BINARY conversion cases
- Convert SET uint64 bit field to string representation before passing to LongText/LongBlob converters
- Removed Skip flags from previously failing tests in script_queries.go
- Updated test expectations to include all SET values (including "defg")

Fixes dolthub/dolt#9511

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…NUM casting

- Extend TypeAwareConversion to handle IsBlobType in addition to IsTextOnly
- Use TypeAwareConversion consistently for both CHAR and BINARY conversions
- Remove direct ConvertToCollatedString call in binary conversion
- Update function documentation to reflect blob type support
- Simplify convertValue logic by using unified conversion approach

This ensures SET/ENUM types are converted properly for all string and binary
target types through a single, consistent code path.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@elianddb elianddb force-pushed the elianddb/9511-fix-set-type-cast branch from f2fa7f7 to 656d0b8 Compare July 25, 2025 20:16
Copy link
Contributor

@angelamayxie angelamayxie left a comment

Choose a reason for hiding this comment

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

lgtm

@elianddb elianddb merged commit 7bc2294 into main Jul 25, 2025
8 checks passed
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.

SET type does not cast correctly to char or binary
2 participants