Skip to content

Conversation

@brancz
Copy link
Contributor

@brancz brancz commented Jan 9, 2026

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

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jan 9, 2026
Copy link
Contributor

@alamb alamb 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 @brancz

| DataType::FixedSizeList(field, _)
| DataType::Map(field, _) => field.fields(),
DataType::Dictionary(_, value_field) => Field::_fields(value_field.as_ref()),
DataType::RunEndEncoded(_, field) => field.fields(),
Copy link
Contributor

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 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

having a look!

Copy link
Contributor Author

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>(
Copy link
Contributor

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

@alamb alamb merged commit 57b64b4 into apache:main Jan 10, 2026
29 of 30 checks passed
@alamb
Copy link
Contributor

alamb commented Jan 10, 2026

Thanks again @brancz and thanks @Jefffrey for the review

alamb pushed a commit that referenced this pull request Jan 13, 2026
# 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
Dandandan pushed a commit to Dandandan/arrow-rs that referenced this pull request Jan 15, 2026
# 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
Dandandan pushed a commit to Dandandan/arrow-rs that referenced this pull request Jan 15, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Roundtripping dicts nested in ListView not working

3 participants