(
dataflow: &mut DataflowDesc,
transform_ctx: &mut TransformCtx,
fast_path_optimizer: bool,
)
| 45 | fields(path.segment ="global") |
| 46 | )] |
| 47 | pub fn optimize_dataflow( |
| 48 | dataflow: &mut DataflowDesc, |
| 49 | transform_ctx: &mut TransformCtx, |
| 50 | fast_path_optimizer: bool, |
| 51 | ) -> Result<(), TransformError> { |
| 52 | // Inline views that are used in only one other view. |
| 53 | inline_views(dataflow)?; |
| 54 | |
| 55 | if fast_path_optimizer { |
| 56 | optimize_dataflow_relations( |
| 57 | dataflow, |
| 58 | &Optimizer::fast_path_optimizer(transform_ctx), |
| 59 | transform_ctx, |
| 60 | )?; |
| 61 | } else { |
| 62 | // Logical optimization pass after view inlining |
| 63 | optimize_dataflow_relations( |
| 64 | dataflow, |
| 65 | #[allow(deprecated)] |
| 66 | &Optimizer::logical_optimizer(transform_ctx), |
| 67 | transform_ctx, |
| 68 | )?; |
| 69 | |
| 70 | optimize_dataflow_filters(dataflow)?; |
| 71 | // TODO: when the linear operator contract ensures that propagated |
| 72 | // predicates are always applied, projections and filters can be removed |
| 73 | // from where they come from. Once projections and filters can be removed, |
| 74 | // TODO: it would be useful for demand to be optimized after filters |
| 75 | // that way demand only includes the columns that are still necessary after |
| 76 | // the filters are applied. |
| 77 | optimize_dataflow_demand(dataflow)?; |
| 78 | |
| 79 | // A smaller logical optimization pass after projections and filters are |
| 80 | // pushed down across views. |
| 81 | optimize_dataflow_relations( |
| 82 | dataflow, |
| 83 | &Optimizer::logical_cleanup_pass(transform_ctx, false), |
| 84 | transform_ctx, |
| 85 | )?; |
| 86 | |
| 87 | // Physical optimization pass |
| 88 | optimize_dataflow_relations( |
| 89 | dataflow, |
| 90 | &Optimizer::physical_optimizer(transform_ctx), |
| 91 | transform_ctx, |
| 92 | )?; |
| 93 | |
| 94 | optimize_dataflow_monotonic(dataflow, transform_ctx)?; |
| 95 | } |
| 96 | |
| 97 | prune_and_annotate_dataflow_index_imports( |
| 98 | dataflow, |
| 99 | transform_ctx.indexes, |
| 100 | transform_ctx.df_meta, |
| 101 | )?; |
| 102 | |
| 103 | // Warning: If you want to add a transform call here, consider it very carefully whether it |
| 104 | // could accidentally invalidate information that we already derived above in |
no test coverage detected