Skip to content

Commit 89e96b4

Browse files
authored
Derive Clone for more ExecutionPlans (#13203)
* Derive `Clone` for more ExecutionPlans * improve docs
1 parent 344f089 commit 89e96b4

24 files changed

+36
-19
lines changed

datafusion/physical-plan/src/aggregates/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl From<StreamType> for SendableRecordBatchStream {
344344
}
345345

346346
/// Hash aggregate execution plan
347-
#[derive(Debug)]
347+
#[derive(Debug, Clone)]
348348
pub struct AggregateExec {
349349
/// Aggregation mode (full, partial)
350350
mode: AggregateMode,

datafusion/physical-plan/src/coalesce_batches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use futures::stream::{Stream, StreamExt};
4848
/// reaches the `fetch` value.
4949
///
5050
/// See [`BatchCoalescer`] for more information
51-
#[derive(Debug)]
51+
#[derive(Debug, Clone)]
5252
pub struct CoalesceBatchesExec {
5353
/// The input plan
5454
input: Arc<dyn ExecutionPlan>,

datafusion/physical-plan/src/coalesce_partitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use datafusion_execution::TaskContext;
3636

3737
/// Merge execution plan executes partitions in parallel and combines them into a single
3838
/// partition. No guarantees are made about the order of the resulting partition.
39-
#[derive(Debug)]
39+
#[derive(Debug, Clone)]
4040
pub struct CoalescePartitionsExec {
4141
/// Input execution plan
4242
input: Arc<dyn ExecutionPlan>,

datafusion/physical-plan/src/empty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use datafusion_physical_expr::EquivalenceProperties;
3535
use log::trace;
3636

3737
/// Execution plan for empty relation with produce_one_row=false
38-
#[derive(Debug)]
38+
#[derive(Debug, Clone)]
3939
pub struct EmptyExec {
4040
/// The schema for the produced row
4141
schema: SchemaRef,

datafusion/physical-plan/src/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use log::trace;
5454

5555
/// FilterExec evaluates a boolean predicate against all input batches to determine which rows to
5656
/// include in its output batches.
57-
#[derive(Debug)]
57+
#[derive(Debug, Clone)]
5858
pub struct FilterExec {
5959
/// The expression to filter on. This expression must evaluate to a boolean value.
6060
predicate: Arc<dyn PhysicalExpr>,

datafusion/physical-plan/src/insert.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub type FileSinkExec = DataSinkExec;
7979
/// Execution plan for writing record batches to a [`DataSink`]
8080
///
8181
/// Returns a single row with the number of values written
82+
#[derive(Clone)]
8283
pub struct DataSinkExec {
8384
/// Input plan that produces the record batches to be written.
8485
input: Arc<dyn ExecutionPlan>,

datafusion/physical-plan/src/joins/cross_join.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ use futures::{ready, Stream, StreamExt, TryStreamExt};
4949
/// Data of the left side
5050
type JoinLeftData = (RecordBatch, MemoryReservation);
5151

52+
#[allow(rustdoc::private_intra_doc_links)]
5253
/// executes partitions in parallel and combines them into a set of
5354
/// partitions by combining all values from the left with all values on the right
55+
///
56+
/// Note that the `Clone` trait is not implemented for this struct due to the
57+
/// `left_fut` [`OnceAsync`], which is used to coordinate the loading of the
58+
/// left side with the processing in each output stream.
5459
#[derive(Debug)]
5560
pub struct CrossJoinExec {
5661
/// left (build) side which gets loaded in memory

datafusion/physical-plan/src/joins/hash_join.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ impl JoinLeftData {
136136
}
137137
}
138138

139+
#[allow(rustdoc::private_intra_doc_links)]
139140
/// Join execution plan: Evaluates eqijoin predicates in parallel on multiple
140141
/// partitions using a hash table and an optional filter list to apply post
141142
/// join.
@@ -293,6 +294,10 @@ impl JoinLeftData {
293294
/// │ "dimension" │ │ "fact" │
294295
/// └───────────────┘ └───────────────┘
295296
/// ```
297+
///
298+
/// Note that the `Clone` trait is not implemented for this struct due to the
299+
/// `left_fut` [`OnceAsync`], which is used to coordinate the loading of the
300+
/// left side with the processing in each output stream.
296301
#[derive(Debug)]
297302
pub struct HashJoinExec {
298303
/// left (build) side which gets hashed

datafusion/physical-plan/src/joins/nested_loop_join.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ impl JoinLeftData {
105105
}
106106
}
107107

108+
#[allow(rustdoc::private_intra_doc_links)]
108109
/// NestedLoopJoinExec is build-probe join operator, whose main task is to
109110
/// perform joins without any equijoin conditions in `ON` clause.
110111
///
@@ -140,6 +141,9 @@ impl JoinLeftData {
140141
/// "reports" about probe phase completion (which means that "visited" bitmap won't be
141142
/// updated anymore), and only the last thread, reporting about completion, will return output.
142143
///
144+
/// Note that the `Clone` trait is not implemented for this struct due to the
145+
/// `left_fut` [`OnceAsync`], which is used to coordinate the loading of the
146+
/// left side with the processing in each output stream.
143147
#[derive(Debug)]
144148
pub struct NestedLoopJoinExec {
145149
/// left side

datafusion/physical-plan/src/joins/sort_merge_join.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use crate::{
7171

7272
/// join execution plan executes partitions in parallel and combines them into a set of
7373
/// partitions.
74-
#[derive(Debug)]
74+
#[derive(Debug, Clone)]
7575
pub struct SortMergeJoinExec {
7676
/// Left sorted joining execution plan
7777
pub left: Arc<dyn ExecutionPlan>,

0 commit comments

Comments
 (0)