Repository navigation
parquet: introduce FILE logical type - #10109
Conversation
etseidl
left a comment
There was a problem hiding this comment.
Looks good, just one test nit.
I marked this as a breaking change since it adds a variant to a public enum.
| assert!(result | ||
| .unwrap_err() | ||
| .to_string() | ||
| .contains("unrecognized field")); |
There was a problem hiding this comment.
Nit: in general I prefer full string compares to contains. In this case it should at least test for the specific unrecognized field name 'unknown_field'.
|
Looking very nice. Could you also add a roundtrip test to/from parquet? 🙏 Also, do you have any plans to add a |
|
are we keen on getting this in for release 60.0.0? |
Now that the spec change has happened, I think so. @brkyvz do you have time to work on this? |
|
@etseidl yes, will update hopefully today or tomorrow |
The FILE logical type no longer supports self-references (a byte range within the current file addressed by offset/size with no uri). A uri is always resolved as an external reference, and offset/size apply only to data referenced by uri. Update the LogicalType::File doc comment to match the revised spec wording. Co-authored-by: Isaac <[email protected]>
|
I took the liberty of creating an issue and linking this to it. |
|
Thank you so much @etseidl ! |
etseidl
left a comment
There was a problem hiding this comment.
Thanks @brkyvz, I think this is a good start. I'd like to validate this against an example parquet file, but that can be done as a follow up. I think the important thing is to get the LogicalType enum updated for inclusion in 60.0.0.
FILE logical type
# Which issue does this PR close? - Closes apache#10900. # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> Introduces the reference implementation for the new LogicalTypeAnnotation File as discussed in this [design document](https://docs.google.com/document/d/1AiwrstqkwkBoOZqgOkm9JGwSMcNeHyLR7EEj1CVqpZQ/edit?tab=t.0#heading=h.k8qyue4jj4rn) # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Introduces a new LogicalTypeAnnotation called FILE. It enforces that a group with this type annotation have the following fields by name: ``` uri STRING offset INT64 size INT64 content_type STRING checksum STRING inline BINARY ``` # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. --> Yes, unit tested # Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please call them out. --> Introduces a new LogicalTypeAnnotation called FILE --------- Co-authored-by: Isaac <[email protected]> Co-authored-by: Jefffrey <[email protected]>
# Which issue does this PR close? - Closes apache#10900. # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> Introduces the reference implementation for the new LogicalTypeAnnotation File as discussed in this [design document](https://docs.google.com/document/d/1AiwrstqkwkBoOZqgOkm9JGwSMcNeHyLR7EEj1CVqpZQ/edit?tab=t.0#heading=h.k8qyue4jj4rn) # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Introduces a new LogicalTypeAnnotation called FILE. It enforces that a group with this type annotation have the following fields by name: ``` uri STRING offset INT64 size INT64 content_type STRING checksum STRING inline BINARY ``` # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. --> Yes, unit tested # Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please call them out. --> Introduces a new LogicalTypeAnnotation called FILE --------- Co-authored-by: Isaac <[email protected]> Co-authored-by: Jefffrey <[email protected]>
# Which issue does this PR close? - Closes apache#10900. # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> Introduces the reference implementation for the new LogicalTypeAnnotation File as discussed in this [design document](https://docs.google.com/document/d/1AiwrstqkwkBoOZqgOkm9JGwSMcNeHyLR7EEj1CVqpZQ/edit?tab=t.0#heading=h.k8qyue4jj4rn) # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Introduces a new LogicalTypeAnnotation called FILE. It enforces that a group with this type annotation have the following fields by name: ``` uri STRING offset INT64 size INT64 content_type STRING checksum STRING inline BINARY ``` # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. --> Yes, unit tested # Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please call them out. --> Introduces a new LogicalTypeAnnotation called FILE --------- Co-authored-by: Isaac <[email protected]> Co-authored-by: Jefffrey <[email protected]>
# Which issue does this PR close? - Closes apache#10900. # Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> Introduces the reference implementation for the new LogicalTypeAnnotation File as discussed in this [design document](https://docs.google.com/document/d/1AiwrstqkwkBoOZqgOkm9JGwSMcNeHyLR7EEj1CVqpZQ/edit?tab=t.0#heading=h.k8qyue4jj4rn) # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> Introduces a new LogicalTypeAnnotation called FILE. It enforces that a group with this type annotation have the following fields by name: ``` uri STRING offset INT64 size INT64 content_type STRING checksum STRING inline BINARY ``` # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. --> Yes, unit tested # Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please call them out. --> Introduces a new LogicalTypeAnnotation called FILE --------- Co-authored-by: Isaac <[email protected]> Co-authored-by: Jefffrey <[email protected]>
…n type (apache#11877) # Which issue does this PR close? - Closes apache#11876. # Rationale for this change apache#10109 added the Parquet `FILE` logical type, but not its Arrow mapping. A `FILE` group reads as a plain struct, and `ArrowWriter` cannot write the annotation, so Arrow-based writers cannot produce conforming `FILE` columns. # What changes are included in this PR? Following the Variant precedent: - A new `parquet::arrow::file_type::FileType` extension type, named `arrow.parquet.file`, with no metadata. Its storage is a struct whose fields are any subset of `uri`, `offset`, `size`, `content_type`, `checksum`, `inline`, each nullable, matching the Parquet-side validation from apache#10109 (string fields accept `Utf8`/`LargeUtf8`/`Utf8View`, `inline` accepts any binary type). - Read: `try_add_extension_type` / `has_extension_type` tag a `FILE` group with `FileType`. - Write: `logical_type_for_struct` returns `LogicalType::File` for a struct field with `FileType`; its gating now covers either `variant_experimental` or `file_experimental`. Sub-field ids come from the existing `PARQUET:field_id` metadata. - A `file_experimental` feature (also part of `experimental`), documented in the README and crate docs, and a CI compile check with `--no-default-features --features file_experimental`. # Are these changes tested? Yes, in `parquet/src/arrow/file_type.rs`: accepted and rejected struct shapes, an Arrow to Parquet to Arrow schema round trip (annotation and field ids), a struct without the extension staying unannotated, and `ArrowWriter` write and read round trips at the top level and as a list element. Locally: `cargo test -p parquet --all-features --lib` passes, `cargo clippy -p parquet --all-targets --all-features -- -D warnings` is clean, docs build with `-D warnings`, and `cargo check -p parquet` passes with default features, `variant_experimental` only, and `file_experimental` only. # Are there any user-facing changes? A new, experimental, opt-in `file_experimental` feature and `FileType` extension type. No change without the feature. The code, tests, and this description were drafted with an AI assistant and reviewed by me before submitting. This pull request and its description were written by Isaac. --------- Signed-off-by: Dejan Krakovic <[email protected]> Co-authored-by: dejankrak-db <[email protected]> Co-authored-by: Isaac <[email protected]>
Which issue does this PR close?
FILElogical type #10900.Rationale for this change
Introduces the reference implementation for the new LogicalTypeAnnotation File as discussed in this design document
What changes are included in this PR?
Introduces a new LogicalTypeAnnotation called FILE. It enforces that a group with this type annotation have the following fields by name:
Are these changes tested?
Yes, unit tested
Are there any user-facing changes?
Introduces a new LogicalTypeAnnotation called FILE