zhuqi-lucas commented on PR #21828: URL: https://github.com/apache/datafusion/pull/21828#issuecomment-4326483205
Thanks for the review @alamb! I agree the current API is confusing. Let me explain the design intent: There are two cases for offset + parquet: **Case 1: No filter** → offset is fully handled (raw row counts are exact). Safe to eliminate `GlobalLimitExec`. **Case 2: Filter + fully matched RGs** → `prune_by_statistics` marks RGs where ALL rows satisfy the filter (`is_fully_matched`). For these RGs, row counts are still exact — safe to skip for offset. But non-fully-matched RGs need `GlobalLimitExec` to handle remaining offset. If `with_offset` returns `None` when filter is present, we lose Case 2 entirely — the offset hint is never passed to the opener, so `prune_by_offset` can't skip any RGs. How about this cleaner API instead: - `with_offset` always returns `Some` for parquet (sets the hint) - Rename `offset_fully_handled` → `can_skip_global_limit_for_offset` - Optimizer: if `can_skip_global_limit_for_offset()` → eliminate `GlobalLimitExec`, else keep it Or alternatively: split into two methods — `with_offset(n)` for full handling (no filter) and `with_offset_hint(n)` for partial (with filter). WDYT? I'll also address the other comments (move RowSelection logic to PreparedAccessPlan method, update docs/naming, mark as API change). -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
