Skip to content

fix(agg): preserve DECIMAL AVG integer capacity - #28828

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-28776-avg-cap
Sep 14, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-28776-avg-cap

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

Summary

  • preserve DECIMAL256 AVG input integer capacity while capping public precision at 65
  • keep the result scale within the available precision for ordinary, DISTINCT, and window aggregation
  • add exact max-value regressions and return-type coverage

Fixes #28776

Validation

  • focused and full pkg/sql/colexec/aggexec CGo tests
  • go vet and incremental golangci-lint (0 issues)
  • make -j8 build
  • isolated SQL validation for DECIMAL(62,0) and DECIMAL(65,30), positive/negative, grouped/window AVG, and empty-set NULL

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

Choose a reason for hiding this comment

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

GPT-6 medium deep review of exact head 65d9cf76b61b8084ba136232b56b87e6ae09911b: no blocker found. The new DECIMAL256 AVG return type preserves the input's integer capacity while increasing scale; planner typing and ordinary, DISTINCT, and window execution share the same result scale. Empty/all-NULL groups, rounding, overflow, and final precision checks remain intact. The added tests are six small single-row aggregate cases with no cluster or concurrency fixture, and no major racing-UT slowdown mechanism is apparent.

Exact-head Ubuntu UT and CI Required pass. The distributed BVT job passed, though its artifact could not be fetched during this review, so I have not independently verified the case-level SQL transcript. This is a self-authored PR, so this is COMMENT only.

@XuPeng-SH
XuPeng-SH merged commit b26b298 into matrixorigin:main Sep 14, 2026
27 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Summary
- preserve DECIMAL256 AVG input integer capacity while capping public
precision at 65
- keep the result scale within the available precision for ordinary,
DISTINCT, and window aggregation
- add exact max-value regressions and return-type coverage

Fixes matrixorigin#28776

## Validation
- focused and full `pkg/sql/colexec/aggexec` CGo tests
- `go vet` and incremental `golangci-lint` (0 issues)
- `make -j8 build`
- isolated SQL validation for DECIMAL(62,0) and DECIMAL(65,30),
positive/negative, grouped/window AVG, and empty-set NULL

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Summary
- preserve DECIMAL256 AVG input integer capacity while capping public
precision at 65
- keep the result scale within the available precision for ordinary,
DISTINCT, and window aggregation
- add exact max-value regressions and return-type coverage

Fixes matrixorigin#28776

## Validation
- focused and full `pkg/sql/colexec/aggexec` CGo tests
- `go vet` and incremental `golangci-lint` (0 issues)
- `make -j8 build`
- isolated SQL validation for DECIMAL(62,0) and DECIMAL(65,30),
positive/negative, grouped/window AVG, and empty-set NULL

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Summary
- preserve DECIMAL256 AVG input integer capacity while capping public
precision at 65
- keep the result scale within the available precision for ordinary,
DISTINCT, and window aggregation
- add exact max-value regressions and return-type coverage

Fixes matrixorigin#28776

## Validation
- focused and full `pkg/sql/colexec/aggexec` CGo tests
- `go vet` and incremental `golangci-lint` (0 issues)
- `make -j8 build`
- isolated SQL validation for DECIMAL(62,0) and DECIMAL(65,30),
positive/negative, grouped/window AVG, and empty-set NULL

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

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

size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: AVG narrows integer capacity for DECIMAL(62-65) and rejects valid values

2 participants