-
Notifications
You must be signed in to change notification settings - Fork 215
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
feat: Add NameMapping
#1072
base: main
Are you sure you want to change the base?
feat: Add NameMapping
#1072
Conversation
…-n/iceberg-rust into implement-name-mapping
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.
Thanks @jonathanc-n for this pr, generally I think this is quite useful to complete features of NameMapping
. Here are my suggestions:
- Split the pr into several smaller ones.
- Add
MappedFields
like java does. - Add visitor for index by name and index by field id with enough tests
- Add visitor for update mappings with tests.
} | ||
|
||
/// Returns an index mapping names to `MappedField`` by visiting the schema. | ||
pub fn index_by_name(schema: &Schema) -> HashMap<String, MappedField> { |
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.
I don't think we should expose this method to user, the index should be constructed lazily.
/// Iceberg fallback field name to ID mapping. | ||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
#[serde(transparent)] | ||
pub struct NameMapping { | ||
/// Holds mapped fields |
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.
Seems we lack a MappedFields
field like java one
} | ||
|
||
/// Applies the name mapping to the given schema. | ||
pub fn apply_name_mapping(schema: &Schema, mapping: &NameMapping) -> Result<Type> { |
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.
I'm confusing about this method, is there any case to demonstrate its usage?
Which issue does this PR close?
What changes are included in this PR?
Added
NameMapping
implementation. Includes updating, creating, and applying to other schema.Are these changes tested?