pub struct Union {
pub inputs: Vec<Arc<LogicalPlan>>,
pub schema: DFSchemaRef,
}Expand description
Union multiple inputs
Fields§
§inputs: Vec<Arc<LogicalPlan>>Inputs to merge
schema: DFSchemaRefUnion schema. Should be the same for all inputs.
Implementations§
Source§impl Union
impl Union
Sourcepub fn try_new(inputs: Vec<Arc<LogicalPlan>>) -> Result<Self>
pub fn try_new(inputs: Vec<Arc<LogicalPlan>>) -> Result<Self>
Constructs new Union instance deriving schema from inputs. Schema data types must match exactly.
Sourcepub fn try_new_with_loose_types(inputs: Vec<Arc<LogicalPlan>>) -> Result<Self>
pub fn try_new_with_loose_types(inputs: Vec<Arc<LogicalPlan>>) -> Result<Self>
Constructs new Union instance deriving schema from inputs. Inputs do not have to have matching types and produced schema will take type from the first input.
Sourcepub fn try_new_by_name(inputs: Vec<Arc<LogicalPlan>>) -> Result<Self>
pub fn try_new_by_name(inputs: Vec<Arc<LogicalPlan>>) -> Result<Self>
Constructs a new Union instance that combines rows from different tables by name, instead of by position. This means that the specified inputs need not have schemas that are all the same width.
Sourcefn rewrite_inputs_from_schema(
schema: &Arc<DFSchema>,
inputs: Vec<Arc<LogicalPlan>>,
) -> Result<Vec<Arc<LogicalPlan>>>
fn rewrite_inputs_from_schema( schema: &Arc<DFSchema>, inputs: Vec<Arc<LogicalPlan>>, ) -> Result<Vec<Arc<LogicalPlan>>>
When constructing a UNION BY NAME, we need to wrap inputs
in an additional Projection to account for absence of columns
in input schemas or differing projection orders.
Sourcefn derive_schema_from_inputs(
inputs: &[Arc<LogicalPlan>],
loose_types: bool,
by_name: bool,
) -> Result<DFSchemaRef>
fn derive_schema_from_inputs( inputs: &[Arc<LogicalPlan>], loose_types: bool, by_name: bool, ) -> Result<DFSchemaRef>
Constructs new Union instance deriving schema from inputs.
If loose_types is true, inputs do not need to have matching types and
the produced schema will use the type from the first input.
TODO (https://github.com/apache/datafusion/issues/14380): This is not necessarily reasonable behavior.
If by_name is true, input schemas need not be the same width. That is,
the constructed schema follows UNION BY NAME semantics.
fn derive_schema_from_inputs_by_name( inputs: &[Arc<LogicalPlan>], loose_types: bool, ) -> Result<DFSchemaRef>
fn derive_schema_from_inputs_by_position( inputs: &[Arc<LogicalPlan>], loose_types: bool, ) -> Result<DFSchemaRef>
Trait Implementations§
Source§impl PartialOrd for Union
impl PartialOrd for Union
impl Eq for Union
impl StructuralPartialEq for Union
Auto Trait Implementations§
impl Freeze for Union
impl !RefUnwindSafe for Union
impl Send for Union
impl Sync for Union
impl Unpin for Union
impl !UnwindSafe for Union
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more