Skip to content

Commit 1ae2469

Browse files
etseidlalamb
andauthored
chore: Remove some deprecated Arrow functions from the public API (#10040)
# Which issue does this PR close? None - related to #9110 # Rationale for this change Housecleaning for 59.0.0 # What changes are included in this PR? Remove some deprecated functions from public Arrow APIs. # Are these changes tested? Covered by existing tests # Are there any user-facing changes? Yes, deprecated public functions are removed --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent 870fb06 commit 1ae2469

8 files changed

Lines changed: 5 additions & 312 deletions

File tree

arrow-array/src/temporal_conversions.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,26 +215,12 @@ pub(crate) fn split_second(v: i64, base: i64) -> (i64, u32) {
215215
(v.div_euclid(base), v.rem_euclid(base) as u32)
216216
}
217217

218-
/// converts a `i64` representing a `duration(s)` to [`Duration`]
219-
#[inline]
220-
#[deprecated(since = "55.2.0", note = "Use `try_duration_s_to_duration` instead")]
221-
pub fn duration_s_to_duration(v: i64) -> Duration {
222-
Duration::try_seconds(v).unwrap()
223-
}
224-
225218
/// converts a `i64` representing a `duration(s)` to [`Option<Duration>`]
226219
#[inline]
227220
pub fn try_duration_s_to_duration(v: i64) -> Option<Duration> {
228221
Duration::try_seconds(v)
229222
}
230223

231-
/// converts a `i64` representing a `duration(ms)` to [`Duration`]
232-
#[inline]
233-
#[deprecated(since = "55.2.0", note = "Use `try_duration_ms_to_duration` instead")]
234-
pub fn duration_ms_to_duration(v: i64) -> Duration {
235-
Duration::try_seconds(v).unwrap()
236-
}
237-
238224
/// converts a `i64` representing a `duration(ms)` to [`Option<Duration>`]
239225
#[inline]
240226
pub fn try_duration_ms_to_duration(v: i64) -> Option<Duration> {

arrow-array/src/types.rs

Lines changed: 0 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,17 +1205,6 @@ impl Date32Type {
12051205
}
12061206

12071207
impl Date64Type {
1208-
/// Converts an arrow Date64Type into a chrono::NaiveDate
1209-
///
1210-
/// # Arguments
1211-
///
1212-
/// * `i` - The Date64Type to convert
1213-
#[deprecated(since = "56.0.0", note = "Use to_naive_date_opt instead.")]
1214-
pub fn to_naive_date(i: <Date64Type as ArrowPrimitiveType>::Native) -> NaiveDate {
1215-
Self::to_naive_date_opt(i)
1216-
.unwrap_or_else(|| panic!("Date64Type::to_naive_date overflowed for date: {i}",))
1217-
}
1218-
12191208
/// Converts an arrow Date64Type into a chrono::NaiveDateTime if it fits in the range that chrono::NaiveDateTime can represent.
12201209
/// Returns `None` if the calculation would overflow or underflow.
12211210
///
@@ -1241,25 +1230,6 @@ impl Date64Type {
12411230
d.sub(epoch).num_milliseconds() as <Date64Type as ArrowPrimitiveType>::Native
12421231
}
12431232

1244-
/// Adds the given IntervalYearMonthType to an arrow Date64Type
1245-
///
1246-
/// # Arguments
1247-
///
1248-
/// * `date` - The date on which to perform the operation
1249-
/// * `delta` - The interval to add
1250-
#[deprecated(
1251-
since = "56.0.0",
1252-
note = "Use `add_year_months_opt` instead, which returns an Option to handle overflow."
1253-
)]
1254-
pub fn add_year_months(
1255-
date: <Date64Type as ArrowPrimitiveType>::Native,
1256-
delta: <IntervalYearMonthType as ArrowPrimitiveType>::Native,
1257-
) -> <Date64Type as ArrowPrimitiveType>::Native {
1258-
Self::add_year_months_opt(date, delta).unwrap_or_else(|| {
1259-
panic!("Date64Type::add_year_months overflowed for date: {date}, delta: {delta}",)
1260-
})
1261-
}
1262-
12631233
/// Adds the given IntervalYearMonthType to an arrow Date64Type
12641234
///
12651235
/// # Arguments
@@ -1278,25 +1248,6 @@ impl Date64Type {
12781248
Some(Date64Type::from_naive_date(posterior))
12791249
}
12801250

1281-
/// Adds the given IntervalDayTimeType to an arrow Date64Type
1282-
///
1283-
/// # Arguments
1284-
///
1285-
/// * `date` - The date on which to perform the operation
1286-
/// * `delta` - The interval to add
1287-
#[deprecated(
1288-
since = "56.0.0",
1289-
note = "Use `add_day_time_opt` instead, which returns an Option to handle overflow."
1290-
)]
1291-
pub fn add_day_time(
1292-
date: <Date64Type as ArrowPrimitiveType>::Native,
1293-
delta: <IntervalDayTimeType as ArrowPrimitiveType>::Native,
1294-
) -> <Date64Type as ArrowPrimitiveType>::Native {
1295-
Self::add_day_time_opt(date, delta).unwrap_or_else(|| {
1296-
panic!("Date64Type::add_day_time overflowed for date: {date}, delta: {delta:?}",)
1297-
})
1298-
}
1299-
13001251
/// Adds the given IntervalDayTimeType to an arrow Date64Type
13011252
///
13021253
/// # Arguments
@@ -1316,25 +1267,6 @@ impl Date64Type {
13161267
Some(Date64Type::from_naive_date(res))
13171268
}
13181269

