Skip to content

Commit

Permalink
minor streamlining
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Jun 25, 2024
1 parent 7f84489 commit 55da6c8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/polars-sql/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ impl SQLContext {
let have_order_by = !query.order_by.is_empty();

// Note: if there is an 'order by' then we project everything (original cols
// and new projections), and *then* select the final cols; the retained cols
// and new projections) and *then* select the final cols; the retained cols
// are used to ensure a correct final projection. If there's no 'order by',
// clause then we can project the final column *expressions* directly.
for p in projections.iter() {
Expand All @@ -752,11 +752,9 @@ impl SQLContext {
if !select_modifiers.rename.is_empty() {
lf = lf.with_columns(select_modifiers.renamed_cols());
}
self.process_order_by(lf, &query.order_by, Some(&retained_cols))?
.select(retained_cols)
} else {
lf.select(retained_cols)
lf = self.process_order_by(lf, &query.order_by, Some(&retained_cols))?
}
lf.select(retained_cols)
} else {
lf = self.process_group_by(lf, &group_by_keys, &projections)?;
lf = self.process_order_by(lf, &query.order_by, None)?;
Expand Down

0 comments on commit 55da6c8

Please sign in to comment.