Skip to content

Commit

Permalink
Bring back transforming = ANY / <> ANY into IN / NOT IN
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Nov 6, 2023
1 parent f838b14 commit e3d7b2d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions nexus/peer-bigquery/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,27 @@ impl BigqueryAst {
ControlFlow::<()>::Continue(())
});

// flatten ANY to IN operation overall.
visit_expressions_mut(query, |node| {
if let Expr::AnyOp { left, compare_op, right } = node {
if matches!(compare_op, BinaryOperator::Eq | BinaryOperator::NotEq) {
let negated = matches!(compare_op, BinaryOperator::NotEq);
let list = self
.flatten_expr_to_in_list(right)
.expect("failed to flatten");
*node = Expr::InList {
expr: left.clone(),
list,
negated,
};
}
}

ControlFlow::<()>::Continue(())
});



Ok(())
}

Expand Down

0 comments on commit e3d7b2d

Please sign in to comment.