Skip to content

Handle Variant column NULL values (0xFF discriminator)#400

Draft
thearyanahmed wants to merge 6 commits intoClickHouse:mainfrom
thearyanahmed:fix-variant-column-reading
Draft

Handle Variant column NULL values (0xFF discriminator)#400
thearyanahmed wants to merge 6 commits intoClickHouse:mainfrom
thearyanahmed:fix-variant-column-reading

Conversation

@thearyanahmed
Copy link
Copy Markdown

@thearyanahmed thearyanahmed commented Mar 24, 2026

This PR tries to fix #392 by adding support for NULL values in Variant columns by handling the 0xFF discriminator.

Variant is implicitly nullable — NULL is encoded as discriminator 0xFF, unlike Nullable(T) which uses a separate leading byte. The client now distinguishes between these two null encodings via a generic NullEncoding enum on the SchemaValidator trait, allowing Option<MyEnum> to work with Variant columns.

Checklist

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided so that we can include it in CHANGELOG later

@thearyanahmed thearyanahmed changed the title Fix variant column reading Handle Variant column NULL values (0xFF discriminator) Mar 24, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 24, 2026

CLA assistant check
All committers have signed the CLA.

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.

Variant column reading fails on NULL values (0xFF discriminator not handled)

2 participants