This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new a7b482e29 Remove APIs deprecated in 50.0.0 (#6838)
a7b482e29 is described below
commit a7b482e290512863ad0c1decc561a815765c4fb3
Author: Piotr Findeisen <[email protected]>
AuthorDate: Sat Dec 7 15:47:23 2024 +0100
Remove APIs deprecated in 50.0.0 (#6838)
50.0.0 was released 11 months ago. Remove the APIs that are deprecated
since then.
---
arrow-array/src/ffi_stream.rs | 15 ---------------
arrow-buffer/src/buffer/immutable.rs | 24 +++---------------------
arrow-schema/src/fields.rs | 29 +----------------------------
arrow-schema/src/schema.rs | 27 ---------------------------
4 files changed, 4 insertions(+), 91 deletions(-)
diff --git a/arrow-array/src/ffi_stream.rs b/arrow-array/src/ffi_stream.rs
index 0d4a3f3b3..3d4e89e80 100644
--- a/arrow-array/src/ffi_stream.rs
+++ b/arrow-array/src/ffi_stream.rs
@@ -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::*;
diff --git a/arrow-buffer/src/buffer/immutable.rs
b/arrow-buffer/src/buffer/immutable.rs
index dc0de7736..d0c8ffa39 100644
--- a/arrow-buffer/src/buffer/immutable.rs
+++ b/arrow-buffer/src/buffer/immutable.rs
@@ -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};
@@ -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.
///
@@ -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;
diff --git a/arrow-schema/src/fields.rs b/arrow-schema/src/fields.rs
index b4c4d4e59..904b933cd 100644
--- a/arrow-schema/src/fields.rs
+++ b/arrow-schema/src/fields.rs
@@ -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`]
///
@@ -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 {
diff --git a/arrow-schema/src/schema.rs b/arrow-schema/src/schema.rs
index c5c22b527..47c22e2a9 100644
--- a/arrow-schema/src/schema.rs
+++ b/arrow-schema/src/schema.rs
@@ -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 {