Repository navigation
Support the Parquet FILE logical type - #125132
Conversation
…ormat master This brings the `ALP` encoding and the `FILE` logical type into the generated Thrift code used by the native Parquet reader and writer. Related: ClickHouse/arrow#87 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tree is identical; this points the submodule at the commit on the `ClickHouse/apache-arrow-25.0.0` branch. Related: ClickHouse/arrow#87 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`FILE` (added to parquet-format in 2026) annotates a group that references a range of bytes stored inline or in an external file, with any subset of the `OPTIONAL` fields `uri`, `offset`, `size`, `content_type`, `checksum`, `inline`. Reading: the schema of a `FILE` group is validated (only these fields, `OPTIONAL`, with the types from the specification; otherwise `INCORRECT_DATA`), then the group is read as an ordinary named `Tuple` of `Nullable` elements, so subsets of fields and subcolumns work as for any tuple. Values are not validated. A repeated `FILE` group under `LIST` is the list element even with one field. Writing: with the new setting `output_format_parquet_write_file_logical_type`, a named `Tuple` whose element names are a non-empty subset of the `FILE` fields is written as a `FILE`-annotated group, with integer `offset`/`size` converted to `Int64` and string fields to `String`, all `OPTIONAL`. The tests include a reference file written by arrow-rs (`parquet` crate, which implements `FILE`). Co-Authored-By: Claude Opus 5.5 <[email protected]>
It contains raw binary `inline` values and is tested by `05361_parquet_file_logical_type_arrow_rs`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ings Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [6e80547] Summary: ✅
AI ReviewSummaryThis PR adds native Parquet reader and writer support for the Final VerdictStatus: ✅ Approve |
The fast test build has no Parquet support, so these tests fail with `Unknown format Parquet`. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125132&sha=07c369ab7acda9288ab0637b855316f99bc7de8c&name_0=PR&name_1=Fast%20test #125132 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Commit See the job log for details. |
A malformed schema with `logicalType.FILE` on a primitive element was read as an ordinary scalar instead of being rejected with `INCORRECT_DATA`. Add a test case for it to `05360_parquet_file_logical_type_schema_validation`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125132&sha=d365d68dcd1b0bc928d40ef24c752fa928bee61f&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29 ( |
|
The fix is already in progress: #123121 (mine, open). The linked run is not a timeout. This is the #112642 race: with a local plan, the query sent to the replicas can start before the initiator has materialized the CTE. On #123121 (head #123121 is waiting for review from @ novikd and @ devcrafter. |
There was a problem hiding this comment.
The code LGTM. This is an obscure feature, hardly supported by anyone. But it is in the spec, and we can let it in our codebase. For the readers, one obvious thing: we don't read arbitrary external files 🤣 Otherwise, it would be a million-dollar trap like XXE.
Support the Parquet
FILElogical type (https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#file) in the native Parquet reader and writer. It annotates a group that references a range of bytes stored inline or in an external file (fieldsuri,offset,size,content_type,checksum,inline).The first commits update
contrib/arrowto have theFILElogical type in the generated Thrift code (sync ofparquet.thriftwith apache/parquet-format master).Reading: a
FILEgroup is read as a namedTupleof the fields present in the file:Nullable(String)foruri,content_type,checksum,inlineandNullable(Int64)foroffset,size. Type hints, subsets and subcolumns work as for other groups. The schema of the group is validated (field names, types,OPTIONALrepetition) and a non-conforming schema throwsINCORRECT_DATA. Row values are returned as stored, without checking that they form a valid reference.Writing: with the new setting
output_format_parquet_write_file_logical_type(disabled by default, because readers that do not know the type, e.g. Arrow C++ / pyarrow, cannot open such files), a namedTuplewhose element names are allFILEfields is written as aFILE-annotated group withOPTIONALfields.Interoperability is tested with a file written by arrow-rs (which has
FILEsupport since apache/arrow-rs#10109); arrow-rs also reads files written by ClickHouse.Related: ClickHouse/arrow#87
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Support the Parquet
FILElogical type (a reference to bytes stored inline or in an external file): it is read as a namedTuple, and can be written from aTuplewith the corresponding element names with the new settingoutput_format_parquet_write_file_logical_type.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125132]
Version info
26.10.1.2334-master(included in26.10and later)