(
expr: &ast::Expr,
keys: &mut Vec<(String, String)>,
non_equi: &mut Vec<ast::Expr>,
)
| 93 | } |
| 94 | |
| 95 | fn extract_equi_keys( |
| 96 | expr: &ast::Expr, |
| 97 | keys: &mut Vec<(String, String)>, |
| 98 | non_equi: &mut Vec<ast::Expr>, |
| 99 | ) -> Result<()> { |
| 100 | match expr { |
| 101 | ast::Expr::BinaryOp { |
| 102 | left, |
| 103 | op: ast::BinaryOperator::And, |
| 104 | right, |
| 105 | } => { |
| 106 | extract_equi_keys(left, keys, non_equi)?; |
| 107 | extract_equi_keys(right, keys, non_equi)?; |
| 108 | } |
| 109 | ast::Expr::BinaryOp { |
| 110 | left, |
| 111 | op: ast::BinaryOperator::Eq, |
| 112 | right, |
| 113 | } => { |
| 114 | if let (Some(l), Some(r)) = (extract_col_ref(left), extract_col_ref(right)) { |
| 115 | keys.push((l, r)); |
| 116 | } else { |
| 117 | non_equi.push(expr.clone()); |
| 118 | } |
| 119 | } |
| 120 | _ => { |
| 121 | non_equi.push(expr.clone()); |
| 122 | } |
| 123 | } |
| 124 | Ok(()) |
| 125 | } |
| 126 | |
| 127 | fn extract_col_ref(expr: &ast::Expr) -> Option<String> { |
| 128 | match expr { |
no test coverage detected