gabotechs commented on code in PR #47:
URL: https://github.com/apache/datafusion-iceberg/pull/47#discussion_r4208609973


##########
crates/datafusion/src/physical_plan/metadata_scan.rs:
##########
@@ -80,28 +92,40 @@ impl ExecutionPlan for IcebergMetadataScan {
 
     fn apply_expressions(
         &self,
-        _f: &mut dyn FnMut(
-            &Arc<dyn PhysicalExpr>,
-        ) -> datafusion::error::Result<TreeNodeRecursion>,
-    ) -> datafusion::error::Result<TreeNodeRecursion> {
+        _f: &mut dyn FnMut(&Arc<dyn PhysicalExpr>) -> 
Result<TreeNodeRecursion>,
+    ) -> Result<TreeNodeRecursion> {
         Ok(TreeNodeRecursion::Continue)
     }
 
     fn with_new_children(
         self: Arc<Self>,
         _children: Vec<Arc<dyn ExecutionPlan>>,
-    ) -> datafusion::error::Result<Arc<dyn ExecutionPlan>> {
+    ) -> Result<Arc<dyn ExecutionPlan>> {
         Ok(self)
     }
 
     fn execute(
         &self,
         _partition: usize,
         _context: Arc<datafusion::execution::TaskContext>,
-    ) -> 
datafusion::error::Result<datafusion::execution::SendableRecordBatchStream> {
+    ) -> Result<datafusion::execution::SendableRecordBatchStream> {
         let fut = self.provider.clone().scan();
-        let stream = futures::stream::once(fut).try_flatten();
-        let schema = self.provider.schema();
-        Ok(Box::pin(RecordBatchStreamAdapter::new(schema, stream)))
+        let projection = self.projection.clone();
+
+        let stream =
+            futures::stream::once(fut)
+                .try_flatten()
+                .map(move |result| -> Result<_> {
+                    let batch = result?;
+                    match &projection {
+                        Some(indices) => Ok(batch.project(indices)?),
+                        None => Ok(batch),
+                    }
+                });

Review Comment:
   🤔 Ok, this might be worth at least creating an issue in `iceberg-rust` 
upstream requesting for this functionality so that we can leave a TODO comment 
in the code here for future contributors, and leave it like this for now.
   
   WDYT?



-- 
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