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

Method optimize

src/adapter/src/optimize/peek.rs:171–201  ·  view source on GitHub ↗
(&mut self, expr: HirRelationExpr)

Source from the content-addressed store, hash-verified

169 type To = LocalMirPlan;
170
171 fn optimize(&mut self, expr: HirRelationExpr) -> Result<Self::To, OptimizerError> {
172 let time = Instant::now();
173
174 // Trace the pipeline input under `optimize/raw`.
175 trace_plan!(at: "raw", &expr);
176
177 // HIR ⇒ MIR lowering and decorrelation
178 let mir_expr = expr.clone().lower(&self.config, Some(&self.metrics))?;
179
180 // MIR ⇒ MIR optimization (local)
181 let mut df_meta = DataflowMetainfo::default();
182 let mut transform_ctx = TransformCtx::local(
183 &self.config.features,
184 &self.typecheck_ctx,
185 &mut df_meta,
186 Some(&mut self.metrics),
187 Some(self.select_id),
188 );
189 let mir_expr = optimize_mir_local(mir_expr, &mut transform_ctx)?.into_inner();
190 let typ = infer_sql_type_for_catalog(&expr, &mir_expr);
191
192 self.duration += time.elapsed();
193
194 // Return the (sealed) plan at the end of this optimization step.
195 Ok(LocalMirPlan {
196 expr: mir_expr,
197 typ,
198 df_meta,
199 context: Unresolved,
200 })
201 }
202}
203
204impl LocalMirPlan<Unresolved> {

Callers

nothing calls this directly

Calls 15

nowFunction · 0.85
optimize_mir_localFunction · 0.85
create_fast_path_planFunction · 0.85
optimize_dataflowFunction · 0.85
trace_planFunction · 0.85
FastPathClass · 0.85
normalize_letsFunction · 0.85
default_keyMethod · 0.80

Tested by

no test coverage detected