MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / optimize

Method optimize

src/transform/src/lib.rs:1008–1029  ·  view source on GitHub ↗
(
        &self,
        mut relation: MirRelationExpr,
        ctx: &mut TransformCtx,
    )

Source from the content-addressed store, hash-verified

1006 fields(path.segment = self.name)
1007 )]
1008 pub fn optimize(
1009 &self,
1010 mut relation: MirRelationExpr,
1011 ctx: &mut TransformCtx,
1012 ) -> Result<mz_expr::OptimizedMirRelationExpr, TransformError> {
1013 let transform_result = self.transform(&mut relation, ctx);
1014
1015 match transform_result {
1016 Ok(_) => {
1017 mz_repr::explain::trace_plan(&relation);
1018 Ok(mz_expr::OptimizedMirRelationExpr(relation))
1019 }
1020 Err(e) => {
1021 // Without this, the dropping of `relation` (which happens automatically when
1022 // returning from this function) might run into a stack overflow, see
1023 // https://github.com/MaterializeInc/database-issues/issues/4043
1024 relation.destroy_carefully();
1025 error!("Optimizer::optimize(): {}", e);
1026 Err(e)
1027 }
1028 }
1029 }
1030
1031 /// Optimizes the supplied relation expression in place, using available arrangements.
1032 ///

Callers 6

actionMethod · 0.45
undo_preparationMethod · 0.45
actionMethod · 0.45
actionMethod · 0.45
run_multiview_testcaseFunction · 0.45

Calls 4

trace_planFunction · 0.85
destroy_carefullyMethod · 0.80
transformMethod · 0.45

Tested by 1

run_multiview_testcaseFunction · 0.36