1319-
/// Adds the given IntervalMonthDayNanoType to an arrow Date64Type
1320-
///
1321-
/// # Arguments
1322-
///
1323-
/// * `date` - The date on which to perform the operation
1324-
/// * `delta` - The interval to add
1325-
#[deprecated(
1326-
since = "56.0.0",
1327-
note = "Use `add_month_day_nano_opt` instead, which returns an Option to handle overflow."
1328-
)]
1329-
pub fn add_month_day_nano(
1330-
date: <Date64Type as ArrowPrimitiveType>::Native,
1331-
delta: <IntervalMonthDayNanoType as ArrowPrimitiveType>::Native,
1332-
) -> <Date64Type as ArrowPrimitiveType>::Native {
1333-
Self::add_month_day_nano_opt(date, delta).unwrap_or_else(|| {
1334-
panic!("Date64Type::add_month_day_nano overflowed for date: {date}, delta: {delta:?}",)
1335-
})
1336-
}
1337-
13381270
/// Adds the given IntervalMonthDayNanoType to an arrow Date64Type
13391271
///
13401272
/// # Arguments
@@ -1355,25 +1287,6 @@ impl Date64Type {
13551287
Some(Date64Type::from_naive_date(res))
13561288
}
13571289

1358-
/// Subtract the given IntervalYearMonthType to an arrow Date64Type
1359-
///
1360-
/// # Arguments
1361-
///
1362-
/// * `date` - The date on which to perform the operation
1363-
/// * `delta` - The interval to subtract
1364-
#[deprecated(
1365-
since = "56.0.0",
1366-
note = "Use `subtract_year_months_opt` instead, which returns an Option to handle overflow."
1367-
)]
1368-
pub fn subtract_year_months(
1369-
date: <Date64Type as ArrowPrimitiveType>::Native,
1370-
delta: <IntervalYearMonthType as ArrowPrimitiveType>::Native,
1371-
) -> <Date64Type as ArrowPrimitiveType>::Native {
1372-
Self::subtract_year_months_opt(date, delta).unwrap_or_else(|| {
1373-
panic!("Date64Type::subtract_year_months overflowed for date: {date}, delta: {delta}",)
1374-
})
1375-
}
1376-
13771290
/// Subtract the given IntervalYearMonthType to an arrow Date64Type
13781291
///
13791292
/// # Arguments
@@ -1392,25 +1305,6 @@ impl Date64Type {
13921305
Some(Date64Type::from_naive_date(posterior))
13931306
}
13941307

1395-
/// Subtract the given IntervalDayTimeType to an arrow Date64Type
1396-
///
1397-
/// # Arguments
1398-
///
1399-
/// * `date` - The date on which to perform the operation
1400-
/// * `delta` - The interval to subtract
1401-
#[deprecated(
1402-
since = "56.0.0",
1403-
note = "Use `subtract_day_time_opt` instead, which returns an Option to handle overflow."
1404-
)]
1405-
pub fn subtract_day_time(
1406-
date: <Date64Type as ArrowPrimitiveType>::Native,
1407-
delta: <IntervalDayTimeType as ArrowPrimitiveType>::Native,
1408-
) -> <Date64Type as ArrowPrimitiveType>::Native {
1409-
Self::subtract_day_time_opt(date, delta).unwrap_or_else(|| {
1410-
panic!("Date64Type::subtract_day_time overflowed for date: {date}, delta: {delta:?}",)
1411-
})
1412-
}
1413-
14141308
/// Subtract the given IntervalDayTimeType to an arrow Date64Type
14151309
///
14161310
/// # Arguments
@@ -1430,27 +1324,6 @@ impl Date64Type {
14301324
Some(Date64Type::from_naive_date(res))
14311325
}
14321326

