You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Compatibility]: VAR/STDDEV aggregates reject BOOL and ENUM inputs accepted by MySQL #30180
MySQL accepts BOOLEAN and ENUM columns as inputs to statistical aggregates, converting them to numeric values. MatrixOne rejects both types during aggregate binding.
Reproductions
CREATETABLEenum_t (e ENUM('b','a','c'));
INSERT INTO enum_t VALUES ('b'), ('a'), ('c');
SELECT VAR_POP(e), VAR_SAMP(e), STDDEV_POP(e), STDDEV_SAMP(e) FROM enum_t;
CREATETABLEbool_t (b BOOLEAN);
INSERT INTO bool_t VALUES (TRUE), (FALSE), (TRUE);
SELECT VAR_POP(b), VAR_SAMP(b), STDDEV_POP(b), STDDEV_SAMP(b) FROM bool_t;
MySQL 8.0.46 returns 0.6666666666666666, 1, 0.816496580927726, 1 for the ENUM case and 0.22222222222222224, 0.33333333333333337, 0.4714045207910317, 0.5773502691896258 for BOOLEAN.
MO rejects VAR_POP(e) with invalid argument aggregate function var_pop, bad value [ENUM] and VAR_POP(b) with the corresponding [BOOL] binding error. The same rejection was observed for VAR_SAMP, STDDEV_POP, STDDEV_SAMP, STDDEV and STD aliases on ENUM. Explicit numeric controls (VAR_POP(e + 0) and VAR_POP(CAST(b AS DOUBLE))) execute and match MySQL.
Expected behavior
The statistical aggregates should accept these MySQL numeric-context operands: BOOLEAN should use its 0/1 values and ENUM should use its ordinal, without requiring applications to add explicit casts.
No BOOL/ENUM statistical-aggregate exception is listed in the compatibility contract; issue search found no matching report.
Environment
MatrixOne local runtime commit: 2ce4e58af6f03b943ee288ffad81012766cf830a.
Current origin/main inspected at a53390c57de48ac280249ff0e88831e502e20fb0; the relevant aggregate binder is unchanged from the tested runtime. The runtime itself was not rebuilt at that newer SHA.
changed the title [-][Compatibility]: VAR/STDDEV aggregates reject ENUM operands accepted by MySQL[/-][+][Compatibility]: VAR/STDDEV aggregates reject BOOL and ENUM inputs accepted by MySQL[/+]on Oct 14, 2026
Regression and extended verification for #30180 (2026-10-16)
Verification Environment
MatrixOne origin/main: b24d1b311555e0b6f3d56eb37f9a2e9617e9a5b7 — fix(window): support temporal interval frame parameters and string parsing (#30310). The running 2-CN cluster's mo-service -version identified this exact main commit and Go 1.27.1; the clean local source worktree matched it.
Full topology: 2 CN / 1 TN / 1 Log service / 1 Proxy. Proxy 127.0.0.1:6771 (container port 6009), CN1 127.0.0.1:16771 (container port 16001), and CN2 127.0.0.1:16772 (container port 16002) were all reachable. The original ENUM/BOOLEAN aggregate SQL was actually executed through each endpoint using the MySQL text protocol. The final MOTR cherry-pick replay used a second isolated cluster built from the same main at Proxy 127.0.0.1:6851; it did not claim direct CN execution from that replay alone.
Local MySQL 8.0.46 was the compatibility control. Direct checks used PyMySQL/MySQL text protocol; SQL PREPARE/EXECUTE was exercised. The MOTR case used a single serial MySQL-protocol connection (-j 1).
What Was Covered
OK — Original reproductions: VAR_POP, VAR_SAMP, STDDEV_POP, and STDDEV_SAMP accepted ENUM('b','a','c') ordinals 1,2,3 and BOOLEAN values 1,0,1. Results on Proxy, CN1, and CN2 matched MySQL 8.0.46: ENUM population/sample variance 0.666667/1.000000; BOOLEAN population/sample variance 0.222222/0.333333; the corresponding standard deviations matched within 0.000001.
OK — Explicit numeric controls VAR_POP(e+0) and VAR_POP(CAST(b AS DOUBLE)), plus STDDEV and STD aliases, agreed with the uncast results. This distinguishes ordinal numeric aggregation from accidentally treating ENUM labels as numbers.
OK — Singleton input returned population variance 0 and sample variance NULL; empty input and all-NULL input returned NULL. SQL-prepared execution reused one statement with numeric ENUM-ordinal filter boundaries 1, 2, then 1, yielding 0.25, 0, then 0.25 without changing the aggregate operand type. Connections remained healthy.
Not covered — Binary-protocol/JDBC prepared statements, long-running or large-row-count aggregation, engine-internal parallel workers, and a fresh mo-tester/full BVT or TKE run on this exact main. The fix PR's own BVT covered grouping and window forms, but those forms were not independently rerun here.
Findings
Fixed on the tested main: the prior invalid argument aggregate function var_pop, bad value [ENUM] and [BOOL] binding errors did not occur in the original cases. The numerical results matched MySQL 8.0.46.
Fix: MatrixOne PR #30223, merged as 678b72b9292cd5e9e26c90b469e575322bb0f617 (fix(sql): accept BOOL and ENUM in statistical aggregates (#30223)). It resolves BOOL through the existing INT8 numeric cast and ENUM through its UINT16 ordinal, reusing the statistical aggregate executors while preserving NULL and cardinality behavior.
Large-data regression: not needed. The bug is aggregate operand-type binding, not a row-count, block/batch, memory/spill, skew, or network threshold. Three non-NULL rows plus singleton, empty, and all-NULL controls are the smallest stable dataset that distinguishes the required statistical results.
MOTR / BVT Coverage
MOTR was based on origin/main4fd475a39876cdbd8aec5a025b9826a74a1cc48b. The independent branch test/issue-30180-stat-agg-bool-enum contains commit 8db0dfd7eab45ecfda124b3a2ef9266298a15b71 (test: add MOTR regression for #30180) with one .test/.result pair; no MatrixOne service source was changed.
MOTR recording and normal replay passed: 1/1 case, 23/23 statements, 0 skipped/failed. The daily cherry-pick d831a840b5b7fe149d03b62f0faa3d7c42afca84 was separately replayed with the same result on daily MOTR PR #246. The test database was absent after replay. Runs were serial (-j 1); engine parallelism was not asserted.
PR fix(sql): accept BOOL and ENUM in statistical aggregates #30223 reports its targeted MatrixOne BVT passed 31/31 twice on its fix tree. I did not rerun mo-tester or the full BVT suite on the latest main; the direct three-endpoint checks and MOTR runs above are this verification's evidence.
Final Conclusion
Fixed on MatrixOne mainb24d1b311555e0b6f3d56eb37f9a2e9617e9a5b7 for the reported MySQL-compatible BOOL/ENUM statistical aggregates. The original SQL, MySQL comparison, negative/cardinality controls, prepared reuse, and recorded/replayed MOTR coverage passed. Large-data regression is not required for this type-binding issue.
Activity
[-][Compatibility]: VAR/STDDEV aggregates reject ENUM operands accepted by MySQL[/-][+][Compatibility]: VAR/STDDEV aggregates reject BOOL and ENUM inputs accepted by MySQL[/+]fix(sql): accept BOOL and ENUM in statistical aggregates (#30223)
slyunnn commentedon Oct 16, 2026
Regression and extended verification for #30180 (2026-10-16)
Verification Environment
origin/main:b24d1b311555e0b6f3d56eb37f9a2e9617e9a5b7—fix(window): support temporal interval frame parameters and string parsing (#30310). The running2-CN cluster'smo-service -versionidentified this exactmaincommit and Go1.27.1; the clean local source worktree matched it.2CN /1TN /1Log service /1Proxy. Proxy127.0.0.1:6771(container port6009), CN1127.0.0.1:16771(container port16001), and CN2127.0.0.1:16772(container port16002) were all reachable. The originalENUM/BOOLEANaggregate SQL was actually executed through each endpoint using the MySQL text protocol. The final MOTR cherry-pick replay used a second isolated cluster built from the samemainat Proxy127.0.0.1:6851; it did not claim direct CN execution from that replay alone.8.0.46was the compatibility control. Direct checks used PyMySQL/MySQL text protocol; SQLPREPARE/EXECUTEwas exercised. The MOTR case used a single serial MySQL-protocol connection (-j 1).What Was Covered
VAR_POP,VAR_SAMP,STDDEV_POP, andSTDDEV_SAMPacceptedENUM('b','a','c')ordinals1,2,3andBOOLEANvalues1,0,1. Results on Proxy, CN1, and CN2 matched MySQL8.0.46:ENUMpopulation/sample variance0.666667/1.000000;BOOLEANpopulation/sample variance0.222222/0.333333; the corresponding standard deviations matched within0.000001.VAR_POP(e+0)andVAR_POP(CAST(b AS DOUBLE)), plusSTDDEVandSTDaliases, agreed with the uncast results. This distinguishes ordinal numeric aggregation from accidentally treatingENUMlabels as numbers.0and sample varianceNULL; empty input and all-NULLinput returnedNULL. SQL-prepared execution reused one statement with numericENUM-ordinal filter boundaries1,2, then1, yielding0.25,0, then0.25without changing the aggregate operand type. Connections remained healthy.main. The fix PR's own BVT covered grouping and window forms, but those forms were not independently rerun here.Findings
main: the priorinvalid argument aggregate function var_pop, bad value [ENUM]and[BOOL]binding errors did not occur in the original cases. The numerical results matched MySQL8.0.46.678b72b9292cd5e9e26c90b469e575322bb0f617(fix(sql): accept BOOL and ENUM in statistical aggregates (#30223)). It resolvesBOOLthrough the existingINT8numeric cast andENUMthrough itsUINT16ordinal, reusing the statistical aggregate executors while preservingNULLand cardinality behavior.NULLrows plus singleton, empty, and all-NULLcontrols are the smallest stable dataset that distinguishes the required statistical results.MOTR / BVT Coverage
origin/main4fd475a39876cdbd8aec5a025b9826a74a1cc48b. The independent branchtest/issue-30180-stat-agg-bool-enumcontains commit8db0dfd7eab45ecfda124b3a2ef9266298a15b71(test: add MOTR regression for #30180) with one.test/.resultpair; no MatrixOne service source was changed.1/1case,23/23statements,0skipped/failed. The daily cherry-pickd831a840b5b7fe149d03b62f0faa3d7c42afca84was separately replayed with the same result on daily MOTR PR #246. The test database was absent after replay. Runs were serial (-j 1); engine parallelism was not asserted.31/31twice on its fix tree. I did not rerun mo-tester or the full BVT suite on the latestmain; the direct three-endpoint checks and MOTR runs above are this verification's evidence.Final Conclusion
Fixed on MatrixOne
mainb24d1b311555e0b6f3d56eb37f9a2e9617e9a5b7for the reported MySQL-compatibleBOOL/ENUMstatistical aggregates. The original SQL, MySQL comparison, negative/cardinality controls, prepared reuse, and recorded/replayed MOTR coverage passed. Large-data regression is not required for this type-binding issue.