Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
ExpressionVisitor in datafusion_expr::expr_visitor - Rust
[go: Go Back, main page]

pub trait ExpressionVisitor<E: ExprVisitable = Expr>: Sized {
    // Required method
    fn pre_visit(self, expr: &E) -> Result<Recursion<Self>>
       where Self: ExpressionVisitor;

    // Provided method
    fn post_visit(self, _expr: &E) -> Result<Self> { ... }
}
Expand description

Implements the visitor pattern for recursively walking Exprs.

ExpressionVisitor allows keeping the algorithms separate from the code to traverse the structure of the Expr tree and makes it easier to add new types of expressions and algorithms by.

When passed toExpr::accept, ExpressionVisitor::pre_visit and ExpressionVisitor::post_visit are invoked recursively on all nodes of an expression tree.

For an expression tree such as

BinaryExpr (GT)
   left: Column("foo")
   right: Column("bar")

The nodes are visited using the following order

pre_visit(BinaryExpr(GT))
pre_visit(Column("foo"))
post_visit(Column("foo"))
pre_visit(Column("bar"))
post_visit(Column("bar"))
post_visit(BinaryExpr(GT))

If an Err result is returned, recursion is stopped immediately.

If Recursion::Stop is returned on a call to pre_visit, no children of that expression are visited, nor is post_visit called on that expression

See Also:

Required Methods§

source

fn pre_visit(self, expr: &E) -> Result<Recursion<Self>>where Self: ExpressionVisitor,

Invoked before any children of expr are visited.

Provided Methods§

source

fn post_visit(self, _expr: &E) -> Result<Self>

Invoked after all children of expr are visited. Default implementation does nothing.

Implementors§