Xuanwo commented on code in PR #870: URL: https://github.com/apache/iceberg-rust/pull/870#discussion_r1905085981
########## crates/iceberg/src/metadata_scan.rs: ########## @@ -95,7 +99,17 @@ impl<'a> SnapshotsTable<'a> { } /// Scans the snapshots table. - pub fn scan(&self) -> Result<RecordBatch> { + pub async fn scan(&self) -> Result<ArrowRecordBatchStream> { + let arrow_schema = Arc::new(self.schema()); + let table_metadata = self.table.metadata_ref(); + + Ok( + futures::stream::once(async move { Self::build_batch(arrow_schema, &table_metadata) }) Review Comment: Hi, maybe we can use [`stream::iter`](https://docs.rs/futures/latest/futures/stream/fn.iter.html) instead to convert an Iterator into stream directly. The `async move {}` call here seems not needed. ########## crates/iceberg/src/metadata_scan.rs: ########## @@ -95,7 +99,17 @@ impl<'a> SnapshotsTable<'a> { } /// Scans the snapshots table. - pub fn scan(&self) -> Result<RecordBatch> { + pub async fn scan(&self) -> Result<ArrowRecordBatchStream> { + let arrow_schema = Arc::new(self.schema()); + let table_metadata = self.table.metadata_ref(); + + Ok( + futures::stream::once(async move { Self::build_batch(arrow_schema, &table_metadata) }) + .boxed(), + ) + } + + fn build_batch(arrow_schema: SchemaRef, table_metadata: &TableMetadata) -> Result<RecordBatch> { Review Comment: Perhaps we could simply implement it in `scan` instead. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org