adriangb commented on code in PR #17129:
URL: https://github.com/apache/datafusion/pull/17129#discussion_r2268079864


##########
datafusion/datasource/src/source.rs:
##########
@@ -320,7 +321,39 @@ impl ExecutionPlan for DataSourceExec {
         &self,
         projection: &ProjectionExec,
     ) -> Result<Option<Arc<dyn ExecutionPlan>>> {
-        self.data_source.try_swapping_with_projection(projection)
+        match self.data_source.try_swapping_with_projection(projection)? {
+            Some(new_plan) => {
+                if let Some(new_data_source_exec) =
+                    new_plan.as_any().downcast_ref::<DataSourceExec>()

Review Comment:
   I cry every time I see a downcast of a trait to a specific type. I 
understand why it's necessary in this case, I think the existing API is to 
blame, it's worth moving forward with this to fix the (pretty bad IMO) bug BUT 
this is the sort of thing I hope a future refactor will avoid the need for.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to