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
[Bug]: SUM() over a boolean expression rejected with bad value [BOOL] (MySQL compatibility) #24547
A very common MySQL idiom SUM(<boolean expr>) (count rows matching a condition) fails in MatrixOne.
Reproduce
SELECTSUM(v >1) FROM (SELECT0AS v UNION ALLSELECT2) t;
-- e.g. SUM(status = 'ERROR') over a spans table
Actual
ERROR 20203 (HY000): invalid argument aggregate function sum, bad value [BOOL]
Expected
MySQL coerces booleans to 0/1, so SUM(boolean_expr) returns the count of true rows. Workaround: SUM(CASE WHEN v > 1 THEN 1 ELSE 0 END).
Found while evaluating MatrixOne git4data / SQL as a data-versioning & agent-trace backend. Version: 8.0.30-MatrixOne-v3.0.11 (MatrixOne v3.0.11).
Testing background
Found while computing per-trace error counts over an OpenTelemetry agent-trace table stored in MatrixOne: the natural rollup is SUM(status = 'ERROR') grouped by trace, to get error counts/rates per agent run.
Why it matters (expected purpose)
We're using MatrixOne as a queryable + versionable agent-trace backend; error-rate rollups via SUM(<bool>) are an extremely common, idiomatic MySQL pattern. Supporting boolean->0/1 coercion in SUM keeps observability queries simple and MySQL-compatible.
Activity
test: add comprehensive BVT cases for SUM/AVG over boolean expressions