JingsongLi commented on code in PR #196:
URL: https://github.com/apache/paimon-rust/pull/196#discussion_r3031610096


##########
crates/paimon/src/table/table_scan.rs:
##########
@@ -166,6 +168,72 @@ fn partition_matches_predicate(
     }
 }
 
+#[derive(Debug, Clone)]
+struct FileStatsRows {
+    row_count: i64,
+    min_values: Option<BinaryRow>,
+    max_values: Option<BinaryRow>,
+    null_counts: Vec<i64>,
+}
+
+impl FileStatsRows {
+    fn from_data_file(file: &DataFileMeta) -> Self {
+        Self {
+            row_count: file.row_count,
+            min_values: 
BinaryRow::from_serialized_bytes(file.value_stats.min_values()).ok(),
+            max_values: 
BinaryRow::from_serialized_bytes(file.value_stats.max_values()).ok(),
+            null_counts: file.value_stats.null_counts().clone(),
+        }
+    }
+
+    fn null_count(&self, index: usize) -> Option<i64> {
+        self.null_counts.get(index).copied()
+    }
+
+    /// Check whether the stats rows have the expected number of fields.
+    ///
+    /// If either min or max BinaryRow has an arity different from
+    /// `expected_fields`, the stats were likely written in dense mode or
+    /// under a different schema — making index-based access unsafe.
+    fn arity_matches(&self, expected_fields: usize) -> bool {

Review Comment:
   We should consider schema evolution here, otherwise may occur exception here.



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

Reply via email to