Skip to content

Conversation

@alexeykudinkin
Copy link
Contributor

@alexeykudinkin alexeykudinkin commented Nov 2, 2024

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 ArrowBlockBuilder is now able to handle arbitrary Python object we can just deprecate DelegatingBlockBuilder altogether.

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 changed the title [Data] Fixing DelegatingBlockBuilder to avoid re-serializing objects multiple times [WIP][Data] Fixing DelegatingBlockBuilder to avoid re-serializing objects multiple times Nov 2, 2024
@alexeykudinkin alexeykudinkin added the go add ONLY when ready to merge, run all tests label Nov 4, 2024
@alexeykudinkin alexeykudinkin changed the title [WIP][Data] Fixing DelegatingBlockBuilder to avoid re-serializing objects multiple times [Data] Fixing DelegatingBlockBuilder to avoid re-serializing objects multiple times 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()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These fallbacks are no longer necessary since Arrow now support ArrowPythonObjectType allowing to fallback to serializing rows as native Python objects (using pickle)

@bveeramani bveeramani merged commit 8ef918a into ray-project:master Nov 13, 2024
2 checks passed
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 <[email protected]>
mohitjain2504 pushed a commit to mohitjain2504/ray that referenced this pull request Nov 15, 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 <[email protected]>
Signed-off-by: mohitjain2504 <[email protected]>
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.

2 participants