You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2026/09/20 08:15:14 UTC
[PR] [python] Improve parallel native read scheduling [paimon]
JingsongLi opened a new pull request, #10003:
URL: https://github.com/apache/paimon/pull/10003
## Summary
- close every native reader before waiting for parallel workers, so early batch-reader close interrupts workers blocked in their first read
- cap unfiltered LIMIT fan-out to avoid eagerly constructing readers that cannot contribute result rows, while retaining full parallelism for filtered limits
- balance contiguous native split groups by physical file bytes instead of split count, preserving input order while reducing tail skew
- update native-read documentation and add deterministic concurrency, LIMIT, and grouping regressions
## Dependency
Depends on apache/paimon-rust#885 for the cancellable and idempotent RecordBatchReader.close API. The Rust Python binding has not been released, so this intentionally targets current paimon-rust main rather than adding compatibility logic for older builds.
## Performance
A local native-read benchmark used four valid Paimon splits of about 39.5 MiB, 39.5 MiB, 1.58 MiB, and 1.58 MiB with parallelism 2.
- count grouping: 79.0 MiB vs 3.2 MiB; median 10.83 ms
- byte grouping: 39.5 MiB vs 42.7 MiB; median 7.55 ms
The byte-balanced path was about 30 percent faster in this cached local decode benchmark.
## Tests
- native read, native integration, Data Evolution, formats, row rolling, reader parallelism, and deferred BLOB suites: 177 passed, 15 subtests passed
- paimon-rust binding test_read.py against the rebuilt extension: 82 passed
- focused Rust pending-read cancellation test and clippy with warnings denied
- flake8 on the changed Python files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [python] Improve parallel native read scheduling [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #10003:
URL: https://github.com/apache/paimon/pull/10003
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [python] Improve parallel native read scheduling [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #10003:
URL: https://github.com/apache/paimon/pull/10003#discussion_r4056533969
##########
paimon-python/pypaimon/read/table_read.py:
##########
@@ -219,7 +219,7 @@ def to_arrow_batch_reader(
table reads do not guarantee row order. Python fallback reads remain
serial.
"""
- effective = self._resolve_parallelism(parallelism, len(splits))
+ effective = self._effective_parallelism(parallelism, len(splits))
Review Comment:
Fixed in 66ce56469b. The actual native fan-out still uses the LIMIT-capped effective parallelism, while the public and managed wrappers now use the uncapped resolved parallelism solely to retain iterator cleanup ownership. Added a regression with two splits, parallelism 2, limit 1, one read_next_batch call, and public close; it verifies that the sole native reader is closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [python] Improve parallel native read scheduling [paimon]
Posted by "leaves12138 (via GitHub)" <gi...@apache.org>.
leaves12138 commented on code in PR #10003:
URL: https://github.com/apache/paimon/pull/10003#discussion_r4056522916
##########
paimon-python/pypaimon/read/table_read.py:
##########
@@ -219,7 +219,7 @@ def to_arrow_batch_reader(
table reads do not guarantee row order. Python fallback reads remain
serial.
"""
- effective = self._resolve_parallelism(parallelism, len(splits))
+ effective = self._effective_parallelism(parallelism, len(splits))
Review Comment:
[P2] Preserve explicit iterator cleanup when LIMIT reduces concurrency to one
With two or more native splits, `parallelism=2`, and an unfiltered `limit=1`, the new effective parallelism becomes 1. Consequently, the check below skips `_ClosableArrowBatchReader` and returns the raw `RecordBatchReader.from_batches(...)` reader. On PyArrow 19.0.1, calling `read_next_batch()` once and then `close()` does not close the suspended `_convert_native_batches` generator, so its `finally` never calls the underlying native reader's `close()`. This retains the native stream until later exhaustion/garbage collection instead of releasing it at explicit close.
I reproduced this through `to_arrow_batch_reader` with close-tracking native readers: the base revision closes both readers after that sequence, whereas this head leaves its sole native reader open. `read_all()` hides the regression by exhausting the iterator.
Could we preserve the explicit iterator-close chain independently of the effective worker count (including the newly capped single-reader path), and add a regression covering `limit=1`, one `read_next_batch()`, then public `close()`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org