liurenjie1024 commented on code in PR #1116: URL: https://github.com/apache/iceberg-rust/pull/1116#discussion_r2050622530
########## crates/iceberg/src/spec/name_mapping/mod.rs: ########## @@ -17,14 +17,31 @@ //! Iceberg name mapping. +use std::sync::Arc; + use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DefaultOnNull}; +/// Property name for name mapping. +pub const DEFAULT_SCHEMA_NAME_MAPPING: &str = "schema.name-mapping.default"; + /// Iceberg fallback field name to ID mapping. #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] #[serde(transparent)] pub struct NameMapping { - pub root: Vec<MappedField>, + root: Vec<MappedField>, +} + +impl NameMapping { + /// Create a new [`NameMapping`] given a collection of mapped fields. + pub fn new(fields: Vec<MappedField>) -> Self { + Self { root: fields } + } + + /// Get a reference to fields which are to be mapped from name to field ID. + pub fn root(&self) -> &[MappedField] { Review Comment: ```suggestion pub fn fields(&self) -> &[MappedField] { ``` -- 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