Removes an error-free MapFilterProject from 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, and the expression will remain unchanged. This me
(expr: &mut MirRelationExpr)
| 372 | /// This method is meant to be used during optimization, where it is |
| 373 | /// necessary to avoid moving around maps and filters with errors. |
| 374 | pub fn extract_non_errors_from_expr_mut(expr: &mut MirRelationExpr) -> Self { |
| 375 | match expr { |
| 376 | MirRelationExpr::Map { input, scalars } |
| 377 | if scalars.iter().all(|s| !s.is_literal_err()) => |
| 378 | { |
| 379 | let mfp = |
| 380 | Self::extract_non_errors_from_expr_mut(input).map(scalars.iter().cloned()); |
| 381 | *expr = input.take_dangerous(); |
| 382 | mfp |
| 383 | } |
| 384 | MirRelationExpr::Filter { input, predicates } |
| 385 | if predicates.iter().all(|p| !p.is_literal_err()) => |
| 386 | { |
| 387 | let mfp = Self::extract_non_errors_from_expr_mut(input) |
| 388 | .filter(predicates.iter().cloned()); |
| 389 | *expr = input.take_dangerous(); |
| 390 | mfp |
| 391 | } |
| 392 | MirRelationExpr::Project { input, outputs } => { |
| 393 | let mfp = |
| 394 | Self::extract_non_errors_from_expr_mut(input).project(outputs.iter().cloned()); |
| 395 | *expr = input.take_dangerous(); |
| 396 | mfp |
| 397 | } |
| 398 | x => Self::new(x.arity()), |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | impl<E: OptimizableExpr> MapFilterProject<E> { |
nothing calls this directly
no test coverage detected