diff --git a/datafusion/core/src/physical_optimizer/optimize_projections.rs b/datafusion/core/src/physical_optimizer/optimize_projections.rs index eda1716b8141e..3fecd4b0cdc26 100644 --- a/datafusion/core/src/physical_optimizer/optimize_projections.rs +++ b/datafusion/core/src/physical_optimizer/optimize_projections.rs @@ -459,7 +459,8 @@ impl ProjectionOptimizer { let Some(projection) = self.plan.as_any().downcast_ref::() 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: if projection.expr().len() >= projection.input().schema().fields().len() || !projection.expr().iter().all(|(expr, _)| { expr.as_any().downcast_ref::().is_some()