-
Notifications
You must be signed in to change notification settings - Fork 4.1k
GH-49689: [R][C++] Parquets do not support list-columns of ordered factors (ordered dictionaries) #49937
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
thisisnic
wants to merge
5
commits into
apache:main
Choose a base branch
from
thisisnic:GH-49689-ordered
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
GH-49689: [R][C++] Parquets do not support list-columns of ordered factors (ordered dictionaries) #49937
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d18517b
Add tests for ordered dictionaries
thisisnic 3d48f84
Fix failing tests to fail properly
thisisnic 97135f5
Plumb in changes needed for ordered dictionaries
thisisnic 0a21ada
Fix dangling reference
thisisnic bcc614b
fix tests
thisisnic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,17 +168,24 @@ struct DictionaryBuilderCase { | |
| template <typename ValueType> | ||
| Status CreateFor() { | ||
| using AdaptiveBuilderType = DictionaryBuilder<ValueType>; | ||
| using ExactBuilderType = | ||
| internal::DictionaryBuilderBase<TypeErasedIntBuilder, ValueType>; | ||
| if (dictionary != nullptr) { | ||
| out->reset(new AdaptiveBuilderType(dictionary, pool)); | ||
| auto builder = new AdaptiveBuilderType(dictionary, pool); | ||
| builder->set_ordered(ordered); | ||
| out->reset(builder); | ||
| } else if (exact_index_type) { | ||
| if (!is_integer(index_type->id())) { | ||
| return Status::TypeError("MakeBuilder: invalid index type ", *index_type); | ||
| } | ||
| out->reset(new internal::DictionaryBuilderBase<TypeErasedIntBuilder, ValueType>( | ||
| index_type, value_type, pool)); | ||
| auto builder = new ExactBuilderType(index_type, value_type, pool); | ||
| builder->set_ordered(ordered); | ||
| out->reset(builder); | ||
| } else { | ||
| auto start_int_size = index_type->byte_width(); | ||
| out->reset(new AdaptiveBuilderType(start_int_size, value_type, pool)); | ||
| auto builder = new AdaptiveBuilderType(start_int_size, value_type, pool); | ||
| builder->set_ordered(ordered); | ||
| out->reset(builder); | ||
| } | ||
| return Status::OK(); | ||
| } | ||
|
|
@@ -188,8 +195,9 @@ struct DictionaryBuilderCase { | |
| MemoryPool* pool; | ||
| const std::shared_ptr<DataType>& index_type; | ||
| const std::shared_ptr<DataType>& value_type; | ||
| const std::shared_ptr<Array>& dictionary; | ||
| std::shared_ptr<Array> dictionary; | ||
|
Member
Author
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. This was updated as without it, we ended up with a dangling reference when |
||
| bool exact_index_type; | ||
| bool ordered; | ||
| std::unique_ptr<ArrayBuilder>* out; | ||
| }; | ||
|
|
||
|
|
@@ -206,6 +214,7 @@ struct MakeBuilderImpl { | |
| dict_type.value_type(), | ||
| /*dictionary=*/nullptr, | ||
| exact_index_type, | ||
| dict_type.ordered(), | ||
| &out}; | ||
| return visitor.Make(); | ||
| } | ||
|
|
@@ -332,9 +341,13 @@ Status MakeDictionaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& | |
| const std::shared_ptr<Array>& dictionary, | ||
| std::unique_ptr<ArrayBuilder>* out) { | ||
| const auto& dict_type = static_cast<const DictionaryType&>(*type); | ||
| DictionaryBuilderCase visitor = { | ||
| pool, dict_type.index_type(), dict_type.value_type(), | ||
| dictionary, /*exact_index_type=*/false, out}; | ||
| DictionaryBuilderCase visitor = {pool, | ||
| dict_type.index_type(), | ||
| dict_type.value_type(), | ||
| dictionary, | ||
| /*exact_index_type=*/false, | ||
| dict_type.ordered(), | ||
| out}; | ||
| return visitor.Make(); | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is all AI-generated. I roughly understood what it does but am not confident in it, other than having checked it looks relatively idiomatic, and all of these tests except
UnorderedTypeStaysUnorderedfailed before the PR and passed after.