diff --git a/arrow-array/src/temporal_conversions.rs b/arrow-array/src/temporal_conversions.rs index a5ec50da1fc6..375c19bc8722 100644 --- a/arrow-array/src/temporal_conversions.rs +++ b/arrow-array/src/temporal_conversions.rs @@ -215,26 +215,12 @@ pub(crate) fn split_second(v: i64, base: i64) -> (i64, u32) { (v.div_euclid(base), v.rem_euclid(base) as u32) } -/// converts a `i64` representing a `duration(s)` to [`Duration`] -#[inline] -#[deprecated(since = "55.2.0", note = "Use `try_duration_s_to_duration` instead")] -pub fn duration_s_to_duration(v: i64) -> Duration { - Duration::try_seconds(v).unwrap() -} - /// converts a `i64` representing a `duration(s)` to [`Option`] #[inline] pub fn try_duration_s_to_duration(v: i64) -> Option { Duration::try_seconds(v) } -/// converts a `i64` representing a `duration(ms)` to [`Duration`] -#[inline] -#[deprecated(since = "55.2.0", note = "Use `try_duration_ms_to_duration` instead")] -pub fn duration_ms_to_duration(v: i64) -> Duration { - Duration::try_seconds(v).unwrap() -} - /// converts a `i64` representing a `duration(ms)` to [`Option`] #[inline] pub fn try_duration_ms_to_duration(v: i64) -> Option { diff --git a/arrow-array/src/types.rs b/arrow-array/src/types.rs index 267011d8af80..a8de9267b3e6 100644 --- a/arrow-array/src/types.rs +++ b/arrow-array/src/types.rs @@ -1205,17 +1205,6 @@ impl Date32Type { } impl Date64Type { - /// Converts an arrow Date64Type into a chrono::NaiveDate - /// - /// # Arguments - /// - /// * `i` - The Date64Type to convert - #[deprecated(since = "56.0.0", note = "Use to_naive_date_opt instead.")] - pub fn to_naive_date(i: ::Native) -> NaiveDate { - Self::to_naive_date_opt(i) - .unwrap_or_else(|| panic!("Date64Type::to_naive_date overflowed for date: {i}",)) - } - /// Converts an arrow Date64Type into a chrono::NaiveDateTime if it fits in the range that chrono::NaiveDateTime can represent. /// Returns `None` if the calculation would overflow or underflow. /// @@ -1241,25 +1230,6 @@ impl Date64Type { d.sub(epoch).num_milliseconds() as ::Native } - /// Adds the given IntervalYearMonthType to an arrow Date64Type - /// - /// # Arguments - /// - /// * `date` - The date on which to perform the operation - /// * `delta` - The interval to add - #[deprecated( - since = "56.0.0", - note = "Use `add_year_months_opt` instead, which returns an Option to handle overflow." - )] - pub fn add_year_months( - date: ::Native, - delta: ::Native, - ) -> ::Native { - Self::add_year_months_opt(date, delta).unwrap_or_else(|| { - panic!("Date64Type::add_year_months overflowed for date: {date}, delta: {delta}",) - }) - } - /// Adds the given IntervalYearMonthType to an arrow Date64Type /// /// # Arguments @@ -1278,25 +1248,6 @@ impl Date64Type { Some(Date64Type::from_naive_date(posterior)) } - /// Adds the given IntervalDayTimeType to an arrow Date64Type - /// - /// # Arguments - /// - /// * `date` - The date on which to perform the operation - /// * `delta` - The interval to add - #[deprecated( - since = "56.0.0", - note = "Use `add_day_time_opt` instead, which returns an Option to handle overflow." - )] - pub fn add_day_time( - date: ::Native, - delta: ::Native, - ) -> ::Native { - Self::add_day_time_opt(date, delta).unwrap_or_else(|| { - panic!("Date64Type::add_day_time overflowed for date: {date}, delta: {delta:?}",) - }) - } - /// Adds the given IntervalDayTimeType to an arrow Date64Type /// /// # Arguments @@ -1316,25 +1267,6 @@ impl Date64Type { Some(Date64Type::from_naive_date(res)) } - /// Adds the given IntervalMonthDayNanoType to an arrow Date64Type - /// - /// # Arguments - /// - /// * `date` - The date on which to perform the operation - /// * `delta` - The interval to add - #[deprecated( - since = "56.0.0", - note = "Use `add_month_day_nano_opt` instead, which returns an Option to handle overflow." - )] - pub fn add_month_day_nano( - date: ::Native, - delta: ::Native, - ) -> ::Native { - Self::add_month_day_nano_opt(date, delta).unwrap_or_else(|| { - panic!("Date64Type::add_month_day_nano overflowed for date: {date}, delta: {delta:?}",) - }) - } - /// Adds the given IntervalMonthDayNanoType to an arrow Date64Type /// /// # Arguments @@ -1355,25 +1287,6 @@ impl Date64Type { Some(Date64Type::from_naive_date(res)) } - /// Subtract the given IntervalYearMonthType to an arrow Date64Type - /// - /// # Arguments - /// - /// * `date` - The date on which to perform the operation - /// * `delta` - The interval to subtract - #[deprecated( - since = "56.0.0", - note = "Use `subtract_year_months_opt` instead, which returns an Option to handle overflow." - )] - pub fn subtract_year_months( - date: ::Native, - delta: ::Native, - ) -> ::Native { - Self::subtract_year_months_opt(date, delta).unwrap_or_else(|| { - panic!("Date64Type::subtract_year_months overflowed for date: {date}, delta: {delta}",) - }) - } - /// Subtract the given IntervalYearMonthType to an arrow Date64Type /// /// # Arguments @@ -1392,25 +1305,6 @@ impl Date64Type { Some(Date64Type::from_naive_date(posterior)) } - /// Subtract the given IntervalDayTimeType to an arrow Date64Type - /// - /// # Arguments - /// - /// * `date` - The date on which to perform the operation - /// * `delta` - The interval to subtract - #[deprecated( - since = "56.0.0", - note = "Use `subtract_day_time_opt` instead, which returns an Option to handle overflow." - )] - pub fn subtract_day_time( - date: ::Native, - delta: ::Native, - ) -> ::Native { - Self::subtract_day_time_opt(date, delta).unwrap_or_else(|| { - panic!("Date64Type::subtract_day_time overflowed for date: {date}, delta: {delta:?}",) - }) - } - /// Subtract the given IntervalDayTimeType to an arrow Date64Type /// /// # Arguments @@ -1430,27 +1324,6 @@ impl Date64Type { Some(Date64Type::from_naive_date(res)) } - /// Subtract the given IntervalMonthDayNanoType to an arrow Date64Type - /// - /// # Arguments - /// - /// * `date` - The date on which to perform the operation - /// * `delta` - The interval to subtract - #[deprecated( - since = "56.0.0", - note = "Use `subtract_month_day_nano_opt` instead, which returns an Option to handle overflow." - )] - pub fn subtract_month_day_nano( - date: ::Native, - delta: ::Native, - ) -> ::Native { - Self::subtract_month_day_nano_opt(date, delta).unwrap_or_else(|| { - panic!( - "Date64Type::subtract_month_day_nano overflowed for date: {date}, delta: {delta:?}", - ) - }) - } - /// Subtract the given IntervalMonthDayNanoType to an arrow Date64Type /// /// # Arguments diff --git a/arrow-buffer/src/buffer/immutable.rs b/arrow-buffer/src/buffer/immutable.rs index a73cc55086ac..fc001afe5a07 100644 --- a/arrow-buffer/src/buffer/immutable.rs +++ b/arrow-buffer/src/buffer/immutable.rs @@ -103,17 +103,6 @@ unsafe impl Send for Buffer where Bytes: Send {} unsafe impl Sync for Buffer where Bytes: Sync {} impl Buffer { - /// Create a new Buffer from a (internal) `Bytes` - /// - /// NOTE despite the same name, `Bytes` is an internal struct in arrow-rs - /// and is different than [`bytes::Bytes`]. - /// - /// See examples on [`Buffer`] for ways to create a buffer from a [`bytes::Bytes`]. - #[deprecated(since = "54.1.0", note = "Use Buffer::from instead")] - pub fn from_bytes(bytes: Bytes) -> Self { - Self::from(bytes) - } - /// Returns the offset, in bytes, of `Self::ptr` to `Self::data` /// /// self.ptr and self.data can be different after slicing or advancing the buffer. diff --git a/arrow-data/src/data.rs b/arrow-data/src/data.rs index 7b208b7af0be..0ce98aa090df 100644 --- a/arrow-data/src/data.rs +++ b/arrow-data/src/data.rs @@ -2210,12 +2210,6 @@ impl ArrayDataBuilder { Ok(data) } - /// Creates an array data, validating all inputs, and aligning any buffers - #[deprecated(since = "54.1.0", note = "Use ArrayData::align_buffers instead")] - pub fn build_aligned(self) -> Result { - self.align_buffers(true).build() - } - /// Ensure that all buffers are aligned, copying data if necessary /// /// Rust requires that arrays are aligned to their corresponding primitive, diff --git a/arrow-data/src/decimal.rs b/arrow-data/src/decimal.rs index 2c997753bd5f..a5986755ad6e 100644 --- a/arrow-data/src/decimal.rs +++ b/arrow-data/src/decimal.rs @@ -688,106 +688,6 @@ pub const MIN_DECIMAL256_FOR_EACH_PRECISION: [i256; 77] = [ ]), ]; -/// `MAX_DECIMAL_FOR_EACH_PRECISION[p-1]` holds the maximum `i128` value that can -/// be stored in a [`Decimal128`] value of precision `p` -/// -/// [`Decimal128`]: arrow_schema::DataType::Decimal128 -#[deprecated( - since = "54.1.0", - note = "Use MAX_DECIMAL128_FOR_EACH_PRECISION (note indexes are different)" -)] -#[allow(dead_code)] // no longer used but is part of our public API -pub const MAX_DECIMAL_FOR_EACH_PRECISION: [i128; 38] = [ - 9, - 99, - 999, - 9999, - 99999, - 999999, - 9999999, - 99999999, - 999999999, - 9999999999, - 99999999999, - 999999999999, - 9999999999999, - 99999999999999, - 999999999999999, - 9999999999999999, - 99999999999999999, - 999999999999999999, - 9999999999999999999, - 99999999999999999999, - 999999999999999999999, - 9999999999999999999999, - 99999999999999999999999, - 999999999999999999999999, - 9999999999999999999999999, - 99999999999999999999999999, - 999999999999999999999999999, - 9999999999999999999999999999, - 99999999999999999999999999999, - 999999999999999999999999999999, - 9999999999999999999999999999999, - 99999999999999999999999999999999, - 999999999999999999999999999999999, - 9999999999999999999999999999999999, - 99999999999999999999999999999999999, - 999999999999999999999999999999999999, - 9999999999999999999999999999999999999, - 99999999999999999999999999999999999999, -]; - -/// `MIN_DECIMAL_FOR_EACH_PRECISION[p-1]` holds the minimum `i128` value that can -/// be stored in a [`Decimal128`] value of precision `p` -/// -/// [`Decimal128`]: arrow_schema::DataType::Decimal128 -#[allow(dead_code)] // no longer used but is part of our public API -#[deprecated( - since = "54.1.0", - note = "Use MIN_DECIMAL128_FOR_EACH_PRECISION (note indexes are different)" -)] -pub const MIN_DECIMAL_FOR_EACH_PRECISION: [i128; 38] = [ - -9, - -99, - -999, - -9999, - -99999, - -999999, - -9999999, - -99999999, - -999999999, - -9999999999, - -99999999999, - -999999999999, - -9999999999999, - -99999999999999, - -999999999999999, - -9999999999999999, - -99999999999999999, - -999999999999999999, - -9999999999999999999, - -99999999999999999999, - -999999999999999999999, - -9999999999999999999999, - -99999999999999999999999, - -999999999999999999999999, - -9999999999999999999999999, - -99999999999999999999999999, - -999999999999999999999999999, - -9999999999999999999999999999, - -99999999999999999999999999999, - -999999999999999999999999999999, - -9999999999999999999999999999999, - -99999999999999999999999999999999, - -999999999999999999999999999999999, - -9999999999999999999999999999999999, - -99999999999999999999999999999999999, - -999999999999999999999999999999999999, - -9999999999999999999999999999999999999, - -99999999999999999999999999999999999999, -]; - /// `MAX_DECIMAL128_FOR_EACH_PRECISION[p]` holds the maximum `i128` value that can /// be stored in [`Decimal128`] value of precision `p`. /// diff --git a/arrow-ipc/src/reader.rs b/arrow-ipc/src/reader.rs index 1d5e06c6871c..6d1466febf0f 100644 --- a/arrow-ipc/src/reader.rs +++ b/arrow-ipc/src/reader.rs @@ -754,7 +754,7 @@ impl<'a> RecordBatchDecoder<'a> { /// If `require_alignment` is false, this function will automatically allocate a new aligned buffer /// and copy over the data if any array data in the input `buf` is not properly aligned. /// (Properly aligned array data will remain zero-copy.) -/// Under the hood it will use [`arrow_data::ArrayDataBuilder::build_aligned`] to construct [`arrow_data::ArrayData`]. +/// Under the hood it will use [`arrow_data::ArrayDataBuilder::align_buffers`] to construct [`arrow_data::ArrayData`]. pub fn read_record_batch( buf: &Buffer, batch: crate::RecordBatch, @@ -1046,7 +1046,7 @@ impl FileDecoder { /// If `require_alignment` is false (the default), this decoder will automatically allocate a /// new aligned buffer and copy over the data if any array data in the input `buf` is not /// properly aligned. (Properly aligned array data will remain zero-copy.) - /// Under the hood it will use [`arrow_data::ArrayDataBuilder::build_aligned`] to construct + /// Under the hood it will use [`arrow_data::ArrayDataBuilder::align_buffers`] to construct /// [`arrow_data::ArrayData`]. pub fn with_require_alignment(mut self, require_alignment: bool) -> Self { self.require_alignment = require_alignment; diff --git a/arrow-ipc/src/reader/stream.rs b/arrow-ipc/src/reader/stream.rs index bfecf7b6ffa5..e18d32cea2f6 100644 --- a/arrow-ipc/src/reader/stream.rs +++ b/arrow-ipc/src/reader/stream.rs @@ -101,7 +101,7 @@ impl StreamDecoder { /// If `require_alignment` is false (the default), this decoder will automatically allocate a /// new aligned buffer and copy over the data if any array data in the input `buf` is not /// properly aligned. (Properly aligned array data will remain zero-copy.) - /// Under the hood it will use [`arrow_data::ArrayDataBuilder::build_aligned`] to construct + /// Under the hood it will use [`arrow_data::ArrayDataBuilder::align_buffers`] to construct /// [`arrow_data::ArrayData`]. pub fn with_require_alignment(mut self, require_alignment: bool) -> Self { self.require_alignment = require_alignment; diff --git a/arrow-schema/src/fields.rs b/arrow-schema/src/fields.rs index 93638181d9ae..3d19cb963f96 100644 --- a/arrow-schema/src/fields.rs +++ b/arrow-schema/src/fields.rs @@ -534,55 +534,6 @@ impl UnionFields { Ok(Self(out.into())) } - /// Create a new [`UnionFields`] from a [`Fields`] and array of type_ids - /// - /// See - /// - /// # Deprecated - /// - /// Use [`UnionFields::try_new`] instead. This method panics on invalid input, - /// while `try_new` returns a `Result`. - /// - /// # Panics - /// - /// Panics if any type_id appears more than once (duplicate type ids). - /// - /// ``` - /// use arrow_schema::{DataType, Field, UnionFields}; - /// // Create a new UnionFields with type id mapping - /// // 1 -> DataType::UInt8 - /// // 3 -> DataType::Utf8 - /// UnionFields::try_new( - /// vec![1, 3], - /// vec![ - /// Field::new("field1", DataType::UInt8, false), - /// Field::new("field3", DataType::Utf8, false), - /// ], - /// ); - /// ``` - #[deprecated(since = "57.0.0", note = "Use `try_new` instead")] - pub fn new(type_ids: T, fields: F) -> Self - where - F: IntoIterator, - F::Item: Into, - T: IntoIterator, - { - let fields = fields.into_iter().map(Into::into); - let mut set = 0_u128; - type_ids - .into_iter() - .inspect(|&idx| { - let mask = 1_u128 << idx; - if (set & mask) != 0 { - panic!("duplicate type id: {idx}"); - } else { - set |= mask; - } - }) - .zip(fields) - .collect() - } - /// Return size of this instance in bytes. pub fn size(&self) -> usize { self.iter() @@ -614,13 +565,13 @@ impl UnionFields { /// ``` /// use arrow_schema::{DataType, Field, UnionFields}; /// - /// let fields = UnionFields::new( + /// let fields = UnionFields::try_new( /// vec![1, 3], /// vec![ /// Field::new("field1", DataType::UInt8, false), /// Field::new("field3", DataType::Utf8, false), /// ], - /// ); + /// ).unwrap(); /// /// assert!(fields.get(0).is_some()); /// assert!(fields.get(1).is_some());