Repository navigation
fix: coerce temporal and string variance operands - #28509
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? |
aptend
left a comment
There was a problem hiding this comment.
Reviewed exact head 4972d08 against merge base 00faf01.
Re-review: I read the full review/comment/thread history and checked both the increment since 590ebf6 and the complete PR diff. The prior blocker is closed: TIME/DATETIME/TIMESTAMP now retain their declared fractional scale when coerced to DECIMAL128, so variance/stddev no longer silently truncate fractional temporal values before aggregation. The aliases resolve to the same aggregate IDs, so they share the corrected type path.
Validation on this exact head:
- make thirdparties && make -C cgo
- .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 ./pkg/sql/plan/function
- .agents/skills/mo-dev/scripts/mo-cgo-test -race -run Test(MySQLNumericAggTypeCheck|VarianceAggregateTypeCheck) -count=1 ./pkg/sql/plan/function
I found no remaining blocking issue.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed exact head c0941cb against base a6a493a, including both requested-changes reviews and the intervening approval. No concrete blocker remains.
The prior fractional-temporal loss is fixed: TIME/DATETIME/TIMESTAMP now retain their declared scale in DECIMAL128(38, scale), while DATE remains scale 0. The cast no longer rescales the TIME(6) 0.1/0.3 counterexample to zero. Resolver tests cover scales 1–6 for all four aggregates, and public SQL oracles cover positive/negative TIME, fractional DATETIME/TIMESTAMP, NULL neighbors, grouped results and prepared execution. Existing numeric types remain unchanged; strings use the established FLOAT64 conversion/warning path. This PR changes operand lowering, not aggregate IDs, accumulation/merge state or serialization; the existing numeric variance executors and protocol checks continue to own those contracts.
Also reviewed the additional logservice allocator mutex change in the current full diff rather than treating it as out of scope. Next/Set/Capacity/restore-generation discard each lock only local field accesses, do not call one another or hold the mutex across RPC, and Set's existing panic releases via defer. The change does not claim to make multi-method refill sequences atomic or solve duplicate HAKeeper drivers; no new deadlock or correctness regression found in this bounded locking change.
Evidence: full current diff/history and current cast/registration/allocator consumers plus test assertions. Earlier exact-head native function-suite/race evidence and the PR's remote build/vet report are historical/author evidence, not fresh execution at this rebased head. No new UT/BVT, live distributed SQL, upgrade or benchmark run is claimed; a grouped SQL case alone is not proof of multi-CN execution. CI was not awaited; exact head/base rechecked before submission.
Merge Queue Status
This pull request spent 9 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Requeued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 23 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. 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:
issue #28229
What this PR does / why we need it:
Updated VAR_POP, VAR_SAMP, STDDEV_POP, and STDDEV_SAMP to support MySQL-compatible numeric
coercion.
String operands are implicitly converted to FLOAT64.
Temporal operands (DATE, TIME, DATETIME, and TIMESTAMP) are converted to DECIMAL128.
Added regression tests covering VARCHAR, DATE, and DATETIME inputs.
Verified remotely with: