Skip to content

[Data] Fixed BlockMetadata derivation for Read operator#53908

Merged
alexeykudinkin merged 20 commits intomasterfrom
ak/pq-rd-mtd-fix
Jun 19, 2025
Merged

[Data] Fixed BlockMetadata derivation for Read operator#53908
alexeykudinkin merged 20 commits intomasterfrom
ak/pq-rd-mtd-fix

Conversation

@alexeykudinkin
Copy link
Copy Markdown
Contributor

Why are these changes needed?

Currently, Planner incorrectly shapes the BlockMetadata for ref-bundles submitted to Read operator, carrying only the file-paths, while their corresponding metadata is actually being set as if these bundles were carrying actual data.

That in turn inflates Object Store utilization for the Read operator, subsequently triggering back-pressure being applied to it incorrectly.

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 :(

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>
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 requested a review from a team as a code owner June 18, 2025 05:46
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
@alexeykudinkin alexeykudinkin added the go add ONLY when ready to merge, run all tests label Jun 18, 2025
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>

class TestMetadataProvider(ParquetMetadataProvider):
expected_num_rows = len(df1) + len(df2)
expected_byte_size = 787500
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where does 787500 come from? Seems kind of non-obvious at a first glance

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Total dataset byte size

# - Passed to ReadParquet hold metadata matching actual bundle
# - Produced by ReadParquet reflects actual amount of bytes read
assert read_stats.base_name == "ReadParquet"
assert read_stats.extra_metrics["average_bytes_inputs_per_task"] < 5_000
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where does 5000 come from? Could you name this constant or add a comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's the task size

)
def test_parquet_read_meta_provider(ray_start_regular_shared, fs, data_path):
df1 = pd.DataFrame({"one": [1, 2, 3], "two": ["a", "b", "c"]})
df1 = pd.DataFrame({"one": range(30_000), "two": ["a", "b", "c"] * 10_000})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the motivation for increasing the size the input data here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Otherwise the size of 2 files is much larger than the size of the task (asserted below in avg inputs size to read op)

data_path,
filesystem=fs,
meta_provider=TestMetadataProvider(),
meta_provider=AssertingMetadataProvider(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

FYI -- meta provider has been deprecated for many months and is slated for removal this month

@alexeykudinkin alexeykudinkin enabled auto-merge (squash) June 18, 2025 18:33
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>
@github-actions github-actions bot disabled auto-merge June 19, 2025 00:23
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
Signed-off-by: Alexey Kudinkin <ak@anyscale.com>
@alexeykudinkin alexeykudinkin enabled auto-merge (squash) June 19, 2025 06:18
@alexeykudinkin alexeykudinkin merged commit 07bb1a8 into master Jun 19, 2025
6 checks passed
@alexeykudinkin alexeykudinkin deleted the ak/pq-rd-mtd-fix branch June 19, 2025 07:35
minerharry pushed a commit to minerharry/ray that referenced this pull request Jun 27, 2025
…ect#53908)

<!-- 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?

Currently, Planner incorrectly shapes the `BlockMetadata` for
ref-bundles submitted to `Read` operator, carrying only the file-paths,
while their corresponding metadata is actually being set as if these
bundles were carrying actual data.

That in turn inflates Object Store utilization for the Read operator,
subsequently triggering back-pressure being applied to it incorrectly.

## 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>
elliot-barn pushed a commit that referenced this pull request Jul 2, 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?

Currently, Planner incorrectly shapes the `BlockMetadata` for
ref-bundles submitted to `Read` operator, carrying only the file-paths,
while their corresponding metadata is actually being set as if these
bundles were carrying actual data.

That in turn inflates Object Store utilization for the Read operator,
subsequently triggering back-pressure being applied to it incorrectly.

## Related issue number

<!-- For example: "Closes #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>
Signed-off-by: elliot-barn <elliot.barnwell@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.

2 participants