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

Method fmt_text

src/expr/src/explain/text.rs:38–90  ·  view source on GitHub ↗
(&self, f: &mut fmt::Formatter<'_>, _ctx: &mut ())

Source from the content-addressed store, hash-verified

36 T: DisplayText<PlanRenderingContext<'a, T>> + Ord,
37{
38 fn fmt_text(&self, f: &mut fmt::Formatter<'_>, _ctx: &mut ()) -> fmt::Result {
39 let mut ctx = PlanRenderingContext::new(
40 Indent::default(),
41 self.context.humanizer,
42 self.plan.annotations.clone(),
43 self.context.config,
44 self.context
45 .used_indexes
46 .ambiguous_ids(self.context.humanizer),
47 );
48
49 let mode = HumanizedExplain::new(self.context.config.redacted);
50
51 if let Some(finishing) = &self.context.finishing {
52 if ctx.config.humanized_exprs {
53 let analyses = ctx.annotations.get(&self.plan.plan);
54 let cols = analyses
55 .map(|analyses| analyses.column_names.clone())
56 .flatten();
57 mode.expr(finishing, cols.as_ref()).fmt_text(f, &mut ctx)?;
58 } else {
59 mode.expr(finishing, None).fmt_text(f, &mut ctx)?;
60 }
61 ctx.indented(|ctx| self.plan.plan.fmt_text(f, ctx))?;
62 } else {
63 self.plan.plan.fmt_text(f, &mut ctx)?;
64 }
65
66 if !self.context.used_indexes.is_empty() {
67 writeln!(f)?;
68 self.context.used_indexes.fmt_text(f, &mut ctx)?;
69 }
70
71 if let Some(target_cluster) = self.context.target_cluster {
72 writeln!(f)?;
73 writeln!(f, "Target cluster: {}", target_cluster)?;
74 }
75
76 if !self.context.optimizer_notices.is_empty() {
77 writeln!(f)?;
78 writeln!(f, "Notices:")?;
79 for notice in self.context.optimizer_notices.iter() {
80 writeln!(f, "{}", notice)?;
81 }
82 }
83
84 if self.context.config.timing {
85 writeln!(f)?;
86 writeln!(f, "Optimization time: {:?}", self.context.duration)?;
87 }
88
89 Ok(())
90 }
91}
92
93impl<'a, T: 'a> DisplayText for ExplainMultiPlan<'a, T>

Callers 1

fmt_verbose_syntaxMethod · 0.45

Calls 15

IndicesClass · 0.85
ambiguous_idsMethod · 0.80
indentedMethod · 0.80
enumerateMethod · 0.80
anyMethod · 0.80
childMethod · 0.80
fmt_verbose_syntaxMethod · 0.80
fmt_default_syntaxMethod · 0.80
separatedFunction · 0.50
cloneMethod · 0.45
getMethod · 0.45
flattenMethod · 0.45

Tested by

no test coverage detected