Skip to content

[data] DataSourceV2: don't disable pre_buffer in Parquet scanner options - #63466

Merged
bveeramani merged 1 commit into
ray-project:masterfrom
goutamvenkat-anyscale:goutam/parquet_v2_wide_schema_fix
May 19, 2026
Merged

bveeramani merged 1 commit into
ray-project:masterfrom
goutamvenkat-anyscale:goutam/parquet_v2_wide_schema_fix

Conversation

@goutamvenkat-anyscale

@goutamvenkat-anyscale goutamvenkat-anyscale commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

V2's ParquetFileReader._arrow_scanner_kwargs was constructing pds.ParquetFragmentScanOptions(pre_buffer=False, use_buffered_stream=True, buffer_size=8 MiB). With pre_buffer=False, pyarrow opens a per-column buffered stream and issues range requests lazily. On wide-schema Parquet (thousands of small columns) that turns one fragment read into thousands of S3 GETs.

The wide_schema_pipeline_primitives release test regressed from ~16s on V1 to ~154s after V2 became the default reader (#63326). Other release tests on wide schemas (wide_schema_pipeline_{tensors,objects,nested_structs} and write_parquet, which is read-then-write) are affected by the same mechanism.

Evidence

ds.stats() from a regressing run on s3://ray-benchmark-data-internal-us-west-2/wide_schema/primitives (27 files × 22 MB × 5000 columns):

Operator 2 ReadFilesParquetV2: 27 tasks executed, 40 blocks produced in 143.19s
  Remote wall time:  61.73ms min, 141.62s max, 88.67s mean
  Remote cpu time:   62.07ms min, 4.76s max,   2.96s mean
  Peak heap memory:  448.82 MiB min, 612.21 MiB max

96% of per-task wall time is blocked, CPU is negligible — the classic many-small-I/O signature, not memory pressure or per-task setup cost.

Why this only affects V2

  • V1 ParquetDatasource constructs pds.ParquetFragmentScanOptions(use_buffered_stream=True, buffer_size=8 MiB) without setting pre_buffer → pyarrow default True → one coalesced range request per fragment. Fast.
  • Anyscale internal Turbo ParquetReader does the same — pre_buffer left at default. No regression.
  • V2 (this PR fixes) explicitly set pre_buffer=False. On narrow schemas the difference is invisible (few large columns either way). On wide schemas it's catastrophic.

The cross-fragment memory accumulation that originally motivated disabling pre_buffer (apache/arrow#39808) is already addressed by V2's per-fragment scanner construction — so disabling pre_buffer was load-bearing on a problem that no longer needs that fix.

Change

Drop the pre_buffer=False argument. Update the comment to record why we rely on the default. No other behavioral change.

Test plan

  • pre-commit clean on the modified file
  • python/ray/data/_internal/datasource_v2/tests/test_parquet_datasource_v2.py — 11/11 pass
  • python/ray/data/tests/datasource/test_parquet.py — 267 passed / 6 skipped

Release tests: https://buildkite.com/ray-project/release/builds/93384#_

🤖 Generated with Claude Code

@goutamvenkat-anyscale
goutamvenkat-anyscale requested a review from a team as a code owner May 18, 2026 18:58
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@ray-gardener ray-gardener Bot added data Ray Data-related issues release-test release test labels May 18, 2026
V2's ``ParquetFileReader._arrow_scanner_kwargs`` explicitly set
``pds.ParquetFragmentScanOptions(pre_buffer=False, ...)``. With
``pre_buffer=False`` pyarrow opens a per-column buffered stream
and issues range requests lazily. On wide-schema Parquet files
(thousands of small columns), that turns one fragment read into
thousands of S3 GETs — wide_schema_pipeline_primitives regressed
from ~16s to ~154s after V2 became the default reader.

``ds.stats()`` from the regressing run showed the symptom
clearly:

  Operator 2 ReadFilesParquetV2: 27 tasks, 40 blocks in 143.19s
    Remote wall time:  88.67s mean per task
    Remote cpu time:    2.96s mean per task

96% of per-task wall time was blocked, with negligible CPU —
classic many-small-I/O signature. V1 ``ParquetDatasource``
and Anyscale's internal Turbo ``ParquetReader`` both leave
``pre_buffer`` at the pyarrow default (``True``), which plans
one coalesced range request per fragment.

Drop the ``pre_buffer=False`` override. The cross-fragment
memory accumulation that originally motivated disabling it
(apache/arrow#39808) is already addressed by V2's per-fragment
scanners.

Tests: 11/11 V2 parquet pass; 267 passed / 6 skipped on
``tests/datasource/test_parquet.py``.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Goutam <[email protected]>
@goutamvenkat-anyscale
goutamvenkat-anyscale force-pushed the goutam/parquet_v2_wide_schema_fix branch from 097b1e5 to 3b5ccad Compare May 18, 2026 20:57
@goutamvenkat-anyscale goutamvenkat-anyscale changed the title [data] DataSourceV2: fix wide-schema parquet read regression [data] DataSourceV2: don't disable pre_buffer in Parquet scanner options May 18, 2026
@goutamvenkat-anyscale goutamvenkat-anyscale added the go add ONLY when ready to merge, run all tests label May 19, 2026
@bveeramani
bveeramani enabled auto-merge (squash) May 19, 2026 01:46
@bveeramani
bveeramani merged commit e09e2db into ray-project:master May 19, 2026
5 checks passed
@goutamvenkat-anyscale
goutamvenkat-anyscale deleted the goutam/parquet_v2_wide_schema_fix branch May 19, 2026 02:30
TruongQuangPhat pushed a commit to cyhapun/ray-fix-issue that referenced this pull request May 27, 2026
…ons (ray-project#63466)

## Summary
V2's ``ParquetFileReader._arrow_scanner_kwargs`` was constructing
``pds.ParquetFragmentScanOptions(pre_buffer=False,
use_buffered_stream=True, buffer_size=8 MiB)``. With
``pre_buffer=False``, pyarrow opens a per-column buffered stream and
issues range requests lazily. On wide-schema Parquet (thousands of small
columns) that turns one fragment read into thousands of S3 GETs.

The ``wide_schema_pipeline_primitives`` release test regressed from ~16s
on V1 to ~154s after V2 became the default reader (ray-project#63326). Other
release tests on wide schemas
(``wide_schema_pipeline_{tensors,objects,nested_structs}`` and
``write_parquet``, which is read-then-write) are affected by the same
mechanism.

## Evidence
``ds.stats()`` from a regressing run on
``s3://ray-benchmark-data-internal-us-west-2/wide_schema/primitives``
(27 files × 22 MB × 5000 columns):

```
Operator 2 ReadFilesParquetV2: 27 tasks executed, 40 blocks produced in 143.19s
  Remote wall time:  61.73ms min, 141.62s max, 88.67s mean
  Remote cpu time:   62.07ms min, 4.76s max,   2.96s mean
  Peak heap memory:  448.82 MiB min, 612.21 MiB max
```

96% of per-task wall time is blocked, CPU is negligible — the classic
many-small-I/O signature, not memory pressure or per-task setup cost.

## Why this only affects V2
- **V1** ``ParquetDatasource`` constructs
``pds.ParquetFragmentScanOptions(use_buffered_stream=True, buffer_size=8
MiB)`` without setting ``pre_buffer`` → pyarrow default ``True`` → one
coalesced range request per fragment. Fast.
- **Anyscale internal Turbo** ``ParquetReader`` does the same —
``pre_buffer`` left at default. No regression.
- **V2 (this PR fixes)** explicitly set ``pre_buffer=False``. On narrow
schemas the difference is invisible (few large columns either way). On
wide schemas it's catastrophic.

The cross-fragment memory accumulation that originally motivated
disabling ``pre_buffer`` (apache/arrow#39808) is already addressed by
V2's per-fragment scanner construction — so disabling ``pre_buffer`` was
load-bearing on a problem that no longer needs that fix.

## Change
Drop the ``pre_buffer=False`` argument. Update the comment to record why
we rely on the default. No other behavioral change.

## Test plan
- [x] pre-commit clean on the modified file
- [x]
``python/ray/data/_internal/datasource_v2/tests/test_parquet_datasource_v2.py``
— 11/11 pass
- [x] ``python/ray/data/tests/datasource/test_parquet.py`` — 267 passed
/ 6 skipped

Release tests: https://buildkite.com/ray-project/release/builds/93384#_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Goutam <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: phattruong <[email protected]>
alexandrplashchinsky pushed a commit to alexandrplashchinsky/ray-alex that referenced this pull request May 29, 2026
…ons (ray-project#63466)

## Summary
V2's ``ParquetFileReader._arrow_scanner_kwargs`` was constructing
``pds.ParquetFragmentScanOptions(pre_buffer=False,
use_buffered_stream=True, buffer_size=8 MiB)``. With
``pre_buffer=False``, pyarrow opens a per-column buffered stream and
issues range requests lazily. On wide-schema Parquet (thousands of small
columns) that turns one fragment read into thousands of S3 GETs.

The ``wide_schema_pipeline_primitives`` release test regressed from ~16s
on V1 to ~154s after V2 became the default reader (ray-project#63326). Other
release tests on wide schemas
(``wide_schema_pipeline_{tensors,objects,nested_structs}`` and
``write_parquet``, which is read-then-write) are affected by the same
mechanism.

## Evidence
``ds.stats()`` from a regressing run on
``s3://ray-benchmark-data-internal-us-west-2/wide_schema/primitives``
(27 files × 22 MB × 5000 columns):

```
Operator 2 ReadFilesParquetV2: 27 tasks executed, 40 blocks produced in 143.19s
  Remote wall time:  61.73ms min, 141.62s max, 88.67s mean
  Remote cpu time:   62.07ms min, 4.76s max,   2.96s mean
  Peak heap memory:  448.82 MiB min, 612.21 MiB max
```

96% of per-task wall time is blocked, CPU is negligible — the classic
many-small-I/O signature, not memory pressure or per-task setup cost.

## Why this only affects V2
- **V1** ``ParquetDatasource`` constructs
``pds.ParquetFragmentScanOptions(use_buffered_stream=True, buffer_size=8
MiB)`` without setting ``pre_buffer`` → pyarrow default ``True`` → one
coalesced range request per fragment. Fast.
- **Anyscale internal Turbo** ``ParquetReader`` does the same —
``pre_buffer`` left at default. No regression.
- **V2 (this PR fixes)** explicitly set ``pre_buffer=False``. On narrow
schemas the difference is invisible (few large columns either way). On
wide schemas it's catastrophic.

The cross-fragment memory accumulation that originally motivated
disabling ``pre_buffer`` (apache/arrow#39808) is already addressed by
V2's per-fragment scanner construction — so disabling ``pre_buffer`` was
load-bearing on a problem that no longer needs that fix.

## Change
Drop the ``pre_buffer=False`` argument. Update the comment to record why
we rely on the default. No other behavioral change.

## Test plan
- [x] pre-commit clean on the modified file
- [x]
``python/ray/data/_internal/datasource_v2/tests/test_parquet_datasource_v2.py``
— 11/11 pass
- [x] ``python/ray/data/tests/datasource/test_parquet.py`` — 267 passed
/ 6 skipped

Release tests: https://buildkite.com/ray-project/release/builds/93384#_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Goutam <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Alexandr Plashchinsky <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ons (ray-project#63466)

## Summary
V2's ``ParquetFileReader._arrow_scanner_kwargs`` was constructing
``pds.ParquetFragmentScanOptions(pre_buffer=False,
use_buffered_stream=True, buffer_size=8 MiB)``. With
``pre_buffer=False``, pyarrow opens a per-column buffered stream and
issues range requests lazily. On wide-schema Parquet (thousands of small
columns) that turns one fragment read into thousands of S3 GETs.

The ``wide_schema_pipeline_primitives`` release test regressed from ~16s
on V1 to ~154s after V2 became the default reader (ray-project#63326). Other
release tests on wide schemas
(``wide_schema_pipeline_{tensors,objects,nested_structs}`` and
``write_parquet``, which is read-then-write) are affected by the same
mechanism.

## Evidence
``ds.stats()`` from a regressing run on
``s3://ray-benchmark-data-internal-us-west-2/wide_schema/primitives``
(27 files × 22 MB × 5000 columns):

```
Operator 2 ReadFilesParquetV2: 27 tasks executed, 40 blocks produced in 143.19s
  Remote wall time:  61.73ms min, 141.62s max, 88.67s mean
  Remote cpu time:   62.07ms min, 4.76s max,   2.96s mean
  Peak heap memory:  448.82 MiB min, 612.21 MiB max
```

96% of per-task wall time is blocked, CPU is negligible — the classic
many-small-I/O signature, not memory pressure or per-task setup cost.

## Why this only affects V2
- **V1** ``ParquetDatasource`` constructs
``pds.ParquetFragmentScanOptions(use_buffered_stream=True, buffer_size=8
MiB)`` without setting ``pre_buffer`` → pyarrow default ``True`` → one
coalesced range request per fragment. Fast.
- **Anyscale internal Turbo** ``ParquetReader`` does the same —
``pre_buffer`` left at default. No regression.
- **V2 (this PR fixes)** explicitly set ``pre_buffer=False``. On narrow
schemas the difference is invisible (few large columns either way). On
wide schemas it's catastrophic.

The cross-fragment memory accumulation that originally motivated
disabling ``pre_buffer`` (apache/arrow#39808) is already addressed by
V2's per-fragment scanner construction — so disabling ``pre_buffer`` was
load-bearing on a problem that no longer needs that fix.

## Change
Drop the ``pre_buffer=False`` argument. Update the comment to record why
we rely on the default. No other behavioral change.

## Test plan
- [x] pre-commit clean on the modified file
- [x]
``python/ray/data/_internal/datasource_v2/tests/test_parquet_datasource_v2.py``
— 11/11 pass
- [x] ``python/ray/data/tests/datasource/test_parquet.py`` — 267 passed
/ 6 skipped

Release tests: https://buildkite.com/ray-project/release/builds/93384#_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Goutam <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: 400Ping <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants