Repository navigation
fix(frontend): honor column signedness when saving query results (#31498) - #31559
Conversation
) Fixes #31498. mysqlColDef2PlanResultColDef ignored col.IsSigned() and mapped every integer column to a signed T_int*, so convertRowsIntoBatch hit 'interface conversion: interface {} is uint64, not int64' while saving query results: SHOW COUNT(*) WARNINGS/ERRORS publish unsigned LONG LONG rows, and per the follow-up report DATA BRANCH DIFF on a SET('a','b') column (engine T_uint64) with save_query_result=ON crashed an unsupervised diffMergeAgency goroutine and exited the whole service. - publish unsigned wire metadata (TINY/SHORT/LONG/LONGLONG -> T_uint8/16/32/64 when !IsSigned()); convertRowsIntoBatch accepts unsigned rows (uint64 exact, non-negative int64 accepted, clean errors for negative/out-of-range/foreign types, NULLs preserved) - unit + contract-level tests, and two BVT regressions (SHOW COUNT and DATA BRANCH DIFF over SET with saving ON) added
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? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: ddd215ad6b772f16f5290b0e69b088396df6cfca
Assessment: approve
Approve the fix for the reported uint64 SHOW-count and SET-diff failures. Signedness, exact values, NULL handling and saved-result readback align across the affected paths. No actionable regression was found.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Reviewed the complete seven-file delta, affected producers and consumers, linked issues and both discussion entries. Saved review-plan.md and discussion-assessment.json.
-
Frozen evidence reports successful UT, SCA, coverage and both BVT-group workflows at this head. Source selection includes the changed frontend tests and both new BVT files.
-
Local source audit passed: patch/head agreement, clean source, git diff --check, gofmt, BVT pair consistency and complete discussion coverage. Receipt: checks/1793186558699883326-3.json; retained output: review-audit.log and review-audit.json.
Limitations:
-
No runtime tests were rerun locally. Author-reported standalone and full-metadata checks had no attached receipts; individual CI test logs were not supplied.
-
Native uint8/uint16/uint32 row values remain unsupported by the helper, and partial-conversion error cleanup remains incomplete. Both failure paths predate this change; this approval does not claim they are fixed.
-
The separately tracked JSON/BIT/BLOB and DATETIME/TIME failures remain outside this fix.
🚫 Left the queue2 min in the queue, with no time running CI. So far
Reason Pull request #31559 has been merged manually at 6ff8881 Hint You were too fast! Merge conditions: 2 of 3 metThis pull request
The batch, tested in place
Tick the box to put this pull request back in the merge queue (same as
Times in UTC · dashboard · how the merge queue works |
What type of PR is this?
Which issue(s) this PR fixes:
issue #31498 (Fixes #31498)
What this PR does / why we need it:
Problem
With
save_query_result=ON,mysqlColDef2PlanResultColDefignoredIsSigned()and mapped every integer column to a signedT_int*, soconvertRowsIntoBatchhitinterface conversion: interface {} is uint64, not int64:SHOW COUNT(*) WARNINGS / ERRORSpublishesMYSQL_TYPE_LONGLONGwithIsSigned()==falseanduint64row values; the frontend only survived through the recovered-20101 path.DATA BRANCH DIFFon aSET('a','b')column (engine typeT_uint64, published as unsignedLONGLONG) withsave_query_result=ONraised the same panic insidediffMergeAgency/satisfyDiffOutputOpt- an unsupervised goroutine - and the whole service exited with exit code 2, while the same statement worked with saving OFF.Fix
pkg/frontend/util.go:mysqlColDef2PlanResultColDefis now signedness-aware -TINY/SHORT/LONG/LONGLONGmap toT_uint8/16/32/64when!col.IsSigned(), so saved result metadata matches the wire protocol.convertRowsIntoBatchhandlesT_uint8/16/32/64:uint64values are appended exactly; non-negativeint64is accepted; negative values, out-of-range widths and foreign types return clean errors (values abovemath.MaxInt64are never truncated); NULL rows keep their null slot. The new helpergetUnsignedRowValuefollows the existinggetDecimal*FromRowValueconvention.pkg/frontend/util_test.go: sign-aware mapping matrix; unsigned round-trip over0, 1, MaxInt64, MaxInt64+1, MaxUint64plus NULL rows; rejection matrix (negative / out-of-range / wrong type).pkg/frontend/mysql_cmd_executor_test.go: contract-level test assertingSHOW COUNT(*)publishesMYSQL_TYPE_LONGLONGwithIsSigned()==falseanduint64row values for both variants.test/distributed/cases/save_query_result/save_query_result_show_count.{sql,result}(SHOW COUNT path, including the corrupt-input warning boundary) andtest/distributed/cases/git4data/branch/diff/diff_18.{sql,result}(DATA BRANCH DIFF over a SET column with saving ON, asserting the diff row and an int-safe column projection of theresult_scanreadback).Verification (isolated external mo-service with a private port config; no shared clusters)
mainatda0c931aa7(baseline binary built from that source): DIFF+SET with saving ON -> client lost connection (2013), server-side unrecovered panic (uint64, not int64inconvertRowsIntoBatchviasatisfyDiffOutputOpt/diffMergeAgency) and service exit code 2; the saving OFF path worked on the same instance.da0c931aa7+ this change: DIFF/SET rows identical with saving OFF vs ON (set_branch | UPDATE | 1 | 3),vpublished as unsignedLONGLONG(type 8, flags 0x20, length 64),result_scanreadback identical, and both the statement connection and a second concurrent connection stayed alive;SHOW COUNT(*)returned 0/0 and then 0/1 across a corrupt-input warning with proper@@session.warning_countmetadata; server stopped cleanly and all TCP/UDP listeners were released.pkg/frontendselections - 14 runs, all PASS, exit code 0.make static-check-selected STATIC_CHECK_PACKAGES=./pkg/frontend/...-0 issues., exit code 0.optools/bvt_ut/entrypoint.sh:./run.sh -n -g -o -p <cases> -e optimistic, plus exact case selection-i diff_18,save_query_result_show_countand the repo resource path): both case files executed,TOTAL 20 / SUCCESS 20, 100% success rate, original exit code 0. The CI-nflag skips result-metadata comparison; the same two cases additionally passed in the default full-comparison mode (20/20, exit code 0), and real-protocol consumers separately verified types, values and metadata as described above.mo-testercannot parse column lengths >= 2^31 (Integer.parseIntoverflow on the saved VARCHAR length4294967295); therefore theresult_scanassertion indiff_18.sqlprojects the int-safe columns (id,v) instead ofselect *.Limitations (deliberately not overclaimed)