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


##########
datafusion/datasource/src/memory.rs:
##########
@@ -213,26 +213,28 @@ impl DataSource for MemorySourceConfig {
 
     fn try_swapping_with_projection(
         &self,
-        projection: &ProjectionExec,
-    ) -> Result<Option<Arc<dyn ExecutionPlan>>> {
+        projection: &[ProjectionExpr],
+    ) -> Result<Option<Arc<dyn DataSource>>> {
         // If there is any non-column or alias-carrier expression, Projection 
should not be removed.
         // This process can be moved into MemoryExec, but it would be an 
overlap of their responsibility.
-        all_alias_free_columns(projection.expr())
+        let res = all_alias_free_columns(projection)
             .then(|| {
                 let all_projections = 
(0..self.schema.fields().len()).collect();
                 let new_projections = new_projections_for_columns(
                     projection,
                     self.projection().as_ref().unwrap_or(&all_projections),
                 );
 
-                MemorySourceConfig::try_new_exec(
+                MemorySourceConfig::try_new(
                     self.partitions(),
                     self.original_schema(),
                     Some(new_projections),
                 )
-                .map(|e| e as _)
+                .map(|s| Arc::new(s) as Arc<dyn DataSource>)
             })
-            .transpose()
+            .transpose()?;
+
+        Ok(res)

Review Comment:
   73e0aaac1



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to