Repository navigation
fix: support extended types in group_concat - #27620
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.
Blocking: pkg/sql/colexec/aggexec/agg_payload.go:211-215 now writes GEOMETRY/GEOMETRY32 as arbitrary raw WKB bytes, but GroupConcatReturnType at pkg/sql/colexec/aggexec/concat2.go:152-160 still returns TEXT/UTF8 unless an argument is BINARY/VARBINARY/BLOB. Consequently binaryResult is false and the truncation path at concat2.go:1658-1665 treats WKB as UTF-8.
A concrete counterexample is GROUP_CONCAT over WKB POINT(1 2) with group_concat_max_len=20: the 21-byte WKB begins 01 01 00 00 00 00 00 00 00 00 00 f0 3f .... The aggregate should preserve the first 20 binary bytes, but the current code returns only the first 11 bytes because it backtracks over the invalid UTF-8 byte f0; the result is also advertised to MySQL clients as TEXT rather than binary. This corrupts/truncates one of the newly supported types.
Please either make GEOMETRY/GEOMETRY32 force a BLOB/binary GROUP_CONCAT result (including mixed arguments), or serialize them to a textual representation consistently, and add coverage for result metadata plus a group_concat_max_len boundary through the aggregate execution path.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Blocking correctness issue in the newly supported GEOMETRY/GEOMETRY32 path: writeGroupConcatData appends raw WKB, but GroupConcatReturnType neither returns BLOB for geometry nor propagates its binary charset (MergeStringCharset ignores geometry). Every truncation path then decides binary/text from retType.Oid == T_blob and treats WKB as UTF-8.
I reproduced this through the aggregate executor on this exact head. WKB POINT(1 2) is 21 bytes; with group_concat_max_len=20, the expected binary prefix is 20 bytes, but the result is only 11 bytes because truncation backs up past byte 0xf0 until the buffer happens to be valid UTF-8. The result type also carries CharsetUTF8, so clients receive incorrect text metadata for opaque bytes. Mixed geometry/text arguments have the same contract problem.
Please make GEOMETRY and GEOMETRY32 force a binary GROUP_CONCAT result (and make the truncation decision follow the binary contract), or serialize them as text consistently. Add executor-level coverage for result OID/charset and a max-length cut inside WKB, including a mixed-argument case. The new Decimal256/Year/UUID serialization and malformed fixed-payload checks passed focused tests; no material performance regression was found there.
aptend
left a comment
There was a problem hiding this comment.
Deep re-reviewed the complete diff and all prior reviews/threads at exact head 8e74e4f, with the incremental changes since my previous reviewed head 0a8f3b5 checked separately.
The prior blockers are closed: GEOMETRY/GEOMETRY32 now force an opaque binary result; every resident, ordered, spill, and accounted finalizer truncates according to the result charset; and valid WKB above 64 KiB bypasses the legacy unit limit while the final scratch remains bounded by group_concat_max_len. The new fail-closed type admission matches the serializer contract, with untyped NULL still handled by the existing T_any-to-TEXT cast.
Validated with diff check, full aggexec package tests, vet, build, the full race suite, and repeated focused race coverage for large geometry, Geometry32, mixed binary/text, allocation-account, and spill paths.
aunjgr
left a comment
There was a problem hiding this comment.
Approved exact head .\n\nThe previous >64 KiB GEOMETRY rejection is closed by routing GEOMETRY/GEOMETRY32 through the binary result writer rather than the uint16-limited unit validator. The added 65,545-byte coverage exercises both geometry types across ordered, spill, and accounted finalizers. The legacy finalizer's scratch growth is now bounded by , binary truncation follows charset semantics, and the supported-type check is fail-closed. I found no remaining correctness or lifecycle blocker.
aunjgr
left a comment
There was a problem hiding this comment.
Approved exact head 8e74e4ff2d9f22f5985b74168deaac8c2d0da78c.
The previous >64 KiB GEOMETRY rejection is closed by routing GEOMETRY/GEOMETRY32 through the binary result writer rather than the uint16-limited unit validator. The added 65,545-byte coverage exercises both geometry types across ordered, spill, and accounted finalizers. The legacy finalizer's scratch growth is now bounded by group_concat_max_len, binary truncation follows charset semantics, and the supported-type check is fail-closed. I found no remaining correctness or lifecycle blocker.
Merge Queue Status
This pull request spent 19 minutes 13 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27620 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.
Failing checks:
HintYou 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. 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:
close #27589
What this PR does / why we need it:
GROUP_CONCATaccepts DECIMAL256, YEAR, UUID, GEOMETRY, and GEOMETRY32 inputs, but its payload writer did not serialize these types. Queries using them therefore failed during aggregation.This change:
Local verification:
go test ./pkg/sql/colexec/aggexec -count=1go test -race ./pkg/sql/colexec/aggexec -count=1go vet ./pkg/sql/colexec/aggexecgo vet ./...make configmake err-checkThe full repository test run was also attempted. Its remaining failures (service configuration nil dereferences, unavailable local Grafana, and missing macOS
libusearch_c.dylibruntime lookup) were reproduced unchanged on a cleanorigin/mainworktree.