MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / flatten_and_expr

Function flatten_and_expr

nodedb-sql/src/planner/ast_helpers.rs:23–35  ·  view source on GitHub ↗

Flatten a right-leaning AND expression tree into a list of conjuncts.

(expr: &ast::Expr, out: &mut Vec<ast::Expr>)

Source from the content-addressed store, hash-verified

21
22/// Flatten a right-leaning AND expression tree into a list of conjuncts.
23pub fn flatten_and_expr(expr: &ast::Expr, out: &mut Vec<ast::Expr>) {
24 match expr {
25 ast::Expr::BinaryOp {
26 left,
27 op: ast::BinaryOperator::And,
28 right,
29 } => {
30 flatten_and_expr(left, out);
31 flatten_and_expr(right, out);
32 }
33 other => out.push(other.clone()),
34 }
35}
36
37/// Reassemble conjuncts into a right-leaning AND tree. Panics if empty.
38pub fn rebuild_and_expr(mut conjuncts: Vec<ast::Expr>) -> ast::Expr {

Callers 1

extract_join_predicateFunction · 0.85

Calls 2

pushMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected