Pull `(column_name, equality_value, residual_expr)` out of a filter expression if it contains a column-equals-literal predicate that can drive an index lookup. Returns `None` if no usable equality is present. The returned residual is the rest of the conjunction with the equality removed — `None` when the filter was a bare equality.
(
expr: &FilterExpr,
)
| 292 | /// present. The returned residual is the rest of the conjunction with |
| 293 | /// the equality removed — `None` when the filter was a bare equality. |
| 294 | fn extract_equality_with_residual( |
| 295 | expr: &FilterExpr, |
| 296 | ) -> Option<(String, SqlValue, Option<SqlExpr>)> { |
| 297 | match expr { |
| 298 | FilterExpr::Comparison { |
| 299 | field, |
| 300 | op: CompareOp::Eq, |
| 301 | value, |
| 302 | } => Some((field.clone(), value.clone(), None)), |
| 303 | FilterExpr::Expr(sql_expr) => { |
| 304 | let (col, lit, residual) = split_equality_from_expr(sql_expr)?; |
| 305 | Some((col, lit, residual)) |
| 306 | } |
| 307 | _ => None, |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | /// Return `(column, literal, residual_expr)` for an equality found |
| 312 | /// anywhere in a right-leaning AND conjunction tree, or `None` if no |
no test coverage detected