apache / apache/arrow

[C++] RandomArrayGenerator does not properly generate ListArrays with Nulls

Open
#33,164 1 comment 0 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 18h
Merged PRs (30d)
91

Description

There are multiple problems with the `OffsetsFromLengthsArray` method:
- There is an assumption that the first and last length value in the input are never null. This is not true at all for the usage of this method in GENERATE_LIST_CASE, where the input is completely randomly generated, respecting null_probability:
- The SetBit call for non-null items is off-by-one. The index variable represents the index of the next offset, which is based of the current elements length. But the validity bit should still be set for the current element
-  I don't see what effect the `force_empty_nulls` argument should have. I think the desired effect that Null items also have a zero length is always given, based on how the method is implemented. Please correct me if I'm wrong.

**Reporter**: [Tobias Zagorni](https://issues.apache.org/jira/browse/ARROW-17956) / @zagto
#### PRs and other links:
- [GitHub Pull Request #14338](https://github.com/apache/arrow/pull/14338)

**Note**: *This issue was originally created as [ARROW-17956](https://issues.apache.org/jira/browse/ARROW-17956). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Read cpp/src/arrow/testing/random.cc at OffsetsFromLengthsArray and its use in GENERATE_LIST_CASE. Trace how randomly generated lengths, null validity bits, offsets, and force_empty_nulls are handled; done means list arrays with nulls have correct validity and offsets for the reported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.