Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions arrow-array/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,37 +109,8 @@ use arrow_data::{ArrayData, layout};
pub use arrow_schema::ffi::FFI_ArrowSchema;
use arrow_schema::{ArrowError, DataType, UnionMode};

use crate::array::ArrayRef;

type Result<T> = std::result::Result<T, ArrowError>;

/// Exports an array to raw pointers of the C Data Interface provided by the consumer.
/// # Safety
/// Assumes that these pointers represent valid C Data Interfaces, both in memory
/// representation and lifetime via the `release` mechanism.
///
/// This function copies the content of two FFI structs [arrow_data::ffi::FFI_ArrowArray] and
/// [arrow_schema::ffi::FFI_ArrowSchema] in the array to the location pointed by the raw pointers.
/// Usually the raw pointers are provided by the array data consumer.
#[deprecated(
since = "52.0.0",
note = "Use FFI_ArrowArray::new and FFI_ArrowSchema::try_from"
)]
pub unsafe fn export_array_into_raw(
src: ArrayRef,
out_array: *mut FFI_ArrowArray,
out_schema: *mut FFI_ArrowSchema,
) -> Result<()> {
let data = src.to_data();
let array = FFI_ArrowArray::new(&data);
let schema = FFI_ArrowSchema::try_from(data.data_type())?;

unsafe { std::ptr::write_unaligned(out_array, array) };
unsafe { std::ptr::write_unaligned(out_schema, schema) };

Ok(())
}

/// returns the number of bits that buffer `i` (in the C data interface) is expected to have.
/// This is set by the Arrow specification
fn bit_width(data_type: &DataType, i: usize) -> Result<usize> {
Expand Down Expand Up @@ -1151,35 +1122,6 @@ mod tests_to_then_from_ffi {
Ok(())
}

#[test]
#[allow(deprecated)]
fn test_export_array_into_raw() -> Result<()> {
let array = make_array(Int32Array::from(vec![1, 2, 3]).into_data());

// Assume two raw pointers provided by the consumer
let mut out_array = FFI_ArrowArray::empty();
let mut out_schema = FFI_ArrowSchema::empty();

{
let out_array_ptr = std::ptr::addr_of_mut!(out_array);
let out_schema_ptr = std::ptr::addr_of_mut!(out_schema);
unsafe {
export_array_into_raw(array, out_array_ptr, out_schema_ptr)?;
}
}

// (simulate consumer) import it
let data = unsafe { from_ffi(out_array, &out_schema) }?;
let array = make_array(data);

// perform some operation
let array = array.as_any().downcast_ref::<Int32Array>().unwrap();

// verify
assert_eq!(array, &Int32Array::from(vec![1, 2, 3]));
Ok(())
}

#[test]
fn test_duration() -> Result<()> {
// create an array natively
Expand Down
9 changes: 0 additions & 9 deletions arrow-ipc/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1616,15 +1616,6 @@ impl<R: Read> StreamReader<R> {
})
}

/// Deprecated, use [`StreamReader::try_new`] instead.
#[deprecated(since = "53.0.0", note = "use `try_new` instead")]
pub fn try_new_unbuffered(
reader: R,
projection: Option<Vec<usize>>,
) -> Result<Self, ArrowError> {
Self::try_new(reader, projection)
}

/// Return the schema of the stream
pub fn schema(&self) -> SchemaRef {
self.schema.clone()
Expand Down
4 changes: 0 additions & 4 deletions arrow/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,5 @@ pub use arrow_data::{

pub use arrow_data::transform::{Capacities, MutableArrayData};

#[cfg(feature = "ffi")]
#[allow(deprecated)]
pub use arrow_array::ffi::export_array_into_raw;

// --------------------- Array's values comparison ---------------------
pub use arrow_ord::ord::{DynComparator, make_comparator};
Loading