Skip to content

Commit 55e181e

Browse files
authored
chore: expose field id mapping from schema (#1498)
## What changes are included in this PR? Motivation: - I would like to leverage naming mapping, to compensate the issue that table metadata reassigns field id on creation. - Name mapping requires (1) field id; (2) field name; (3) children values; all these information could be fetched from `Schema`, but could be a lot easier and performant if we could expose (1) field id -> field name; (2) field id -> field mapping. ## Are these changes tested? N/A, trivial visibility change, no functional change
1 parent aeff4e5 commit 55e181e

File tree

1 file changed

+6
-1
lines changed
  • crates/iceberg/src/spec/schema

1 file changed

+6
-1
lines changed

crates/iceberg/src/spec/schema/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,14 @@ impl Schema {
410410
}
411411

412412
/// Return A HashMap matching field ids to field names.
413-
pub(crate) fn field_id_to_name_map(&self) -> &HashMap<i32, String> {
413+
pub fn field_id_to_name_map(&self) -> &HashMap<i32, String> {
414414
&self.id_to_name
415415
}
416+
417+
/// Return a hashmap matching field ids to nested fields.
418+
pub fn field_id_to_fields(&self) -> &HashMap<i32, NestedFieldRef> {
419+
&self.id_to_field
420+
}
416421
}
417422

418423
impl Display for Schema {

0 commit comments

Comments
 (0)