-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[Data] Avoid unnecessary conversion to Numpy when creating Arrow/Pandas blocks #51238
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raulchen
approved these changes
Mar 11, 2025
lint is failing. please fix |
181c205
to
705f8a1
Compare
Signed-off-by: Alexey Kudinkin <[email protected]>
Signed-off-by: Alexey Kudinkin <[email protected]>
Signed-off-by: Alexey Kudinkin <[email protected]>
ccc4b47
to
f92c9fb
Compare
qinyiyan
pushed a commit
to qinyiyan/ray
that referenced
this pull request
Mar 13, 2025
…as blocks (ray-project#51238) Context --- This change skips unnecessary blanket conversion to Numpy (applied to every chunk of data) before converting to Pyarrow. That creates challenges when batches contain Arrow native `Scalars` which because of that are ultimately being serialized as `ArrowPythonObjectType` extension. Changes --- We revisit following conversion aspects and convert to Numpy passed in column values only in following cases: - Column name is `TENSOR_COLUMN_NAME` (for compatibility) - Provided column values are already represented by a tensor (either numpy, torch, etc) - Provided column values is a list of ndarrays (we do this for compatibility with previously existing behavior where all column values were blindly converted to Numpy leading to list of ndarrays being converted a tensor) --------- Signed-off-by: Alexey Kudinkin <[email protected]>
park12sj
pushed a commit
to park12sj/ray
that referenced
this pull request
Mar 18, 2025
…as blocks (ray-project#51238) Context --- This change skips unnecessary blanket conversion to Numpy (applied to every chunk of data) before converting to Pyarrow. That creates challenges when batches contain Arrow native `Scalars` which because of that are ultimately being serialized as `ArrowPythonObjectType` extension. Changes --- We revisit following conversion aspects and convert to Numpy passed in column values only in following cases: - Column name is `TENSOR_COLUMN_NAME` (for compatibility) - Provided column values are already represented by a tensor (either numpy, torch, etc) - Provided column values is a list of ndarrays (we do this for compatibility with previously existing behavior where all column values were blindly converted to Numpy leading to list of ndarrays being converted a tensor) --------- Signed-off-by: Alexey Kudinkin <[email protected]>
dhakshin32
pushed a commit
to dhakshin32/ray
that referenced
this pull request
Mar 27, 2025
…as blocks (ray-project#51238) Context --- This change skips unnecessary blanket conversion to Numpy (applied to every chunk of data) before converting to Pyarrow. That creates challenges when batches contain Arrow native `Scalars` which because of that are ultimately being serialized as `ArrowPythonObjectType` extension. Changes --- We revisit following conversion aspects and convert to Numpy passed in column values only in following cases: - Column name is `TENSOR_COLUMN_NAME` (for compatibility) - Provided column values are already represented by a tensor (either numpy, torch, etc) - Provided column values is a list of ndarrays (we do this for compatibility with previously existing behavior where all column values were blindly converted to Numpy leading to list of ndarrays being converted a tensor) --------- Signed-off-by: Alexey Kudinkin <[email protected]> Signed-off-by: Dhakshin Suriakannu <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
Context
This change skips unnecessary blanket conversion to Numpy (applied to every chunk of data) before converting to Pyarrow.
That creates challenges when batches contain Arrow native
Scalars
which because of that are ultimately being serialized asArrowPythonObjectType
extension.Changes
We revisit following conversion aspects and convert to Numpy passed in column values only in following cases:
TENSOR_COLUMN_NAME
(for compatibility)Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.