liurenjie1024 commented on code in PR #129:
URL: https://github.com/apache/iceberg-rust/pull/129#discussion_r1445554235


##########
crates/iceberg/src/spec/snapshot.rs:
##########
@@ -124,6 +150,70 @@ impl Snapshot {
         Utc.timestamp_millis_opt(self.timestamp_ms).unwrap()
     }
 
+    /// Get the schema id of this snapshot.
+    #[inline]
+    pub fn schema_id(&self) -> Option<SchemaId> {
+        self.schema_id
+    }
+
+    /// Get the schema of this snapshot.
+    pub fn schema(&self, table_metadata: &TableMetadata) -> Result<SchemaRef> {
+        Ok(match self.schema_id() {
+            Some(schema_id) => table_metadata
+                .schema_by_id(schema_id)
+                .ok_or_else(|| {
+                    Error::new(
+                        ErrorKind::DataInvalid,
+                        format!("Schema with id {} not found", schema_id),
+                    )
+                })?
+                .clone(),
+            None => table_metadata.current_schema().clone(),
+        })
+    }
+
+    /// Get parent snapshot.
+    #[cfg(test)]
+    pub(crate) fn parent_snapshot(&self, table_metadata: &TableMetadata) -> 
Option<SnapshotRef> {
+        match self.parent_snapshot_id {
+            Some(id) => table_metadata.snapshot_by_id(id).cloned(),
+            None => None,
+        }
+    }
+
+    /// Load manifest list.
+    pub async fn load_manifest_list(
+        &self,
+        file_io: &FileIO,
+        table_metadata: &TableMetadata,
+    ) -> Result<ManifestList> {
+        match &self.manifest_list {
+            ManifestListLocation::ManifestListFile(file) => {
+                let mut manifest_list_content= Vec::new();

Review Comment:
   We have rustfmt check in ci, so I guess this is sth not supported by stable 
rustfmt.



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