pub struct NamePreserver { /* private fields */ }
Expand description
Handles ensuring the name of rewritten expressions is not changed.
This is important when optimizing plans to ensure the output
schema of plan nodes don’t change after optimization.
For example, if an expression 1 + 2
is rewritten to 3
, the name of the
expression should be preserved: 3 as "1 + 2"
See https://github.com/apache/datafusion/issues/3555 for details
Implementations§
Source§impl NamePreserver
impl NamePreserver
Sourcepub fn new(plan: &LogicalPlan) -> Self
pub fn new(plan: &LogicalPlan) -> Self
Create a new NamePreserver for rewriting the expr
that is part of the specified plan
Sourcepub fn new_for_projection() -> Self
pub fn new_for_projection() -> Self
Create a new NamePreserver for rewriting the expr
s in Projection
This will use aliases
pub fn save(&self, expr: &Expr) -> SavedName
Auto Trait Implementations§
impl Freeze for NamePreserver
impl RefUnwindSafe for NamePreserver
impl Send for NamePreserver
impl Sync for NamePreserver
impl Unpin for NamePreserver
impl UnwindSafe for NamePreserver
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<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