-
Notifications
You must be signed in to change notification settings - Fork 494
Introduces a new LogicalType: FILE #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
7d966f0
b6ae0de
0f05340
bcbabcc
117b3d1
4ff444e
278c9c0
7186bca
a60d312
f03610e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -635,7 +635,133 @@ The type has two type parameters: | |||||||
|
|
||||||||
| The sort order used for `GEOGRAPHY` is undefined. When writing data, no min/max | ||||||||
| statistics should be saved for this type and if such non-compliant statistics | ||||||||
| are found during reading, they must be ignored. | ||||||||
| are found during reading, they must be ignored. | ||||||||
|
|
||||||||
| ### FILE | ||||||||
|
|
||||||||
| `FILE` annotates a group that represents a reference to a range of bytes, which may | ||||||||
| be stored inline in the value, elsewhere within this file, or in an external file. It | ||||||||
| is intended for use cases such as storing file inventories, manifests, and unstructured | ||||||||
| data references (e.g., images or audio files stored in object storage). | ||||||||
|
|
||||||||
| The annotated group may contain the following fields, identified by name. Field IDs | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
| may also be used for projection. All fields are optional: | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
|
|
||||||||
| | Field | Type | Required | | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
| |----------------|------------|----------| | ||||||||
| | `path` | STRING | No | | ||||||||
| | `offset` | INT64 | No | | ||||||||
| | `size` | INT64 | No | | ||||||||
| | `content_type` | STRING | No | | ||||||||
| | `checksum` | STRING | No | | ||||||||
| | `inline` | BYTE_ARRAY | No | | ||||||||
|
|
||||||||
| A value resolves to bytes determined by `inline` / `path` / `offset` / `size`; | ||||||||
| `content_type` and `checksum` are metadata describing whatever is resolved. | ||||||||
|
|
||||||||
|
brkyvz marked this conversation as resolved.
|
||||||||
| #### Fields | ||||||||
|
|
||||||||
|
etseidl marked this conversation as resolved.
|
||||||||
| ##### path | ||||||||
|
|
||||||||
| An opaque path string to an external file (e.g., `s3://bucket/file.jpg`). No special | ||||||||
| encoding (e.g., URI encoding) is applied on top of the user provided data. If `path` is absent, | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
| the value refers to this file (a self-reference). | ||||||||
|
|
||||||||
| ##### offset | ||||||||
|
|
||||||||
| A byte offset indicating the start of the byte range within the referenced data. | ||||||||
| If not provided, readers must treat the value as 0. | ||||||||
| If provided and non-zero, readers must seek to this offset to retrieve the referenced data. | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
|
|
||||||||
| ##### size | ||||||||
|
|
||||||||
| The byte length of the referenced data. Must be zero or a positive integer if provided. | ||||||||
| A value of 0 indicates empty referenced data. If not provided, the range runs to the end | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
brkyvz marked this conversation as resolved.
Outdated
|
||||||||
| of the referenced data. | ||||||||
|
|
||||||||
| ##### content_type | ||||||||
|
|
||||||||
| The media type (MIME type) of the resolved bytes (e.g., `image/png`). | ||||||||
|
|
||||||||
| ##### checksum | ||||||||
|
|
||||||||
| A self-describing integrity token for the resolved bytes, of the form | ||||||||
| `<algorithm>:base64(<digest bytes>)`. It generalizes the storage-system eTag. The | ||||||||
|
brkyvz marked this conversation as resolved.
Outdated
|
||||||||
| recognized algorithms are: | ||||||||
|
brkyvz marked this conversation as resolved.
Outdated
|
||||||||
|
|
||||||||
| | Algorithm | Notes | | ||||||||
| |-----------|----------------------------------------------------------------| | ||||||||
| | `ETAG` | the object-store eTag — equality-only, not recomputable | | ||||||||
| | `MD5` | the usual S3/HTTP eTag and Content-MD5 | | ||||||||
| | `CRC32` | Parquet's page-checksum algorithm (gzip/zlib) | | ||||||||
| | `CRC32C` | common in object stores, hardware-accelerated | | ||||||||
| | `SHA-256` | e.g. S3 additional checksums | | ||||||||
|
brkyvz marked this conversation as resolved.
Outdated
|
||||||||
|
|
||||||||
| `checksum` applies to the resolved bytes, except for `ETAG`, which is the | ||||||||
| object-store eTag for the whole file referenced by `path`. | ||||||||
|
|
||||||||
| ##### inline | ||||||||
|
|
||||||||
| The referenced bytes stored inline in the value. If `inline` is set, it supplies the | ||||||||
| bytes and any locator fields (`path`, `offset`, `size`) that are present are provenance | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
| only. | ||||||||
|
|
||||||||
| #### Resolution | ||||||||
|
|
||||||||
| A value resolves to bytes based on which of `inline`, `path`, `offset`, and `size` are | ||||||||
| set: | ||||||||
|
|
||||||||
| | `inline` | `path` | `offset` | `size` | Resolves to | | ||||||||
| |----------|--------|----------|--------|----------------------------------------------| | ||||||||
| | set | – | – | – | the inline bytes | | ||||||||
| | – | set | – | – | whole external file at `path` | | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be invalid with the new requirements for |
||||||||
| | – | set | set | – | external `path`, `[offset, EOF)` | | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be invalid with the new requirements for |
||||||||
| | – | set | – | set | external `path`, `[0, size)` | | ||||||||
| | – | set | set | set | external `path`, `[offset, offset + size)` | | ||||||||
| | – | – | set | – | this file, `[offset, EOF)` (self-reference) | | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be invalid with the new requirements for |
||||||||
| | – | – | – | set | this file, `[0, size)` (self-reference) | | ||||||||
| | – | – | set | set | this file, `[offset, offset + size)` (self-reference) | | ||||||||
| | – | – | – | – | nothing — invalid | | ||||||||
|
|
||||||||
| A self-reference typically points within the same Parquet file using `offset` and | ||||||||
| `size`; the bytes are written between column chunks and are not otherwise referenced by | ||||||||
| the footer. A self-reference is the absence of `path`, never an absolute path back to | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
| the current file, so a file containing self-references is renamed or relocated as a | ||||||||
| single unit. | ||||||||
|
|
||||||||
| The referenced bytes are compressed with the same `CompressionCodec` as the one | ||||||||
| specified for the `inline` column. | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make this clearer.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we point out |
||||||||
|
|
||||||||
| #### Validation | ||||||||
|
|
||||||||
| * A value must resolve to some referenced data. If none of `inline`, `path`, `offset`, or | ||||||||
| `size` is set, the value does not resolve and is invalid; use column nullability to | ||||||||
| represent a null value. | ||||||||
| * If `inline` is set, it supplies the bytes; producers may instead treat `inline` and the | ||||||||
| locator fields as mutually exclusive. | ||||||||
| * Field names within a `FILE`-annotated group must not be renamed. | ||||||||
| * Additional metadata about the file (e.g., modification timestamp) should | ||||||||
|
etseidl marked this conversation as resolved.
Outdated
|
||||||||
| be stored adjacent to this struct by engines or table formats, not inside it. | ||||||||
|
|
||||||||
| Statistics may be collected for the individual fields of a `FILE`-annotated group | ||||||||
| according to the sort order of each field's logical type. | ||||||||
|
|
||||||||
| This is an example `FILE`-annotated group in Parquet: | ||||||||
|
|
||||||||
| ``` | ||||||||
| optional group my_file (FILE) { | ||||||||
| optional binary path (STRING); | ||||||||
| optional int64 offset; | ||||||||
| optional int64 size; | ||||||||
| optional binary content_type (STRING); | ||||||||
| optional binary checksum (STRING); | ||||||||
| optional binary inline; | ||||||||
| } | ||||||||
| ``` | ||||||||
|
|
||||||||
| *Compatibility* | ||||||||
|
brkyvz marked this conversation as resolved.
Outdated
|
||||||||
|
|
||||||||
| `FILE` has no corresponding `ConvertedType`. | ||||||||
|
|
||||||||
| ## Nested Types | ||||||||
|
|
||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.