Skip to content

Commit

Permalink
refactor(rust): conditionally print the CSEs (pola-rs#16292)
Browse files Browse the repository at this point in the history
  • Loading branch information
coastalwhite authored May 17, 2024
1 parent 31608f3 commit 7fa728e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/polars-plan/src/logical_plan/alp/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,16 @@ impl<'a> IRDisplay<'a> {
Select { expr, input, .. } => {
// @NOTE: Maybe there should be a clear delimiter here?
let default_exprs = self.display_expr_slice(expr.default_exprs());
let cse_exprs = self.display_expr_slice(expr.cse_exprs());

write!(f, "{:indent$} SELECT {default_exprs}, {cse_exprs} FROM", "")?;
write!(f, "{:indent$} SELECT {default_exprs}", "")?;

if !expr.cse_exprs().is_empty() {
let cse_exprs = self.display_expr_slice(expr.cse_exprs());
write!(f, ", CSE = {cse_exprs}")?;
}

f.write_str(" FROM")?;

self.with_root(*input)._format(f, sub_indent)
},
Sort {
Expand Down

0 comments on commit 7fa728e

Please sign in to comment.