1433-
/// Subtract the given IntervalMonthDayNanoType to an arrow Date64Type
1434-
///
1435-
/// # Arguments
1436-
///
1437-
/// * `date` - The date on which to perform the operation
1438-
/// * `delta` - The interval to subtract
1439-
#[deprecated(
1440-
since = "56.0.0",
1441-
note = "Use `subtract_month_day_nano_opt` instead, which returns an Option to handle overflow."
1442-
)]
1443-
pub fn subtract_month_day_nano(
1444-
date: <Date64Type as ArrowPrimitiveType>::Native,
1445-
delta: <IntervalMonthDayNanoType as ArrowPrimitiveType>::Native,
1446-
) -> <Date64Type as ArrowPrimitiveType>::Native {
1447-
Self::subtract_month_day_nano_opt(date, delta).unwrap_or_else(|| {
1448-
panic!(
1449-
"Date64Type::subtract_month_day_nano overflowed for date: {date}, delta: {delta:?}",
1450-
)
1451-
})
1452-
}
1453-
14541327
/// Subtract the given IntervalMonthDayNanoType to an arrow Date64Type
14551328
///
14561329
/// # Arguments

arrow-buffer/src/buffer/immutable.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,6 @@ unsafe impl Send for Buffer where Bytes: Send {}
103103
unsafe impl Sync for Buffer where Bytes: Sync {}
104104

105105
impl Buffer {
106-
/// Create a new Buffer from a (internal) `Bytes`
107-
///
108-
/// NOTE despite the same name, `Bytes` is an internal struct in arrow-rs
109-
/// and is different than [`bytes::Bytes`].
110-
///
111-
/// See examples on [`Buffer`] for ways to create a buffer from a [`bytes::Bytes`].
112-
#[deprecated(since = "54.1.0", note = "Use Buffer::from instead")]
113-
pub fn from_bytes(bytes: Bytes) -> Self {
114-
Self::from(bytes)
115-
}
116-
117106
/// Returns the offset, in bytes, of `Self::ptr` to `Self::data`
118107
///
119108
/// self.ptr and self.data can be different after slicing or advancing the buffer.

arrow-data/src/data.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,12 +2210,6 @@ impl ArrayDataBuilder {
22102210
Ok(data)
22112211
}
22122212

2213-
/// Creates an array data, validating all inputs, and aligning any buffers
2214-
#[deprecated(since = "54.1.0", note = "Use ArrayData::align_buffers instead")]
2215-
pub fn build_aligned(self) -> Result<ArrayData, ArrowError> {
2216-
self.align_buffers(true).build()
2217-
}
2218-
22192213
/// Ensure that all buffers are aligned, copying data if necessary
22202214
///
22212215
/// Rust requires that arrays are aligned to their corresponding primitive,

arrow-data/src/decimal.rs

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -688,106 +688,6 @@ pub const MIN_DECIMAL256_FOR_EACH_PRECISION: [i256; 77] = [
688688
]),
689689
];
690690

