brkyvz commented on code in PR #585:
URL: https://github.com/apache/parquet-format/pull/585#discussion_r3632350959


##########
LogicalTypes.md:
##########
@@ -635,7 +635,183 @@ 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 the current 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 case 
sensitively,
+not by field order. Field IDs, if they exist, may also be used for projection. 
Every field
+is optional both in the schema and in the data: a writer may omit any field 
from the group
+definition, and any field that is present has a field repetition type of 
`OPTIONAL`.
+A group need only define the fields it uses (for example, an inline-only group 
may define
+just `inline`, and an external reference may define just `path`).
+
+| Field          | Type       |
+|----------------|------------|
+| `path`         | STRING     |
+| `offset`       | INT64      |
+| `size`         | INT64      |
+| `content_type` | STRING     |
+| `checksum`     | STRING     |
+| `inline`       | BYTE_ARRAY |
+
+A value resolves to bytes determined by `inline` / `path` / `offset` / `size`;
+`content_type` and `checksum` are metadata describing whatever is resolved.
+
+#### Fields
+
+For the descriptions below, a field is *set* when it is present in the `FILE` 
group
+and its value is non-null (and, for string fields, non-empty[1]). A field is 
*not set*
+when it is absent from the group, or is present but null or empty.
+
+[1] Implementations are not expected to treat empty strings as null
+
+##### path
+
+A URI-reference as defined by RFC 3986, encoded as a Parquet STRING (e.g., 
`s3://bucket/file.jpg`).
+The URI may be absolute or relative. No additional encoding (e.g., URI 
encoding) is applied on top
+of the user-provided data. If `path` is not set, the value refers to the 
current file
+(a self-reference).
+
+##### offset
+
+A byte offset indicating the start of the byte range within the referenced 
data.
+If not set, readers must treat the value as 0.
+If set and non-zero, readers must seek to this offset to retrieve the 
referenced data.
+`offset` must be set for a self-reference (`path` not set); it is optional for 
an
+external reference (`path` set). `offset` must not be < 0.
+
+##### size
+
+The byte length of the referenced data. Must be zero or a positive integer if 
set; a
+value of 0 indicates empty referenced data. `size` must be set whenever 
`offset` is set.
+It may be omitted only for a whole-file external reference (`path` set, 
`offset` not set),
+in which case the range runs to the end of the referenced file. Because a 
self-reference
+always sets `offset`, it always sets `size` as well.
+
+##### content_type
+
+The media type (MIME type), as defined by RFC 2046, of the resolved bytes 
(e.g., `image/png`).
+When not set, the type can be assumed as `application/octet-stream`.
+
+##### checksum
+
+A self-describing integrity token for the resolved bytes, of the form
+`<algorithm>:<digest>`, where `<digest>` is encoded according to the `Encoding`
+column below. Readers should ignore unknown algorithms. The recognized 
algorithms
+are:
+
+| Algorithm | Encoding      | Notes                                            
        |
+|-----------|---------------|----------------------------------------------------------|
+| `ETAG`    | opaque        | the object-store eTag, not recomputable          
        |
+| `MD5`     | lowercase hex | as defined in RFC 6151 represented as 32 hex 
characters  |
+| `CRC32`   | lowercase hex | as defined in RFC 3385, represented as 8 hex 
characters  |
+| `CRC32C`  | lowercase hex | as defined in RFC 9260, represented as 8 hex 
characters  |
+| `SHA-256` | lowercase hex | as defined in RFC 6234, represented as 64 hex 
characters |
+
+`<digest>` encodings are:
+
+* `lowercase hex`: the digest bytes rendered as lowercase hexadecimal, two
+  characters per byte and no separators (e.g. 
`MD5:d41d8cd98f00b204e9800998ecf8427e`).
+* `opaque`: the token supplied verbatim by the object store, used only for
+  equality comparison and not otherwise interpreted.
+
+`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 set are 
provenance
+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`        
                 |
+| –        | set    | set      | -      | invalid                              
                 |
+| –        | set    | –        | set    | external `path`, `[0, size)`         
                 |
+| –        | set    | set      | set    | external `path`, `[offset, offset + 
size)`            |
+| –        | -      | set      | -      | invalid                              
                 |
+| –        | -      | -        | set    | invalid                              
                 |
+| –        | –      | set      | set    | this file, `[offset, offset + size)` 
(self-reference) |
+| –        | –      | –        | –      | nothing — invalid                    
                 |

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to