From 3bba784e2ef208543e9ba204489868f6d34f1851 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Mon, 27 Jan 2025 10:35:40 -0500 Subject: [PATCH 1/2] Improve deprecation message for `MemoryExec` --- datafusion/physical-plan/src/values.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/datafusion/physical-plan/src/values.rs b/datafusion/physical-plan/src/values.rs index a30b8981fdd8a..ebd987867fe99 100644 --- a/datafusion/physical-plan/src/values.rs +++ b/datafusion/physical-plan/src/values.rs @@ -27,6 +27,7 @@ use crate::{ PhysicalExpr, }; +use crate::memory::MemoryExec; use arrow::datatypes::{Schema, SchemaRef}; use arrow::record_batch::{RecordBatch, RecordBatchOptions}; use datafusion_common::{internal_err, plan_err, Result, ScalarValue}; @@ -34,7 +35,13 @@ use datafusion_execution::TaskContext; use datafusion_physical_expr::EquivalenceProperties; /// Execution plan for values list based relation (produces constant rows) -#[deprecated(since = "45.0.0", note = "Use `MemoryExec::try_new_as_values` instead")] +/// +/// Note this structure is the same as [`MemoryExec`] and is deprecated. +/// Please see the following for alternatives +/// * [`MemoryExec::try_new`] +/// * [`MemoryExec::try_new_from_batches`] +/// +#[deprecated(since = "45.0.0", note = "Use `MemoryExec` instead")] #[derive(Debug, Clone)] pub struct ValuesExec { /// The schema @@ -48,6 +55,7 @@ pub struct ValuesExec { #[allow(deprecated)] impl ValuesExec { /// Create a new values exec from data as expr + #[deprecated(since = "45.0.0", note = "Use `MemoryExec::try_new` instead")] pub fn try_new( schema: SchemaRef, data: Vec>>, @@ -101,6 +109,10 @@ impl ValuesExec { /// /// Errors if any of the batches don't match the provided schema, or if no /// batches are provided. + #[deprecated( + since = "45.0.0", + note = "Use `MemoryExec::try_new_from_batches` instead" + )] pub fn try_new_from_batches( schema: SchemaRef, batches: Vec, From 08a5cccb9fd01e8588ff7fcfee6d5e6b9e2eb0b4 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Mon, 27 Jan 2025 10:36:33 -0500 Subject: [PATCH 2/2] clippy --- datafusion/physical-plan/src/values.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/datafusion/physical-plan/src/values.rs b/datafusion/physical-plan/src/values.rs index ebd987867fe99..b000f9335a3e4 100644 --- a/datafusion/physical-plan/src/values.rs +++ b/datafusion/physical-plan/src/values.rs @@ -27,7 +27,6 @@ use crate::{ PhysicalExpr, }; -use crate::memory::MemoryExec; use arrow::datatypes::{Schema, SchemaRef}; use arrow::record_batch::{RecordBatch, RecordBatchOptions}; use datafusion_common::{internal_err, plan_err, Result, ScalarValue}; @@ -41,6 +40,9 @@ use datafusion_physical_expr::EquivalenceProperties; /// * [`MemoryExec::try_new`] /// * [`MemoryExec::try_new_from_batches`] /// +/// [`MemoryExec`]: crate::memory::MemoryExec +/// [`MemoryExec::try_new`]: crate::memory::MemoryExec::try_new +/// [`MemoryExec::try_new_from_batches`]: crate::memory::MemoryExec::try_new_from_batches #[deprecated(since = "45.0.0", note = "Use `MemoryExec` instead")] #[derive(Debug, Clone)] pub struct ValuesExec {