Skip to content

feat: Add IndexByName and IndexById to Namemapping #1299

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jonathanc-n
Copy link
Contributor

Which issue does this PR close?

Build on #1116

What changes are included in this PR?

Adds IndexByName and index by id to name mapping

Are these changes tested?

Yes, unit tests

@jonathanc-n
Copy link
Contributor Author

cc @jdockerty @liurenjie1024

Copy link
Contributor

@jdockerty jdockerty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question and a clarification 💯

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jonathanc-n , just finished first round of review, generally looks good.

@jonathanc-n
Copy link
Contributor Author

@jdockerty @liurenjie1024 Thanks for the reviews. Should be fixed now!

Xuanwo
Xuanwo previously approved these changes May 10, 2025
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jonathanc-n for working on this and thank you @liurenjie1024 for the review.

Wait for @liurenjie1024 for another look.

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a 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, just finished second round of review. There are still some problems to fix.

@@ -84,9 +133,187 @@ impl MappedField {
}
}

/// Recursively visits the entire name mapping using visitor
fn visit_name_mapping<V>(namespace: &Vec<Arc<MappedField>>, visitor: &V) -> V::S
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn visit_name_mapping<V>(namespace: &Vec<Arc<MappedField>>, visitor: &V) -> V::S
fn visit_name_mapping<V>(namespace: &NameMapping, visitor: &V) -> V::S

It's odd that the name is visit_name_mapping while accepts a list of fields.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the return value should be a Result

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because when creating a new NameMapping we call visit_schema which creates an array of mapped fields which are then called on by index_by_id + index_by_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants