Skip to content
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

Recursively set dictionaries in struct fields #662

Merged
merged 8 commits into from
Mar 8, 2023

Conversation

gsilvestrin
Copy link
Contributor

No description provided.

@gsilvestrin gsilvestrin changed the title initial recursive implementation to set dictionaries in struct fields Recursively set dictionaries in struct fields Mar 8, 2023
@@ -301,7 +303,7 @@ impl Field {
assert!(self.data_type().is_dictionary());
self.dictionary = Some(Dictionary {
offset: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should set the offset as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment clarifying when / how these fields are set

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

}
DataType::List(values) => {
// should this be self.children[0]?
let mut f = Field::try_from(values.as_ref()).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

change to use self.children[0]?

I might prefer keep such case unhandled instead of leaving code like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let mut f = Field::try_from(values.as_ref()).unwrap();
let list_arr = arr.as_any().downcast_ref::<LargeListArray>().unwrap();
f.set_dictionary(list_arr.values());
}
_ => {
// Add nested struct support.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the comments? Any other edge case left?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

list support was moved to their own pr: https://github.com/eto-ai/lance/pull/664/files

@gsilvestrin gsilvestrin marked this pull request as ready for review March 8, 2023 17:19
Copy link
Contributor

@eddyxu eddyxu left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks GC

@gsilvestrin gsilvestrin merged commit 8e6ea86 into main Mar 8, 2023
@gsilvestrin gsilvestrin deleted the gsilvestrin/struct_fields_dictionary branch March 8, 2023 19:30
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.

2 participants