pitrou commented on code in PR #5080:
URL: https://github.com/apache/arrow-rs/pull/5080#discussion_r1394975959
##########
arrow-integration-testing/src/lib.rs:
##########
@@ -100,3 +166,146 @@ pub fn read_gzip_json(version: &str, path: &str) ->
ArrowJson {
let arrow_json: ArrowJson = serde_json::from_str(&s).unwrap();
arrow_json
}
+
+//
+// C Data Integration entrypoints
+//
+
+fn cdata_integration_export_schema_from_json(
+ c_json_name: *const i8,
+ out: *mut FFI_ArrowSchema,
+) -> Result<()> {
+ let json_name = unsafe { CStr::from_ptr(c_json_name) };
+ let f = read_json_file_metadata(json_name.to_str()?)?;
+ let c_schema = FFI_ArrowSchema::try_from(&f.schema)?;
+ // Move exported schema into output struct
+ unsafe { ptr::replace(out, c_schema) };
Review Comment:
Should probably use `ptr::write` instead (`out` is not supposed to be
initialized).
--
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]