Skip to content

[arrow-array] rename size parameters to value_length#55

Draft
alamb wants to merge 7 commits intoalamb/fsb_overflow_try3from
alamb/fsb_overflow_try3_names
Draft

[arrow-array] rename size parameters to value_length#55
alamb wants to merge 7 commits intoalamb/fsb_overflow_try3from
alamb/fsb_overflow_try3_names

Conversation

@alamb
Copy link
Copy Markdown
Owner

@alamb alamb commented May 1, 2026

Summary

This PR is stacked on apache#9872.

It updates FixedSizeBinaryArray constructor and local variable names from size to value_length / value_size where that improves readability, without changing behavior.

Why

The overflow fix in apache#9872 is easier to review when the naming-only cleanup is split out. This PR carries only the terminology changes so the lower PR can stay focused on the bounds and overflow checks.

Validation

  • cargo test -p arrow-array validate_lengths
  • cargo test -p arrow-array test_constructors
  • cargo +stable fmt --all --check

@github-actions github-actions Bot added the arrow label May 1, 2026
alamb and others added 7 commits May 1, 2026 17:24
# Which issue does this PR close?
- related to
https://github.com/apache/arrow-rs/pull/9850/changes#r3170266352

# Rationale for this change

While working on apache#9850 I felt it
would help to have some better docs about what a FixedSizeBinaryArray
actually was, so I made some

# What changes are included in this PR?

Add some more background / explanatory docs about this array

# Are these changes tested?

By CI
# Are there any user-facing changes?

Docs only
…iles using non-standard block sizes (apache#9794)

# Which issue does this PR close?

- Closes apache#9793.

# Rationale for this change
`DeltaBitPackDecoder::skip` uses some magic numbers when sizing the
buffer used for skipping. Files that use non-standard miniblock sizes
will cause `skip` to panic.

# What changes are included in this PR?

Check for non-standard miniblock sizes and return an error rather than a
panic.

Note: allocating a vec sized with `values_per_mini_block` resulted in a
significant performance regression.

# Are these changes tested?

Yes, test with file with non-standard sizes is added to the arrow_reader
tests.

# Are there any user-facing changes?

No.
…tests for nested types (apache#9853)

# 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.
-->

- Closes #NNN.

# Rationale for this change

<!--
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.
-->

In apache#9600 we added capability to
call `finish_preserve_values` on any array builder, and it will
propagate the choice to preserve dictionary values down into the nested
builders. I thought it would be good to extend the integration tests we
have in
https://github.com/apache/arrow-rs/blob/main/arrow-ipc/tests/test_delta_dictionary.rs
to cover the use cases, which was to call the method on builders with
nested child builders (such as `StructBuilder` and `ListBuilder`).

While reviewing the PR for apache#9600 I also noticed a small issue with the
docs related to using the StreamWriter with delta dictionaries, notably
that we set up some options to use delta dictionaries but don't pass the
options into the `StreamWriter` constructor:

https://docs.rs/arrow-ipc/58.1.0/arrow_ipc/writer/struct.StreamWriter.html#example---efficient-delta-dictionaries

# What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

- adds cases to the integration tests for delta dictionaries covering
`ListBuilder` and `StructBuilder`
- small docs correction for `StreamWriter`

# Are these changes tested?

<!--
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)?
-->

it is simply docs & tests

# Are there any user-facing changes?

No

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
…#9872)

# Which issue does this PR close?

- Closes apache#9850

# Rationale for this change

`FixedSizeBinaryArray::value_offset_at` works use `i32` arithmetic which
can overflow. For offsets beyond `i32::MAX`, that can be bad

# What changes are included in this PR?

1. Prevent any FixedSizedBinaryArrays from being constructed where the
offset calculation could overflow
2. Add some other overflow checks

As @adamreeve [pointed
out](apache#9850 (comment))
on apache#9850 there are several places
where the `i32` arithmetic is problematic in `FixedSizeBinaryArray`. I
will fix them for real in a different, follow on PR, by switching to
entirely `usize` based arithmetic for offset calculations

However, since I hope to backport this PR to older releases, I would
like something that is easy to review and has the least potential for
unintended consequences.

# Are these changes tested?

I added unit tests. However, I can't find any way to fully trigger the
actual paths short of trying to allocate very large arrays, which I
don't think is appropriate for unit tests.

# Are there any user-facing changes?
Better limit checking
…ache#9892)

# Which issue does this PR close?

None

# Rationale for this change

Arrow and Datafusion provide this guidance, it's high time we do as
well.

# What changes are included in this PR?

Add links to the Arrow and ASF AI policies.

# Are these changes tested?

Docs only

# Are there any user-facing changes?

Only to project documentation
In preparation for a specialized interleave kernel.

# 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.
-->

- No issue needed: benchmark addition

# Rationale for this change

<!--
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.
-->
I want to open a subsequent PR adding the specialized REE interleave
kernel.

# What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
Benchmarks

# Are these changes tested?

<!--
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)?
-->
Not necessary

# Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
No

Signed-off-by: Alfonso Subiotto Marques <alfonso.subiotto@polarsignals.com>
@alamb alamb force-pushed the alamb/fsb_overflow_try3_names branch from 12c4e78 to cadf3d1 Compare May 5, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants