-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix IPC roundtripping dicts nested in ListViews #9126
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
Conversation
alamb
left a comment
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.
Thank you @brancz
| | DataType::FixedSizeList(field, _) | ||
| | DataType::Map(field, _) => field.fields(), | ||
| DataType::Dictionary(_, value_field) => Field::_fields(value_field.as_ref()), | ||
| DataType::RunEndEncoded(_, field) => field.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.
I wonder if we should (as a separate PR) add DataType::Union and DataType::Map too 🤔
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.
having a look!
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.
looks like it works fine, but doesn't hurt to have some extra tests to ensure it doesn't break: #9146
| assert_eq!(in_batch, out_batch); | ||
| } | ||
|
|
||
| fn test_roundtrip_list_view_of_dict_impl<OffsetSize: OffsetSizeTrait, U: ArrowNativeType>( |
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 verified these tests fail without the provided code fix
failures:
---- writer::tests::test_roundtrip_large_list_view_of_dict stdout ----
thread 'writer::tests::test_roundtrip_large_list_view_of_dict' (26537286) panicked at arrow-ipc/src/writer.rs:2145:32:
called `Result::unwrap()` on an `Err` value: ParseError("Cannot find a dictionary batch with dict id: 0")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- writer::tests::test_roundtrip_list_view_of_dict stdout ----
thread 'writer::tests::test_roundtrip_list_view_of_dict' (26537289) panicked at arrow-ipc/src/writer.rs:2145:32:
called `Result::unwrap()` on an `Err` value: ParseError("Cannot find a dictionary batch with dict id: 0")
---- writer::tests::test_roundtrip_sliced_list_view_of_dict stdout ----
thread 'writer::tests::test_roundtrip_sliced_list_view_of_dict' (26537290) panicked at arrow-ipc/src/writer.rs:2145:32:
called `Result::unwrap()` on an `Err` value: ParseError("Cannot find a dictionary batch with dict id: 0")
failures:
writer::tests::test_roundtrip_large_list_view_of_dict
writer::tests::test_roundtrip_list_view_of_dict
writer::tests::test_roundtrip_sliced_list_view_of_dict
test result: FAILED. 92 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.73s
# Which issue does this PR close? No known issue, but this confirms that nested dicts do indeed work in Map and Union arrays. It was brought up here: #9126 (comment) # Rationale for this change Ensure that IPC roundtripping nested dicts works in Map and Union arrays. # What changes are included in this PR? Unit tests testing the functionality. # Are these changes tested? The whole PR consists of tests only. # Are there any user-facing changes? No @alamb @Jefffrey
# Which issue does this PR close? Closes apache#9125 # Rationale for this change Fixes correct handling of dict building for IPC when ListView is used. # What changes are included in this PR? Creating schemas correctly and reading dict IDs correctly when ListView occurs in IPC. # Are these changes tested? Yes, see new unit tests. # Are there any user-facing changes? No, just a bug fix. @alamb
…e#9146) # Which issue does this PR close? No known issue, but this confirms that nested dicts do indeed work in Map and Union arrays. It was brought up here: apache#9126 (comment) # Rationale for this change Ensure that IPC roundtripping nested dicts works in Map and Union arrays. # What changes are included in this PR? Unit tests testing the functionality. # Are these changes tested? The whole PR consists of tests only. # Are there any user-facing changes? No @alamb @Jefffrey
Which issue does this PR close?
Closes #9125
Rationale for this change
Fixes correct handling of dict building for IPC when ListView is used.
What changes are included in this PR?
Creating schemas correctly and reading dict IDs correctly when ListView occurs in IPC.
Are these changes tested?
Yes, see new unit tests.
Are there any user-facing changes?
No, just a bug fix.
@alamb