Skip to content

fix: preserve temporal scale and timezone in group_concat - #28701

Merged
XuPeng-SH merged 15 commits into
matrixorigin:mainfrom
aunjgr:fix/group-concat-temporal-format-28657
Sep 14, 2026
Merged

XuPeng-SH merged 15 commits into
matrixorigin:mainfrom
aunjgr:fix/group-concat-temporal-format-28657

Conversation

@aunjgr

@aunjgr aunjgr commented Sep 11, 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:

issue #28657

What this PR does / why we need it:

GROUP_CONCAT used scale-blind temporal formatting and the internal UTC representation of TIMESTAMP. Its remote process codec also retained only an offset, so named locations could lose historical and daylight-saving rules: Asia/Shanghai could become a fixed +08:05:43 zone instead of using the offset applicable to each timestamp.

Render DATETIME and TIME at their declared scale and TIMESTAMP in the initiating session location. Configure group, merge-group, window, and time-window executors consistently. Add the IANA timezone name to process session metadata and reconstruct that named location on the receiving CN. Preserve the legacy time-zone bytes for fixed-offset and older payloads; reject invalid named identities instead of silently discarding their rules.

Require compatible worker capability before remotely finalizing named-zone GROUP_CONCAT. Probe selected worker versions and validate their destination addresses, use local placement when capability cannot be established, and recheck before sending. Machine-local SYSTEM zones with historical or DST rules remain with the coordinator when no portable name is available; UTC and fixed-offset system zones retain their compatible remote path. Aggregate payload and spill formats are unchanged.

Cover named-zone codec round trips through two hops, fixed-offset compatibility, invalid names, winter/summer finalization, and a real two-CN query whose remote worker finalizes GROUP_CONCAT. Verify that lowering the worker capability moves execution locally while preserving the result.

The send-time fence inspects lowered Group/MergeGroup aggregate IDs and TIMESTAMP arguments, including nested/forwarded pipeline children, rather than relying only on function expressions. Exercise a real encoded NeedEval group with a compatible destination followed by a capability downgrade, plus DISTINCT and non-TIMESTAMP controls.

Render temporal inputs at their declared scale and use the initiating session timezone for TIMESTAMP values across local and remote execution.
@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.

Reviewed the complete current diff at f3ae3fc against main db4edb4. One P2 correctness blocker remains: remote finalization cannot rely on the existing session timezone codec to preserve a named location (inline finding).

The scale-aware formatting covers ordinary, ordered and DISTINCT payload rendering; group/merge/spill reconstruction and window/timewin creation configure execution-local timezone, and cleanup does not serialize a location pointer into aggregate state. NULL handling, raw equality/order payloads and bounded truncation mechanisms remain structurally unchanged. Added formatter and SQL/prepared tests exercise fractional precision and fixed +08:00 rebinding, but that fixed-offset case does not expose the named-zone transport failure.

Validation: exact-head source tracing through session setting, process serialization/deserialization, distributed shuffle-group NeedEval=true construction, aggregate creation and final rendering; inspected all changed tests and PR comments. Also inspected Go's actual time binary codec and local timezone database historical Shanghai offset. I did not run MatrixOne UT/BVT or a live two-CN SQL reproduction, and did not wait for CI. The finding is a composed source-derived counterexample, not a claimed executed SQL result.

Comment thread pkg/sql/colexec/group/exec2.go Resolved

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

Deep review of exact head f3ae3fc9b35489bed0d169db908c43869e399b94 against exact base/merge-base db4edb49d2a9da049781aa985b6227b1601db39b. I read the complete existing review, inline comment, unresolved thread, issue discussion, and PR contract, then independently traced the full eleven-file diff through ordinary/ordered/DISTINCT finalization, group/merge/spill reconstruction, window/time-window construction, remote shuffle ownership, and process session serialization. The scale-aware formatting and fixed-offset local/prepared paths are correct, and raw payload/order/distinct behavior remains unchanged. One blocking distributed named-timezone defect remains inline: the process codec does not preserve IANA timezone rules, so the newly consumed remote location can format TIMESTAMP values with the wrong offset.

Validation at the exact head: repository-required third-party/CGo artifacts built; full ./pkg/sql/colexec/aggexec ./pkg/sql/colexec/group ./pkg/sql/colexec/timewin ./pkg/sql/colexec/window tests passed; focused aggregate race tests passed; git diff --check passed; all GitHub checks are green. A review-only process-codec counterexample reproduced the named-zone offset corruption and was removed.

