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

   **Describe the bug**
   
   When constructing a `Field` from an `FFI_ArrowSchema`, it calls the `name()` 
method:
   
https://github.com/apache/arrow-rs/blob/2461a16c19ee5032531b1c05dd7e7192bc842e0f/arrow-schema/src/ffi.rs#L585
   That method asserts that name is not null:
   
https://github.com/apache/arrow-rs/blob/2461a16c19ee5032531b1c05dd7e7192bc842e0f/arrow-schema/src/ffi.rs#L265
   
   But according to the C Data Interface spec, it is allowed for the name to be 
null:
   
   > `const char *ArrowSchema.name`
   > Optional. A null-terminated, UTF8-encoded string of the field or array 
name. This is mainly used to reconstruct child fields of nested types.
   >
   > Producers MAY decide not to provide this information, and consumers MAY 
decide to ignore it. If omitted, MAY be NULL or an empty string.
   
   I would argue that this function should _at least not panic_ on spec-valid 
input. It should either infer a blank name for that field or return a 
user-recoverable `Error`.
   
   **To Reproduce**
   
   I can try to provide a full rust repro case if necessary; the claimed bug 
should be clear without a full repro case.
   
   **Expected behavior**
   
   Expected not to panic.
   
   **Additional context**
   
   I hit this in my arro3 project, where I pass in a pyarrow `Schema` and try 
to reconstruct it on the Rust side as a `Field`. This is slightly simpler 
because I can directly get a single `DataType::Struct` with all fields, rather 
than accessing the fields of a `Schema` and then passing that to 
`DataType::Struct`. But since the pyarrow Schema doesn't set a name on the 
Arrow C Schema, this fails.
   
   Since they're communicating via a valid Arrow C Schema, I would argue this 
should work, and at least not panic.
   


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