Mukunth1004 opened a new pull request, #12540:
URL: https://github.com/apache/arrow-rs/pull/12540
# Which issue does this PR close?
- Closes #12537
# Rationale for this change
`decode_fixed_size_list` finds where each element of a valid row ends by
decoding it into a throwaway one-row array (`convert_raw` per element). For a
`FixedSizeList(Float32, 768)` that is 768 array builds per row. For element
types whose row encoding has a fixed width, every element (null or not) is as
long as the encoded null element the function already computes, so the probe
is not needed.
# What changes are included in this PR?
Two commits:
1. `chore(arrow)`: adds `row_format` benchmarks for `FixedSizeList` (f32 x 8
and
f32 x 768, plus utf8 x 8 as a variable-width control). Use this commit as
`baseline.ref`.
2. `perf(arrow-row)`: when the element type is primitive, `Boolean`, `Null`
or
`FixedSizeBinary`, cut each valid row into `value_length` chunks of the
null element's encoded width with `chunks_exact`, and size `child_rows`
up front. Other element types keep the existing loop.
No public API change.
The variable-width path (the issue's second suggestion) is left for a
separate PR.
# Are these changes tested?
Existing `FixedSizeList` tests exercise the new path (Int32, Null, two
adjacent
lists). Added `test_fixed_size_list_of_fixed_width_values`, which round-trips
Boolean, Float32 (incl. NaN and -0.0), Decimal128, FixedSizeBinary and Null
elements with list-level and element-level nulls, under all four sort option
combinations, followed by a second column to check the row is advanced
correctly.
Benchmarks (`cargo bench -p arrow --features test_utils --bench row_format
-- "convert_rows .*fixed_size_list"`,
local Linux machine, shared, so expect some noise):
| benchmark | before | after | change |
|---|---|---|---|
| convert_rows 4096 fixed_size_list(8) of f32(0) | 6.23 ms | 123 µs | -98.0%
|
| convert_rows 1024 fixed_size_list(768) of f32(0) | 153.5 ms | 5.57 ms |
-96.4% |
| convert_rows 4096 fixed_size_list(8) of utf8(10, 0) | 9.21 ms | 9.18 ms |
no change |
No input gets slower: variable-width elements take the unchanged path.
# Are there any significant user-facing changes?
No.
# AI usage disclosure
Claude Code assisted with investigating the issue and developing the
implementation and tests. I reviewed the changes, verified the test results and
benchmarks, and understand the implementation. I'll take responsibility for
addressing review feedback and maintaining this contribution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]