wangzhigang1999 opened a new pull request, #11411: URL: https://github.com/apache/paimon/pull/11411
### Purpose Closes #11410 Fix `IndexedSplit` size overestimation in `RayDatasource` and prevent Ray Data from over-splitting small global-index search lookups (`query.to_ray()`) into single-row blocks: - `DataSplit.row_count_before_deletions(files)`: counts on-disk covered rows before deletion vectors (deduplicating overlapping Data Evolution column files), reused by `_data_evolution_merged_row_count()`. - `estimate_split_size(split)` in `ray_datasource.py`: scales `IndexedSplit` bytes by `selected_rows / row_count_before_deletions` for `estimate_inmemory_data_size()`, `_distribute_splits_into_equal_chunks()`, and `BlockMetadata.size_bytes`. - `_read_lookup_splits()` in `search_result.py`: when `override_num_blocks is None`, defaults to `max(min(len(splits), concurrency), ceil(estimated_bytes / target_max_block_size))` (preserving cross-file parallel reads on object storage while avoiding `SplitBlocks` fan-out) and clamps `concurrency = min(concurrency, override_num_blocks)`. Explicit `override_num_blocks` is preserved unchanged. OSS lookup latency on the same snapshots, measured from candidate selection completion through result collection. The baseline was `master` at `88792ed0d1`. The first three scenarios use four timed runs per version in ABBA order. | OSS Scenario | Metric | `master` -> PR | |---|---|---:| | Single file, Top-10 | P50 latency | 385 -> 90 ms (-77%) | | 64 files, skewed (1 file 5,000 rows + 63 files 1 row each) | P50 latency | 1,041 -> 370 ms (-64%) | | 256 files, K=10,000 | P50 latency | 1,366 -> 1,367 ms (flat) | | 16 files, 2 slow splits (+800 ms delay each) | P95 latency (40 runs) | 1,947 -> 1,881 ms (-3.4%) | Note: when `DataContext.target_max_block_size` is explicitly set to `None`, a single split is no longer split by size and is materialized as one block (increasing peak worker RSS for highly compressible large splits). ### Tests - Added unit and Ray lookup tests in `ray_datasource_test.py` and `ray_search_result_test.py` covering `IndexedSplit` metadata scaling, deletion vectors, overlapping/gapped column files, skewed split balancing, `target_max_block_size` boundaries, and snapshot-pinned Ray lookups. - The final targeted OSS run passed 67 tests and skipped one unsupported HNSW case. Flake8 passed for the five changed files. Full-file Ruff and ty checks currently report 59 and 7 diagnostics respectively, compared with 36 and 14 on the PR base. -- 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]
