Skip to content

Commit edd691b

Browse files
authored
Remove deprecated Arrow functions (#7830)
# Which issue does this PR close? - Closes #7810. # Rationale for this change Removes the last batch of functions that can be removed in 56.0.0. Some deprecated functions remain (esp in arrow-schema and arrow-ipc), but those will be dealt with elsewhere (#7467) # What changes are included in this PR? # Are these changes tested? Covered by existing tests # Are there any user-facing changes? Yes, public functions are removed
1 parent 52ad7d7 commit edd691b

File tree

10 files changed

+4
-146
lines changed

10 files changed

+4
-146
lines changed

arrow-array/src/builder/generic_bytes_view_builder.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,6 @@ impl<T: ByteViewType + ?Sized> GenericByteViewBuilder<T> {
134134
}
135135
}
136136

137-
/// Override the size of buffers to allocate for holding string data
138-
/// Use `with_fixed_block_size` instead.
139-
#[deprecated(since = "53.0.0", note = "Use `with_fixed_block_size` instead")]
140-
pub fn with_block_size(self, block_size: u32) -> Self {
141-
self.with_fixed_block_size(block_size)
142-
}
143-
144137
/// Deduplicate strings while building the array
145138
///
146139
/// This will potentially decrease the memory usage if the array have repeated strings

arrow-array/src/builder/null_builder.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,6 @@ impl NullBuilder {
5959
Self { len: 0 }
6060
}
6161

