Skip to content

Commit

Permalink
Add name method to execution plan (#9793)
Browse files Browse the repository at this point in the history
* Add name method to execution plan

* Cleanup

* Change default impl

* Add tests

* Clippy

* Use unimplemented macro

* Fix
  • Loading branch information
matthewmturner committed Mar 28, 2024
1 parent 45b8b0b commit 3a1e3ad
Show file tree
Hide file tree
Showing 41 changed files with 312 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datafusion-examples/examples/custom_datasource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/datasource/physical_plan/arrow_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/datasource/physical_plan/avro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/datasource/physical_plan/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/datasource/physical_plan/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/datasource/physical_plan/parquet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/physical_optimizer/output_requirements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/core/src/physical_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions datafusion/physical-plan/src/aggregates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1658,6 +1662,10 @@ mod tests {
}

impl ExecutionPlan for TestYieldingExec {
fn name(&self) -> &'static str {
"TestYieldingExec"
}

fn as_any(&self) -> &dyn Any {
self
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/coalesce_batches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/coalesce_partitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/explain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/joins/cross_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/joins/hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/joins/nested_loop_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/joins/sort_merge_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions datafusion/physical-plan/src/joins/symmetric_hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading

0 comments on commit 3a1e3ad

Please sign in to comment.