Skip to content

Commit 23d03a4

Browse files
adriangbclaude
andcommitted
refactor: revert TableScan tree-node match to explicit destructuring
Restores the explicit field destructuring for the LogicalPlan::TableScan arm of map_expressions instead of the `mut scan` + `..scan` shorthand. Explicit destructuring forces a compile error if a new field carrying expressions is added to TableScan, so this callsite cannot be silently missed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent a7c1f20 commit 23d03a4

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

‎datafusion/expr/src/logical_plan/tree_node.rs‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,15 +608,25 @@ impl LogicalPlan {
608608
Transformed::new(plan, exprs.transformed, exprs.tnr)
609609
}
610610
}
611-
LogicalPlan::TableScan(mut scan) => {
612-
// Only `filters` carry expressions; take them out, rewrite,
613-
// and rebuild with `..scan` so every other field (including
614-
// any added later) is carried through untouched.
615-
let filters = std::mem::take(&mut scan.filters);
616-
filters.map_elements(f)?.update_data(|filters| {
617-
LogicalPlan::TableScan(TableScan { filters, ..scan })
611+
LogicalPlan::TableScan(TableScan {
612+
table_name,
613+
source,
614+
projection,
615+
projected_schema,
616+
filters,
617+
fetch,
618+
statistics_requests,
619+
}) => filters.map_elements(f)?.update_data(|filters| {
620+
LogicalPlan::TableScan(TableScan {
621+
table_name,
622+
source,
623+
projection,
624+
projected_schema,
625+
filters,
626+
fetch,
627+
statistics_requests,
618628
})
619-
}
629+
}),
620630
LogicalPlan::Distinct(Distinct::On(DistinctOn {
621631
on_expr,
622632
select_expr,

0 commit comments

Comments
 (0)