Skip to content

Commit 73c5a01

Browse files
ZENOTMEliurenjie1024
authored andcommitted
Refactor: remove unnecessary async for ArrowReader::read (apache#1608)
## Which issue does this PR close? - Closes #. ## What changes are included in this PR? ## Are these changes tested? Co-authored-by: Renjie Liu <[email protected]>
1 parent d755caf commit 73c5a01

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

crates/iceberg/src/arrow/reader.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub struct ArrowReader {
138138
impl ArrowReader {
139139
/// Take a stream of FileScanTasks and reads all the files.
140140
/// Returns a stream of Arrow RecordBatches containing the data from the files
141-
pub async fn read(self, tasks: FileScanTaskStream) -> Result<ArrowRecordBatchStream> {
141+
pub fn read(self, tasks: FileScanTaskStream) -> Result<ArrowRecordBatchStream> {
142142
let file_io = self.file_io.clone();
143143
let batch_size = self.batch_size;
144144
let concurrency_limit_data_files = self.concurrency_limit_data_files;
@@ -1751,7 +1751,6 @@ message schema {
17511751

17521752
let result = reader
17531753
.read(tasks)
1754-
.await
17551754
.unwrap()
17561755
.try_collect::<Vec<RecordBatch>>()
17571756
.await

crates/iceberg/src/scan/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,7 @@ impl TableScan {
437437
arrow_reader_builder = arrow_reader_builder.with_batch_size(batch_size);
438438
}
439439

440-
arrow_reader_builder
441-
.build()
442-
.read(self.plan_files().await?)
443-
.await
440+
arrow_reader_builder.build().read(self.plan_files().await?)
444441
}
445442

446443
/// Returns a reference to the column names of the table scan.
@@ -1332,14 +1329,12 @@ pub mod tests {
13321329
let batch_stream = reader
13331330
.clone()
13341331
.read(Box::pin(stream::iter(vec![Ok(plan_task.remove(0))])))
1335-
.await
13361332
.unwrap();
13371333
let batch_1: Vec<_> = batch_stream.try_collect().await.unwrap();
13381334

13391335
let reader = ArrowReaderBuilder::new(fixture.table.file_io().clone()).build();
13401336
let batch_stream = reader
13411337
.read(Box::pin(stream::iter(vec![Ok(plan_task.remove(0))])))
1342-
.await
13431338
.unwrap();
13441339
let batch_2: Vec<_> = batch_stream.try_collect().await.unwrap();
13451340

0 commit comments

Comments
 (0)