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

Method fmt_default_text

src/expr/src/explain/text.rs:266–301  ·  view source on GitHub ↗

Render an MFP using the default (concise) syntax.

(
        &self,
        f: &mut fmt::Formatter<'_>,
        ctx: &mut PlanRenderingContext<'_, T>,
    )

Source from the content-addressed store, hash-verified

264{
265 /// Render an MFP using the default (concise) syntax.
266 pub fn fmt_default_text<T>(
267 &self,
268 f: &mut fmt::Formatter<'_>,
269 ctx: &mut PlanRenderingContext<'_, T>,
270 ) -> fmt::Result {
271 if self.expr.projection.len() != self.expr.input_arity
272 || self
273 .expr
274 .projection
275 .iter()
276 .enumerate()
277 .any(|(i, p)| i != *p)
278 {
279 if self.expr.projection.len() == 0 {
280 writeln!(f, "{}Project: ()", ctx.indent)?;
281 } else {
282 let outputs = Indices(&self.expr.projection);
283 writeln!(f, "{}Project: {outputs}", ctx.indent)?;
284 }
285 }
286
287 // render `filter` field iff predicates are present
288 if !self.expr.predicates.is_empty() {
289 let predicates = self.expr.predicates.iter().map(|(_, p)| self.child(p));
290 let predicates = separated(" AND ", predicates);
291 writeln!(f, "{}Filter: {predicates}", ctx.indent)?;
292 }
293 // render `map` field iff scalars are present
294 if !self.expr.expressions.is_empty() {
295 let scalars = self.expr.expressions.iter().map(|s| self.child(s));
296 let scalars = separated(", ", scalars);
297 writeln!(f, "{}Map: {scalars}", ctx.indent)?;
298 }
299
300 Ok(())
301 }
302}
303
304/// `EXPLAIN ... AS TEXT` support for [`MirRelationExpr`].

Callers

nothing calls this directly

Calls 9

IndicesClass · 0.85
anyMethod · 0.80
enumerateMethod · 0.80
childMethod · 0.80
separatedFunction · 0.50
lenMethod · 0.45
iterMethod · 0.45
is_emptyMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected