Skip to content

Use ListArray nullability instead of offsets for array_element, array_any_value.#21672

Merged
gabotechs merged 1 commit intoapache:mainfrom
tabac:array-element-null-handling
Apr 16, 2026
Merged

Use ListArray nullability instead of offsets for array_element, array_any_value.#21672
gabotechs merged 1 commit intoapache:mainfrom
tabac:array-element-null-handling

Conversation

@tabac
Copy link
Copy Markdown
Contributor

@tabac tabac commented Apr 16, 2026

Which issue does this PR close?

Rationale for this change

Align the implementation of array_element, array_any_value with Arrow's spec concerning Null rows. Specifically allow the below from Arrow's spec

It should be noted that a null value may have a positive slot length. That is, a null value may occupy a non-empty memory space in the data buffer. When this is true, the content of the corresponding memory space is undefined.

Are these changes tested?

Unit tests included.

In array_element, array_any_value use the ListArray's
nullability to detect null rows instead of relying on the
offsets.
@github-actions github-actions bot added the functions Changes to functions implementation label Apr 16, 2026
Copy link
Copy Markdown
Contributor

@gabotechs gabotechs left a comment

Choose a reason for hiding this comment

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

Thanks @tabac from the PR, and @Jefffrey for the review!

@gabotechs gabotechs added this pull request to the merge queue Apr 16, 2026
Merged via the queue into apache:main with commit 4c7bb08 Apr 16, 2026
31 checks passed
tabac added a commit to DataDog/datafusion that referenced this pull request Apr 16, 2026
…ray_any_value`. (apache#21672)

## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #. apache#21671

## Rationale for this change

Align the implementation of `array_element`, `array_any_value` with
Arrow's spec concerning Null rows. Specifically allow the below from
[Arrow's
spec](https://arrow.apache.org/docs/format/Columnar.html#variable-size-binary-layout)

> It should be noted that a null value may have a positive slot length.
That is, a null value may occupy a non-empty memory space in the data
buffer. When this is true, the content of the corresponding memory space
is undefined.

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

## Are these changes tested?

Unit tests included.
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

(cherry picked from commit 4c7bb08)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants