bit2swaz commented on code in PR #10764:
URL: https://github.com/apache/arrow-rs/pull/10764#discussion_r3823493569
##########
arrow-schema/src/ffi.rs:
##########
@@ -194,12 +194,25 @@ impl FFI_ArrowSchema {
Ok(self)
}
- /// Add metadata to the schema
- pub fn with_metadata<I, S>(mut self, metadata: I) -> Result<Self,
ArrowError>
+ /// Add metadata to the schema.
+ ///
+ /// # Safety
+ ///
+ /// Reinterprets `private_data` as a value this crate produced. `self` must
+ /// come from arrow-rs (e.g. [`FFI_ArrowSchema::try_new`] or a `TryFrom`),
+ /// not a foreign producer. See
<https://github.com/apache/arrow-rs/issues/10679>.
+ pub unsafe fn with_metadata<I, S>(mut self, metadata: I) -> Result<Self,
ArrowError>
where
I: IntoIterator<Item = (S, S)>,
S: AsRef<str>,
{
+ // empty() leaves private_data null; error instead of deref-ing it
(#10286).
+ if self.private_data.is_null() {
Review Comment:
right. ill swap the "empty errors" test for a metadata round-trip thru an
empty schema and run it under miri. brb
--
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]