-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Remove debug asserts on scratch space #20224
Changes from 6 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,6 @@ pub fn pushdown_eligibility( | |
expr_arena: &mut Arena<AExpr>, | ||
scratch: &mut UnitVec<Node>, | ||
) -> PolarsResult<(PushdownEligibility, PlHashMap<PlSmallStr, PlSmallStr>)> { | ||
debug_assert!(scratch.is_empty()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed assert here |
||
scratch.clear(); | ||
let ae_nodes_stack = scratch; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,8 @@ mod inner { | |
} | ||
} | ||
|
||
pub fn nodes_scratch_mut(&mut self) -> &mut UnitVec<Node> { | ||
/// Returns shared scratch space after clearing. | ||
pub fn empty_nodes_scratch_mut(&mut self) -> &mut UnitVec<Node> { | ||
self.scratch.clear(); | ||
&mut self.scratch | ||
} | ||
|
@@ -50,7 +51,6 @@ fn can_pushdown_slice_past_projections( | |
arena: &Arena<AExpr>, | ||
scratch: &mut UnitVec<Node>, | ||
) -> (bool, bool) { | ||
debug_assert!(scratch.is_empty()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed assert here |
||
scratch.clear(); | ||
|
||
let mut can_pushdown_and_any_expr_has_column = false; | ||
|
@@ -496,15 +496,16 @@ impl SlicePushDown { | |
// [Pushdown] | ||
// these nodes will be pushed down. | ||
// State is None, we can continue | ||
m @(Select {..}, None) | | ||
m @ (SimpleProjection {..}, _) | ||
m @ (Select {..}, None) | ||
| m @ (HStack {..}, None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original MRE of the panic didn't actually contain a |
||
| m @ (SimpleProjection {..}, _) | ||
=> { | ||
let (lp, state) = m; | ||
self.pushdown_and_continue(lp, state, lp_arena, expr_arena) | ||
} | ||
// there is state, inspect the projection to determine how to deal with it | ||
(Select {input, expr, schema, options}, Some(_)) => { | ||
if can_pushdown_slice_past_projections(&expr, expr_arena, self.nodes_scratch_mut()).1 { | ||
if can_pushdown_slice_past_projections(&expr, expr_arena, self.empty_nodes_scratch_mut()).1 { | ||
let lp = Select {input, expr, schema, options}; | ||
self.pushdown_and_continue(lp, state, lp_arena, expr_arena) | ||
} | ||
|
@@ -514,8 +515,8 @@ impl SlicePushDown { | |
self.no_pushdown_restart_opt(lp, state, lp_arena, expr_arena) | ||
} | ||
} | ||
(HStack {input, exprs, schema, options}, _) => { | ||
let (can_pushdown, can_pushdown_and_any_expr_has_column) = can_pushdown_slice_past_projections(&exprs, expr_arena, self.nodes_scratch_mut()); | ||
(HStack {input, exprs, schema, options}, Some(_)) => { | ||
let (can_pushdown, can_pushdown_and_any_expr_has_column) = can_pushdown_slice_past_projections(&exprs, expr_arena, self.empty_nodes_scratch_mut()); | ||
|
||
if can_pushdown_and_any_expr_has_column || ( | ||
// If the schema length is greater then an input column is being projected, so | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename and add doc