TheR1sing3un commented on PR #7742:
URL: https://github.com/apache/paimon/pull/7742#issuecomment-4345969474

   Update — there was a second divergence from Java's implementation that the 
previous version of this PR didn't address.
   
   Java's `applyPushDownLimit` accumulates `split.partialMergedRowCount()` 
(file row_count **minus** deletion-vector cardinality already recorded in the 
manifest), while Python was using `split.row_count` (the pre-DV upper bound). 
On a DV-aware raw split, the pre-DV accumulator over-counts and the 
early-return fires before the reader can produce `limit` rows — even with the 
"always append" fix from the previous round, a plan like 
`[raw_with_DV(row_count=10, merged=4), non-raw, non-raw]` with `limit=5` would 
still early-return on the raw split and leave the reader with only 4 rows, 
despite the trailing non-raw splits being able to provide more.
   
   `DataSplit.merged_row_count()` already exposes the post-DV value, so the fix 
is one line — accumulate `merged_row_count()` instead of `row_count`, with a 
fallback to `row_count` when the merged count is unavailable (older snapshots / 
certain data-evolution shapes).
   
   Force-pushed 
[a57200ebb](https://github.com/apache/paimon/pull/7742/commits/a57200ebb):
   
   * `_apply_push_down_limit` now uses `merged_row_count() if not None else 
row_count` as the budget accumulator.
   * New unit tests in `ApplyPushDownLimitUnitTest` drive the accumulator 
directly with synthetic splits — pypaimon's writer doesn't promote L0 → L1+, 
and the DV-enabled PK read path skips L0 files, so producing a true DV-aware 
raw split end-to-end isn't really feasible from a pure-Python fixture. The 
synthetic-split tests pin down the accumulator semantics without depending on 
storage layout.
   * Both regression tests 
(`test_limit_drops_non_raw_split_after_raw_budget_is_met` and 
`test_dv_aware_accumulator_uses_merged_row_count`) fail on `origin/master` and 
pass post-fix.
   * PR description rewritten to walk through both divergences and how they 
interact.
   
   PTAL.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to