[Data] Fixing DelegatingBlockBuilder to avoid re-serializing objects multiple times#48509
Merged
bveeramani merged 2 commits intoray-project:masterfrom Nov 13, 2024
Merged
Conversation
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
DelegatingBlockBuilder to avoid re-serializing objects multiple timesDelegatingBlockBuilder to avoid re-serializing objects multiple times
DelegatingBlockBuilder to avoid re-serializing objects multiple timesDelegatingBlockBuilder to avoid re-serializing objects multiple times
alexeykudinkin
commented
Nov 12, 2024
Comment on lines
-26
to
-36
| import pyarrow | ||
|
|
||
| if self._builder is None: | ||
| try: | ||
| check = ArrowBlockBuilder() | ||
| check.add(item) | ||
| check.build() | ||
| self._builder = ArrowBlockBuilder() | ||
| except (TypeError, pyarrow.lib.ArrowInvalid, ArrowConversionError): | ||
| # Can also handle nested Python objects, which Arrow cannot. | ||
| self._builder = PandasBlockBuilder() |
Contributor
Author
There was a problem hiding this comment.
These fallbacks are no longer necessary since Arrow now support ArrowPythonObjectType allowing to fallback to serializing rows as native Python objects (using pickle)
bveeramani
approved these changes
Nov 12, 2024
JP-sDEV
pushed a commit
to JP-sDEV/ray
that referenced
this pull request
Nov 14, 2024
…s multiple times (ray-project#48509) Currently, we're serializing first row in every block twice when adding it t/h `DelegatingBlockBuilder`, carrying tangible overhead and impact on latency for large enough rows. Provided that `ArrowBlockBuilder` is now able to handle arbitrary Python object we can just deprecate `DelegatingBlockBuilder` altogether. --------- Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
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
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?
Currently, we're serializing first row in every block twice when adding it t/h
DelegatingBlockBuilder, carrying tangible overhead and impact on latency for large enough rows.Provided that
ArrowBlockBuilderis now able to handle arbitrary Python object we can just deprecateDelegatingBlockBuilderaltogether.Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.