Repository navigation
fix(sql): enforce DECIMAL UNSIGNED and ZEROFILL attributes end to end - #31739
Conversation
DECIMAL column declarations silently dropped the parsed UNSIGNED and ZEROFILL attributes: getTypeFromAstWithoutCharset selected decimal64/128/256 by precision and scale only, so the attribute never reached the persisted type, assignment admission enforced no unsigned domain (negative values were stored under every sql_mode), SHOW CREATE and information_schema.COLUMN_TYPE lost the modifiers, no zero-padded presentation was produced, and the CAST target grammar accepted UNSIGNED/ZEROFILL spellings that MySQL rejects with ERROR 1064. No versioned upgrade entry could reconcile the persisted information_schema.COLUMNS view text on existing clusters. - carry the attributes on plan.Type.numeric_attributes (proto field 14) from DDL through persistence, the catalog cache, table functions, arrowbridge/external readers, checkpoint tooling and sysview - enforce the unsigned domain at every assignment admission path (INSERT/UPDATE/LOAD/REPLACE/VALUES): strict mode rejects negatives with ERROR 1264 (22003) atomically, non-strict saturates to the lower bound with a 1264 warning, IGNORE accepts; ZEROFILL implies UNSIGNED - render attributes in SHOW CREATE and COLUMN_TYPE, and zero-pad values on all six decimal serialization/export sites plus result-column metadata - reject CAST(... AS DECIMAL(p,s) UNSIGNED|ZEROFILL) with ERROR 1064 - add version 4.0.18 one-shot information_schema.COLUMNS reconciliation with legacy-CDC admission gating, retained-target recheck and frozen offset preservation (MinUpgradeVersion 4.0.7, RequiredProtocolVersion 126) Tests: planner/executor/frontend/bootstrap/hakeeper unit tests, embedded cluster upgrade legs including maintenance-isolated ablation and post-replacement crash rollback/idempotent replay, full pkg/bootstrap tree, and the focused BVT file test/distributed/cases/dtype/decimal_unsigned_zerofill.test (144 statements covering strict/non-strict/IGNORE semantics, modifier masks 0/1/3, wide widths, NULL/defaults, UPDATE, wide wire and snapshot compatibility). Related to matrixorigin#30940
…COLUMNS BVT DDL CI run 40845538549 at head 5f7c3d2 failed Matrixone UT Coverage (4 tests) and multi-CN e2e BVT (3 rows); all were caused by this PR. Root causes and fixes: * pkg/bootstrap/service_upgrade_tenant.go (MaybeUpgradeTenant) and pkg/bootstrap/custom_upgrade.go (UpgradeOneTenant): upgrade planning stopped at the frozen consolidated v4.0.7 terminal entry, so tenants on older versions never received the forward v4.0.18 upgrade, and tenants already at 4.0.7 skipped the frozen terminal and the entries after it. Both paths now re-plan and run the v4.0.7 crossing upgrade on demand until no pending v4.0.7 upgrade remains, and UpgradeOneTenant skips the frozen terminal entry so the forward version still executes. Fixes UT Coverage failures in TestCollationsMetadataUpgrade, TestV407LoginRepairsTenantCreatedAfterUpgradeSnapshot, TestCallerOwnedTenantUpgradeRollsBackAndRetries and TestCatalogVersionOrderingUsesSemanticVersionAndOffset. * pkg/embed/catalog_view_identity_test.go: assert the semantic final version instead of a hardcoded "4.0.7". pkg/embed/catalog_upgrade_paging_test.go: retarget injected version samples to 4.1.9/4.1.10/4.1.11 so the semantic-vs-lexicographic ordering check still exercises versions newer than the new final version. * test/distributed/cases/dml/show/show.result and test/distributed/cases/zz_accesscontrol/account_restricted.result: splice the unsigned-decimal-decorated information_schema.COLUMNS view DDL (Create View descriptor 18848 chars, +209) into the three SHOW CREATE expectations. Fixes BVT failures at show.test row 295 and account_restricted.sql rows 55 and 113. Local proof: pkg/bootstrap and focused pkg/embed UTs pass; the decimal_unsigned_zerofill BVT passes 144/144 against a locally built instance; the three spliced SHOW CREATE rows are byte-exact (18848 chars) against the live upgraded instance.
|
This PR currently has CI failures that we verified as unrelated to this change; both share one root cause tracked in #31044:
|
CI run 40862553192 (job 123409348216, SCA Test on Linux/arm64) at head 74a4105 failed `make static-check-selected` with 9 findings, all in files added or modified by this PR: * pkg/container/arrowbridge/staging_text_test.go: gofmt(simplify) on the composite literal — collapse `decimal128.Num{}` to `{}`. * pkg/sql/plan/function/func_cast_unsigned_decimal.go: ineffassign on the `outcome` initializer, which is unconditionally overwritten by both classifier branches — declare the variable without a dead initializer. * pkg/sql/plan/function/func_cast_unsigned_decimal_test.go: two ineffassign findings for slots reassigned before use — discard the dead results with `_` and rescope the second result. * pkg/vm/engine/disttae/cache/catalog_column_update_numeric_attributes_test.go: prealloc on a 4-element literal followed by append — build the full 5-column slice in a single literal with capacity 5. * pkg/bootstrap/service_upgrade_crossing_test.go: unused `inTxn` field and unused `executionLog` accessor on crossingFakeDB — remove both. * pkg/embed/upgrade_columns_4_0_18_test.go: unused `readColumnsRoute` and `waitColumnsVersionReady` helpers left behind by earlier rounds — remove both and the now-orphaned testify/assert import. No behavior change: the production edit only changes the declared initializer binding, and every test edit touches dead code paths, dead assignments, or formatting. Local verification: `golangci-lint run -c .golangci.yml` on the five affected packages reports 0 issues; the targeted test files' suites all pass (arrowbridge staging-text suite, pkg/sql/plan/function TestUnsignedDecimalAdmission* + TestCastDecimalExtremeExponentRendering, disttae/cache TestColumnOnlyUpdateNeverDropsNumericAttributes, pkg/bootstrap TestCrossing*).
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: 9d109f531e34babed1ad5441a733918f58b8354d
Assessment: request_changes
One reproduced defect remains in Arrow staging-size estimation. The older CI admission-timeout concern is superseded by the supplied current-head results.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/container/arrowbridge/staging_text.go:165: Attributed-DECIMAL LOAD stages Arrow decimals using the supported scientific rendering fallback, such as precision 38 and scale 1000000000.
Impact: The precision+3 estimate omits exponent bytes, so MaxOutputRows admits multiple rows exceeding the configured logical batch budget. The reader materializes excess data before its later wire-size safeguard splits and copies the batch; discarded rows are subsequently rendered again.
Evidence: The retained TestReviewScientificStagingBudget probe admits two coefficient-10^37 rows under a 130-byte budget but materializes 148 bytes (146 for negative scale); the fixed-point control uses 124 bytes. See arrow-staging-probe.log:49–54 and checks/1793312351076577788-4.json. A diagnostic-only larger-bound control passes. Account conservatively for scientific exponents and physical coefficient lengths, with plain and dictionary regression cases.
Validation:
-
Isolation preflight and native build passed; 193 staged native inputs match the frozen source.
-
Eleven existing Arrow staging tests passed; the added budget probe failed as described. The diagnostic correction control passed. Receipts and logs were reconciled.
-
Complete decompressed protobuf descriptor comparison passed: only uint32 Type.numeric_attributes field 14 was added.
-
Supplied current-head CI reports successful build, UT, coverage, SCA and PROXY/PESSIMISTIC BVT. Discussion assessment covers all three keys; source remains unchanged.
Limitations:
-
The reproduction exercises the internal Arrow bridge, not public SQL; downstream wire-size enforcement remains effective. No OOM or data corruption was demonstrated.
-
Full SQL, upgrade and race suites were not rerun locally. Supplied upgrade compatibility jobs were skipped; raw CI and author-local logs were unavailable.
-
Review records, probes, logs and receipts are retained in the assigned attempt-1 diagnostic directory.
…onent renderedStageTextBound estimated one staged decimal row as precision+3 bytes, which only covers the fixed-point render form. A declared scale outside the fixed-point domain renders the bounded scientific form (<coeff>e<-scale>), whose exponent bytes the estimate omitted, and a forged record can carry more coefficient digits than the declared precision. MaxOutputRows then admitted windows of individually valid rows whose rendered staging payload exceeded the configured byte budget, so the reader materialized excess rows for its wire-size safeguard to split, copy, and discard. Charge the larger of the two reachable render forms over the physical coefficient span (39 digits for Decimal128, 77 for Decimal256 two's complement storage): fixed-point needs a sign, the digit run zero padded to the scale capped at 76, and the point; scientific needs a sign, the digits, and the e plus up-to-11-character exponent suffix. The literary maximum renders pin the resulting 79/90 byte bound exactly, and a plain/dictionary regression test proves the admitted window now materializes within its budget.
|
Fixed in P2
Regression coverage, both plain and dictionary encodings:
|
|
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: 1a96756f0d378a28a15cbeffe7d0c2570be5629b
Assessment: approve
The prior Arrow staging-budget finding is resolved. Physical-width bounds cover fixed-point and scientific rendering for plain and dictionary inputs. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Full isolated Arrow bridge package passed: 80 top-level tests, zero failures or skips. Evidence: arrowbridge-tests.log and checks/1793318238816321883-2.json.
-
Preflight and native build passed; 193 native-input hashes matched the frozen source. Receipts and logs are recorded in validation-audit.json.
-
All six discussion entries were reconciled in discussion-assessment.json; source remained unchanged.
-
Supplied current-head CI snapshot reports successful required checks.
Limitations:
-
Unchanged broader feature coverage was reused from supplied review evidence; SQL integration, upgrade and race suites were not rerun locally.
-
Raw CI logs were unavailable. Skipped upgrade compatibility jobs were not counted as passes.
🚫 Left the queue33 min in the queue, with no time running CI. So far
Reason Pull request #31739 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.
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. 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:
Related to #30940
What this PR does / why we need it:
Problem
DECIMALcolumn declarations silently dropped the parsedUNSIGNEDandZEROFILLattributes:DECIMAL(10,2) UNSIGNEDaccepted and stored negative values under everysql_mode, where MySQL rejects them withERROR 1264 (22003) Out of range value.DECIMAL(10,2) ZEROFILLproduced no zero-padded output, andSHOW CREATE TABLE/information_schema.columns.COLUMN_TYPElost both modifiers.CAST(x AS DECIMAL(p,s) UNSIGNED|ZEROFILL)was accepted, which MySQL rejects outright withERROR 1064.Root cause
Three coupled defects:
getTypeFromAstWithoutCharset) selected decimal64/128/256 by precision and scale only, discarding the parsed attributes, so the attribute never reached the persisted type, assignment admission, or any presentation surface.information_schema.COLUMNSview text on existing clusters, and no admission gate for legacy CDC tasks during that crossing.Changes
plan.Type.numeric_attributes(proto field 14) carries UNSIGNED/ZEROFILL from DDL through persistence, catalog cache, table functions, arrowbridge/external readers, checkpoint tooling and sysview.ERROR 1264 (22003)atomically (no partial writes), non-strict saturates to the lower bound with a 1264 warning,IGNOREaccepts;ZEROFILLimpliesUNSIGNED. Executor cast saturates to the unsigned domain with scale widening before negation.decimal(10,2),decimal(10,2) unsigned,decimal(10,2) unsigned zerofill); zero-padding is applied on all six decimal serialization/export sites (text rows ×2, binary rows ×2 including prepared, CSV and JSONLINE export) plus result-column display metadata.CAST(... AS DECIMAL(p,s) UNSIGNED|ZEROFILL)is rejected withERROR 1064 (42000), matching MySQL.information_schema.COLUMNSreconciliation entry with legacy-CDC admission gating, retained-target recheck, frozen-offset preservation (MinUpgradeVersion 4.0.7,RequiredProtocolVersion 126), so upgraded clusters decorate their persisted view text exactly once.Validation
3cf38889bc(every defect reproduced: negatives stored, modifiers dropped, no padding, CAST accepted) and (b) this change (strictERROR 1264 (22003)with zero rows stored, non-strict clip to0.00+ Warning 1264, modifiers retained in SHOW CREATE/COLUMN_TYPE for masks 0/1/3, zero-padded text and binary wire, both CAST spellingsERROR 1064, signed/NULL controls unchanged).test/distributed/cases/dtype/decimal_unsigned_zerofill.test(144 statements: strict/non-strict/IGNORE, modifier masks, wide widths, defaults, UPDATE, NULL, CAST rejection, persistence, snapshot compatibility):TOTAL 144 SUCCESS 144 SUCCESS RATE 100%;mo-testerresult regeneration byte-identical.go test ./pkg/embed/ -run 'TestColumnsUpgrade'— 7/7 PASS, including an ablation leg proving the 4.0.18 entry is solely responsible for decoration (background COLUMNS maintenance suppressed, undecorated predecessor verified) and a post-replacement-crash leg proving view-content and tenant-progress roll back together with idempotent restart replay; plusgo test ./pkg/bootstrap/...,go test ./pkg/hakeeper/, and the v4_0_18 commit-fence unit subcase, all green.Residual risks
information_schema.COLUMNS/TABLESmaintenance walker (kept enabled in production) also converges view text over time; the upgrade entry owns the deterministic crossing and the ablation leg proves its sole responsibility, but real-cluster non-upgrade convergence remains upstream-owned behavior.CI fix update (2026-10-29, commit 74a4105)
CI run 40845538549 at the previous head failed Matrixone UT Coverage (4 tests) and multi-CN e2e BVT (3 rows); all were caused by this PR and are fixed in
74a4105d94:pkg/bootstrap/service_upgrade_tenant.go,pkg/bootstrap/custom_upgrade.go):MaybeUpgradeTenant/UpgradeOneTenantplanning stopped at the frozen consolidated v4.0.7 terminal entry, so tenants on older versions never received the forward v4.0.18 upgrade and tenants already at 4.0.7 skipped it. Both paths now re-plan and run the v4.0.7 crossing on demand until no pending v4.0.7 upgrade remains, and the frozen terminal entry is skipped so the forward version still executes. FixesTestCollationsMetadataUpgrade,TestV407LoginRepairsTenantCreatedAfterUpgradeSnapshot,TestCallerOwnedTenantUpgradeRollsBackAndRetries,TestCatalogVersionOrderingUsesSemanticVersionAndOffset.pkg/embed/catalog_view_identity_test.go,pkg/embed/catalog_upgrade_paging_test.go): assert the semantic final version instead of hardcoded4.0.7; injected version samples retargeted to 4.1.9/4.1.10/4.1.11 to preserve the semantic-vs-lexicographic ordering check.test/distributed/cases/dml/show/show.test,zz_accesscontrol/account_restricted.sql): spliced the unsigned-decimal-decoratedinformation_schema.COLUMNSSHOW CREATE DDL (Create View descriptor 18848 chars, +209) into the three expectations; fixes show.test row 295 and account_restricted.sql rows 55/113.Local verification: pkg/bootstrap package suite green; both embed tests pass with
-v; focuseddecimal_unsigned_zerofillBVT 144/144 pass via mo-tester against a locally built instance; the three spliced SHOW CREATE rows are byte-exact (18848 chars) against the live upgraded instance.CI fix update #2 (2026-10-29, commit 0a05d68)
CI run 40862553192 at head 74a4105 failed
SCA Test on Linux/arm64(job 123409348216):make static-check-selectedreported 9 static-analysis findings, all in files owned by this PR. Fixed in0a05d68642:pkg/container/arrowbridge/staging_text_test.go: gofmt(simplify) — collapsedecimal128.Num{}to{}in the composite literal.pkg/sql/plan/function/func_cast_unsigned_decimal.go: ineffassign — drop the deadoutcomeinitializer (both classifier branches always assign).pkg/sql/plan/function/func_cast_unsigned_decimal_test.go: two ineffassign findings — discard results reassigned before use, rescope the second JSON admission result.pkg/vm/engine/disttae/cache/catalog_column_update_numeric_attributes_test.go: prealloc — build the 5-column fixture slice in a single literal with full capacity.pkg/bootstrap/service_upgrade_crossing_test.go: unusedinTxnfield andexecutionLogaccessor removed.pkg/embed/upgrade_columns_4_0_18_test.go: unusedreadColumnsRoute/waitColumnsVersionReadyhelpers and the orphanedtestify/assertimport removed.No behavior change. Local verification:
golangci-lint run -c .golangci.ymlon the five affected packages reports 0 issues (the exact CI gate); the targeted suites all pass — arrowbridge staging-text suite,pkg/sql/plan/functionTestUnsignedDecimalAdmission* + TestCastDecimalExtremeExponentRendering,disttae/cacheTestColumnOnlyUpdateNeverDropsNumericAttributes, andpkg/bootstrapTestCrossing*.The same run's
UT Coverage on Ubuntu/x86failure (job 123409393777) and its downstreamCoveragemerge block are the knownTestCrossTargetUpgradeRecoveryembedded-cluster admission flake tracked in #31044 (comment below); the PR code does not execute in that fixture-acquire failure.Base update (2026-10-29, merge commit 983cad4)
Main advanced with #31662 (
641c34d259), which removed the periodicinformation_schema.COLUMNS/TABLESrepair walker and made the versioned 4.0.7 entry plusCREATE ACCOUNTinitialization own convergence. That removal conflicted with this PR's walker-ablation additions (which only existed so upgrade scenario tests could attribute decoration to the v4.0.18 entry). Merge983cad4dc3resolves it: the disable option, gate, and struct field are dropped together with the ablation argument at all 13 cluster-wiring call sites; with the walker gone, the scenario tests' attribution premise holds unconditionally. This PR's v4.0.18 one-shot COLUMNS reconciliation entry is unchanged and is exactly the supported convergence path on the new main.Verification on the merged tree:
go vetgreen onpkg/bootstrap/...,pkg/embed,pkg/frontend;golangci-lint(repo config) reports 0 issues on./pkg/bootstrap/...and./pkg/embed;pkg/bootstrapTestCrossing* and TestV407* pass;TestColumnsUpgradeAutomaticScenarioCompletionpasses as the merged-premise end-to-end smoke.The residual-risks note above mentioning the background walker "also converges view text over time" is superseded: on current main the walker no longer exists and the versioned entries own convergence.
CI fix update #3 (2026-10-29, commit a15f2bf)
CI run 40880503711 at head 983cad4 (after the #31662 merge) failed
UT Coverage on Ubuntu/x86(job 123471690727):TestCreateAccountCatalogInitializationinpkg/tests/sqlintegrationfailed in 3.35s. That test was introduced by #31662 with a hard-codedcreate_versionexpectation of4.0.7; this PR registers the v4_0_18 upgrade handle, so on the PR headGetFinalVersion()is4.0.18andCREATE ACCOUNTstampsmo_account.create_version = '4.0.18'(bound tobaseService.GetFinalVersion()inauthenticate.go). The stale literal is updated to4.0.18ina15f2bff2b; the sibling scenario incollations_metadata_test.goalready compares against the dynamicupgrader.GetFinalVersion()and passed in the same job. No production-code change.CI fix update #4 (2026-10-30, commit 66bae00)
CI run 40902981503 at head a15f2bf failed
Matrixone Coverage execution / Coverage(job 123577267924): this PR's own diff coverage measured 536/717 = 74.76%, below the 75% PR-coverage gate. The failure is PR-caused (the gate only counts blocks this PR adds or modifies), so the root cause is fixed with genuine test additions rather than any gate change; nothing outside test files is touched:pkg/sql/plan/function/func_cast_unsigned_decimal_test.go: admission-matrix coverage for the uncovered blocks infunc_cast_unsigned_decimal.go— signed fixed-width sources rejecting negative rows (1264/22003) and pass-through for non-negative float/int/uint/bool/bit rows; date/datetime/timestamp/enum decodes; select-list row skipping across fixed, JSON, binary and varlena inputs; binary decimal128/256 payload decoding and empty-payload errors; the MySQL-prefix charset fast path; string outcome branches (pass through, clip-to-zero with WARN_DATA_TRUNCATED + 1264 warnings under ignore policy, and the fit-abstain path); varlena NULL rows; and the nil-process out-of-range warning fallback.pkg/container/arrowbridge/staging_text_test.go: staged-text rendering for the remaining Arrow scalar kinds (int8/16/32, uint8/16/32/64, float16/32, decimal256), the rendered upper-bound table for int/float/bool kinds plus its unsupported-source rejection, context cancellation observed in both the whole-batch conversion and the per-column staged loop, and row-budget rejection for unsupported staged sources.pkg/common/moerr/error_out_of_range_column_test.go(new):NewOutOfRangeValueForColumnNoCtxkeeps the 1264/22003 wire contract naming the column and 1-based row.pkg/container/types/attributed_decimal_oid_test.go(new):T.IsAttributedDecimalOidaccepts exactly the decimal family.Local verification, reproducing the CI gate exactly: artifact profiles from the failed run (UT + BVT pessimistic + BVT compose) merged by block key with the profiles of these tests (same Go 1.27.1 toolchain), then the CI
parse_coverage.pyrerun over this PR's diff: total 717 modified blocks, covered 602, PR coverage 83.96% → pass (margin +9 points over the gate). All named suites pass locally (arrowbridge staging-text file,pkg/sql/plan/functionTestUnsignedDecimalAdmission* + TestAppendUnsignedDecimalOutOfRangeWarning*, moerr, types).No production-code change; no CI/workflow change.
Base update (2026-10-30, merge commit 8cc3ce9)
GitHub reported the PR CONFLICTING after main advanced with #31628 (FK rebind to surviving keys,
969998e697), #31738, #31746, #31766, #31767, #31768, #31777. The only content conflict waspkg/sql/plan/build_ddl_test.go: both sides appended independent test functions afterTestSessionDatabaseNullability. The resolution keeps both — this PR'sTestBuildCTASUnsignedDecimal{Attribute,SetOperation}Provenanceand main's FK-rebind tests — with no changes to either test body.All other shared files auto-merged on disjoint hunks, verified by comparing both sides' diff regions against the merge base
641c34d259:pkg/common/moerr/error{,_no_ctx}.go(this PR'sErrOutOfRangeValueForColumn20211 vs main'sErrDataBranchConflict22501, different code groups),pkg/sql/plan/build_ddl.go(this PR's CTAS default/attribute region vs main's FK-rebind region), plusbase_binder.go,build_alter_table.go,query_builder.go, andpkg/vm/engine/disttae/txn_table.go.Local verification on the merged tree (Go toolchain, repo Makefile CGO flags):
go build ./pkg/common/moerr/... ./pkg/sql/plan/... ./pkg/vm/engine/disttae/...— green.go test ./pkg/common/moerr/— pass (covers both error-catalog sides).go test ./pkg/vm/engine/disttae/cache/ -run TestColumnOnlyUpdateNeverDropsNumericAttributes— pass (4 subtests).go test ./pkg/sql/plan/ -run '<19-test seam regex>'— all 19 top-level tests pass: this PR's 9 unsigned-decimal suites, main's 8 FK-rebind suites,TestSessionDatabaseNullability,TestBuildCTASPreservesMySQLSpecialColumnTypes.No production-code change in the resolution beyond the merge itself; no CI/workflow change. Fresh CI on the new head was not awaited.
CI fix update #5 (2026-10-30, commit 9d109f5)
CI run 40929677611 (attempt 1) at head 8cc3ce9 failed
Matrixone CI execution / UT Test on Ubuntu/x86(job 123645508612): packagepkg/sql/plan/functionfailed with--- FAIL: TestUnsignedDecimalAdmissionTemporalEnumAndUnsupportedSources—panic: type mismatch: casting ENUM vector to []uint16— andCI Requiredfailed as a consequence. The failure is PR-caused: the enum decode case added in update #4 built its ENUM input vector throughtestutil.NewVector, whoseT_enumbranch appends plainuint16;vector.AppendFixed[uint16]trips the race-buildcheckTypeIfRaceDetectorEnabledinpkg/container/vector(an enum-typed vector is not type-compatible with[]uint16). UT runs with-race, so the panic only fires there; local non-race runs passed, which is how it escaped update #4. Production code is unaffected: the admission path already reads enum vectors throughunsignedDecimalAdmissionFixed[types.Enum].Fix, test-only and one spot:
pkg/sql/plan/function/func_cast_unsigned_decimal_test.go: construct the enum source withvector.NewVec(types.T_enum.ToType())+vector.AppendFixed(types.Enum(7)), the enum vector construction already used elsewhere in the tree (e.g.pkg/sql/compile/fuzzyCheck_test.go).Local verification with the race detector (Go 1.27.1, repo Makefile CGO flags):
go test -race -run '^TestUnsignedDecimalAdmissionTemporalEnumAndUnsupportedSources$' ./pkg/sql/plan/function/ -count=1 -vpanics with the identicaltype mismatch: casting ENUM vector to []uint16seen in the CI log.go test -race ./pkg/sql/plan/function/ -count=1— the package CI aborted early at the panic — passes end to end.No production-code change; no CI/workflow change. Fresh CI on the new head was not awaited.
Review fix update #1 (2026-10-30, commit 1a96756)
The local review at
9d109f531e(CHANGES_REQUESTED) reproduced one P2 defect inpkg/container/arrowbridge/staging_text.go:renderedStageTextBoundestimated a staged Arrow decimal row asprecision + 3bytes, which only covers the fixed-point render form. A declared scale outside the fixed-point domain renders the bounded scientific form (<coeff>e<-sf>), whose exponent bytes the estimate omitted, and a forged record can carry more coefficient digits than the declared precision.MaxOutputRowsthen admitted a window of individually valid rows whose rendered staging payload exceeded the configured byte budget — the probe admitted two 10^37 rows at scale 1e9 under a 130-byte budget but materialized 148 bytes (146 at scale -1e9) — leaving the reader's wire-size safeguard to split, copy, and discard the excess rows.Fix, scoped to the shared bound helper:
pkg/container/arrowbridge/staging_text.go:renderedStageTextBoundnow charges decimals the larger of the two reachable render forms over the physical coefficient span — Decimal128 at most 39 digits (|2^127|), Decimal256 at most 77 (|2^255|), signed two's-complement storage — independent of the declared precision. Fixed-point needs a sign, the digit run zero-padded to the gate-capped scale (<= 76), and the point; scientific needs a sign, the digits, andeplus the at-most-11-character negated int32-scale text. The resulting conservative row bounds are 79 bytes (Decimal128) and 90 bytes (Decimal256).Regression coverage (
pkg/container/arrowbridge/staging_text_test.go):TestMaxOutputRowsAccountsScientificStagedText(new, replicates the review probe): plain and dictionary-encodedDECIMAL128(38, +/-1e9)rows of coefficient 10^37 under a 130-byte budget admit exactly one row, and the converted staging window materializes within the budget; a two-row budget admits both with the encoding-independent 148/146-byte footprints below the estimate.TestRenderedStageDecimalBoundCoversWorstRenders(new): the worst renders the gate can physically emit reach the bound exactly (Decimal256 scientific at scalemath.MaxInt32= 90 bytes; the shared renderer's fixed-point ceiling = 79 bytes), and a forged 39-digit Decimal128 coefficient stays inside the bound.TestRenderedStageTextBoundKinds: pins the 79/90 decimal bounds, including extreme declared scales;TestMaxOutputRowsAccountsRenderedStagedTextrow arithmetic updated to the new bound.Local verification (Go 1.27.1, repo Makefile CGO flags): the new regression tests fail on the pre-fix bound with the review's exact symptom (budget admits 2 rows, expected 1;
arrow-staging-probe.logequivalent), and the fullgo test ./pkg/container/arrowbridge/ -count=1passes after the fix.go test ./pkg/sql/colexec/external/ -count=1passes except the pre-existing environmentalTestExternalArrowLoadFromLocalMinIOAndRejectsObjectChange, whose local shared MinIO refuses writes because the host Data volume is at 100% capacity ("minimum free drive threshold"). Production-code change is confined to the row-size estimate rule; no CI/workflow change. Fresh CI on the new head was not awaited.