Skip to content

Add Arrow and Parquet format support for UUID data type - #99521

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
ivanmantova:feature/arrow-parquet-uuid
Mar 19, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
ivanmantova:feature/arrow-parquet-uuid

Conversation

@ivanmantova

@ivanmantova ivanmantova commented Mar 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #72639

Maps the ClickHouse UUID type to Arrow's FixedSizeBinary(16).

Parquet and Arrow exports, alongside v2 reads, share the underlying Arrow C++ conversion pipeline. For v3 we directly integrate UUID decoding into native Parquet reader, bypassing Arrow for maximum performance.

For the v2 parquet reader, automated logical inference for nested UUIDs (e.g., Array(UUID)) is deliberately disabled. Recursively traversing and mutating nested extension types in the Arrow C++ API triggers an upstream bug that silently forces inner elements to become Nullable. Users can still read deeply nested UUIDs by providing an explicit schema hint (e.g., SELECT * FROM file(..., 'arr Array(UUID)')). For v3 we can infer Array(UUID) cleanly.

Changelog category:

Improvement

Changelog entry:

Adds native support for importing and exporting UUID data types in Arrow and Parquet formats. Users can now directly query and transfer UUID data between ClickHouse and other data tools without requiring manual string conversions or workarounds. Automated logical inference for top-level UUIDs, and support for explicit schema hint for nested UUIDs.

Version info

  • Merged into: 26.3.1.886

@CLAassistant

CLAassistant commented Mar 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ivanmantova
ivanmantova force-pushed the feature/arrow-parquet-uuid branch from 2a4989c to 35539a3 Compare March 15, 2026 12:14
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Mar 16, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f497658]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Mar 16, 2026
@ivanmantova

Copy link
Copy Markdown
Contributor Author

Well, learned a couple of things today. I pushed a new commit to address the clickhouse-gh feedback on endianness and memory alignment. I replaced the reinterpret_cast and unalignedLoad with explicit std::reverse byte-swapping to ensure the 64-bit UUID halves are strictly translated to/from RFC 4122 big-endian network order. Also added two cross-language PyArrow tests to the stateless suite to guarantee this behaves correctly across different CPU architectures.

@ivanmantova

Copy link
Copy Markdown
Contributor Author

This bot is actually quite smart 👍
I've updated both the import and export paths to guard the std::reverse byte-swapping behind an if constexpr (std::endian::native == std::endian::little) check. This will ensure we don't scramble the canonical chunk ordering on big-endian architectures.

@ivanmantova

Copy link
Copy Markdown
Contributor Author

Nice catch again.

I've pushed a fix that keeps the zero-cost std::reverse abstraction for Little-Endian hosts, but adds an explicit else branch using std::swap_ranges(bytes, bytes + 8, bytes + 8). This safely flips the 64-bit halves on Big-Endian machines to match Arrow's canonical high||low requirement.

@ivanmantova
ivanmantova force-pushed the feature/arrow-parquet-uuid branch 2 times, most recently from 84d867a to 1fe944d Compare March 16, 2026 13:22
@ivanmantova

Copy link
Copy Markdown
Contributor Author

The CI failure in the libFuzzer tests was caused by a flaky out-of-memory error on the runner, seemingly unrelated to the Arrow/Parquet UUID changes. I just pushed an empty commit to re-trigger the jobs on a fresh instance.

Comment thread .claude/learnings.md Resolved
@ivanmantova
ivanmantova force-pushed the feature/arrow-parquet-uuid branch from 641c13d to 9054bcb Compare March 18, 2026 16:47
@ivanmantova

ivanmantova commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Implemented strict Big-Endian byte-swapping for Parquet/Arrow standard compliance.

For the Parquet reader v2, root-level UUIDs are inferred automatically. Automated inference for nested UUIDs is deliberately disabled to route around an upstream Arrow 11 nullability bug. Nested UUIDs are fully supported via explicit schema hints. For v3 we can infer nested UUIDs cleanly.

Tests are green locally. Ready for review.

@ivanmantova
ivanmantova force-pushed the feature/arrow-parquet-uuid branch 2 times, most recently from 20aaa57 to d007f38 Compare March 18, 2026 19:54
@ivanmantova
ivanmantova force-pushed the feature/arrow-parquet-uuid branch from d007f38 to b9be61d Compare March 18, 2026 20:45
- Implements C++ reader/writer logic for UUIDs in Parquet/Arrow
- Adds stateless test coverage using clickhouse-local to prevent CI collisions
@ivanmantova
ivanmantova force-pushed the feature/arrow-parquet-uuid branch from b9be61d to f497658 Compare March 19, 2026 10:16
@ivanmantova

Copy link
Copy Markdown
Contributor Author

The 00900_long_parquet_load_2 failure was actually due to the test now correctly parsing Parquet UUIDs into strings (fixed and amended to the commit).

The AST fuzzer failure is an exception from a bad cast from ColumnReplicated to ColumnString. This appears to be an existing issue on master unrelated to my Parquet/Arrow IO changes. Could a maintainer re-trigger the fuzzer or bypass?

@clickhouse-gh

clickhouse-gh Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

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

PR changed lines: PR changed-lines coverage: 90.00% (288/320, 1 noise lines excluded)
Diff coverage report
Uncovered code

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Mar 19, 2026
@alexey-milovidov alexey-milovidov self-assigned this Mar 19, 2026
Merged via the queue into ClickHouse:master with commit 083ff35 Mar 19, 2026
159 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 19, 2026
@zlareb1

zlareb1 commented Mar 19, 2026

Copy link
Copy Markdown
Member

@ivanmantova @alexey-milovidov please check #100119

zvonand added a commit to Altinity/ClickHouse that referenced this pull request May 21, 2026
Antalya 26.3 Backport of ClickHouse#99521, ClickHouse#100150 - Add Arrow and Parquet format support for UUID data type
subkanthi pushed a commit to Altinity/ClickHouse that referenced this pull request May 26, 2026
…rquet-uuid

Add Arrow and Parquet format support for UUID data type
subkanthi pushed a commit to Altinity/ClickHouse that referenced this pull request May 26, 2026
Antalya 26.3 Backport of ClickHouse#99521, ClickHouse#100150 - Add Arrow and Parquet format support for UUID data type
il9ue pushed a commit to il9ue/ClickHouse that referenced this pull request Jun 1, 2026
…rquet-uuid

Add Arrow and Parquet format support for UUID data type
arthurpassos added a commit to Altinity/ClickHouse that referenced this pull request Oct 8, 2026
…row-parquet-uuid

Antalya 25.8 - Backport of ClickHouse#99521 Parquet UUID support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-improvement Pull request with some product improvements 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.

Support UUID for format Arrow

5 participants