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


##########
crates/iceberg/src/spec/manifest_list.rs:
##########
@@ -73,263 +71,273 @@ impl ManifestList {
         &self.entries
     }
 
-    const MANIFEST_PATH: Lazy<NestedFieldRef> = {
+    /// Get the v2 schema of the manifest list entry.
+    pub(crate) fn v2_schema() -> Schema {
+        let fields = vec![
+            _schema::MANIFEST_PATH.clone(),
+            _schema::MANIFEST_LENGTH.clone(),
+            _schema::PARTITION_SPEC_ID.clone(),
+            _schema::CONTENT.clone(),
+            _schema::SEQUENCE_NUMBER.clone(),
+            _schema::MIN_SEQUENCE_NUMBER.clone(),
+            _schema::ADDED_SNAPSHOT_ID.clone(),
+            _schema::ADDED_FILES_COUNT_V2.clone(),
+            _schema::EXISTING_FILES_COUNT_V2.clone(),
+            _schema::DELETED_FILES_COUNT_V2.clone(),
+            _schema::ADDED_ROWS_COUNT_V2.clone(),
+            _schema::EXISTING_ROWS_COUNT_V2.clone(),
+            _schema::DELETED_ROWS_COUNT_V2.clone(),
+            _schema::PARTITIONS.clone(),
+            _schema::KEY_METADATA.clone(),
+        ];
+        Schema::builder().with_fields(fields).build().unwrap()
+    }
+
+    /// Get the v1 schema of the manifest list entry.
+    pub(crate) fn v1_schema() -> Schema {
+        let fields = vec![
+            _schema::MANIFEST_PATH.clone(),
+            _schema::MANIFEST_LENGTH.clone(),
+            _schema::PARTITION_SPEC_ID.clone(),
+            _schema::ADDED_SNAPSHOT_ID.clone(),
+            _schema::ADDED_FILES_COUNT_V1.clone().to_owned(),
+            _schema::EXISTING_FILES_COUNT_V1.clone(),
+            _schema::DELETED_FILES_COUNT_V1.clone(),
+            _schema::ADDED_ROWS_COUNT_V1.clone(),
+            _schema::EXISTING_ROWS_COUNT_V1.clone(),
+            _schema::DELETED_ROWS_COUNT_V1.clone(),
+            _schema::PARTITIONS.clone(),
+            _schema::KEY_METADATA.clone(),
+        ];
+        Schema::builder().with_fields(fields).build().unwrap()
+    }
+}
+
+/// This is a helper module that defines the schema field of the manifest list 
entry.
+mod _schema {
+    use std::sync::Arc;
+
+    use once_cell::sync::Lazy;
+
+    use crate::spec::{ListType, NestedField, NestedFieldRef, PrimitiveType, 
StructType, Type};
+
+    pub static MANIFEST_PATH: Lazy<NestedFieldRef> = {
         Lazy::new(|| {
             Arc::new(NestedField::required(
                 500,
                 "manifest_path",
-                super::Type::Primitive(super::PrimitiveType::String),
+                Type::Primitive(PrimitiveType::String),
             ))
         })
     };
-    const MANIFEST_LENGTH: Lazy<NestedFieldRef> = {
+    pub static MANIFEST_LENGTH: Lazy<NestedFieldRef> = {

Review Comment:
   I would suggest to change modifier to `pub(crate)`



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