Skip to content

Commit

Permalink
refactor(rust): remove unused order_by attribute (pola-rs#11434)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Sep 30, 2023
1 parent ddc1b4f commit a06a342
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion crates/polars-lazy/src/physical_plan/planner/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ pub(crate) fn create_physical_expr(
Window {
mut function,
partition_by,
order_by: _,
options,
} => {
state.set_window();
Expand Down
1 change: 0 additions & 1 deletion crates/polars-plan/src/dsl/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ pub enum Expr {
/// Also has the input. i.e. avg("foo")
function: Box<Expr>,
partition_by: Vec<Expr>,
order_by: Option<Box<Expr>>,
options: WindowOptions,
},
Wildcard,
Expand Down
1 change: 0 additions & 1 deletion crates/polars-plan/src/dsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,6 @@ impl Expr {
Expr::Window {
function: Box::new(self),
partition_by,
order_by: None,
options,
}
}
Expand Down
7 changes: 0 additions & 7 deletions crates/polars-plan/src/logical_plan/aexpr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ pub enum AExpr {
Window {
function: Node,
partition_by: Vec<Node>,
order_by: Option<Node>,
options: WindowOptions,
},
#[default]
Expand Down Expand Up @@ -314,15 +313,11 @@ impl AExpr {
Window {
function,
partition_by,
order_by,
options: _,
} => {
for e in partition_by.iter().rev() {
container.push(*e);
}
if let Some(e) = order_by {
container.push(*e);
}
// latest so that it is popped first
container.push(*function);
},
Expand Down Expand Up @@ -398,14 +393,12 @@ impl AExpr {
Window {
function,
partition_by,
order_by,
..
} => {
*function = *inputs.last().unwrap();
partition_by.clear();
partition_by.extend_from_slice(&inputs[..inputs.len() - 1]);

assert!(order_by.is_none());
return self;
},
};
Expand Down
5 changes: 0 additions & 5 deletions crates/polars-plan/src/logical_plan/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ pub fn to_aexpr(expr: Expr, arena: &mut Arena<AExpr>) -> Node {
Expr::Window {
function,
partition_by,
order_by,
options,
} => AExpr::Window {
function: to_aexpr(*function, arena),
partition_by: to_aexprs(partition_by, arena),
order_by: order_by.map(|ob| to_aexpr(*ob, arena)),
options,
},
Expr::Slice {
Expand Down Expand Up @@ -565,16 +563,13 @@ pub fn node_to_expr(node: Node, expr_arena: &Arena<AExpr>) -> Expr {
AExpr::Window {
function,
partition_by,
order_by,
options,
} => {
let function = Box::new(node_to_expr(function, expr_arena));
let partition_by = nodes_to_exprs(&partition_by, expr_arena);
let order_by = order_by.map(|ob| Box::new(node_to_expr(ob, expr_arena)));
Expr::Window {
function,
partition_by,
order_by,
options,
}
},
Expand Down
4 changes: 0 additions & 4 deletions crates/polars-plan/src/logical_plan/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,11 @@ macro_rules! push_expr {
Window {
function,
partition_by,
order_by,
..
} => {
for e in partition_by.into_iter().rev() {
$push(e)
}
if let Some(e) = order_by {
$push(e);
}
// latest so that it is popped first
$push(function);
},
Expand Down

0 comments on commit a06a342

Please sign in to comment.