-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TableMetadataBuilder #587
TableMetadataBuilder #587
Changes from 7 commits
dfd81bc
acbbbdf
47270f7
6a55d6f
164e90c
64ab410
9929a82
937ea7a
826fb08
e733c30
941cc4d
53e30e0
e6301a2
7ba1520
e4dcc7f
2627c0d
f7b4fcf
dd06a8d
72b5c0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,6 @@ impl SchemaBuilder { | |
/// Reassignment starts from the field-id specified in `start_from` (inclusive). | ||
/// | ||
/// All specified aliases and identifier fields will be updated to the new field-ids. | ||
#[allow(dead_code)] // Will be needed in TableMetadataBuilder | ||
pub(crate) fn with_reassigned_field_ids(mut self, start_from: u32) -> Self { | ||
self.reassign_field_ids_from = Some(start_from.try_into().unwrap_or(i32::MAX)); | ||
self | ||
|
@@ -376,6 +375,24 @@ impl Schema { | |
pub fn accessor_by_field_id(&self, field_id: i32) -> Option<Arc<StructAccessor>> { | ||
self.field_id_to_accessor.get(&field_id).cloned() | ||
} | ||
|
||
/// Check if this schema is identical to another schema semantically - excluding schema id. | ||
pub(crate) fn is_same_schema(&self, other: &SchemaRef) -> bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not implement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about this as well, but opted for a method with documentation. |
||
self.as_struct().eq(other.as_struct()) | ||
&& self.identifier_field_ids().eq(other.identifier_field_ids()) | ||
} | ||
|
||
/// Change the schema id of this schema. | ||
// This is redundant with the `with_schema_id` method on the builder, but useful | ||
// as it is infallible in contrast to the builder `build()` method. | ||
pub(crate) fn with_schema_id(self, schema_id: SchemaId) -> Self { | ||
Self { schema_id, ..self } | ||
} | ||
|
||
/// Return A HashMap matching field ids to field names. | ||
pub(crate) fn field_id_to_name_map(&self) -> &HashMap<i32, String> { | ||
&self.id_to_name | ||
} | ||
} | ||
|
||
impl Display for Schema { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this debug statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done