alexanderbianchi commented on code in PR #114:
URL: 
https://github.com/apache/datafusion-iceberg/pull/114#discussion_r4607108117


##########
crates/datafusion/src/read/scan.rs:
##########
@@ -93,6 +98,39 @@ impl IcebergDataSource {
     pub fn fetch(&self) -> Option<usize> {
         self.fetch
     }
+
+    /// Estimates the rows the scan returns before its predicate and fetch,
+    /// from the snapshot summary.
+    ///
+    /// `total-records` counts rows before deletes. A position delete removes
+    /// at most one row, so position deletes are subtracted. An equality delete
+    /// can remove any number of rows, so equality deletes are ignored. Summary
+    /// fields are optional. A missing or invalid `total-records` leaves the
+    /// estimate unknown, and a missing or invalid `total-position-deletes`
+    /// counts as zero, rather than failing the query.
+    fn estimated_num_rows(&self) -> Precision<usize> {
+        let metadata = self.table.metadata();
+        let snapshot = match self.snapshot_id {
+            Some(snapshot_id) => metadata.snapshot_by_id(snapshot_id),

Review Comment:
   This snapshot pattern comes up frequently, I wonder if we should just 
resolve the snapshot once during data source construction. Not for this PR 
though,.



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