pub struct UnnestOptions {
pub preserve_nulls: bool,
pub recursions: Vec<RecursionUnnestOption>,
}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 c2recursions instruct how a column should be unnested (e.g unnesting a column multiple
time, with depth = 1 and depth = 2). Any unnested column not being mentioned inside this
options is inferred to be unnested with depth = 1
Fields§
§preserve_nulls: boolShould nulls in the input be preserved? Defaults to true
recursions: Vec<RecursionUnnestOption>If specific columns need to be unnested multiple times (e.g at different depth), declare them here. Any unnested columns not being mentioned inside this option will be unnested with depth = 1
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
Sourcepub fn with_recursions(self, recursion: RecursionUnnestOption) -> UnnestOptions
pub fn with_recursions(self, recursion: RecursionUnnestOption) -> UnnestOptions
Set the recursions for the unnest operation
Trait Implementations§
Source§impl Clone for UnnestOptions
impl Clone for UnnestOptions
Source§fn clone(&self) -> UnnestOptions
fn clone(&self) -> UnnestOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl From<&UnnestOptions> for UnnestOptions
impl From<&UnnestOptions> for UnnestOptions
Source§fn from(opts: &UnnestOptions) -> UnnestOptions
fn from(opts: &UnnestOptions) -> UnnestOptions
Source§impl Hash for UnnestOptions
impl Hash for UnnestOptions
Source§impl PartialEq for UnnestOptions
impl PartialEq for UnnestOptions
Source§impl PartialOrd for UnnestOptions
impl PartialOrd for UnnestOptions
impl 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> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo* type which aligns Self to ALIGNMENT.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,
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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
Source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
Source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
Source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read more