struct ProjectedCaseBody {
projection: Vec<usize>,
body: CaseBody,
}Expand description
A derived case body that can be used to evaluate a case expression after projecting record batches using a projection vector.
This is used to avoid filtering columns that are not used in the
input RecordBatch when progressively evaluating a CASE expression’s
remainder batches. Filtering these columns is wasteful since for a record
batch of n rows, filtering requires at worst a copy of n - 1 values
per array. If these filtered values will never be accessed, the time spent
producing them is better avoided.
For example, if we are evaluating the following case expression that only references columns B and D:
SELECT CASE WHEN B > 10 THEN D ELSE NULL END FROM (VALUES (...)) T(A, B, C, D)Of the 4 input columns [A, B, C, D], the CASE expression only access B and D.
Filtering A and C would be unnecessary and wasteful.
If we only retain columns B and D using RecordBatch::project and the projection vector
[1, 3], the indices of these two columns will change to [0, 1]. To evaluate the
case expression, it will need to be rewritten from CASE WHEN B@1 > 10 THEN D@3 ELSE NULL END
to CASE WHEN B@0 > 10 THEN D@1 ELSE NULL END.
The projection vector and the rewritten expression (which only differs from the original in
column reference indices) are held in a ProjectedCaseBody.
Fields§
§projection: Vec<usize>§body: CaseBodyTrait Implementations§
Source§impl Debug for ProjectedCaseBody
impl Debug for ProjectedCaseBody
Source§impl Hash for ProjectedCaseBody
impl Hash for ProjectedCaseBody
Source§impl PartialEq for ProjectedCaseBody
impl PartialEq for ProjectedCaseBody
impl Eq for ProjectedCaseBody
impl StructuralPartialEq for ProjectedCaseBody
Auto Trait Implementations§
impl Freeze for ProjectedCaseBody
impl !RefUnwindSafe for ProjectedCaseBody
impl Send for ProjectedCaseBody
impl Sync for ProjectedCaseBody
impl Unpin for ProjectedCaseBody
impl !UnwindSafe for ProjectedCaseBody
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
§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