Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove APIs deprecated in 50.0.0 #6838

Merged
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
15 changes: 0 additions & 15 deletions arrow-array/src/ffi_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,21 +379,6 @@ impl RecordBatchReader for ArrowArrayStreamReader {
}
}

/// Exports a record batch reader to raw pointer of the C Stream Interface provided by the consumer.
///
/// # Safety
/// Assumes that the pointer represents valid C Stream Interfaces, both in memory
/// representation and lifetime via the `release` mechanism.
#[deprecated(since = "50.0.0", note = "Use FFI_ArrowArrayStream::new")]
pub unsafe fn export_reader_into_raw(
reader: Box<dyn RecordBatchReader + Send>,
out_stream: *mut FFI_ArrowArrayStream,
) {
let stream = FFI_ArrowArrayStream::new(reader);

std::ptr::write_unaligned(out_stream, stream);
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
24 changes: 3 additions & 21 deletions arrow-buffer/src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::fmt::Debug;
use std::ptr::NonNull;
use std::sync::Arc;

use crate::alloc::{Allocation, Deallocation, ALIGNMENT};
use crate::alloc::{Allocation, Deallocation};
use crate::util::bit_chunk_iterator::{BitChunks, UnalignedBitChunk};
use crate::BufferBuilder;
use crate::{bit_util, bytes::Bytes, native::ArrowNativeType};
Expand Down Expand Up @@ -99,26 +99,6 @@ impl Buffer {
buffer.into()
}

/// Creates a buffer from an existing aligned memory region (must already be byte-aligned), this
/// `Buffer` will free this piece of memory when dropped.
///
/// # Arguments
///
/// * `ptr` - Pointer to raw parts
/// * `len` - Length of raw parts in **bytes**
/// * `capacity` - Total allocated memory for the pointer `ptr`, in **bytes**
///
/// # Safety
///
/// This function is unsafe as there is no guarantee that the given pointer is valid for `len`
/// bytes. If the `ptr` and `capacity` come from a `Buffer`, then this is guaranteed.
#[deprecated(since = "50.0.0", note = "Use Buffer::from_vec")]
pub unsafe fn from_raw_parts(ptr: NonNull<u8>, len: usize, capacity: usize) -> Self {
assert!(len <= capacity);
let layout = Layout::from_size_align(capacity, ALIGNMENT).unwrap();
Buffer::build_with_arguments(ptr, len, Deallocation::Standard(layout))
}

/// Creates a buffer from an existing memory region. Ownership of the memory is tracked via reference counting
/// and the memory will be freed using the `drop` method of [crate::alloc::Allocation] when the reference count reaches zero.
///
Expand Down Expand Up @@ -322,6 +302,8 @@ impl Buffer {
/// Returns `MutableBuffer` for mutating the buffer if this buffer is not shared.
/// Returns `Err` if this is shared or its allocation is from an external source or
/// it is not allocated with alignment [`ALIGNMENT`]
///
/// [`ALIGNMENT`]: crate::alloc::ALIGNMENT
pub fn into_mutable(self) -> Result<MutableBuffer, Self> {
let ptr = self.ptr;
let length = self.length;
Expand Down
29 changes: 1 addition & 28 deletions arrow-schema/src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use std::ops::Deref;
use std::sync::Arc;

use crate::{ArrowError, DataType, Field, FieldRef, SchemaBuilder};
use crate::{ArrowError, DataType, Field, FieldRef};

/// A cheaply cloneable, owned slice of [`FieldRef`]
///
Expand Down Expand Up @@ -256,33 +256,6 @@ impl Fields {
.collect();
Ok(filtered)
}

/// Remove a field by index and return it.
///
/// # Panic
///
/// Panics if `index` is out of bounds.
///
/// # Example
/// ```
/// use arrow_schema::{DataType, Field, Fields};
/// let mut fields = Fields::from(vec![
/// Field::new("a", DataType::Boolean, false),
/// Field::new("b", DataType::Int8, false),
/// Field::new("c", DataType::Utf8, false),
/// ]);
/// assert_eq!(fields.len(), 3);
/// assert_eq!(fields.remove(1), Field::new("b", DataType::Int8, false).into());
/// assert_eq!(fields.len(), 2);
/// ```
#[deprecated(since = "50.0.0", note = "Use SchemaBuilder::remove")]
#[doc(hidden)]
pub fn remove(&mut self, index: usize) -> FieldRef {
let mut builder = SchemaBuilder::from(Fields::from(&*self.0));
let field = builder.remove(index);
*self = builder.finish().fields;
field
}
}

impl Default for Fields {
Expand Down
27 changes: 0 additions & 27 deletions arrow-schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,33 +434,6 @@ impl Schema {
.iter()
.all(|(k, v1)| self.metadata.get(k).map(|v2| v1 == v2).unwrap_or_default())
}

/// Remove field by index and return it. Recommend to use [`SchemaBuilder`]
/// if you are looking to remove multiple columns, as this will save allocations.
///
/// # Panic
///
/// Panics if `index` is out of bounds.
///
/// # Example
///
/// ```
/// use arrow_schema::{DataType, Field, Schema};
/// let mut schema = Schema::new(vec![
/// Field::new("a", DataType::Boolean, false),
/// Field::new("b", DataType::Int8, false),
/// Field::new("c", DataType::Utf8, false),
/// ]);
/// assert_eq!(schema.fields.len(), 3);
/// assert_eq!(schema.remove(1), Field::new("b", DataType::Int8, false).into());
/// assert_eq!(schema.fields.len(), 2);
/// ```
#[deprecated(since = "50.0.0", note = "Use SchemaBuilder::remove")]
#[doc(hidden)]
#[allow(deprecated)]
pub fn remove(&mut self, index: usize) -> FieldRef {
self.fields.remove(index)
}
}

impl fmt::Display for Schema {
Expand Down
Loading