Skip to content

ARROW-10791: [Rust] StreamReader, read_dictionary duplicating schema info - #8820

Closed
carols10cents wants to merge 3 commits into
apache:masterfrom
integer32llc:simplify-dictionary-field-lookup
Closed

ARROW-10791: [Rust] StreamReader, read_dictionary duplicating schema info#8820
carols10cents wants to merge 3 commits into
apache:masterfrom
integer32llc:simplify-dictionary-field-lookup

Conversation

@carols10cents

Copy link
Copy Markdown
Contributor

The purpose of this PR is refactoring read_dictionary to only need one kind of Schema, which lets us then remove the find_dictionary_field function and the ipc_schema field on StreamReader by adding a way to look up schema fields that use a particular dictionary by ID.

I'm also resubmitting a change to the dict_id/dict_is_ordered methods on Field; I had submitted this to @nevi-me to become part of #8200 but it looks like it got lost in a rebase or something? I think it's more correct to only return values if the fields have a dictionary as their datatype.

I had submitted this before but I think it got lost in a rebase
somewhere. I think this is more correct and informative.
This simplifies the code in `read_dictionary` and `StreamReader`;
the `ipc_schema` gets parsed and converted into a `Schema` that
`StreamReader` also holds onto, so use the `Schema` to find which fields
use dictionaries rather than keeping both around.
@github-actions

Copy link
Copy Markdown

@nevi-menevi-me left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

}
DataType::Dictionary(key_type, value_type) => {
let dict_id = field.dict_id();
let dict_id = field.dict_id().ok_or_else(|| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I apologise, I do remember this change, but I'm not sure of what happened; I presume while I was rebasing.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

No worries! I remember I sent you a rebased PR to your branch that was... complicated... so I'm not surprised :) Thanks for the merge!

@carols10cents
carols10cents deleted the simplify-dictionary-field-lookup branch December 3, 2020 14:16
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@carols10cents@nevi-me