Extracts an error-free MapFilterProject at the root of the expression. The expression will be modified to extract maps, filters, and projects from the root of the expression, which will be returned as `Self`. The extraction will halt if a Map or Filter containing a literal error is reached. Otherwise, the method will return an identity operator. This method is meant to be used during optimizatio
(expr: &MirRelationExpr)
| 296 | /// This method is meant to be used during optimization, where it is |
| 297 | /// necessary to avoid moving around maps and filters with errors. |
| 298 | pub fn extract_non_errors_from_expr(expr: &MirRelationExpr) -> (Self, &MirRelationExpr) { |
| 299 | match expr { |
| 300 | MirRelationExpr::Map { input, scalars } |
| 301 | if scalars.iter().all(|s| !s.is_literal_err()) => |
| 302 | { |
| 303 | let (mfp, expr) = Self::extract_non_errors_from_expr(input); |
| 304 | (mfp.map(scalars.iter().cloned()), expr) |
| 305 | } |
| 306 | MirRelationExpr::Filter { input, predicates } |
| 307 | if predicates.iter().all(|p| !p.is_literal_err()) => |
| 308 | { |
| 309 | let (mfp, expr) = Self::extract_non_errors_from_expr(input); |
| 310 | (mfp.filter(predicates.iter().cloned()), expr) |
| 311 | } |
| 312 | MirRelationExpr::Project { input, outputs } => { |
| 313 | let (mfp, expr) = Self::extract_non_errors_from_expr(input); |
| 314 | (mfp.project(outputs.iter().cloned()), expr) |
| 315 | } |
| 316 | x => (Self::new(x.arity()), x), |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | /// Extracts an error-free MapFilterProject at the root of the expression. |
| 321 | /// |