You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "yashmayya (via GitHub)" <gi...@apache.org> on 2026/05/27 21:22:00 UTC

[PR] Include OFFSET in physical optimizer group-trim limit pushdown [pinot]

yashmayya opened a new pull request, #18600:
URL: https://github.com/apache/pinot/pull/18600

   On the physical optimizer path (`usePhysicalOptimizer=true`), the group-trim rule pushed `limit = fetch` into the leaf/final aggregate and ignored the query `OFFSET`. Paginated `DISTINCT` / `GROUP BY` queries that hit group trim then trimmed away rows the outer `OFFSET ... FETCH` window still needed and came back short — silently wrong results, no error. It now pushes `offset + fetch` (clamped to avoid int overflow) so the leaf/final aggregate keeps enough groups.
   
   The default/legacy planner isn't affected: its sort-exchange-copy rule already folds the offset into the inner sort's fetch before the aggregate rule runs, so that rule sees `offset + fetch` there. `PINOT_POST_RULES_V2` has no sort-exchange rule, so `PinotLogicalAggregateRule` matches the raw outer sort and has to add the offset itself.
   
   ### Tests
   - Plan-level (`PhysicalOptimizerPlans.json`): no-aggregate `DISTINCT ... LIMIT n OFFSET m` and hinted aggregate, asserting leaf/final `limit=[offset+fetch]`.
   - Integration (`GroupByOptionsTest`, `usePhysicalOptimizer=true`): paginated DISTINCT and hinted-aggregate paths return a full page. Verified it fails (0 rows) without the fix.
   
   Fixes #18592
   


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Include OFFSET in physical optimizer group-trim limit pushdown [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #18600:
URL: https://github.com/apache/pinot/pull/18600#issuecomment-4559086090

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/18600?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `80.00000%` with `2 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 56.78%. Comparing base ([`26e7d12`](https://app.codecov.io/gh/apache/pinot/commit/26e7d1211ec8401bd7681589c265fcd74335f131?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`04222c6`](https://app.codecov.io/gh/apache/pinot/commit/04222c6571f7555746708cb6c9368cfddcf32471?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 19 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/pinot/pull/18600?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...t/calcite/rel/rules/PinotLogicalAggregateRule.java](https://app.codecov.io/gh/apache/pinot/pull/18600?src=pr&el=tree&filepath=pinot-query-planner%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fcalcite%2Frel%2Frules%2FPinotLogicalAggregateRule.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcXVlcnktcGxhbm5lci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY2FsY2l0ZS9yZWwvcnVsZXMvUGlub3RMb2dpY2FsQWdncmVnYXRlUnVsZS5qYXZh) | 80.00% | [1 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/pinot/pull/18600?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   > :exclamation:  There is a different number of reports uploaded between BASE (26e7d12) and HEAD (04222c6). Click for more details.
   > 
   > <details><summary>HEAD has 16 uploads less than BASE</summary>
   >
   >| Flag | BASE (26e7d12) | HEAD (04222c6) |
   >|------|------|------|
   >|java-21|5|1|
   >|unittests|2|1|
   >|temurin|5|1|
   >|unittests2|1|0|
   >|integration|3|0|
   >|integration1|1|0|
   >|integration2|1|0|
   >|custom-integration1|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #18600      +/-   ##
   ============================================
   - Coverage     64.31%   56.78%   -7.53%     
   + Complexity     1137        1    -1136     
   ============================================
     Files          3335     2564     -771     
     Lines        205710   149096   -56614     
     Branches      32085    24112    -7973     
   ============================================
   - Hits         132295    84670   -47625     
   + Misses        62774    57225    -5549     
   + Partials      10641     7201    -3440     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.78% <80.00%> (-7.53%)` | :arrow_down: |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.78% <80.00%> (-7.53%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.78% <80.00%> (-7.52%)` | :arrow_down: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.78% <80.00%> (+0.05%)` | :arrow_up: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/18600/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/18600?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Include OFFSET in physical optimizer group-trim limit pushdown [pinot]

Posted by "yashmayya (via GitHub)" <gi...@apache.org>.
yashmayya merged PR #18600:
URL: https://github.com/apache/pinot/pull/18600


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org