etseidl commented on code in PR #11877:
URL: https://github.com/apache/arrow-rs/pull/11877#discussion_r4459768700


##########
parquet/src/arrow/file_type.rs:
##########
@@ -0,0 +1,349 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Arrow extension type for the Parquet [`FILE`] logical type.
+//!
+//! [`FILE`]: 
https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#file
+
+use arrow_schema::extension::ExtensionType;
+use arrow_schema::{ArrowError, DataType};
+
+/// Arrow extension type for the Parquet [`FILE`] logical type.
+///
+/// A `FILE` value is a reference to a range of bytes, stored inline or in an
+/// external file. Its Arrow storage type is a struct whose fields are a subset
+/// of the following, each nullable, identified by name, in any order:
+///
+/// | Field          | Arrow type                                  |
+/// |----------------|---------------------------------------------|
+/// | `uri`          | `Utf8`, `LargeUtf8`, or `Utf8View`          |
+/// | `offset`       | `Int64`                                     |
+/// | `size`         | `Int64`                                     |
+/// | `content_type` | `Utf8`, `LargeUtf8`, or `Utf8View`          |
+/// | `checksum`     | `Utf8`, `LargeUtf8`, or `Utf8View`          |
+/// | `inline`       | `Binary`, `LargeBinary`, or `BinaryView`    |
+///
+/// When reading, a `FILE`-annotated group is returned as a struct with this
+/// extension type. When writing, a struct field with this extension type is
+/// written as a `FILE`-annotated group.

Review Comment:
   Small doc nit my agent brought up, it's possible that a parquet file could 
have the FILE annotation in the parquet schema, but the embedded arrow schema 
says it's a plain struct. On read, if the embedded schema is used, the FILE 
annotation is lost. This isn't anything new or unique to this extension, but it 
is a caveat that might be worth mentioning here. The workaround is to read with 
`skip_arrow_metadata` set to `true`.



-- 
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]

Reply via email to