(&self, f: &mut fmt::Formatter<'_>, _ctx: &mut ())
| 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 | |
| 93 | impl<'a, T: 'a> DisplayText for ExplainMultiPlan<'a, T> |
no test coverage detected