Skip to content

feat: support LISTAGG and ARRAY_AGG compatibility - #29166

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
daviszhen:codex/issue-25110-list-array-agg
Sep 20, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
daviszhen:codex/issue-25110-list-array-agg

Conversation

@daviszhen

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:

Part of #25110

What this PR does / why we need it:

  • Adds LISTAGG(value [, delimiter]) WITHIN GROUP (ORDER BY ...) as a compatibility surface over the existing ordered GROUP_CONCAT implementation.
  • Adds ordinary, DISTINCT, and window ARRAY_AGG(value) forms as an explicit compatibility alias of JSON_ARRAYAGG.
  • Preserves the public SQL spelling while lowering plans to the existing canonical aggregate implementations.
  • Adds parser/deparser, function-resolution, planner, and distributed SQL regression coverage.

Compatibility contract:

  • LISTAGG inherits GROUP_CONCAT behavior for NULL handling, default comma delimiter, DISTINCT, ordering, group_concat_max_len, truncation, and warnings.
  • MatrixOne does not currently expose a general typed SQL ARRAY. ARRAY_AGG therefore returns JSON and inherits JSON_ARRAYAGG conversion, NULL, DISTINCT, window, serialization, and persistence behavior.
  • This PR does not add ARRAY_AGG(...) WITHIN GROUP (...); ordered ARRAY aggregation requires a separate executor contract.

Validation:

  • go test ./pkg/sql/parsers/dialect/mysql -count=1
  • go test ./pkg/sql/plan/function -count=1
  • go test ./pkg/sql/plan -count=1
  • Focused pkg/sql/compile GROUP_CONCAT/config tests
  • Built the branch mo-service and executed all new BVT statements against a fresh local launch deployment

@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 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.

Approve for exact head da9a95f20deb9a6334727d0d330f999c0a52e09e.

Fresh exact-head review found no actionable P0/P1/P2 defect. LISTAGG keeps the public spelling while resolving to the existing GROUP_CONCAT implementation, including delimiter/default delimiter, NULL handling, DISTINCT, ordered-set lowering, and the existing truncation/warning contract. ARRAY_AGG deliberately keeps the documented JSON return contract by resolving to JSON_ARRAYAGG; ordinary, DISTINCT, window, NULL, empty-input, parser/deparser round-trip, and plan-resolution paths are covered. Existing canonical function IDs and aggregate implementations are reused, so no new persisted aggregate identity or serialization format is introduced.

Exact-head CI Required, Ubuntu UT, SCA, coverage, PROXY BVT, and pessimistic multi-CN BVT are green. The PR's explicit non-goal—ARRAY_AGG WITHIN GROUP ordering—remains correctly rejected/deferred as a separate executor contract.

@mergify mergify Bot added the queued label Sep 20, 2026
@mergify

mergify Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-20 11:45 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-20 11:45 UTC · at cd5feff242744557448cd107c6744fb9fd5df088 · squash

This pull request spent 11 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify
mergify Bot merged commit cd5feff into matrixorigin:main Sep 20, 2026
28 of 29 checks passed
@mergify mergify Bot removed the queued label Sep 20, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change kind/feature size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants