Skip to content

Apache DataFusion SQL Query Engine

Add name method to execution plan (#9793)

Matthew Turner3a1e3adc727e
diff --git a/datafusion-examples/examples/custom_datasource.rs b/datafusion-examples/examples/custom_datasource.rs
index 0b7e3d4c64..ba0d2f3b30 100644
--- a/datafusion-examples/examples/custom_datasource.rs
+++ b/datafusion-examples/examples/custom_datasource.rs
@@ -226,6 +226,10 @@ impl DisplayAs for CustomExec {
}
impl ExecutionPlan for CustomExec {
+ fn name(&self) -> &'static str {
+ "CustomExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/core/src/datasource/physical_plan/arrow_file.rs b/datafusion/core/src/datasource/physical_plan/arrow_file.rs
index 96b3adf968..1e87757310 100644
--- a/datafusion/core/src/datasource/physical_plan/arrow_file.rs
+++ b/datafusion/core/src/datasource/physical_plan/arrow_file.rs
@@ -122,6 +122,10 @@ impl DisplayAs for ArrowExec {
}
impl ExecutionPlan for ArrowExec {
+ fn name(&self) -> &'static str {
+ "ArrowExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/core/src/datasource/physical_plan/avro.rs b/datafusion/core/src/datasource/physical_plan/avro.rs
index 2ccd83de80..4e5140e82d 100644
--- a/datafusion/core/src/datasource/physical_plan/avro.rs
+++ b/datafusion/core/src/datasource/physical_plan/avro.rs
@@ -99,6 +99,10 @@ impl DisplayAs for AvroExec {
}
impl ExecutionPlan for AvroExec {
+ fn name(&self) -> &'static str {
+ "AvroExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/core/src/datasource/physical_plan/csv.rs b/datafusion/core/src/datasource/physical_plan/csv.rs
index 31cc52f796..831ef45205 100644
--- a/datafusion/core/src/datasource/physical_plan/csv.rs
+++ b/datafusion/core/src/datasource/physical_plan/csv.rs
@@ -160,6 +160,10 @@ impl DisplayAs for CsvExec {
}
impl ExecutionPlan for CsvExec {
+ fn name(&self) -> &'static str {
+ "CsvExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/core/src/datasource/physical_plan/json.rs b/datafusion/core/src/datasource/physical_plan/json.rs
index c876b3d078..a5afda4752 100644
--- a/datafusion/core/src/datasource/physical_plan/json.rs
+++ b/datafusion/core/src/datasource/physical_plan/json.rs
@@ -127,6 +127,10 @@ impl DisplayAs for NdJsonExec {
}
impl ExecutionPlan for NdJsonExec {
+ fn name(&self) -> &'static str {
+ "NdJsonExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/core/src/datasource/physical_plan/parquet/mod.rs b/datafusion/core/src/datasource/physical_plan/parquet/mod.rs
index 767cde9cc5..377dad5cee 100644
--- a/datafusion/core/src/datasource/physical_plan/parquet/mod.rs
+++ b/datafusion/core/src/datasource/physical_plan/parquet/mod.rs
@@ -315,6 +315,10 @@ impl DisplayAs for ParquetExec {
}
impl ExecutionPlan for ParquetExec {
+ fn name(&self) -> &'static str {
+ "ParquetExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/core/src/physical_optimizer/enforce_distribution.rs b/datafusion/core/src/physical_optimizer/enforce_distribution.rs
index 0740a8d2cd..a58f8698d6 100644
--- a/datafusion/core/src/physical_optimizer/enforce_distribution.rs
+++ b/datafusion/core/src/physical_optimizer/enforce_distribution.rs
@@ -1369,6 +1369,10 @@ pub(crate) mod tests {
}
impl ExecutionPlan for SortRequiredExec {
+ fn name(&self) -> &'static str {
+ "SortRequiredExec"
+ }
+
fn as_any(&self) -> &dyn std::any::Any {
self
}
diff --git a/datafusion/core/src/physical_optimizer/output_requirements.rs b/datafusion/core/src/physical_optimizer/output_requirements.rs
index bf010a5e39..829d523c99 100644
--- a/datafusion/core/src/physical_optimizer/output_requirements.rs
+++ b/datafusion/core/src/physical_optimizer/output_requirements.rs
@@ -133,6 +133,10 @@ impl DisplayAs for OutputRequirementExec {
}
impl ExecutionPlan for OutputRequirementExec {
+ fn name(&self) -> &'static str {
+ "OutputRequirementExec"
+ }
+
fn as_any(&self) -> &dyn std::any::Any {
self
}
diff --git a/datafusion/core/src/physical_planner.rs b/datafusion/core/src/physical_planner.rs
index deac3dcf46..0a1730e944 100644
--- a/datafusion/core/src/physical_planner.rs
+++ b/datafusion/core/src/physical_planner.rs
@@ -2616,6 +2616,10 @@ mod tests {
}
impl ExecutionPlan for NoOpExecutionPlan {
+ fn name(&self) -> &'static str {
+ "NoOpExecutionPlan"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/aggregates/mod.rs b/datafusion/physical-plan/src/aggregates/mod.rs
index 65987e0155..e263876b07 100644
--- a/datafusion/physical-plan/src/aggregates/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/mod.rs
@@ -636,6 +636,10 @@ impl DisplayAs for AggregateExec {
}
impl ExecutionPlan for AggregateExec {
+ fn name(&self) -> &'static str {
+ "AggregateExec"
+ }
+
/// Return a reference to Any that can be used for down-casting
fn as_any(&self) -> &dyn Any {
self
@@ -1658,6 +1662,10 @@ mod tests {
}
impl ExecutionPlan for TestYieldingExec {
+ fn name(&self) -> &'static str {
+ "TestYieldingExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/analyze.rs b/datafusion/physical-plan/src/analyze.rs
index 83a73ee992..c420581c43 100644
--- a/datafusion/physical-plan/src/analyze.rs
+++ b/datafusion/physical-plan/src/analyze.rs
@@ -111,6 +111,10 @@ impl DisplayAs for AnalyzeExec {
}
impl ExecutionPlan for AnalyzeExec {
+ fn name(&self) -> &'static str {
+ "AnalyzeExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/coalesce_batches.rs b/datafusion/physical-plan/src/coalesce_batches.rs
index 0b9ecebbb1..bc7c4a3d06 100644
--- a/datafusion/physical-plan/src/coalesce_batches.rs
+++ b/datafusion/physical-plan/src/coalesce_batches.rs
@@ -104,6 +104,10 @@ impl DisplayAs for CoalesceBatchesExec {
}
impl ExecutionPlan for CoalesceBatchesExec {
+ fn name(&self) -> &'static str {
+ "CoalesceBatchesExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/coalesce_partitions.rs b/datafusion/physical-plan/src/coalesce_partitions.rs
index 1e58260a53..1c725ce31f 100644
--- a/datafusion/physical-plan/src/coalesce_partitions.rs
+++ b/datafusion/physical-plan/src/coalesce_partitions.rs
@@ -89,6 +89,10 @@ impl DisplayAs for CoalescePartitionsExec {
}
impl ExecutionPlan for CoalescePartitionsExec {
+ fn name(&self) -> &'static str {
+ "CoalescePartitionsExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/display.rs b/datafusion/physical-plan/src/display.rs
index 4b7b35e53e..ca93ce5e7b 100644
--- a/datafusion/physical-plan/src/display.rs
+++ b/datafusion/physical-plan/src/display.rs
@@ -489,6 +489,10 @@ mod tests {
}
impl ExecutionPlan for TestStatsExecPlan {
+ fn name(&self) -> &'static str {
+ "TestStatsExecPlan"
+ }
+
fn as_any(&self) -> &dyn std::any::Any {
self
}
diff --git a/datafusion/physical-plan/src/empty.rs b/datafusion/physical-plan/src/empty.rs
index 4ff79cdaae..8e8eb4d25e 100644
--- a/datafusion/physical-plan/src/empty.rs
+++ b/datafusion/physical-plan/src/empty.rs
@@ -101,6 +101,10 @@ impl DisplayAs for EmptyExec {
}
impl ExecutionPlan for EmptyExec {
+ fn name(&self) -> &'static str {
+ "EmptyExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/explain.rs b/datafusion/physical-plan/src/explain.rs
index 320ee37bed..6499469932 100644
--- a/datafusion/physical-plan/src/explain.rs
+++ b/datafusion/physical-plan/src/explain.rs
@@ -98,6 +98,10 @@ impl DisplayAs for ExplainExec {
}
impl ExecutionPlan for ExplainExec {
+ fn name(&self) -> &'static str {
+ "ExplainExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/filter.rs b/datafusion/physical-plan/src/filter.rs
index f44ade7106..2996152fb9 100644
--- a/datafusion/physical-plan/src/filter.rs
+++ b/datafusion/physical-plan/src/filter.rs
@@ -231,6 +231,10 @@ impl DisplayAs for FilterExec {
}
impl ExecutionPlan for FilterExec {
+ fn name(&self) -> &'static str {
+ "FilterExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/insert.rs b/datafusion/physical-plan/src/insert.rs
index 16c929b781..f0233264f2 100644
--- a/datafusion/physical-plan/src/insert.rs
+++ b/datafusion/physical-plan/src/insert.rs
@@ -206,6 +206,10 @@ impl DisplayAs for FileSinkExec {
}
impl ExecutionPlan for FileSinkExec {
+ fn name(&self) -> &'static str {
+ "FileSinkExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/joins/cross_join.rs b/datafusion/physical-plan/src/joins/cross_join.rs
index 9f8dc0ce56..19d34f8048 100644
--- a/datafusion/physical-plan/src/joins/cross_join.rs
+++ b/datafusion/physical-plan/src/joins/cross_join.rs
@@ -194,6 +194,10 @@ impl DisplayAs for CrossJoinExec {
}
impl ExecutionPlan for CrossJoinExec {
+ fn name(&self) -> &'static str {
+ "CrossJoinExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rs
index a1c50a2113..1c0181c2e1 100644
--- a/datafusion/physical-plan/src/joins/hash_join.rs
+++ b/datafusion/physical-plan/src/joins/hash_join.rs
@@ -611,6 +611,10 @@ fn project_index_to_exprs(
}
impl ExecutionPlan for HashJoinExec {
+ fn name(&self) -> &'static str {
+ "HashJoinExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/joins/nested_loop_join.rs b/datafusion/physical-plan/src/joins/nested_loop_join.rs
index c6d891dd13..e6236e45f0 100644
--- a/datafusion/physical-plan/src/joins/nested_loop_join.rs
+++ b/datafusion/physical-plan/src/joins/nested_loop_join.rs
@@ -205,6 +205,10 @@ impl DisplayAs for NestedLoopJoinExec {
}
impl ExecutionPlan for NestedLoopJoinExec {
+ fn name(&self) -> &'static str {
+ "NestedLoopJoinExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/joins/sort_merge_join.rs b/datafusion/physical-plan/src/joins/sort_merge_join.rs
index 7b70a2952b..21630087f2 100644
--- a/datafusion/physical-plan/src/joins/sort_merge_join.rs
+++ b/datafusion/physical-plan/src/joins/sort_merge_join.rs
@@ -262,6 +262,10 @@ impl DisplayAs for SortMergeJoinExec {
}
impl ExecutionPlan for SortMergeJoinExec {
+ fn name(&self) -> &'static str {
+ "SortMergeJoinExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
index 79b8c813d8..453b217f7f 100644
--- a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
+++ b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
@@ -385,6 +385,10 @@ impl DisplayAs for SymmetricHashJoinExec {
}
impl ExecutionPlan for SymmetricHashJoinExec {
+ fn name(&self) -> &'static str {
+ "SymmetricHashJoinExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/lib.rs b/datafusion/physical-plan/src/lib.rs
index 6334a4a211..4b4b37f8b5 100644
--- a/datafusion/physical-plan/src/lib.rs
+++ b/datafusion/physical-plan/src/lib.rs
@@ -113,6 +113,15 @@ pub use datafusion_execution::{RecordBatchStream, SendableRecordBatchStream};
/// [`required_input_distribution`]: ExecutionPlan::required_input_distribution
/// [`required_input_ordering`]: ExecutionPlan::required_input_ordering
pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync {
+ /// Short name for the ExecutionPlan, such as 'ParquetExec'.
+ fn name(&self) -> &'static str {
+ let full_name = std::any::type_name::<Self>();
+ let maybe_start_idx = full_name.rfind(':');
+ match maybe_start_idx {
+ Some(start_idx) => &full_name[start_idx + 1..],
+ None => "UNKNOWN",
+ }
+ }
/// Returns the execution plan as [`Any`] so that it can be
/// downcast to a specific implementation.
fn as_any(&self) -> &dyn Any;
@@ -778,4 +787,135 @@ pub fn get_plan_string(plan: &Arc<dyn ExecutionPlan>) -> Vec<String> {
#[allow(clippy::single_component_path_imports)]
use rstest_reuse;
+#[cfg(test)]
+mod tests {
+ use std::any::Any;
+ use std::sync::Arc;
+
+ use arrow_schema::{Schema, SchemaRef};
+ use datafusion_common::{Result, Statistics};
+ use datafusion_execution::{SendableRecordBatchStream, TaskContext};
+
+ use crate::{DisplayAs, DisplayFormatType, ExecutionPlan, PlanProperties};
+
+ #[derive(Debug)]
+ pub struct EmptyExec;
+
+ impl EmptyExec {
+ pub fn new(_schema: SchemaRef) -> Self {
+ Self
+ }
+ }
+
+ impl DisplayAs for EmptyExec {
+ fn fmt_as(
+ &self,
+ _t: DisplayFormatType,
+ _f: &mut std::fmt::Formatter,
+ ) -> std::fmt::Result {
+ unimplemented!()
+ }
+ }
+
+ impl ExecutionPlan for EmptyExec {
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
+ fn properties(&self) -> &PlanProperties {
+ unimplemented!()
+ }
+
+ fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> {
+ vec![]
+ }
+
+ fn with_new_children(
+ self: Arc<Self>,
+ _: Vec<Arc<dyn ExecutionPlan>>,
+ ) -> Result<Arc<dyn ExecutionPlan>> {
+ unimplemented!()
+ }
+
+ fn execute(
+ &self,
+ _partition: usize,
+ _context: Arc<TaskContext>,
+ ) -> Result<SendableRecordBatchStream> {
+ unimplemented!()
+ }
+
+ fn statistics(&self) -> Result<Statistics> {
+ unimplemented!()
+ }
+ }
+
+ #[derive(Debug)]
+ pub struct RenamedEmptyExec;
+
+ impl RenamedEmptyExec {
+ pub fn new(_schema: SchemaRef) -> Self {
+ Self
+ }
+ }
+
+ impl DisplayAs for RenamedEmptyExec {
+ fn fmt_as(
+ &self,
+ _t: DisplayFormatType,
+ _f: &mut std::fmt::Formatter,
+ ) -> std::fmt::Result {
+ unimplemented!()
+ }
+ }
+
+ impl ExecutionPlan for RenamedEmptyExec {
+ fn name(&self) -> &'static str {
+ "MyRenamedEmptyExec"
+ }
+
+ fn as_any(&self) -> &dyn Any {
+ self
+ }
+
+ fn properties(&self) -> &PlanProperties {
+ unimplemented!()
+ }
+
+ fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> {
+ vec![]
+ }
+
+ fn with_new_children(
+ self: Arc<Self>,
+ _: Vec<Arc<dyn ExecutionPlan>>,
+ ) -> Result<Arc<dyn ExecutionPlan>> {
+ unimplemented!()
+ }
+
+ fn execute(
+ &self,
+ _partition: usize,
+ _context: Arc<TaskContext>,
+ ) -> Result<SendableRecordBatchStream> {
+ unimplemented!()
+ }
+
+ fn statistics(&self) -> Result<Statistics> {
+ unimplemented!()
+ }
+ }
+
+ #[test]
+ fn test_execution_plan_name() {
+ let schema1 = Arc::new(Schema::empty());
+ let default_name_exec = EmptyExec::new(schema1);
+ assert_eq!(default_name_exec.name(), "EmptyExec");
+
+ let schema2 = Arc::new(Schema::empty());
+ let renamed_exec = RenamedEmptyExec::new(schema2);
+ assert_eq!(renamed_exec.name(), "MyRenamedEmptyExec");
+ }
+}
+
pub mod test;
diff --git a/datafusion/physical-plan/src/limit.rs b/datafusion/physical-plan/src/limit.rs
index 9fa15cbf64..fab483b0da 100644
--- a/datafusion/physical-plan/src/limit.rs
+++ b/datafusion/physical-plan/src/limit.rs
@@ -111,6 +111,10 @@ impl DisplayAs for GlobalLimitExec {
}
impl ExecutionPlan for GlobalLimitExec {
+ fn name(&self) -> &'static str {
+ "GlobalLimitExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
@@ -317,6 +321,10 @@ impl DisplayAs for LocalLimitExec {
}
impl ExecutionPlan for LocalLimitExec {
+ fn name(&self) -> &'static str {
+ "LocalLimitExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/memory.rs b/datafusion/physical-plan/src/memory.rs
index 795ec3c731..883cdb540a 100644
--- a/datafusion/physical-plan/src/memory.rs
+++ b/datafusion/physical-plan/src/memory.rs
@@ -103,6 +103,10 @@ impl DisplayAs for MemoryExec {
}
impl ExecutionPlan for MemoryExec {
+ fn name(&self) -> &'static str {
+ "MemoryExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/placeholder_row.rs b/datafusion/physical-plan/src/placeholder_row.rs
index 3880cf3d77..c047ff5122 100644
--- a/datafusion/physical-plan/src/placeholder_row.rs
+++ b/datafusion/physical-plan/src/placeholder_row.rs
@@ -119,6 +119,10 @@ impl DisplayAs for PlaceholderRowExec {
}
impl ExecutionPlan for PlaceholderRowExec {
+ fn name(&self) -> &'static str {
+ "PlaceholderRowExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/projection.rs b/datafusion/physical-plan/src/projection.rs
index 8fe82e7de3..f72815c01a 100644
--- a/datafusion/physical-plan/src/projection.rs
+++ b/datafusion/physical-plan/src/projection.rs
@@ -180,6 +180,10 @@ impl DisplayAs for ProjectionExec {
}
impl ExecutionPlan for ProjectionExec {
+ fn name(&self) -> &'static str {
+ "ProjectionExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/recursive_query.rs b/datafusion/physical-plan/src/recursive_query.rs
index 140820ff78..ba7d1a5454 100644
--- a/datafusion/physical-plan/src/recursive_query.rs
+++ b/datafusion/physical-plan/src/recursive_query.rs
@@ -108,6 +108,10 @@ impl RecursiveQueryExec {
}
impl ExecutionPlan for RecursiveQueryExec {
+ fn name(&self) -> &'static str {
+ "RecursiveQueryExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/repartition/mod.rs b/datafusion/physical-plan/src/repartition/mod.rs
index 7ac70949f8..c0dbf5164e 100644
--- a/datafusion/physical-plan/src/repartition/mod.rs
+++ b/datafusion/physical-plan/src/repartition/mod.rs
@@ -406,6 +406,10 @@ impl DisplayAs for RepartitionExec {
}
impl ExecutionPlan for RepartitionExec {
+ fn name(&self) -> &'static str {
+ "RepartitionExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/sorts/partial_sort.rs b/datafusion/physical-plan/src/sorts/partial_sort.rs
index 2acb881246..d24bc5a670 100644
--- a/datafusion/physical-plan/src/sorts/partial_sort.rs
+++ b/datafusion/physical-plan/src/sorts/partial_sort.rs
@@ -226,6 +226,10 @@ impl DisplayAs for PartialSortExec {
}
impl ExecutionPlan for PartialSortExec {
+ fn name(&self) -> &'static str {
+ "PartialSortExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/sorts/sort.rs b/datafusion/physical-plan/src/sorts/sort.rs
index a80dab058c..a6f47d3d2f 100644
--- a/datafusion/physical-plan/src/sorts/sort.rs
+++ b/datafusion/physical-plan/src/sorts/sort.rs
@@ -860,6 +860,10 @@ impl DisplayAs for SortExec {
}
impl ExecutionPlan for SortExec {
+ fn name(&self) -> &'static str {
+ "SortExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
index 556615f64d..edef022b0c 100644
--- a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
+++ b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
@@ -144,6 +144,10 @@ impl DisplayAs for SortPreservingMergeExec {
}
impl ExecutionPlan for SortPreservingMergeExec {
+ fn name(&self) -> &'static str {
+ "SortPreservingMergeExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/streaming.rs b/datafusion/physical-plan/src/streaming.rs
index 7b062ab874..d7e254c42f 100644
--- a/datafusion/physical-plan/src/streaming.rs
+++ b/datafusion/physical-plan/src/streaming.rs
@@ -191,6 +191,10 @@ impl DisplayAs for StreamingTableExec {
#[async_trait]
impl ExecutionPlan for StreamingTableExec {
+ fn name(&self) -> &'static str {
+ "StreamingTableExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/union.rs b/datafusion/physical-plan/src/union.rs
index 64322bd5f1..69901aa2fa 100644
--- a/datafusion/physical-plan/src/union.rs
+++ b/datafusion/physical-plan/src/union.rs
@@ -183,6 +183,10 @@ impl DisplayAs for UnionExec {
}
impl ExecutionPlan for UnionExec {
+ fn name(&self) -> &'static str {
+ "UnionExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
@@ -370,6 +374,10 @@ impl DisplayAs for InterleaveExec {
}
impl ExecutionPlan for InterleaveExec {
+ fn name(&self) -> &'static str {
+ "InterleaveExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/unnest.rs b/datafusion/physical-plan/src/unnest.rs
index 886b718e6e..324e2ea2d7 100644
--- a/datafusion/physical-plan/src/unnest.rs
+++ b/datafusion/physical-plan/src/unnest.rs
@@ -112,6 +112,10 @@ impl DisplayAs for UnnestExec {
}
impl ExecutionPlan for UnnestExec {
+ fn name(&self) -> &'static str {
+ "UnnestExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/datafusion/physical-plan/src/values.rs b/datafusion/physical-plan/src/values.rs
index 8868a59008..63e8c32349 100644
--- a/datafusion/physical-plan/src/values.rs
+++ b/datafusion/physical-plan/src/values.rs
@@ -154,6 +154,10 @@ impl DisplayAs for ValuesExec {
}
impl ExecutionPlan for ValuesExec {
+ fn name(&self) -> &'static str {
+ "ValuesExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs b/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs
index 70b6182d81..75e203891c 100644
--- a/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs
+++ b/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs
@@ -237,6 +237,10 @@ impl DisplayAs for BoundedWindowAggExec {
}
impl ExecutionPlan for BoundedWindowAggExec {
+ fn name(&self) -> &'static str {
+ "BoundedWindowAggExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/windows/window_agg_exec.rs b/datafusion/physical-plan/src/windows/window_agg_exec.rs
index e300eee49d..46ba21bd79 100644
--- a/datafusion/physical-plan/src/windows/window_agg_exec.rs
+++ b/datafusion/physical-plan/src/windows/window_agg_exec.rs
@@ -172,6 +172,10 @@ impl DisplayAs for WindowAggExec {
}
impl ExecutionPlan for WindowAggExec {
+ fn name(&self) -> &'static str {
+ "WindowAggExec"
+ }
+
/// Return a reference to Any that can be used for downcasting
fn as_any(&self) -> &dyn Any {
self
diff --git a/datafusion/physical-plan/src/work_table.rs b/datafusion/physical-plan/src/work_table.rs
index f6fc0334df..dfdb624a56 100644
--- a/datafusion/physical-plan/src/work_table.rs
+++ b/datafusion/physical-plan/src/work_table.rs
@@ -157,6 +157,10 @@ impl DisplayAs for WorkTableExec {
}
impl ExecutionPlan for WorkTableExec {
+ fn name(&self) -> &'static str {
+ "WorkTableExec"
+ }
+
fn as_any(&self) -> &dyn Any {
self
}
diff --git a/docs/source/library-user-guide/custom-table-providers.md b/docs/source/library-user-guide/custom-table-providers.md
index 9da207da68..11024f77e0 100644
--- a/docs/source/library-user-guide/custom-table-providers.md
+++ b/docs/source/library-user-guide/custom-table-providers.md
@@ -46,6 +46,10 @@ struct CustomExec {
}
impl ExecutionPlan for CustomExec {
+ fn name(&self) {
+ "CustomExec"
+ }
+
fn execute(
&self,
_partition: usize,