You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "borchero (via GitHub)" <gi...@apache.org> on 2026/08/02 00:56:11 UTC

[I] Dictionary "ordered" flag is not preserved when importing an FFI (C Data Interface) schema [arrow-rs]

borchero opened a new issue, #10513:
URL: https://github.com/apache/arrow-rs/issues/10513

   ### Describe the bug
   
   When converting an `FFI_ArrowSchema` (C Data Interface) into a Rust Field, the dictionary ordered flag is silently dropped. The C Data Interface encodes this via the `ARROW_FLAG_DICTIONARY_ORDERED` bit (`0b1`) in `ArrowSchema.flags`, and `FFI_ArrowSchema::dictionary_ordered()` reads it correctly — but `impl TryFrom<&FFI_ArrowSchema>` for `Field` never applies it to the resulting `Field`. As a result, a dictionary field that is exported with `dict_is_ordered = true` always comes back as `dict_is_ordered = false` after a round trip through the FFI schema.
   
   ### To Reproduce
   
   ```rust
   use arrow_schema::{DataType, Field};
   use arrow_schema::ffi::FFI_ArrowSchema;
   
   let field = Field::new(
       "dict",
       DataType::Dictionary(Box::new(DataType::Int32), Box::new(DataType::Utf8)),
       false,
   )
   .with_dict_is_ordered(true);
   
   // Export to the C Data Interface and import back.
   let ffi = FFI_ArrowSchema::try_from(&field).unwrap();
   assert!(ffi.dictionary_ordered()); // OK — flag is set on the FFI schema
   
   let roundtripped = Field::try_from(&ffi).unwrap();
   assert_eq!(roundtripped.dict_is_ordered(), Some(true)); // FAILS: returns Some(false)
   ```
   
   
   ### Expected behavior
   
   Importing an `FFI_ArrowSchema` whose `DICTIONARY_ORDERED` flag is set should produce a `Field` with `dict_is_ordered() == Some(true)`, so that exporting and re-importing a dictionary field is a lossless round trip.
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Dictionary "ordered" flag is not preserved when importing an FFI (C Data Interface) schema [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed issue #10513: Dictionary "ordered" flag is not preserved when importing an FFI (C Data Interface) schema
URL: https://github.com/apache/arrow-rs/issues/10513


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org