blackmwk commented on code in PR #3093:
URL: https://github.com/apache/iceberg-rust/pull/3093#discussion_r3892638524


##########
crates/iceberg/src/spec/table_properties.rs:
##########
@@ -32,6 +34,18 @@ fn parse_location_property(path: &str) -> Result<String> {
     Ok(strip_trailing_slash(path).to_string())
 }
 
+fn parse_name_mapping(value: &str) -> Result<Arc<NameMapping>> {

Review Comment:
   How about implement `FromStr` for NameMapping?



##########
crates/iceberg/src/scan/mod.rs:
##########
@@ -61,6 +60,79 @@ fn resolve_field_id(schema: &Schema, column_name: &str, 
case_sensitive: bool) ->
     }
 }
 
+fn collect_scan_field_ids(
+    schema: &Schema,
+    column_names: Option<&[String]>,
+    case_sensitive: bool,
+) -> Result<Vec<i32>> {
+    let mut field_ids = vec![];
+    let column_names = column_names.map(<[String]>::to_vec).unwrap_or_else(|| {

Review Comment:
   I don't think we need to collect to vec, also this is quite inefficient, if 
column_names is none, just return field id directly.



##########
crates/iceberg/src/spec/table_properties.rs:
##########
@@ -336,6 +350,15 @@ pub struct TableProperties {
         getter
     )]
     write_object_storage_partitioned_paths: bool,
+    /// The table's default name mapping, used to assign field ids when 
reading data files
+    /// that carry no field id metadata. `None` if 
`schema.name-mapping.default` is not set.
+    #[property(
+        key = Self::PROPERTY_DEFAULT_NAME_MAPPING,
+        default = None,
+        parse_with = parse_name_mapping,
+        getter
+    )]
+    default_name_mapping: Option<Arc<NameMapping>>,

Review Comment:
   ```suggestion
       default_name_mapping: Option<NameMapping>,
   ```
   
   The `TableProperties` is now a view of hashmap, I think it should be 
caller's responsibility to store it in Arc.



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