(
&self,
f: &mut fmt::Formatter<'_>,
ctx: &mut PlanRenderingContext<'_, MirRelationExpr>,
)
| 338 | } |
| 339 | |
| 340 | fn fmt_verbose_syntax( |
| 341 | &self, |
| 342 | f: &mut fmt::Formatter<'_>, |
| 343 | ctx: &mut PlanRenderingContext<'_, MirRelationExpr>, |
| 344 | ) -> fmt::Result { |
| 345 | use MirRelationExpr::*; |
| 346 | |
| 347 | let mode = HumanizedExplain::new(ctx.config.redacted); |
| 348 | |
| 349 | match &self { |
| 350 | Constant { rows, typ: _ } => match rows { |
| 351 | Ok(rows) => { |
| 352 | if !rows.is_empty() { |
| 353 | write!(f, "{}Constant", ctx.indent)?; |
| 354 | self.fmt_analyses(f, ctx)?; |
| 355 | ctx.indented(|ctx| { |
| 356 | fmt_text_constant_rows( |
| 357 | f, |
| 358 | rows.iter().map(|(x, y)| (x, y)), |
| 359 | &mut ctx.indent, |
| 360 | mode.redacted(), |
| 361 | ) |
| 362 | })?; |
| 363 | } else { |
| 364 | write!(f, "{}Constant <empty>", ctx.indent)?; |
| 365 | self.fmt_analyses(f, ctx)?; |
| 366 | } |
| 367 | } |
| 368 | Err(err) => { |
| 369 | if mode.redacted() { |
| 370 | writeln!(f, "{}Error █", ctx.indent)?; |
| 371 | } else { |
| 372 | writeln!(f, "{}Error {}", ctx.indent, err.to_string().escaped())?; |
| 373 | } |
| 374 | } |
| 375 | }, |
| 376 | Let { id, value, body } => { |
| 377 | let mut bindings = vec![(id, value.as_ref())]; |
| 378 | let mut head = body.as_ref(); |
| 379 | |
| 380 | // Render Let-blocks nested in the body an outer Let-block in one step |
| 381 | // with a flattened list of bindings |
| 382 | while let Let { id, value, body } = head { |
| 383 | bindings.push((id, value.as_ref())); |
| 384 | head = body.as_ref(); |
| 385 | } |
| 386 | |
| 387 | if ctx.config.linear_chains { |
| 388 | writeln!(f, "{}With", ctx.indent)?; |
| 389 | ctx.indented(|ctx| { |
| 390 | for (id, value) in bindings.iter() { |
| 391 | writeln!(f, "{}cte {} =", ctx.indent, *id)?; |
| 392 | ctx.indented(|ctx| value.fmt_text(f, ctx))?; |
| 393 | } |
| 394 | Ok(()) |
| 395 | })?; |
| 396 | write!(f, "{}Return", ctx.indent)?; |
| 397 | self.fmt_analyses(f, ctx)?; |
no test coverage detected