Comment thread pkg/sql/colexec/group/exec2.go Resolved
Address the review at the execution boundary. Retain a local path when the selected workers cannot preserve the expression contract and recheck the destination before sending. Include focused codec, placement, and execution regressions.
Reject remote rendering without a portable timezone owner and validate the pipeline destination against the probed worker identity. Keep the named-zone regression independent of process-global time.Local so race validation is safe while background services are running.
Resolve legacy address-only scopes against the live CN inventory before probing protocol support. When a scope includes a service ID, require both its identity and pipeline address to match. Verify unknown destinations, stale addresses, cancellation, and successful legacy routing without weakening the remote feature gate.
Distinguish fixed offsets from historical and daylight-saving locations using transition bounds. Keep UTC and fixed SYSTEM sessions on the legacy compatible remote path, while unportable rule-bearing locations stay on the coordinator. Do not reinterpret a fixed offset as IANA rules merely because its display name matches a named location. Cover both classifications and destination validation.
@matrix-meow matrix-meow added size/L Denotes a PR that changes [500,999] lines and removed size/M Denotes a PR that changes [100,499] lines labels Sep 11, 2026
@aunjgr

aunjgr commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Merged newest main in b7c9324 and resolved the integration conflicts without dropping either timezone formatting or the new GROUP_CONCAT warning-source state.

Main now owns protocol65 for ASCII and66 for aggregate row provenance. Named-timezone remote finalization therefore requires67, with current-main66 workers taking the existing local fallback. The actual lowered-aggregate send-time fence remains intact.

Full compile/process/aggregate/group tests and the real two-CN named-zone/fallback test pass on the combined code; full SCA passes. Both previously reviewed fixes remain in place.

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

Deep re-review of exact head b7c9324 against exact base and merge-base 0002cd5. I read all prior reviews, inline comments, author replies, and resolved threads, then checked both the full diff and the increment since the prior reviewed f3ae3fc head. The previous IANA timezone-loss blocker is closed by transporting and reloading the named location, preserving fixed-offset compatibility, and retaining named rules across forwarded hops. The later lowered-aggregate bypass is also closed: the send-time fence inspects Aggregate.Op plus TIMESTAMP arguments recursively in child pipelines, while placement and destination probes fail closed for old or unknown workers. Temporal scale and timezone formatting cover ordinary, ordered, DISTINCT, merge, spill, window, and time-window executor construction without changing raw equality/order payloads. No blocking issue found. Validation at this exact head: repository-required thirdparties and CGo built; focused process, aggregate, and compile timezone/protocol tests passed; full group, timewin, and window package tests passed; the executed two-CN named-zone winter/summer remote-owner and old-worker fallback test passed; gofmt and git diff checks passed; required GitHub CI is green.

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

mergify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-14 04:18 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-14 04:53 UTC · at baeaa46752ff6993d8c86a18e0069a869c46990f

This pull request spent 35 minutes 11 seconds in the queue, with no time running CI.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Reason

Pull request #28701 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit a292c5d into matrixorigin:main Sep 14, 2026
25 of 26 checks passed
@mergify mergify Bot added dequeued and removed queued labels Sep 14, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…in#28701)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28657

## What this PR does / why we need it:

GROUP_CONCAT used scale-blind temporal formatting and the internal UTC
representation of TIMESTAMP. Its remote process codec also retained only
an offset, so named locations could lose historical and daylight-saving
rules: Asia/Shanghai could become a fixed +08:05:43 zone instead of
using the offset applicable to each timestamp.

Render DATETIME and TIME at their declared scale and TIMESTAMP in the
initiating session location. Configure group, merge-group, window, and
time-window executors consistently. Add the IANA timezone name to
process session metadata and reconstruct that named location on the
receiving CN. Preserve the legacy time-zone bytes for fixed-offset and
older payloads; reject invalid named identities instead of silently
discarding their rules.

Require compatible worker capability before remotely finalizing
named-zone GROUP_CONCAT. Probe selected worker versions and validate
their destination addresses, use local placement when capability cannot
be established, and recheck before sending. Machine-local SYSTEM zones
with historical or DST rules remain with the coordinator when no
portable name is available; UTC and fixed-offset system zones retain
their compatible remote path. Aggregate payload and spill formats are
unchanged.

