gabotechs commented on code in PR #47:
URL: https://github.com/apache/datafusion-iceberg/pull/47#discussion_r4203721803
##########
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:
🤔 This seems off. This implies that we might be paying the price of reading
columns that we are going to end up dropping.
Probably worth checking that we are not reading unnecessary columns on the
first place.
--
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]