Repository navigation
Read Paimon ROW columns as named Tuple - #128330
Conversation
A Paimon table with a `ROW` (struct) column, as written by Spark, Flink or pypaimon, could not be read at all: `DESCRIBE`, `SELECT *` and even `SELECT id` failed with `Unsupported Paimon type: ROW`, because `Paimon::DataType::parse` maps every field of the schema while the table schema is loaded and its composite branch knew only `ARRAY` and `MAP`. A `ROW` is now parsed recursively into `Tuple(<name> <type>, ...)`. A nullable composite is no longer passed through `makeNullableSafe`. It was a no-op for `Array` and `Map`, and for a `Tuple` it produces `Nullable(Tuple(...))`, which the Parquet reader rejects for a struct with nullable fields (the usual Paimon shape). Measured with the wrap kept for `ROW`: `DESCRIBE` reports `Nullable(Tuple(f0 Nullable(String), f1 Nullable(Int32)))` and `SELECT *` fails with `Requested type of column s doesn't match parquet schema: parquet type is Tuple, requested type is Nullable(Tuple(...))` (TYPE_MISMATCH), and the new integration test is red at its `DESC` assertion. Iceberg and Delta Lake map `struct` to an unwrapped `Tuple` as well, so a `NULL` row reads as a tuple of the fields' defaults. `test_errors.py::test_unsupported_row_type` asserted the removed error and is replaced by `test_types.py::test_row_type`. `04401` used `ROW` as its example of an unsupported nested type and now uses `MULTISET`. Closes ClickHouse#128307 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a nullable `s_req STRUCT<x: INT NOT NULL>` column. Its NULL row reads as `(0)`: a NULL ROW becomes a tuple of its fields' default values, and the default of a NOT NULL INT field is 0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 rounds, 1 finding) plus my own review (3 nits).
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261030-234000 |
|
Workflow [PR], commit [86206a3] Summary: ❌
AI ReviewSummaryThis PR makes Paimon tables containing Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
|
cc @JiaQiTang98 @SmitaRKulkarni, could you review this and add the |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes6 object files changed (-165.79 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units30 translation units recompiled, 311 s compile time in total, 30 of them have a recent master baseline. |
CI finish ledger - 86206a3Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The first runs of this head stopped at Session id: cron:our-pr-ci-monitor:20261031-140009 |
|
Fixing PR for the |
92ff928
Closes: #128307
Related: #128295
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Paimon tables with a
ROWcolumn can now be read: aROWis read as a namedTuple, like an Iceberg or Delta Lakestruct, and aNULLROWas a tuple of its fields' default values (NULLfor nullable fields). Before, every query on such a table failed withUnsupported Paimon type: ROW, even one that did not read theROWcolumn. Closes #128307.Description
A Paimon table with a
ROW(struct) column, as written by Spark (STRUCT<...>), Flink or pypaimon, could not be read at all:DESCRIBE,SELECT *andSELECT idfailed withUnsupported Paimon type: ROW (BAD_ARGUMENTS). Found by the foreign-writer fuzzer in #128295.Root cause.
Paimon::DataType::parsemaps every field of the schema file while the table schema is loaded, and its composite branch knew onlyARRAYandMAP.The change. A
ROWis parsed recursively intoTuple(<name> <type>, ...), so each field keeps its own nullability and nestedROW/ARRAY/MAPwork. A nullable composite is no longer passed throughmakeNullableSafe: that was a no-op forArray/Map, and for aTupleit would produceNullable(Tuple(...)), which the Parquet reader rejects (TYPE_MISMATCH) when the struct's fields are nullable, the usual Paimon shape. Iceberg and Delta Lake mapstructthe same way. TheROWrow is added to the documented type mapping.Sub-fields are matched by name, not by Paimon field id, so the rename case of #127545 also applies to them; that is out of scope here.
Validation. New
test_types.py::test_row_type(s3 and azure, written by Spark) coversROW NOT NULL,NOT NULLfields, nestedROW,ARRAY/MAPinside aROW,ARRAY<ROW>,MAP<K, ROW>, aNULLrow (nullable andNOT NULLfields) and subcolumn reads; it fails on master.test_errors.py::test_unsupported_row_typeasserted the removed error and is deleted;04401_paimon_unsupported_type_errornow usesMULTISET(still unsupported) as its example. The issue's pypaimon repro returns1 ('a',1). The Paimon stateless tests andtest_types.py/test_errors.pypass.Workflow [PR]
Sync PR [sync-upstream/pr/128330]
Version info
26.11.1.1063-master(included in26.11and later)