AndreaBozzo commented on issue #7136:
URL: https://github.com/apache/arrow-rs/issues/7136#issuecomment-6504693368
> 14\. > let imported = unsafe { from_ffi(ffi,
&FFI_ArrowSchema::try_from(&DataType::Utf8)?) }?;
>
>
> https://docs.rs/arrow/latest/arrow/array/ffi/fn.from_ffi.html
> > This struct assumes that the incoming data agrees with the C data
interface.
>
>
> Since the spec says this data needs to be aligned and you call
`unsafe` you assert that it is (which is is not) I don't think this is a bug
> I think the idea is if you need to read data from a source that
produces unaligned buffers you should use the `align_buffers` method (and/or
fix the producer)
Quoting the docs:
The C data interface spec says alignment is "recommended, but not required"
and consumers "MAY decide not to support unaligned memory", so I read unaligned
input as valid but refusable.
And since from_ffi already calls align_buffers (#10030), it seems to intend
to support it (?). The only issue is that buffer_len reads the offsets before
that runs. A read_unaligned there, or an error instead of the deref, would make
it consistent.
thanks for your time and help on this matter @alamb
--
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]