Repository navigation
Fix Nullable(Tuple) not working with CSV, MsgPack format properly - #100038
Merged
Avogar merged 8 commits intoMar 19, 2026
Merged
Conversation
Contributor
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 97.50% (39/40, 0 noise lines excluded) |
Avogar
approved these changes
Mar 19, 2026
zvonand
added a commit
to Altinity/ClickHouse
that referenced
this pull request
May 19, 2026
`CSVFormatReader::readField` treats an empty unquoted field as the default value when `input_format_csv_empty_as_default` is enabled (the default). For a `Nullable(Tuple())` column the default is `NULL`, so the empty-tuple values written by `SerializationTuple::serializeTextCSV` (which produces an empty field for a tuple with zero elements) are read back as `NULL` instead of `()`. This breaks the `04019_formats_nullable_empty_tuple_roundtrip` test added in the cherry-pick of upstream PR ClickHouse#101272. The fix is the same as upstream commit `29f6f23cafe` from upstream PR \ClickHouse#100038 ("Fix `Nullable(Tuple)` not working with `CSV`, `MsgPack` format properly"), which ClickHouse#101272 depends on: special-case `Nullable(Tuple())` (zero-element tuple) so the empty field falls through to normal deserialization instead of being replaced with `NULL`. Applied verbatim (diff matches upstream byte-for-byte). Addresses CSV section failure in test `04019_formats_nullable_empty_tuple_roundtrip` on #1802. Failure report: https://altinity-build-artifacts.s3.amazonaws.com/json.html?PR=1802&sha=36ae78193451a1aaf81d238b7b3bcb25fab3ee3d&name_0=PR&name_1=Stateless+tests+%28amd_asan%2C+distributed+plan%2C+parallel%2C+1%2F4%29&name_2=Tests Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
subkanthi
pushed a commit
to Altinity/ClickHouse
that referenced
this pull request
May 26, 2026
`CSVFormatReader::readField` treats an empty unquoted field as the default value when `input_format_csv_empty_as_default` is enabled (the default). For a `Nullable(Tuple())` column the default is `NULL`, so the empty-tuple values written by `SerializationTuple::serializeTextCSV` (which produces an empty field for a tuple with zero elements) are read back as `NULL` instead of `()`. This breaks the `04019_formats_nullable_empty_tuple_roundtrip` test added in the cherry-pick of upstream PR ClickHouse#101272. The fix is the same as upstream commit `29f6f23cafe` from upstream PR \ClickHouse#100038 ("Fix `Nullable(Tuple)` not working with `CSV`, `MsgPack` format properly"), which ClickHouse#101272 depends on: special-case `Nullable(Tuple())` (zero-element tuple) so the empty field falls through to normal deserialization instead of being replaced with `NULL`. Applied verbatim (diff matches upstream byte-for-byte). Addresses CSV section failure in test `04019_formats_nullable_empty_tuple_roundtrip` on #1802. Failure report: https://altinity-build-artifacts.s3.amazonaws.com/json.html?PR=1802&sha=36ae78193451a1aaf81d238b7b3bcb25fab3ee3d&name_0=PR&name_1=Stateless+tests+%28amd_asan%2C+distributed+plan%2C+parallel%2C+1%2F4%29&name_2=Tests Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
groeneai
added a commit
to groeneai/ClickHouse
that referenced
this pull request
Jun 30, 2026
…of NULL
Since Nullable(Tuple) is now serialized as a single quoted CSV field
("()"), the empty-tuple value no longer produces an empty field, so the
is_nullable_empty_tuple exception in CSVFormatReader::readField (added in
PR ClickHouse#100038 for the old separate-columns serialization) is obsolete. With
input_format_csv_empty_as_default = 1 (the default) it forced an empty
field through SerializationTuple::deserializeText, which expects '(' and
threw CANNOT_PARSE_INPUT_ASSERTION_FAILED instead of inserting the
nullable default. Remove the exception so an empty field for
Nullable(Tuple()) becomes NULL, consistent with Nullable(Tuple(T)) and
every other Nullable type. The "()" / "(5)" quoted fields still parse
back to the tuple value.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…of NULL
Since Nullable(Tuple) is now serialized as a single quoted CSV field
("()"), the empty-tuple value no longer produces an empty field, so the
is_nullable_empty_tuple exception in CSVFormatReader::readField (added in
PR ClickHouse#100038 for the old separate-columns serialization) is obsolete. With
input_format_csv_empty_as_default = 1 (the default) it forced an empty
field through SerializationTuple::deserializeText, which expects '(' and
threw CANNOT_PARSE_INPUT_ASSERTION_FAILED instead of inserting the
nullable default. Remove the exception so an empty field for
Nullable(Tuple()) becomes NULL, consistent with Nullable(Tuple(T)) and
every other Nullable type. The "()" / "(5)" quoted fields still parse
back to the tuple value.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
Given,
CSV:
MsgPack:
This PR contains test for other formats as well to make sure they work with empty
Nullable(Tuple).TODO: Currently, Arrow, ArrowStream, and ORC still have problem with
Nullable(Tuple)which I will fix later in subsequent PR.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
CSV,MsgPackformat not being able to parseNullable(Tuple)properly. Closes #99753.Documentation entry for user-facing changes
Version info
26.3.1.890