Skip to content

[C++] IsNull produces incorrect results on sliced sparse union arrays #50262

Description

@hadrian-reppas

Describe the bug, including details regarding any error messages, version, and platform.

  ArrayVector children{ArrayFromJSON(int64(), "[1, 2]"),
                       ArrayFromJSON(int8(), "[null, 3]")};
  auto type_ids = ArrayFromJSON(int8(), "[0, 1]");
  auto type = sparse_union({field("a", int64()), field("b", int8())});
  auto array =
      std::make_shared<SparseUnionArray>(type, 2, children, type_ids->data()->buffers[1]);
  auto slice = array->Slice(1);

  ASSERT_FALSE(array->IsNull(0));
  ASSERT_FALSE(array->IsNull(1));
  ASSERT_FALSE(slice->IsNull(0));  // This should succeeded, but it fails

  ASSERT_OK_AND_ASSIGN(auto expected, array->GetScalar(1));
  ASSERT_OK_AND_ASSIGN(auto actual, slice->GetScalar(0));
  AssertScalarsEqual(*expected, *actual);  // This should succeeded, but it fails

Component(s)

C++

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions