Skip to content

Commit 541a67d

Browse files
authored
Remove elements deprecated since v 45 (#17075)
They were deprecated since 45.0.0, which was released 6 months ago.
1 parent ac3a573 commit 541a67d

File tree

17 files changed

+12
-697
lines changed

17 files changed

+12
-697
lines changed

datafusion/common/src/utils/mod.rs

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -444,94 +444,6 @@ impl SingleRowListArrayBuilder {
444444
}
445445
}
446446

447-
/// Wrap an array into a single element `ListArray`.
448-
/// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]`
449-
/// The field in the list array is nullable.
450-
#[deprecated(
451-
since = "44.0.0",
452-
note = "please use `SingleRowListArrayBuilder` instead"
453-
)]
454-
pub fn array_into_list_array_nullable(arr: ArrayRef) -> ListArray {
455-
SingleRowListArrayBuilder::new(arr)
456-
.with_nullable(true)
457-
.build_list_array()
458-
}
459-
460-
/// Wrap an array into a single element `ListArray`.
461-
/// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]`
462-
#[deprecated(
463-
since = "44.0.0",
464-
note = "please use `SingleRowListArrayBuilder` instead"
465-
)]
466-
pub fn array_into_list_array(arr: ArrayRef, nullable: bool) -> ListArray {
467-
SingleRowListArrayBuilder::new(arr)
468-
.with_nullable(nullable)
469-
.build_list_array()
470-
}
471-
472-
#[deprecated(
473-
since = "44.0.0",
474-
note = "please use `SingleRowListArrayBuilder` instead"
475-
)]
476-
pub fn array_into_list_array_with_field_name(
477-
arr: ArrayRef,
478-
nullable: bool,
479-
field_name: &str,
480-
) -> ListArray {
481-
SingleRowListArrayBuilder::new(arr)
482-
.with_nullable(nullable)
483-
.with_field_name(Some(field_name.to_string()))
484-
.build_list_array()
485-
}
486-
487-
/// Wrap an array into a single element `LargeListArray`.
488-
/// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]`
489-
#[deprecated(
490-
since = "44.0.0",
491-
note = "please use `SingleRowListArrayBuilder` instead"
492-
)]
493-
pub fn array_into_large_list_array(arr: ArrayRef) -> LargeListArray {
494-
SingleRowListArrayBuilder::new(arr).build_large_list_array()
495-
}
496-
497-
#[deprecated(
498-
since = "44.0.0",
499-
note = "please use `SingleRowListArrayBuilder` instead"
500-
)]
501-
pub fn array_into_large_list_array_with_field_name(
502-
arr: ArrayRef,
503-
field_name: &str,
504-
) -> LargeListArray {
505-
SingleRowListArrayBuilder::new(arr)
506-
.with_field_name(Some(field_name.to_string()))
507-
.build_large_list_array()
508-
}
509-
510-
#[deprecated(
511-
since = "44.0.0",
512-
note = "please use `SingleRowListArrayBuilder` instead"
513-
)]
514-
pub fn array_into_fixed_size_list_array(
515-
arr: ArrayRef,
516-
list_size: usize,
517-
) -> FixedSizeListArray {
518-
SingleRowListArrayBuilder::new(arr).build_fixed_size_list_array(list_size)
519-
}
520-
521-
#[deprecated(
522-
since = "44.0.0",
523-
note = "please use `SingleRowListArrayBuilder` instead"
524-
)]
525-
pub fn array_into_fixed_size_list_array_with_field_name(
526-
arr: ArrayRef,
527-
list_size: usize,
528-
field_name: &str,
529-
) -> FixedSizeListArray {
530-
SingleRowListArrayBuilder::new(arr)
531-
.with_field_name(Some(field_name.to_string()))
532-
.build_fixed_size_list_array(list_size)
533-
}
534-
535447
/// Wrap arrays into a single element `ListArray`.
536448
///
537449
/// Example:
@@ -832,21 +744,6 @@ pub fn set_difference<T: Borrow<usize>, S: Borrow<usize>>(
832744
.collect()
833745
}
834746

835-
/// Checks whether the given index sequence is monotonically non-decreasing.
836-
#[deprecated(since = "45.0.0", note = "Use std::Iterator::is_sorted instead")]
837-
pub fn is_sorted<T: Borrow<usize>>(sequence: impl IntoIterator<Item = T>) -> bool {
838-
// TODO: Remove this function when `is_sorted` graduates from Rust nightly.
839-
let mut previous = 0;
840-
for item in sequence.into_iter() {
841-
let current = *item.borrow();
842-
if current < previous {
843-
return false;
844-
}
845-
previous = current;
846-
}
847-
true
848-
}
849-
850747
/// Find indices of each element in `targets` inside `items`. If one of the
851748
/// elements is absent in `items`, returns an error.
852749
pub fn find_indices<T: PartialEq, S: Borrow<T>>(
@@ -1274,19 +1171,6 @@ mod tests {
12741171
assert_eq!(set_difference([3, 4, 0], [4, 1, 2]), vec![3, 0]);
12751172
}
12761173

1277-
#[test]
1278-
#[expect(deprecated)]
1279-
fn test_is_sorted() {
1280-
assert!(is_sorted::<usize>([]));
1281-
assert!(is_sorted([0]));
1282-
assert!(is_sorted([0, 3, 4]));
1283-
assert!(is_sorted([0, 1, 2]));
1284-
assert!(is_sorted([0, 1, 4]));
1285-
assert!(is_sorted([0usize; 0]));
1286-
assert!(is_sorted([1, 2]));
1287-
assert!(!is_sorted([3, 2]));
1288-
}
1289-
12901174
#[test]
12911175
fn test_find_indices() -> Result<()> {
12921176
assert_eq!(find_indices(&[0, 3, 4], [0, 3, 4])?, vec![0, 1, 2]);

datafusion/core/src/execution/session_state.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,6 @@ impl Session for SessionState {
274274
}
275275

276276
impl SessionState {
277-
/// Returns new [`SessionState`] using the provided
278-
/// [`SessionConfig`] and [`RuntimeEnv`].
279-
#[deprecated(since = "41.0.0", note = "Use SessionStateBuilder")]
280-
pub fn new_with_config_rt(config: SessionConfig, runtime: Arc<RuntimeEnv>) -> Self {
281-
SessionStateBuilder::new()
282-
.with_config(config)
283-
.with_runtime_env(runtime)
284-
.with_default_features()
285-
.build()
286-
}
287-
288277
pub(crate) fn resolve_table_ref(
289278
&self,
290279
table_ref: impl Into<TableReference>,

datafusion/core/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -828,13 +828,6 @@ pub mod functions_nested {
828828
pub use datafusion_functions_nested::*;
829829
}
830830

831-
/// re-export of [`datafusion_functions_nested`] crate as [`functions_array`] for backward compatibility, if "nested_expressions" feature is enabled
832-
#[deprecated(since = "41.0.0", note = "use datafusion-functions-nested instead")]
833-
pub mod functions_array {
834-
#[cfg(feature = "nested_expressions")]
835-
pub use datafusion_functions_nested::*;
836-
}
837-
838831
/// re-export of [`datafusion_functions_aggregate`] crate
839832
pub mod functions_aggregate {
840833
pub use datafusion_functions_aggregate::*;

datafusion/doc/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,6 @@ pub struct DocumentationBuilder {
212212
}
213213

214214
impl DocumentationBuilder {
215-
#[allow(clippy::new_without_default)]
216-
#[deprecated(
217-
since = "44.0.0",
218-
note = "please use `DocumentationBuilder::new_with_details` instead"
219-
)]
220-
pub fn new() -> Self {
221-
Self::new_with_details(DocSection::default(), "<no description>", "<no example>")
222-
}
223-
224215
/// Creates a new [`DocumentationBuilder`] with all required fields
225216
pub fn new_with_details(
226217
doc_section: DocSection,

datafusion/execution/src/runtime_env.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,6 @@ impl Debug for RuntimeEnv {
8787
}
8888

8989
impl RuntimeEnv {
90-
#[deprecated(since = "43.0.0", note = "please use `RuntimeEnvBuilder` instead")]
91-
#[allow(deprecated)]
92-
pub fn new(config: RuntimeConfig) -> Result<Self> {
93-
Self::try_new(config)
94-
}
95-
/// Create env based on configuration
96-
#[deprecated(since = "44.0.0", note = "please use `RuntimeEnvBuilder` instead")]
97-
#[allow(deprecated)]
98-
pub fn try_new(config: RuntimeConfig) -> Result<Self> {
99-
config.build()
100-
}
101-
10290
/// Registers a custom `ObjectStore` to be used with a specific url.
10391
/// This allows DataFusion to create external tables from urls that do not have
10492
/// built in support such as `hdfs://namenode:port/...`.
@@ -162,15 +150,10 @@ impl Default for RuntimeEnv {
162150
}
163151
}
164152

165-
/// Please see: <https://github.com/apache/datafusion/issues/12156>
166-
/// This a type alias for backwards compatibility.
167-
#[deprecated(since = "43.0.0", note = "please use `RuntimeEnvBuilder` instead")]
168-
pub type RuntimeConfig = RuntimeEnvBuilder;
169-
170-
#[derive(Clone)]
171153
/// Execution runtime configuration builder.
172154
///
173155
/// See example on [`RuntimeEnv`]
156+
#[derive(Clone)]
174157
pub struct RuntimeEnvBuilder {
175158
#[allow(deprecated)]
176159
/// DiskManager to manage temporary disk file usage

datafusion/expr-common/src/operator.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,6 @@ impl Operator {
229229
)
230230
}
231231

232-
/// Return true if the comparison operator can be used in interval arithmetic and constraint
233-
/// propagation
234-
///
235-
/// For example, 'Binary(a, >, b)' expression supports propagation.
236-
#[deprecated(since = "43.0.0", note = "please use `supports_propagation` instead")]
237-
pub fn is_comparison_operator(&self) -> bool {
238-
self.supports_propagation()
239-
}
240-
241232
/// Return true if the operator is a logic operator.
242233
///
243234
/// For example, 'Binary(Binary(a, >, b), AND, Binary(a, <, b + 3))' would

datafusion/expr/src/expr.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,12 +1429,6 @@ impl Expr {
14291429
}
14301430
}
14311431

1432-
/// Returns a full and complete string representation of this expression.
1433-
#[deprecated(since = "42.0.0", note = "use format! instead")]
1434-
pub fn canonical_name(&self) -> String {
1435-
format!("{self}")
1436-
}
1437-
14381432
/// Return String representation of the variant represented by `self`
14391433
/// Useful for non-rust based bindings
14401434
pub fn variant_name(&self) -> &str {
@@ -3556,27 +3550,23 @@ mod test {
35563550
}
35573551

35583552
#[test]
3559-
#[allow(deprecated)]
35603553
fn format_case_when() -> Result<()> {
35613554
let expr = case(col("a"))
35623555
.when(lit(1), lit(true))
35633556
.when(lit(0), lit(false))
35643557
.otherwise(lit(ScalarValue::Null))?;
35653558
let expected = "CASE a WHEN Int32(1) THEN Boolean(true) WHEN Int32(0) THEN Boolean(false) ELSE NULL END";
3566-
assert_eq!(expected, expr.canonical_name());
35673559
assert_eq!(expected, format!("{expr}"));
35683560
Ok(())
35693561
}
35703562

35713563
#[test]
3572-
#[allow(deprecated)]
35733564
fn format_cast() -> Result<()> {
35743565
let expr = Expr::Cast(Cast {
35753566
expr: Box::new(Expr::Literal(ScalarValue::Float32(Some(1.23)), None)),
35763567
data_type: DataType::Utf8,
35773568
});
35783569
let expected_canonical = "CAST(Float32(1.23) AS Utf8)";
3579-
assert_eq!(expected_canonical, expr.canonical_name());
35803570
assert_eq!(expected_canonical, format!("{expr}"));
35813571
// Note that CAST intentionally has a name that is different from its `Display`
35823572
// representation. CAST does not change the name of expressions.

datafusion/functions-aggregate-common/src/utils.rs

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,15 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use std::sync::Arc;
19-
20-
use arrow::array::{ArrayRef, AsArray};
21-
use arrow::datatypes::{ArrowNativeType, FieldRef};
22-
use arrow::{
23-
array::ArrowNativeTypeOp,
24-
compute::SortOptions,
25-
datatypes::{
26-
DataType, Decimal128Type, DecimalType, Field, TimeUnit, TimestampMicrosecondType,
27-
TimestampMillisecondType, TimestampNanosecondType, TimestampSecondType,
28-
ToByteSlice,
29-
},
18+
use arrow::array::{ArrayRef, ArrowNativeTypeOp};
19+
use arrow::compute::SortOptions;
20+
use arrow::datatypes::{
21+
ArrowNativeType, DataType, DecimalType, Field, FieldRef, ToByteSlice,
3022
};
3123
use datafusion_common::{exec_err, DataFusionError, Result};
3224
use datafusion_expr_common::accumulator::Accumulator;
3325
use datafusion_physical_expr_common::sort_expr::{LexOrdering, PhysicalSortExpr};
26+
use std::sync::Arc;
3427

3528
/// Convert scalar values from an accumulator into arrays.
3629
pub fn get_accum_scalar_values_as_arrays(
@@ -43,50 +36,6 @@ pub fn get_accum_scalar_values_as_arrays(
4336
.collect()
4437
}
4538

46-
/// Adjust array type metadata if needed
47-
///
48-
/// Since `Decimal128Arrays` created from `Vec<NativeType>` have
49-
/// default precision and scale, this function adjusts the output to
50-
/// match `data_type`, if necessary
51-
#[deprecated(since = "44.0.0", note = "use PrimitiveArray::with_datatype")]
52-
pub fn adjust_output_array(data_type: &DataType, array: ArrayRef) -> Result<ArrayRef> {
53-
let array = match data_type {
54-
DataType::Decimal128(p, s) => Arc::new(
55-
array
56-
.as_primitive::<Decimal128Type>()
57-
.clone()
58-
.with_precision_and_scale(*p, *s)?,
59-
) as ArrayRef,
60-
DataType::Timestamp(TimeUnit::Nanosecond, tz) => Arc::new(
61-
array
62-
.as_primitive::<TimestampNanosecondType>()
63-
.clone()
64-
.with_timezone_opt(tz.clone()),
65-
),
66-
DataType::Timestamp(TimeUnit::Microsecond, tz) => Arc::new(
67-
array
68-
.as_primitive::<TimestampMicrosecondType>()
69-
.clone()
70-
.with_timezone_opt(tz.clone()),
71-
),
72-
DataType::Timestamp(TimeUnit::Millisecond, tz) => Arc::new(
73-
array
74-
.as_primitive::<TimestampMillisecondType>()
75-
.clone()
76-
.with_timezone_opt(tz.clone()),
77-
),
78-
DataType::Timestamp(TimeUnit::Second, tz) => Arc::new(
79-
array
80-
.as_primitive::<TimestampSecondType>()
81-
.clone()
82-
.with_timezone_opt(tz.clone()),
83-
),
84-
// no adjustment needed for other arrays
85-
_ => array,
86-
};
87-
Ok(array)
88-
}
89-
9039
/// Construct corresponding fields for the expressions in an ORDER BY clause.
9140
pub fn ordering_fields(
9241
order_bys: &[PhysicalSortExpr],

0 commit comments

Comments
 (0)