Repository navigation
fix(clickhouse): VariantSubcolumn inserts strings without type inference - #33
Merged
fm4v merged 1 commit intoNov 25, 2026
Conversation
The oracle inserts each String row as CAST('<word>' AS String) into a
Variant(Int64, String) column and expects it to stay a String. The VALUES
result is converted to the column type with CAST, and with
cast_string_to_variant_use_inference = 1 (the default since 25.4) a String
is parsed into the Variant, so the word `null` is stored as NULL
(variantType None). Every subcolumn read then correctly returns NULL and the
oracle reports "Java expects null but read NULL".
Turn the inference off for this INSERT only, so every word lands in the
String variant as the model assumes. The subcolumn reads under test are
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fm4v
approved these changes
Nov 25, 2026
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.
The 2026-11-25 master nightly (
SQLancer (arm_release), reproducer) reported:Row 32 was inserted as
CAST('null' AS String)intov Variant(Int64, String), andasciiWordhappened to generate the wordnull. ClickHouse converts theVALUESresult to the column type with CAST, and a String to Variant CAST parses the text whencast_string_to_variant_use_inference = 1(the default, documented). The textnullparses to NULL, so the row is stored as NULL (variantType=None) and every subcolumn read returns NULL correctly. The server is right and the oracle's model is wrong:Now the oracle's Variant INSERT sets
cast_string_to_variant_use_inference = 0, so every generated word stays a String, as the model assumes. The subcolumn reads under test are unchanged; this INSERT no longer exercises String to Variant inference, which the oracle never asserted on.Checked:
mvn verify -DskipTests=true -Djacoco.skip=truepasses.--oracle VariantSubcolumnagainst master1c87825f446d(debug build,.claude/clickhouse-config/overrides), before and after on one server:asciiWordreturnsnull1 in 5, local patch), 4 threads, 3 minRelated: ClickHouse/ClickHouse#128538
🤖 Generated with Claude Code