Cover named-zone codec round trips through two hops, fixed-offset
compatibility, invalid names, winter/summer finalization, and a real
two-CN query whose remote worker finalizes GROUP_CONCAT. Verify that
lowering the worker capability moves execution locally while preserving
the result.


The send-time fence inspects lowered Group/MergeGroup aggregate IDs and
TIMESTAMP arguments, including nested/forwarded pipeline children,
rather than relying only on function expressions. Exercise a real
encoded NeedEval group with a compatible destination followed by a
capability downgrade, plus DISTINCT and non-TIMESTAMP controls.

---------

Co-authored-by: XuPeng-SH <[email protected]>
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
…in#28701)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28657

## What this PR does / why we need it:

GROUP_CONCAT used scale-blind temporal formatting and the internal UTC
representation of TIMESTAMP. Its remote process codec also retained only
an offset, so named locations could lose historical and daylight-saving
rules: Asia/Shanghai could become a fixed +08:05:43 zone instead of
using the offset applicable to each timestamp.

Render DATETIME and TIME at their declared scale and TIMESTAMP in the
initiating session location. Configure group, merge-group, window, and
time-window executors consistently. Add the IANA timezone name to
process session metadata and reconstruct that named location on the
receiving CN. Preserve the legacy time-zone bytes for fixed-offset and
older payloads; reject invalid named identities instead of silently
discarding their rules.

Require compatible worker capability before remotely finalizing
named-zone GROUP_CONCAT. Probe selected worker versions and validate
their destination addresses, use local placement when capability cannot
be established, and recheck before sending. Machine-local SYSTEM zones
with historical or DST rules remain with the coordinator when no
portable name is available; UTC and fixed-offset system zones retain
their compatible remote path. Aggregate payload and spill formats are
unchanged.

Cover named-zone codec round trips through two hops, fixed-offset
compatibility, invalid names, winter/summer finalization, and a real
two-CN query whose remote worker finalizes GROUP_CONCAT. Verify that
lowering the worker capability moves execution locally while preserving
the result.


The send-time fence inspects lowered Group/MergeGroup aggregate IDs and
TIMESTAMP arguments, including nested/forwarded pipeline children,
rather than relying only on function expressions. Exercise a real
encoded NeedEval group with a compatible destination followed by a
capability downgrade, plus DISTINCT and non-TIMESTAMP controls.

---------

Co-authored-by: XuPeng-SH <[email protected]>
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
…in#28701)

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28657

## What this PR does / why we need it:

GROUP_CONCAT used scale-blind temporal formatting and the internal UTC
representation of TIMESTAMP. Its remote process codec also retained only
an offset, so named locations could lose historical and daylight-saving
rules: Asia/Shanghai could become a fixed +08:05:43 zone instead of
using the offset applicable to each timestamp.

Render DATETIME and TIME at their declared scale and TIMESTAMP in the
initiating session location. Configure group, merge-group, window, and
time-window executors consistently. Add the IANA timezone name to
process session metadata and reconstruct that named location on the
receiving CN. Preserve the legacy time-zone bytes for fixed-offset and
older payloads; reject invalid named identities instead of silently
discarding their rules.

Require compatible worker capability before remotely finalizing
named-zone GROUP_CONCAT. Probe selected worker versions and validate
their destination addresses, use local placement when capability cannot
be established, and recheck before sending. Machine-local SYSTEM zones
with historical or DST rules remain with the coordinator when no
portable name is available; UTC and fixed-offset system zones retain
their compatible remote path. Aggregate payload and spill formats are
unchanged.

Cover named-zone codec round trips through two hops, fixed-offset
compatibility, invalid names, winter/summer finalization, and a real
two-CN query whose remote worker finalizes GROUP_CONCAT. Verify that
lowering the worker capability moves execution locally while preserving
the result.


The send-time fence inspects lowered Group/MergeGroup aggregate IDs and
TIMESTAMP arguments, including nested/forwarded pipeline children,
rather than relying only on function expressions. Exercise a real
encoded NeedEval group with a compatible destination followed by a
capability downgrade, plus DISTINCT and non-TIMESTAMP controls.

---------

Co-authored-by: XuPeng-SH <[email protected]>
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

kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants