rshkv commented on code in PR #870:
URL: https://github.com/apache/iceberg-rust/pull/870#discussion_r1905307332


##########
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:
   I do agree that `futures::stream::once(async move { ... ` is a bit verbose.
   
   I went with `try_stream!` instead, so now we do this:
   
   ```rust
   pub async fn scan(&self) -> Result<ArrowRecordBatchStream> {
       let arrow_schema = Arc::new(self.schema());
       ...
   
       Ok(try_stream! {
           ...
   
           yield RecordBatch::try_new(arrow_schema, vec![...])?;
       }
       .boxed())
   }
   ```
   
   @xuanwo, I don't know if that's what you had in mind and if you think it's 
better. I'm happy to revert. Let me know.



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

Reply via email to