Struct datafusion::common::UnnestOptions
source · pub struct UnnestOptions {
pub preserve_nulls: bool,
}
Expand description
Options for unnesting a column that contains a list type, replicating values in the other, non nested rows.
Conceptually this operation is like joining each row with all the values in the list column.
If preserve_nulls
is false, nulls and empty lists
from the input column are not carried through to the output. This
is the default behavior for other systems such as ClickHouse and
DuckDB
If preserve_nulls
is true (the default), nulls from the input
column are carried through to the output.
§Examples
§Unnest(c1)
, preserve_nulls: false
┌─────────┐ ┌─────┐ ┌─────────┐ ┌─────┐
│ {1, 2} │ │ A │ Unnest │ 1 │ │ A │
├─────────┤ ├─────┤ ├─────────┤ ├─────┤
│ null │ │ B │ │ 2 │ │ A │
├─────────┤ ├─────┤ ────────────▶ ├─────────┤ ├─────┤
│ {} │ │ D │ │ 3 │ │ E │
├─────────┤ ├─────┤ └─────────┘ └─────┘
│ {3} │ │ E │ c1 c2
└─────────┘ └─────┘
c1 c2
§Unnest(c1)
, preserve_nulls: true
┌─────────┐ ┌─────┐ ┌─────────┐ ┌─────┐
│ {1, 2} │ │ A │ Unnest │ 1 │ │ A │
├─────────┤ ├─────┤ ├─────────┤ ├─────┤
│ null │ │ B │ │ 2 │ │ A │
├─────────┤ ├─────┤ ────────────▶ ├─────────┤ ├─────┤
│ {} │ │ D │ │ null │ │ B │
├─────────┤ ├─────┤ ├─────────┤ ├─────┤
│ {3} │ │ E │ │ 3 │ │ E │
└─────────┘ └─────┘ └─────────┘ └─────┘
c1 c2 c1 c2
Fields§
§preserve_nulls: bool
Should nulls in the input be preserved? Defaults to true
Implementations§
source§impl UnnestOptions
impl UnnestOptions
sourcepub fn new() -> UnnestOptions
pub fn new() -> UnnestOptions
Create a new UnnestOptions
with default values
sourcepub fn with_preserve_nulls(self, preserve_nulls: bool) -> UnnestOptions
pub fn with_preserve_nulls(self, preserve_nulls: bool) -> UnnestOptions
Set the behavior with nulls in the input as described on
Self
Trait Implementations§
source§impl Clone for UnnestOptions
impl Clone for UnnestOptions
source§fn clone(&self) -> UnnestOptions
fn clone(&self) -> UnnestOptions
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UnnestOptions
impl Debug for UnnestOptions
source§impl Default for UnnestOptions
impl Default for UnnestOptions
source§fn default() -> UnnestOptions
fn default() -> UnnestOptions
Returns the “default value” for a type. Read more
source§impl Hash for UnnestOptions
impl Hash for UnnestOptions
source§impl PartialEq for UnnestOptions
impl PartialEq for UnnestOptions
source§fn eq(&self, other: &UnnestOptions) -> bool
fn eq(&self, other: &UnnestOptions) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for UnnestOptions
impl PartialOrd for UnnestOptions
source§fn partial_cmp(&self, other: &UnnestOptions) -> Option<Ordering>
fn partial_cmp(&self, other: &UnnestOptions) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for UnnestOptions
impl StructuralPartialEq for UnnestOptions
Auto Trait Implementations§
impl Freeze for UnnestOptions
impl RefUnwindSafe for UnnestOptions
impl Send for UnnestOptions
impl Sync for UnnestOptions
impl Unpin for UnnestOptions
impl UnwindSafe for UnnestOptions
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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>
Converts
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>
Converts
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