Skip to content

Commit

Permalink
bugfix: fix TableScan may contain fields not included in schema (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener authored Feb 7, 2023
1 parent 61459d9 commit e222bd6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datafusion/optimizer/src/push_down_projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ fn optimize_plan(
// scans:
// * remove un-used columns from the scan projection
LogicalPlan::TableScan(scan) => {
// filter expr may not exist in expr in projection.
// like: TableScan: t1 projection=[bool_col, int_col], full_filters=[t1.id = Int32(1)]
// projection=[bool_col, int_col] don't contain `ti.id`.
exprlist_to_columns(&scan.filters, &mut new_required_columns)?;
push_down_scan(scan, &new_required_columns, has_projection)
}
LogicalPlan::Explain { .. } => Err(DataFusionError::Internal(
Expand Down

0 comments on commit e222bd6

Please sign in to comment.