You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++][Dataset] Parquet schema lost on dataset write #45969
As a user of the Arrow Dataset API I would like to write partitioned data and preserve Parquet schema information.
For example, I may have an arrow::Table containing Parquet INTERVAL data stored in it's physical type representation, a fixed_len_byte_array of length 12. Because no arrow::Schema types are a direct match I use a arrow::FixedSizeBinaryBuilder to create the table. Existing properties and arrow::dataset::FileSystemDataset::Write() don't support providing a native schema for the output file format. As a result, the Parquet logical types of written data that do not have an arrow::schema equivalent are lost.
Some Parquet logical types affected:
interval
uuid
enum
json
bson
Current behavior: When using the Arrow Dataset API, data type roundtripping is limited by the types arrow::schema can represent
Desired behavior: Provide a parquet schema that allows the user to specify a target schema.
This would probably need to be added to the Arrow-Parquet C++ APIs first. I see two possible kinds of API:
expose an additional parameter to pass the full Parquet schema (we would need to validate the Parquet schema is compatible with the provided Arrow data)
allow specifying the Parquet logical type of a Arrow column, using dedicated key-value metadata: we need to devise a binary encoding for a Parquet node description (can we use Thrift?)
I'll add that I wasn't able to find a suitable workaround before realizing an enhancement would be ideal.
I tried writing with the uuid extension type. Since that didn't work I assumed extension types wouldn't work in general. I didn't realize there were extra steps to cover the to/from Parquet process. Thanks for linking that PR.
This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this improvement is still desired but has no current owner, please add the 'Status: needs champion' label.
Activity
pitrou commentedon Mar 31, 2025
This would probably need to be added to the Arrow-Parquet C++ APIs first. I see two possible kinds of API:
@wgtmac @mapleFU
mapleFU commentedon Mar 31, 2025
Emmm can this be solved by direct mapping arrow type / extension type to specific Parquet Logical Type (like json and uuid) ?
I'm ok to add the api to pass the full parquet schema, but maybe it's a bit complex for just these schemas?
wgtmac commentedon Mar 31, 2025
I'm in favor of this because it is simple.
However, these logical types have different issues out there:
jsonanduuid: both have canonical extension types.jsonhas been supported already whileuuidhas an in-progress PR: GH-43807: [C++][Python] Add UUID extension type conversion support to/from Parquet #45866bson: it does not have canonical extension type but it is similar to json.interval: IIRC, this type does not have a perfect mapping to Arrow's interval types.enum: AFAIK, this type is only supported by parquet-java. Not sure if we need to support it on our end.beryan commentedon Apr 1, 2025
I appreciate the discussion and consideration!
I'll add that I wasn't able to find a suitable workaround before realizing an enhancement would be ideal.
github-actions commentedon Jun 1, 2026
This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this improvement is still desired but has no current owner, please add the 'Status: needs champion' label.
beryan commentedon Jun 1, 2026
I still think this is a worthwhile enhancement! This means library users have type support limitations when writing partitioned parquet datasets.