8000 [Data] Fixing PyArrow overflow handling by alexeykudinkin · Pull Request #53971 · ray-project/ray · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Data] Fixing PyArrow overflow handling #53971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 26, 2025
Merged

Conversation

alexeykudinkin
Copy link
Contributor
@alexeykudinkin alexeykudinkin commented Jun 20, 2025

Why are these changes needed?

Current int32 offsets overflow handling is missing appropriate handling of the fixed-width types (any types not involving arbitrary length types like strings, lists, binary, etc).

As a result this has been incorrectly enforcing the 2Gb limit on blocks that actually don't have that limit. This PR addresses that.

Changes

  1. Make sure overflow handling only applied to variable-width types
  2. Fixed chunking method to prevent adding empty chunks
  3. Updated tests

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@alexeykudinkin alexeykudinkin requested a review from a team as a code owner June 20, 2025 08:01
@alexeykudinkin alexeykudinkin added the go add ONLY when ready to merge, run all tests label Jun 23, 2025
# Remaining 2 go into the second one
assert result.chunks[1].nbytes == sum([c.nbytes for c in input_.chunks[14:]])

@pytest.mark.parametrize(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice coverage

@@ -361,8 +362,9 @@ def test_combine_chunked_array_small(
expected_output.equals(result)


def test_combine_chunked_array_large():
"""Verifies `combine_chunked_array` on arrays > 2 GiB"""
def test_combine_chunked_fixed_width_array_large():
Copy link
Contributor

Choose a reason for hiding this comment

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

Will go good to add coverage for all _VARIABLE_WIDTH_INT32_OFFSET_PA_TYPE_PREDICATES

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does below (this is for fixed-width types)

Copy link
Contributor
@raulchen raulchen left a comment

Choose a reason for hiding this comment

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

Can you add PR description?
Is the new behavior always produce one single chunk instead of multiple 2GB chunks?

@alexeykudinkin alexeykudinkin changed the title [Data] Fixing PA overflow handling [Data] Fixing PyArrow overflow handling Jun 26, 2025
…32 offsets overflows (irrelevant for fixed-width arrays)

Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
@alexeykudinkin alexeykudinkin linked an issue Jun 26, 2025 that may be closed by this pull request
@alexeykudinkin
Copy link
Contributor Author

Is the new behavior always produce one single chunk instead of multiple 2GB chunks?

Updated description, that should hopefully answer that question, LMK

Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
@alexeykudinkin alexeykudinkin enabled auto-merge (squash) June 26, 2025 22:30
@alexeykudinkin alexeykudinkin merged commit 021cc47 into master Jun 26, 2025
6 checks passed
@alexeykudinkin alexeykudinkin deleted the ak/pa-cmbn-ovflw-fix branch June 26, 2025 22:58
minerharry pushed a commit to minerharry/ray that referenced this pull request Jun 27, 2025
<!-- Thank you for your contribution! Please review
https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before
opening a pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

Current int32 offsets overflow handling is missing appropriate handling
of the fixed-width types (any types not involving arbitrary length types
like strings, lists, binary, etc).

As a result this has been incorrectly enforcing the 2Gb limit on blocks
that actually don't have that limit. This PR addresses that.

Changes

1. Make sure overflow handling only applied to variable-width types
2. Fixed chunking method to prevent adding empty chunks
3. Updated tests

## Related issue number

<!-- For example: "Closes ray-project#1234" -->

## Checks

- [ ] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [ ] I've run `scripts/format.sh` to lint the changes in this PR.
- [ ] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [ ] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [ ] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

---------

Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Handling Large Pyarrow Chunk
3 participants
0