Struct datafusion_physical_expr::tree_node::ExprContext
source · pub struct ExprContext<T: Sized> {
pub expr: Arc<dyn PhysicalExpr>,
pub data: T,
pub children: Vec<Self>,
}
Expand description
A node object encapsulating a PhysicalExpr
node with a payload. Since there are
two ways to access child plans—directly from the plan and through child nodes—it’s
recommended to perform mutable operations via Self::update_expr_from_children
.
Fields§
§expr: Arc<dyn PhysicalExpr>
The physical expression associated with this context.
data: T
Custom data payload of the node.
children: Vec<Self>
Child contexts of this node.
Implementations§
source§impl<T> ExprContext<T>
impl<T> ExprContext<T>
pub fn new(expr: Arc<dyn PhysicalExpr>, data: T, children: Vec<Self>) -> Self
pub fn update_expr_from_children(self) -> Result<Self>
source§impl<T: Default> ExprContext<T>
impl<T: Default> ExprContext<T>
pub fn new_default(plan: Arc<dyn PhysicalExpr>) -> Self
Trait Implementations§
source§impl<T> ConcreteTreeNode for ExprContext<T>
impl<T> ConcreteTreeNode for ExprContext<T>
source§fn take_children(self) -> (Self, Vec<Self>)
fn take_children(self) -> (Self, Vec<Self>)
Detaches the node from its children, returning the node itself and its detached children.
source§fn with_new_children(self, children: Vec<Self>) -> Result<Self>
fn with_new_children(self, children: Vec<Self>) -> Result<Self>
Reattaches updated child nodes to the node, returning the updated node.
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ExprContext<T>
impl<T> Send for ExprContext<T>where
T: Send,
impl<T> Sync for ExprContext<T>where
T: Sync,
impl<T> Unpin for ExprContext<T>where
T: Unpin,
impl<T> !UnwindSafe for ExprContext<T>
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> TreeNode for Twhere
T: ConcreteTreeNode,
impl<T> TreeNode for Twhere
T: ConcreteTreeNode,
source§fn apply_children<F>(
&self,
op: &mut F
) -> Result<VisitRecursion, DataFusionError>
fn apply_children<F>( &self, op: &mut F ) -> Result<VisitRecursion, DataFusionError>
Apply the closure F
to the node’s children
source§fn map_children<F>(self, transform: F) -> Result<T, DataFusionError>
fn map_children<F>(self, transform: F) -> Result<T, DataFusionError>
Apply transform
F
to the node’s children, the transform F
might have a direction(Preorder or Postorder)source§fn apply<F>(&self, op: &mut F) -> Result<VisitRecursion, DataFusionError>
fn apply<F>(&self, op: &mut F) -> Result<VisitRecursion, DataFusionError>
Applies
op
to the node and its children. op
is applied in a preoder way,
and it is controlled by VisitRecursion
, which means result of the op
on the self node can cause an early return. Read moresource§fn visit<V>(&self, visitor: &mut V) -> Result<VisitRecursion, DataFusionError>where
V: TreeNodeVisitor<N = Self>,
fn visit<V>(&self, visitor: &mut V) -> Result<VisitRecursion, DataFusionError>where
V: TreeNodeVisitor<N = Self>,
Visit the tree node using the given TreeNodeVisitor
It performs a depth first walk of an node and its children. Read more
source§fn transform<F>(self, op: &F) -> Result<Self, DataFusionError>
fn transform<F>(self, op: &F) -> Result<Self, DataFusionError>
Convenience utils for writing optimizers rule: recursively apply the given
op
to the node tree.
When op
does not apply to a given node, it is left unchanged.
The default tree traversal direction is transform_up(Postorder Traversal).source§fn transform_down<F>(self, op: &F) -> Result<Self, DataFusionError>
fn transform_down<F>(self, op: &F) -> Result<Self, DataFusionError>
Convenience utils for writing optimizers rule: recursively apply the given ‘op’ to the node and all of its
children(Preorder Traversal).
When the
op
does not apply to a given node, it is left unchanged.source§fn transform_down_mut<F>(self, op: &mut F) -> Result<Self, DataFusionError>
fn transform_down_mut<F>(self, op: &mut F) -> Result<Self, DataFusionError>
Convenience utils for writing optimizers rule: recursively apply the given ‘op’ to the node and all of its
children(Preorder Traversal) using a mutable function,
F
.
When the op
does not apply to a given node, it is left unchanged.source§fn transform_up<F>(self, op: &F) -> Result<Self, DataFusionError>
fn transform_up<F>(self, op: &F) -> Result<Self, DataFusionError>
Convenience utils for writing optimizers rule: recursively apply the given ‘op’ first to all of its
children and then itself(Postorder Traversal).
When the
op
does not apply to a given node, it is left unchanged.source§fn transform_up_mut<F>(self, op: &mut F) -> Result<Self, DataFusionError>
fn transform_up_mut<F>(self, op: &mut F) -> Result<Self, DataFusionError>
Convenience utils for writing optimizers rule: recursively apply the given ‘op’ first to all of its
children and then itself(Postorder Traversal) using a mutable function,
F
.
When the op
does not apply to a given node, it is left unchanged.source§fn rewrite<R>(self, rewriter: &mut R) -> Result<Self, DataFusionError>where
R: TreeNodeRewriter<N = Self>,
fn rewrite<R>(self, rewriter: &mut R) -> Result<Self, DataFusionError>where
R: TreeNodeRewriter<N = Self>,
Transform the tree node using the given TreeNodeRewriter
It performs a depth first walk of an node and its children. Read more