Skip to content

Commit b3240bf

Browse files
committed
refactor: enhance filter extraction logic for various logical plans with explicit variant handling
1 parent 0b71180 commit b3240bf

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

‎datafusion/core/src/physical_planner.rs‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,36 @@ fn extract_dml_filters(input: &Arc<LogicalPlan>) -> Result<Vec<Expr>> {
19301930
filters.extend(split_conjunction(filter).into_iter().cloned());
19311931
}
19321932
}
1933-
_ => {}
1933+
// Plans without filter information
1934+
LogicalPlan::EmptyRelation(_)
1935+
| LogicalPlan::Values(_)
1936+
| LogicalPlan::DescribeTable(_)
1937+
| LogicalPlan::Explain(_)
1938+
| LogicalPlan::Analyze(_)
1939+
| LogicalPlan::Distinct(_)
1940+
| LogicalPlan::Extension(_)
1941+
| LogicalPlan::Statement(_)
1942+
| LogicalPlan::Dml(_)
1943+
| LogicalPlan::Ddl(_)
1944+
| LogicalPlan::Copy(_)
1945+
| LogicalPlan::Unnest(_)
1946+
| LogicalPlan::RecursiveQuery(_) => {
1947+
// No filters to extract from leaf/meta plans
1948+
}
1949+
// Plans with inputs (may contain filters in children)
1950+
LogicalPlan::Projection(_)
1951+
| LogicalPlan::SubqueryAlias(_)
1952+
| LogicalPlan::Limit(_)
1953+
| LogicalPlan::Sort(_)
1954+
| LogicalPlan::Union(_)
1955+
| LogicalPlan::Join(_)
1956+
| LogicalPlan::Repartition(_)
1957+
| LogicalPlan::Aggregate(_)
1958+
| LogicalPlan::Window(_)
1959+
| LogicalPlan::Subquery(_) => {
1960+
// Filter information may appear in child nodes; continue traversal
1961+
// to extract filters from Filter/TableScan nodes deeper in the plan
1962+
}
19341963
}
19351964
Ok(TreeNodeRecursion::Continue)
19361965
})?;

0 commit comments

Comments
 (0)