Struct datafusion::physical_plan::union::UnionExec
source · pub struct UnionExec { /* private fields */ }
Expand description
UnionExec
: UNION ALL
execution plan.
UnionExec
combines multiple inputs with the same schema by
concatenating the partitions. It does not mix or copy data within
or across partitions. Thus if the input partitions are sorted, the
output partitions of the union are also sorted.
For example, given a UnionExec
of two inputs, with N
partitions, and M
partitions, there will be N+M
output
partitions. The first N
output partitions are from Input 1
partitions, and then next M
output partitions are from Input 2.
▲ ▲ ▲ ▲
│ │ │ │
Output │ ... │ │ │
Partitions │0 │N-1 │ N │N+M-1
(passes through ┌────┴───────┴───────────┴─────────┴───┐
the N+M input │ UnionExec │
partitions) │ │
└──────────────────────────────────────┘
▲
│
│
Input ┌────────┬─────┴────┬──────────┐
Partitions │ ... │ │ ... │
0 │ │ N-1 │ 0 │ M-1
┌────┴────────┴───┐ ┌───┴──────────┴───┐
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│Input 1 │ │Input 2 │
└─────────────────┘ └──────────────────┘
Implementations§
source§impl UnionExec
impl UnionExec
sourcepub fn try_new_with_schema(
inputs: Vec<Arc<dyn ExecutionPlan>>,
schema: DFSchemaRef
) -> Result<Self>
pub fn try_new_with_schema( inputs: Vec<Arc<dyn ExecutionPlan>>, schema: DFSchemaRef ) -> Result<Self>
Create a new UnionExec with specified schema.
The schema
should always be a subset of the schema of inputs
,
otherwise, an error will be returned.
sourcepub fn new(inputs: Vec<Arc<dyn ExecutionPlan>>) -> Self
pub fn new(inputs: Vec<Arc<dyn ExecutionPlan>>) -> Self
Create a new UnionExec
Trait Implementations§
source§impl ExecutionPlan for UnionExec
impl ExecutionPlan for UnionExec
source§fn unbounded_output(&self, children: &[bool]) -> Result<bool>
fn unbounded_output(&self, children: &[bool]) -> Result<bool>
Specifies whether this plan generates an infinite stream of records. If the plan does not support pipelining, but it its input(s) are infinite, returns an error to indicate this.
source§fn output_partitioning(&self) -> Partitioning
fn output_partitioning(&self) -> Partitioning
Output of the union is the combination of all output partitions of the inputs
source§fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> ⓘ
fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> ⓘ
source§fn output_ordering(&self) -> Option<&[PhysicalSortExpr]>
fn output_ordering(&self) -> Option<&[PhysicalSortExpr]>
Some(keys)
with the description of how it was sorted. Read moresource§fn maintains_input_order(&self) -> Vec<bool> ⓘ
fn maintains_input_order(&self) -> Vec<bool> ⓘ
false
if this operator’s implementation may reorder
rows within or between partitions. Read moresource§fn with_new_children(
self: Arc<Self>,
children: Vec<Arc<dyn ExecutionPlan>>
) -> Result<Arc<dyn ExecutionPlan>>
fn with_new_children( self: Arc<Self>, children: Vec<Arc<dyn ExecutionPlan>> ) -> Result<Arc<dyn ExecutionPlan>>
source§fn execute(
&self,
partition: usize,
context: Arc<TaskContext>
) -> Result<SendableRecordBatchStream>
fn execute( &self, partition: usize, context: Arc<TaskContext> ) -> Result<SendableRecordBatchStream>
source§fn metrics(&self) -> Option<MetricsSet>
fn metrics(&self) -> Option<MetricsSet>
source§fn statistics(&self) -> Statistics
fn statistics(&self) -> Statistics
ExecutionPlan
node.source§fn benefits_from_input_partitioning(&self) -> bool
fn benefits_from_input_partitioning(&self) -> bool
true
if this operator would benefit from
partitioning its input (and thus from more parallelism). For
operators that do very little work the overhead of extra
parallelism may outweigh any benefits Read more