Skip to content
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

fix: Respect rewriting flag in Node rewriter #21516

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/polars-plan/src/plans/optimizer/cse/cse_lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ pub(crate) fn elim_cmn_subplans(
let mut id_array = Default::default();

with_ir_arena(lp_arena, expr_arena, |arena| {
let lp_node = IRNode::new(root);
let lp_node = IRNode::new_mutate(root);
let mut visitor = LpIdentifierVisitor::new(&mut sp_count, &mut id_array);

lp_node.visit(&mut visitor, arena).map(|_| ()).unwrap();
Expand Down
6 changes: 4 additions & 2 deletions crates/polars-plan/src/plans/visitor/lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ impl TreeWalker for IRNode {

self.to_alp(&arena.0).copy_inputs(&mut scratch);
for &node in scratch.as_slice() {
let lp_node = IRNode::new(node);
let mut lp_node = IRNode::new(node);
lp_node.mutate = self.mutate;
match op(&lp_node, arena)? {
// let the recursion continue
VisitRecursion::Continue | VisitRecursion::Skip => {},
Expand All @@ -90,7 +91,8 @@ impl TreeWalker for IRNode {

// rewrite the nodes
for node in &mut inputs {
let lp_node = IRNode::new(*node);
let mut lp_node = IRNode::new(*node);
lp_node.mutate = self.mutate;
*node = op(lp_node, arena)?.node;
}
let lp = arena.0.get(self.node);
Expand Down
Loading