Repository navigation
Cherry pick #128077 to 26.10: Do not let a derived indexHint keep HAVING above GROUPING SETS - #131336
Conversation
Since #126219 the GROUPING SETS check in tryPushDownFilter also counts the columns that an implied indexHint reads, so that a filter consisting only of such a hint cannot prune rows below a set that lacks its key. But the hint's own actions are built from the query tree and read the table column (`k` of key `intDiv(k, 10)`, `ts` of `toDate(ts)`), which is in no grouping set. The check then rejected the whole filter, and its other conjuncts (`v < 3`), which 26.10 pushed to the read, stopped pruning: the query from #128072 read 78/78 granules instead of 3/78. Collect the hint inputs separately. The filter's own identifiers still gate it as before. When a hint input is missing from some set, push the filter with PushDownIndexHints::None, so the other conjuncts go below the aggregation as on 26.10 and every hint stays above it; otherwise keep PushDownIndexHints::Implied as on master. Applies to MergingAggregated too. The existing GROUPING SETS ((a, b), (b)) case of 05401 still returns 0; with the hints pushed (Implied instead of None) it returns 1. Closes #128072 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ets-hint-gate-128072 Resolve the conflict in filterPushDown.cpp: master rewrote findIdentifiersOfNode on top of visitReachableNodes; keep that form and route the implied indexHint inputs to the separate set. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The plain conjunct `v < 3` prunes to `3/79` on its own, so without a derived hint the granule check passes whether or not the fix is present (measured with `optimize_and_compare_chain = 0`). Assert the hint is there first, as the other cases of this test already do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…gate-128072 Do not let a derived `indexHint` keep `HAVING` above `GROUPING SETS`
|
The only conflict is in The regression this fixes reached 26.10 with #128130 and is not in a release yet. On the 26.10 tree (clang-22, debug) I cannot push to |
|
The |
f6f8f04 to
cf3fbf0
Compare
Original pull-request #128077
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job