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

ListArray equals should not consider nested values if element is marked as null #626

Closed
jhorstmann opened this issue Jul 28, 2021 · 0 comments · Fixed by #1589
Closed

ListArray equals should not consider nested values if element is marked as null #626

jhorstmann opened this issue Jul 28, 2021 · 0 comments · Fixed by #1589
Assignees
Labels

Comments

@jhorstmann
Copy link
Contributor

Describe the bug

I would expect the following test case to pass. In both arrays the second element is marked as null and so they should compare equal.

#[test]
fn test_list_array_equal() {
    let mut builder = ListBuilder::new(Int64Builder::new(10));
    builder.values().append_value(1).unwrap();
    builder.values().append_value(2).unwrap();
    builder.values().append_value(3).unwrap();
    builder.append(true).unwrap();
    builder.append(false).unwrap();
    let array1 = builder.finish();

    let mut builder = ListBuilder::new(Int64Builder::new(10));
    builder.values().append_value(1).unwrap();
    builder.values().append_value(2).unwrap();
    builder.values().append_value(3).unwrap();
    builder.append(true).unwrap();
    builder.values().append_null().unwrap();
    builder.values().append_null().unwrap();
    builder.append(false).unwrap();
    let array2 = builder.finish();

    assert_eq!(array1, array2);
}

The output of the assert_eq also shows both sides the same:

assertion failed: `(left == right)`
  left: `ListArray
[
  PrimitiveArray<Int64>
[
  1,
  2,
  3,
],
  null,
]`,
 right: `ListArray
[
  PrimitiveArray<Int64>
[
  1,
  2,
  3,
],
  null,
]`
@jhorstmann jhorstmann added the bug label Jul 28, 2021
tustvold added a commit to tustvold/arrow-rs that referenced this issue Apr 19, 2022
@tustvold tustvold self-assigned this Apr 19, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants