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() -> Self
pub fn new() -> Self
Create a new UnnestOptions
with default values
sourcepub fn with_preserve_nulls(self, preserve_nulls: bool) -> Self
pub fn with_preserve_nulls(self, preserve_nulls: bool) -> Self
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§impl Hash for UnnestOptions
impl Hash for UnnestOptions
source§impl PartialEq<UnnestOptions> for UnnestOptions
impl PartialEq<UnnestOptions> 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<UnnestOptions> for UnnestOptions
impl PartialOrd<UnnestOptions> 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 StructuralEq for UnnestOptions
impl StructuralPartialEq for UnnestOptions
Auto Trait Implementations§
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.