init-js opened a new issue, #12233:
URL: https://github.com/apache/arrow-rs/issues/12233

   ### Describe the bug
   
   The two forms of 2-level list fail differently:
   
   - A bare repeated field gets the extension type attached to the list field, 
and `Field::try_with_extension_type` rejects it because the extension's 
`supports_data_type` does not accept a `List` 
([field.rs#L578](https://github.com/apache/arrow-rs/blob/30c5c3287cd5b99ca9aa0aec57509d076eb07347/arrow-schema/src/field.rs#L578),
 
[uuid.rs#L55-L62](https://github.com/apache/arrow-rs/blob/30c5c3287cd5b99ca9aa0aec57509d076eb07347/arrow-schema/src/extension/canonical/uuid.rs#L55-L62)):
   
     ```
     message test_schema {
         repeated fixed_len_byte_array(16) col (UUID);
     }
     ```
   
     fails with `Uuid data type mismatch, expected FixedSizeBinary(16), found 
List(non-null FixedSizeBinary(16), field: 'col', metadata: 
{"ARROW:extension:name": "arrow.uuid"})`. Each of the other types fails with 
its own storage check, for example `Json data type mismatch, expected one of 
Utf8, LargeUtf8, Utf8View, found List(...)`.
   
   - A LIST group whose repeated child is the element converts without error, 
but the element silently loses its extension type:
   
     ```
     message test_schema {
         optional group col (LIST) {
             repeated fixed_len_byte_array(16) element (UUID);
         }
     }
     ```
   
     converts to `List<FixedSizeBinary(16)>` with no `arrow.uuid` on the 
element.
   
   3-level lists are not affected: their element is a separate, non-repeated 
node, converted on its own 
([complex.rs#L626](https://github.com/apache/arrow-rs/blob/30c5c3287cd5b99ca9aa0aec57509d076eb07347/parquet/src/arrow/schema/complex.rs#L626)).
   
   ### To Reproduce
   
   - Build parquet with the arrow_canonical_extension_types feature. 
   
   - Call parquet_to_arrow_schema on the schema `message schema { repeated 
fixed_len_byte_array(16) col (UUID); }`, and it returns Uuid data type 
mismatch, expected FixedSizeBinary(16), found List(...) because arrow.uuid was 
attached to the list field. 
   
   - Then, convert `message schema { optional group col (LIST) { repeated 
fixed_len_byte_array(16) element (UUID); } }`. This one succeeds, but the 
resulting `List<FixedSizeBinary(16)>` element has no arrow.uuid extension. 
   
   - Using JSON, GEOMETRY, GEOGRAPHY, VARIANT or FILE in place of UUID, with 
their features enabled, gives the same results.
   
   ### Expected behavior
   
   The annotation should go onto the wrapped element, not the List wrapper.
   
   ### Additional context
   
   Initially submitted PR on a fork, and reviewed by colleagues separately.
   
   https://github.com/init-js/arrow-rs/pull/1
   
   Thanks to @Kurtiscwright, @dannycjones for reviews.
   
   ### Willingness to contribute
   
   I plan to contribute a fix for this bug independently


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