691-
/// `MAX_DECIMAL_FOR_EACH_PRECISION[p-1]` holds the maximum `i128` value that can
692-
/// be stored in a [`Decimal128`] value of precision `p`
693-
///
694-
/// [`Decimal128`]: arrow_schema::DataType::Decimal128
695-
#[deprecated(
696-
since = "54.1.0",
697-
note = "Use MAX_DECIMAL128_FOR_EACH_PRECISION (note indexes are different)"
698-
)]
699-
#[allow(dead_code)] // no longer used but is part of our public API
700-
pub const MAX_DECIMAL_FOR_EACH_PRECISION: [i128; 38] = [
701-
9,
702-
99,
703-
999,
704-
9999,
705-
99999,
706-
999999,
707-
9999999,
708-
99999999,
709-
999999999,
710-
9999999999,
711-
99999999999,
712-
999999999999,
713-
9999999999999,
714-
99999999999999,
715-
999999999999999,
716-
9999999999999999,
717-
99999999999999999,
718-
999999999999999999,
719-
9999999999999999999,
720-
99999999999999999999,
721-
999999999999999999999,
722-
9999999999999999999999,
723-
99999999999999999999999,
724-
999999999999999999999999,
725-
9999999999999999999999999,
726-
99999999999999999999999999,
727-
999999999999999999999999999,
728-
9999999999999999999999999999,
729-
99999999999999999999999999999,
730-
999999999999999999999999999999,
731-
9999999999999999999999999999999,
732-
99999999999999999999999999999999,
733-
999999999999999999999999999999999,
734-
9999999999999999999999999999999999,
735-
99999999999999999999999999999999999,
736-
999999999999999999999999999999999999,
737-
9999999999999999999999999999999999999,
738-
99999999999999999999999999999999999999,
739-
];
740-
741-
/// `MIN_DECIMAL_FOR_EACH_PRECISION[p-1]` holds the minimum `i128` value that can
742-
/// be stored in a [`Decimal128`] value of precision `p`
743-
///
744-
/// [`Decimal128`]: arrow_schema::DataType::Decimal128
745-
#[allow(dead_code)] // no longer used but is part of our public API
746-
#[deprecated(
747-
since = "54.1.0",
748-
note = "Use MIN_DECIMAL128_FOR_EACH_PRECISION (note indexes are different)"
749-
)]
750-
pub const MIN_DECIMAL_FOR_EACH_PRECISION: [i128; 38] = [
751-
-9,
752-
-99,
753-
-999,
754-
-9999,
755-
-99999,
756-
-999999,
757-
-9999999,
758-
-99999999,
759-
-999999999,
760-
-9999999999,
761-
-99999999999,
762-
-999999999999,
763-
-9999999999999,
764-
-99999999999999,
765-
-999999999999999,
766-
-9999999999999999,
767-
-99999999999999999,
768-
-999999999999999999,
769-
-9999999999999999999,
770-
-99999999999999999999,
771-
-999999999999999999999,
772-
-9999999999999999999999,
773-
-99999999999999999999999,
774-
-999999999999999999999999,
775-
-9999999999999999999999999,
776-
-99999999999999999999999999,
777-
-999999999999999999999999999,
778-
-9999999999999999999999999999,
779-
-99999999999999999999999999999,
780-
-999999999999999999999999999999,
781-
-9999999999999999999999999999999,
782-
-99999999999999999999999999999999,
783-
-999999999999999999999999999999999,
784-
-9999999999999999999999999999999999,
785-
-99999999999999999999999999999999999,
786-
-999999999999999999999999999999999999,
787-
-9999999999999999999999999999999999999,
788-
-99999999999999999999999999999999999999,
789-
];
790-
791691
/// `MAX_DECIMAL128_FOR_EACH_PRECISION[p]` holds the maximum `i128` value that can
792692
/// be stored in [`Decimal128`] value of precision `p`.
793693
///

arrow-ipc/src/reader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ impl<'a> RecordBatchDecoder<'a> {
754754
/// If `require_alignment` is false, this function will automatically allocate a new aligned buffer
755755
/// and copy over the data if any array data in the input `buf` is not properly aligned.
756756
/// (Properly aligned array data will remain zero-copy.)
757-
/// Under the hood it will use [`arrow_data::ArrayDataBuilder::build_aligned`] to construct [`arrow_data::ArrayData`].
757+
/// Under the hood it will use [`arrow_data::ArrayDataBuilder::align_buffers`] to construct [`arrow_data::ArrayData`].
758758
pub fn read_record_batch(
759759
buf: &Buffer,
760760
batch: crate::RecordBatch,
@@ -1046,7 +1046,7 @@ impl FileDecoder {
10461046
/// If `require_alignment` is false (the default), this decoder will automatically allocate a
10471047
/// new aligned buffer and copy over the data if any array data in the input `buf` is not
10481048
/// properly aligned. (Properly aligned array data will remain zero-copy.)
1049-
/// Under the hood it will use [`arrow_data::ArrayDataBuilder::build_aligned`] to construct
1049+
/// Under the hood it will use [`arrow_data::ArrayDataBuilder::align_buffers`] to construct
10501050
/// [`arrow_data::ArrayData`].
10511051
pub fn with_require_alignment(mut self, require_alignment: bool) -> Self {
10521052
self.require_alignment = require_alignment;

arrow-ipc/src/reader/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl StreamDecoder {
101101
/// If `require_alignment` is false (the default), this decoder will automatically allocate a
102102
/// new aligned buffer and copy over the data if any array data in the input `buf` is not
103103
/// properly aligned. (Properly aligned array data will remain zero-copy.)
104-
/// Under the hood it will use [`arrow_data::ArrayDataBuilder::build_aligned`] to construct
104+
/// Under the hood it will use [`arrow_data::ArrayDataBuilder::align_buffers`] to construct
105105
/// [`arrow_data::ArrayData`].
106106
pub fn with_require_alignment(mut self, require_alignment: bool) -> Self {
107107
self.require_alignment = require_alignment;

0 commit comments

Comments
 (0)