Repository navigation
fix(sql): match MySQL empty-input ROLLUP results - #30169
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
ba00ed8 to
a2c0d8e
Compare
80f8324 to
3754080
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 3754080ae6874a3a577008c1aebfe59662422ba7
Assessment: approve
Reviewed the complete eleven-file delta and affected callers. Planner-owned COUNT guards distinguish empty ROLLUP input from real NULL rows while preserving SAMPLE and explicit grouping-set behavior. Shared/direct/split paths retain the guard, and established uniqueness proofs safely remove singleton detail aggregation. Both previous findings are closed; no actionable defect remains.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Full planner package passed: 15,445 named passes and two preexisting skips. All changed planner-test roots were selected.
-
Public SQL checks passed twice: 40 named passes covering empty input, SAMPLE, HAVING, windows, prepared reuse, CTAS/INSERT and forced remote grouping. Shared-fixture teardown completed.
-
Controlled merge-base production overlays passed the same SAMPLE and plan-cost probes twice. With 1,024 primary keys, candidate and base both reported 16,384B operator memory for ROLLUP and 8,232B for ordinary GROUP BY.
-
Preflight, native provenance verification (192 inputs and 62 artifacts), formatting, whitespace and clean-source checks passed. Tests used assigned caches and the supplied executor.
-
Frozen current-head statuses report successful required CI, Ubuntu UT, SCA, coverage and both BVT groups. Local commands, receipts, logs and overlay hashes are reconciled in /home/xupeng/.local/state/mo-bot/jobs/d7cef1a815eddf85d12b718e/attempt-1/evidence-audit.json; detailed analysis is in review-report.md.
Limitations:
-
Raw CI logs, author validation artifacts and the full linked issue body were not supplied. CI statuses were distinguished from independently audited local execution.
-
No fresh local full BVT, full DML package or race suite was run. Production changes introduce no new concurrency mechanism.
-
Performance comparison covers operator memory for the reported workload, not throughput or process peak memory. Additional HAVING/aggregates and unsafe expressions intentionally retain conservative aggregation.
Merge Queue Status
This pull request spent 1 hour 24 minutes 21 seconds in the queue, with no time running CI. ReasonPull request #30169 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Please leave the issue open for the reporter to verify after merge.
What this PR does / why we need it:
Empty input currently produces an extra all-rolled row from
GROUP BY ... WITH ROLLUP. Match MySQL's zero-row result for both ROLLUP spellings, including window, CTE, HAVING, UNION and write consumers. Explicit GROUPING SETS/CUBE and ordinary scalar aggregates retain their empty-input identities; a real NULL input row still contributes detail and total groups.Add a hidden
COUNT(*) > 0HAVING guard to generated aggregate ROLLUP branches. Keep aggregate binding symmetric and preserve the guard through shared aggregation and the direct split path. SAMPLE already emits no rows on empty input, so its current SELECT block keeps the sampling path without an injected ordinary aggregate. Nested SAMPLE does not disable an outer ROLLUP guard, and explicit SAMPLE mixed with ordinary aggregates remains invalid.Preserve primary-key detail aggregate elimination after shared-plan selection: a direct scan with a complete SQL-compatible unique key and all active grouping keys can project its sole canonical COUNT(*) as one. Remove only the proven constant count guard, allowing normal projection cleanup to discard an unused hidden count. Inactive subtotal branches, additional HAVING/aggregates, unsafe expressions and invalid metadata retain their aggregate and guard. LIMIT does not cross the grouping-set UNION.
Validation on macOS/arm64, Go 1.27.1:
Design and overall review use gpt-6-astra with reasoning effort medium. The pre-repair head's required CI is green; the updated head will receive fresh CI after push.