62-
/// Creates a new null builder with space for `capacity` elements without re-allocating
63-
#[deprecated = "there is no actual notion of capacity in the NullBuilder, so emulating it makes little sense"]
64-
pub fn with_capacity(_capacity: usize) -> Self {
65-
Self::new()
66-
}
67-
68-
/// Returns the capacity of this builder measured in slots of type `T`
69-
#[deprecated = "there is no actual notion of capacity in the NullBuilder, so emulating it makes little sense"]
70-
pub fn capacity(&self) -> usize {
71-
self.len
72-
}
73-
7462
/// Appends a null slot into the builder
7563
#[inline]
7664
pub fn append_null(&mut self) {

arrow-array/src/types.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ pub trait ArrowPrimitiveType: primitive::PrimitiveTypeSealed + 'static {
7171
/// the corresponding Arrow data type of this primitive type.
7272
const DATA_TYPE: DataType;
7373

74-
/// Returns the byte width of this primitive type.
75-
#[deprecated(since = "52.0.0", note = "Use ArrowNativeType::get_byte_width")]
76-
fn get_byte_width() -> usize {
77-
std::mem::size_of::<Self::Native>()
78-
}
79-
8074
/// Returns a default value of this primitive type.
8175
///
8276
/// This is useful for aggregate array ops like `sum()`, `mean()`.
@@ -1034,10 +1028,10 @@ impl Date64Type {
10341028
/// # Arguments
10351029
///
10361030
/// * `i` - The Date64Type to convert
1037-
#[deprecated]
1031+
#[deprecated(since = "56.0.0", note = "Use to_naive_date_opt instead.")]
10381032
pub fn to_naive_date(i: <Date64Type as ArrowPrimitiveType>::Native) -> NaiveDate {
1039-
let epoch = NaiveDate::from_ymd_opt(1970, 1, 1).unwrap();
1040-
epoch.add(Duration::try_milliseconds(i).unwrap())
1033+
Self::to_naive_date_opt(i)
1034+
.unwrap_or_else(|| panic!("Date64Type::to_naive_date overflowed for date: {i}",))
10411035
}
10421036

10431037
/// Converts an arrow Date64Type into a chrono::NaiveDateTime if it fits in the range that chrono::NaiveDateTime can represent.

arrow-flight/src/decode.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ impl FlightRecordBatchStream {
138138
self.trailers.as_ref().and_then(|trailers| trailers.get())
139139
}
140140

141-
/// Has a message defining the schema been received yet?
142-
#[deprecated = "use schema().is_some() instead"]
143-
pub fn got_schema(&self) -> bool {
144-
self.schema().is_some()
145-
}
146-
147141
/// Return schema for the stream, if it has been received
148142
pub fn schema(&self) -> Option<&SchemaRef> {
149143
self.inner.schema()

arrow-ord/src/cmp.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -655,70 +655,6 @@ pub fn compare_byte_view<T: ByteViewType>(
655655
unsafe { GenericByteViewArray::compare_unchecked(left, left_idx, right, right_idx) }
656656
}
657657

658-
/// Comparing two [`GenericByteViewArray`] at index `left_idx` and `right_idx`
659-
///
660-
/// Comparing two ByteView types are non-trivial.
661-
/// It takes a bit of patience to understand why we don't just compare two &[u8] directly.
662-
///
663-
/// ByteView types give us the following two advantages, and we need to be careful not to lose them:
664-
/// (1) For string/byte smaller than 12 bytes, the entire data is inlined in the view.
665-
/// Meaning that reading one array element requires only one memory access
666-
/// (two memory access required for StringArray, one for offset buffer, the other for value buffer).
667-
///
668-
/// (2) For string/byte larger than 12 bytes, we can still be faster than (for certain operations) StringArray/ByteArray,
669-
/// thanks to the inlined 4 bytes.
670-
/// Consider equality check:
671-
/// If the first four bytes of the two strings are different, we can return false immediately (with just one memory access).
672-
///
673-
/// If we directly compare two &[u8], we materialize the entire string (i.e., make multiple memory accesses), which might be unnecessary.
674-
/// - Most of the time (eq, ord), we only need to look at the first 4 bytes to know the answer,
675-
/// e.g., if the inlined 4 bytes are different, we can directly return unequal without looking at the full string.
676-
///
677-
/// # Order check flow
678-
/// (1) if both string are smaller than 12 bytes, we can directly compare the data inlined to the view.
679-
/// (2) if any of the string is larger than 12 bytes, we need to compare the full string.
680-
/// (2.1) if the inlined 4 bytes are different, we can return the result immediately.
681-
/// (2.2) o.w., we need to compare the full string.
682-
///
683-
/// # Safety
684-
/// The left/right_idx must within range of each array
685-
#[deprecated(
686-
since = "52.2.0",
687-
note = "Use `GenericByteViewArray::compare_unchecked` instead"
688-
)]
689-
pub unsafe fn compare_byte_view_unchecked<T: ByteViewType>(
690-
left: &GenericByteViewArray<T>,
691-
left_idx: usize,
692-
right: &GenericByteViewArray<T>,
693-
right_idx: usize,
694-
) -> std::cmp::Ordering {
695-
let l_view = left.views().get_unchecked(left_idx);
696-
let l_len = *l_view as u32;
697-
698-
let r_view = right.views().get_unchecked(right_idx);
699-
let r_len = *r_view as u32;
700-
701-
if l_len <= 12 && r_len <= 12 {
702-
let l_data = unsafe { GenericByteViewArray::<T>::inline_value(l_view, l_len as usize) };
703-
let r_data = unsafe { GenericByteViewArray::<T>::inline_value(r_view, r_len as usize) };
704-
return l_data.cmp(r_data);
705-
}
706-
707-
// one of the string is larger than 12 bytes,
708-
// we then try to compare the inlined data first
709-
let l_inlined_data = unsafe { GenericByteViewArray::<T>::inline_value(l_view, 4) };
710-
let r_inlined_data = unsafe { GenericByteViewArray::<T>::inline_value(r_view, 4) };
711-
if r_inlined_data != l_inlined_data {
712-
return l_inlined_data.cmp(r_inlined_data);
713-
}
714-
715-
// unfortunately, we need to compare the full data
716-
let l_full_data: &[u8] = unsafe { left.value_unchecked(left_idx).as_ref() };
717-
let r_full_data: &[u8] = unsafe { right.value_unchecked(right_idx).as_ref() };
718-
719-
l_full_data.cmp(r_full_data)
720-
}
721-
722658
#[cfg(test)]
723659
mod tests {
724660
use std::sync::Arc;

arrow-ord/src/ord.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,6 @@ fn compare_struct(
265265
Ok(f)
266266
}
267267

268-
#[deprecated(since = "52.0.0", note = "Use make_comparator")]
269-
#[doc(hidden)]
270-
pub fn build_compare(left: &dyn Array, right: &dyn Array) -> Result<DynComparator, ArrowError> {
271-
make_comparator(left, right, SortOptions::default())
272-
}
273-
274268
/// Returns a comparison function that compares two values at two different positions
275269
/// between the two arrays.
276270
///

arrow-schema/src/schema.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,6 @@ impl Schema {
365365
self.fields.iter().flat_map(|f| f.fields()).collect()
366366
}
367367

368-
/// Returns a vector with references to all fields (including nested fields)
369-
#[deprecated(since = "52.2.0", note = "Use `flattened_fields` instead")]
370-
#[inline]
371-
pub fn all_fields(&self) -> Vec<&Field> {
372-
self.flattened_fields()
373-
}
374-
375368
/// Returns an immutable reference of a specific [`Field`] instance selected using an
376369
/// offset within the internal `fields` vector.
377370
///

arrow-string/src/regexp.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,6 @@ use regex::Regex;
3333
use std::collections::HashMap;
3434
use std::sync::Arc;
3535

36-
/// Perform SQL `array ~ regex_array` operation on [`StringArray`] / [`LargeStringArray`].
37-
/// If `regex_array` element has an empty value, the corresponding result value is always true.
38-
///
39-
/// `flags_array` are optional [`StringArray`] / [`LargeStringArray`] flag, which allow
40-
/// special search modes, such as case insensitive and multi-line mode.
41-
/// See the documentation [here](https://docs.rs/regex/1.5.4/regex/#grouping-and-flags)
42-
/// for more information.
43-
#[deprecated(since = "54.0.0", note = "please use `regexp_is_match` instead")]
44-
pub fn regexp_is_match_utf8<OffsetSize: OffsetSizeTrait>(
45-
array: &GenericStringArray<OffsetSize>,
46-
regex_array: &GenericStringArray<OffsetSize>,
47-
flags_array: Option<&GenericStringArray<OffsetSize>>,
48-
) -> Result<BooleanArray, ArrowError> {
49-
regexp_is_match(array, regex_array, flags_array)
50-
}
51-
5236
/// Return BooleanArray indicating which strings in an array match an array of
5337
/// regular expressions.
5438
///
@@ -164,19 +148,6 @@ where
164148
Ok(BooleanArray::from(data))
165149
}
166150

167-
/// Perform SQL `array ~ regex_array` operation on [`StringArray`] /
168-
/// [`LargeStringArray`] and a scalar.
169-
///
170-
/// See the documentation on [`regexp_is_match_utf8`] for more details.
171-
#[deprecated(since = "54.0.0", note = "please use `regexp_is_match_scalar` instead")]
172-
pub fn regexp_is_match_utf8_scalar<OffsetSize: OffsetSizeTrait>(
173-
array: &GenericStringArray<OffsetSize>,
174-
regex: &str,
175-
flag: Option<&str>,
176-
) -> Result<BooleanArray, ArrowError> {
177-
regexp_is_match_scalar(array, regex, flag)
178-
}
179-
180151
/// Return BooleanArray indicating which strings in an array match a single regular expression.
181152
///
182153
/// This is equivalent to the SQL `array ~ regex_array`, supporting

arrow/src/array/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,4 @@ pub use arrow_data::transform::{Capacities, MutableArrayData};
3535
pub use arrow_array::ffi::export_array_into_raw;
3636

3737
// --------------------- Array's values comparison ---------------------
38-
39-
#[allow(deprecated)]
40-
pub use arrow_ord::ord::{build_compare, make_comparator, DynComparator};
38+
pub use arrow_ord::ord::{make_comparator, DynComparator};

arrow/src/compute/kernels.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,5 @@ pub use arrow_string::{concat_elements, length, regexp, substring};
3030
pub mod comparison {
3131
pub use arrow_ord::comparison::*;
3232
pub use arrow_string::like::*;
33-
// continue to export deprecated methods until they are removed
3433
pub use arrow_string::regexp::{regexp_is_match, regexp_is_match_scalar};
35-
#[allow(deprecated)]
36-
pub use arrow_string::regexp::{regexp_is_match_utf8, regexp_is_match_utf8_scalar};
3734
}

0 commit comments

Comments
 (0)