Skip to content

Commit

Permalink
Update optimize_projections.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
berkaysynnada committed Apr 30, 2024
1 parent 4315494 commit 1611ca1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ impl ProjectionOptimizer {
let Some(projection) = self.plan.as_any().downcast_ref::<ProjectionExec>() else {
return Ok(Transformed::no(self));
};
// If the projection does not narrow the schema, we should not try to push it down:
// If the projection does not narrow the schema or it does some calculations,
// we should not try to push it down to have less computation during execution.
// (Making any computation dominates the existance of column elimination)
if projection.expr().len() >= projection.input().schema().fields().len()
|| !projection.expr().iter().all(|(expr, _)| {
expr.as_any().downcast_ref::<Column>().is_some()
Expand Down

0 comments on commit 1611ca1

Please sign in to comment.