debugmiller opened a new issue, #100:
URL: https://github.com/apache/datafusion-iceberg/issues/100

   `IcebergDataSource::open` does not pass `execution.batch_size` from the 
session config to `get_batch_stream`:
   
   
https://github.com/apache/datafusion-iceberg/blob/256c4b7bde01a5eee9e4c6b417a36dbe3eb761ec/crates/datafusion/src/read/scan.rs#L182-L198
   
   `get_batch_stream` never calls `TableScanBuilder::with_batch_size`:
   
   
https://github.com/apache/datafusion-iceberg/blob/256c4b7bde01a5eee9e4c6b417a36dbe3eb761ec/crates/datafusion/src/read/scan.rs#L297-L305
   
   So scans always read arrow-rs's default of 1,024-row batches. That's an 
eighth of DataFusion's default of 8,192, and `SET 
datafusion.execution.batch_size` has no effect on them.
   
   Suggested fix:
   
   ```diff
   --- a/crates/datafusion/src/read/scan.rs
   +++ b/crates/datafusion/src/read/scan.rs
   @@ -195,6 +195,7 @@ impl DataSource for IcebergDataSource {
                    .execution
                    .parquet
                    .enable_page_index,
   +            context.session_config().batch_size(),
            );
            let stream = futures::stream::once(fut).try_flatten();
    
   @@ -281,6 +282,7 @@ async fn get_batch_stream(
        column_names: Option<Vec<String>>,
        predicate: Option<Predicate>,
        enable_page_index: bool,
   +    batch_size: usize,
    ) -> Result<Pin<Box<dyn Stream<Item = Result<RecordBatch>> + Send>>> {
        let scan_builder = match snapshot_id {
            Some(snapshot_id) => table.scan().snapshot_id(snapshot_id),
   @@ -296,6 +298,7 @@ async fn get_batch_stream(
        }
        let table_scan = scan_builder
            .with_row_selection_enabled(enable_page_index)
   +        .with_batch_size(Some(batch_size))
            .build()
            .map_err(to_datafusion_error)?;
   ```


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