Skip to content

Improve SORT ROLLUP reuse for MIN and MAX - #32089

Merged
mergify[bot] merged 7 commits into
matrixorigin:mainfrom
iamlinjunhong:loom-20653-d9591c296f
Nov 3, 2026
Merged

mergify[bot] merged 7 commits into
matrixorigin:mainfrom
iamlinjunhong:loom-20653-d9591c296f

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

The existing SORT ROLLUP implementation and subsequent correctness and reuse fixes are already merged. A later issue comment measured a slow forced-SORT path at high cardinality when MIN/MAX were included; the earlier DISTINCT and ordering concerns were static risks, not a reproduced wrong SQL result. This change extends single-group reuse to supported fixed-width MIN/MAX and generic decimal SUM/AVG, including BIGINT, while preserving conservative fallback for unsupported aggregate lists and metadata.

Validation:

  • Aggregate and group package tests and race tests; targeted allocation failure, cancellation and re-prepare tests with resource cleanup assertions; incremental vet and lint.
  • SQL hint BVT: 68/68 twice on the same instance, 68/68 with metadata comparison, and 688/688 in the hint directory. SORT/HASH results were checked against independent expected values, including NULL, BIGINT and decimal cases.
  • On the same machine, configuration and data, the high-cardinality five-aggregate forced-SORT median improved from 24.8800 s to 1.5363 s (30 samples each; ratio 0.0618, bootstrap 95% interval 0.0593–0.0645). Full results and metadata were independently checked for the measured query shapes.

The main performance target was met, but some controls and ablations remained inconclusive after 30 samples because of variability; this does not establish that every control avoids regression. Measurements do not establish production concurrency, multi-CN, cold-cache, peak RSS, or CPU/GC attribution. CI is pending.

Branch refresh (2026-11-03):

  • Rebased d9591c296fcc9e6e037c86104d8aecb675399950 onto official main at c337122982537dcf957705cb6fc5f7f9bdc6a0f6; resulting head 45c5a1418a499c47d75e09913a7c78c0f1b1560e. This completes the branch update that Mergify check 125839036507 could not perform because its GitHub App lacked workflow write permission.
  • Newly run: git range-diff confirms all six patches unchanged; git diff --check and the Loom PR artifact check pass. The delivery diff contains only the eight original source/test files, including the SQL fixture and expected results. No product code was changed during this refresh.
  • The functional, race, BVT and benchmark results above are prior author-reported validation, retained rather than rerun for this rebase. Aggregate/group code, their tests, core dependencies and module inputs are unchanged; incoming main changes concern MinIO range-read handling, HA deployment documentation and CI checkout depth. Fresh CI is pending on the rebased head.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 45c5a1418a499c47d75e09913a7c78c0f1b1560e

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 45c5a1418a499c47d75e09913a7c78c0f1b1560e

Assessment: approve

The reuse extension preserves aggregate semantics, conservative metadata fallback, and failure cleanup. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0

Validation:

  • Go 1.27.1 focused tests passed in aggexec and group: 35 top-level tests using the assigned isolated executor. Receipt: checks/1793701615887156778-2.json; log: targeted-tests-toolchain.log.

  • Whitespace, Go formatting, and independent checks of all 52 added SQL fixture rows and metadata passed. Receipt: checks/1793700978773759901-2.json; log: source-audit-retry.log.

  • Isolation preflight and native input verification passed. validation-index.json reconciles nine terminal receipts with retained logs and post-test source hashes.

  • Complete delta, relevant owners, linked issue context, and discussion assessed; review-plan.md and discussion-assessment.json saved.

Limitations:

  • Race, live SQL BVT, and benchmark results rely on qualified author reports; they were not rerun locally.

  • The pre-rebase commit is unavailable, so unchanged-patch equivalence remains author-reported. Available incoming-main changes exclude affected owners and core build inputs.

  • Reported performance controls remain inconclusive; no broader production or multi-CN performance conclusion is claimed.

@mergify

mergify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as 5eba6f6 at 13:06 UTC

1 h 32 min in the queue, 1 h 8 min of it CI.

So far

  • ✅ Entered the queue Tue 3 Nov, 11:33 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Passed · in place
  • ✅ Merged 13:06 · 5eba6f6 · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
ci — 38242db9 Deployed Nov 3, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants