datafusion
datafusion copied to clipboard
LogicalPlan::map_children should recurse into table scans defined by a plan
Describe the bug
This is about the TreeNode impl for LogicalPlan. Some LogicalPlan::TableScan are not actually leaves because they are defined by a logical plan. However here: https://github.com/apache/datafusion/blob/321401ce627c586703f3b8902831bbe4578c5a9b/datafusion/expr/src/logical_plan/tree_node.rs#L348-L349
The fn map_children is unconditionally assuming that the table scan is a leaf and has no children.
The correct behaviour would be to recurse into the plan, if one exists.
take
@leoyvens can you please review the changes .