Skip to content

Fix Nullable(Tuple) not working with CSV, MsgPack format properly#100038

Merged
Avogar merged 8 commits intoClickHouse:masterfrom
nihalzp:fix-csv-empty-nullable-empty-tuple
Mar 19, 2026
Merged

Fix Nullable(Tuple) not working with CSV, MsgPack format properly#100038
Avogar merged 8 commits intoClickHouse:masterfrom
nihalzp:fix-csv-empty-nullable-empty-tuple

Conversation

@nihalzp
Copy link
Copy Markdown
Member

@nihalzp nihalzp commented Mar 19, 2026

Given,

SET allow_experimental_nullable_tuple_type = 1;
SET engine_file_truncate_on_insert = 1;

CREATE TABLE test_nullable_empty_tuple (c0 Nullable(Tuple())) ENGINE = Memory;
INSERT INTO TABLE test_nullable_empty_tuple (c0) VALUES (()), (NULL), (());

CSV:

INSERT INTO TABLE FUNCTION file(currentDatabase() || '_04019.csv', 'CSV', 'c0 Nullable(Tuple())') SELECT c0 FROM test_nullable_empty_tuple;
-- returns \N \N \N. Should be () \N ()
SELECT c0 FROM file(currentDatabase() || '_04019.csv', 'CSV', 'c0 Nullable(Tuple())');

MsgPack:

SET allow_experimental_nullable_tuple_type = 1;
SET engine_file_truncate_on_insert = 1;

CREATE TABLE test_single (c0 Nullable(Tuple(Int32))) ENGINE = Memory;
INSERT INTO test_single VALUES ((1)), (NULL), ((3));
INSERT INTO TABLE FUNCTION file(currentDatabase() || '_04029_single.msgpack', 'MsgPack', 'c0 Nullable(Tuple(Int32))') SELECT c0 FROM test_single;

-- Throws error but should work
SELECT c0 FROM file(currentDatabase() || '_04029_single.msgpack', 'MsgPack', 'c0 Nullable(Tuple(Int32))');

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):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix CSV, MsgPack format not being able to parse Nullable(Tuple) properly. Closes #99753.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Mar 19, 2026

Workflow [PR], commit [e1c67a3]

Summary:

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Mar 19, 2026
Comment thread src/Processors/Formats/Impl/MsgPackRowInputFormat.cpp
@nihalzp nihalzp requested a review from Avogar March 19, 2026 14:17
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Mar 19, 2026

LLVM Coverage Report

Metric Baseline Current Δ
Lines 83.80% 83.80% +0.00%
Functions 23.90% 23.90% +0.00%
Branches 76.30% 76.30% +0.00%

PR changed lines: PR changed-lines coverage: 97.50% (39/40, 0 noise lines excluded)
Diff coverage report
Uncovered code

@Avogar Avogar self-assigned this Mar 19, 2026
@Avogar Avogar added this pull request to the merge queue Mar 19, 2026
Merged via the queue into ClickHouse:master with commit 59b29fe Mar 19, 2026
163 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty nullable tuples read back as null values

3 participants