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

[Safety] Filtering Dense UnionArray Produces Invalid Offsets #1596

Closed
tustvold opened this issue Apr 20, 2022 · 0 comments · Fixed by #1589
Closed

[Safety] Filtering Dense UnionArray Produces Invalid Offsets #1596

tustvold opened this issue Apr 20, 2022 · 0 comments · Fixed by #1589
Labels
bug question Further information is requested

Comments

@tustvold
Copy link
Contributor

Describe the bug

build_extend_dense blindly copies offsets from the source array across, which can lead to invalid offsets in the filtered array

To Reproduce

let mut builder = UnionBuilder::new_dense(4);
builder.append::<Int32Type>("A", 1).unwrap();
builder.append::<Float64Type>("B", 3.2).unwrap();
builder.append::<Float64Type>("B", 3.2).unwrap();
let array = builder.build().unwrap();

let filter_array = BooleanArray::from(vec![true, false, true]);
let c = filter(&array, &filter_array).unwrap();
let filtered = c.as_any().downcast_ref::<UnionArray>().unwrap();

filtered.value(1);

Panics with

thread 'compute::kernels::filter::tests::test_filter_union_array_dense_with_nulls' panicked at 'assertion failed: (offset + length) <= self.len()', arrow/src/array/data.rs:486:9
****

Expected behavior

This should not panic

@tustvold tustvold added question Further information is requested bug labels Apr 20, 2022
@tustvold tustvold changed the title Filtering Dense UnionArray Produces Invalid Offsets [Safety] Filtering Dense UnionArray Produces Invalid Offsets Apr 20, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Apr 20, 2022
Various UnionArray fixes (apache#1598) (apache#1596) (apache#1591) (apache#1590)

Fix handling of null masks in ArrayData equality (apache#1599)
alamb pushed a commit that referenced this issue Apr 28, 2022
* Fix ListArray and StructArray equality (#626)

* Simplify null masking in equality comparisons

Various UnionArray fixes (#1598) (#1596) (#1591) (#1590)

Fix handling of null masks in ArrayData equality (#1599)

* Miscellaneous fixes

* Fix structure null equality

* Review feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant