Repository navigation
Description
Description
MatrixOne collapses -0 and +0 in duplicate-eliminating set operations on FLOAT/DOUBLE, while MySQL 8.0.46 preserves the two signed-zero values as separate set members. As a result, UNION, INTERSECT, and EXCEPT return different row counts/membership across the two servers.
The MySQL compatibility contract README was checked and does not document signed-zero set-operation behavior as an exception. Existing reports #27425 and #28856 cover MatrixOne's internal signed-zero handling in aggregate paths; neither covers this set-operation difference. This issue is scoped to set-operation compatibility and does not reopen those closed issues.
Environment
- MatrixOne SQL runtime:
8.0.30-MatrixOne-v1.3.0, local single-CN/TN/LogService environment; the server binary was built from source commit2ce4e58af6f03b943ee288ffad81012766cf830a. - Current official
mainat report time:a53390c57de48ac280249ff0e88831e502e20fb0(10 commits ahead). The comparison contains no changes to the float key canonicalization/comparison or set-operation implementation paths; the runtime build SHA is stated separately rather than attributed to current main. - MySQL comparison server:
8.0.46.
Steps to reproduce
CREATE TABLE signed_zero_setop(id INT PRIMARY KEY, x DOUBLE);
INSERT INTO signed_zero_setop VALUES (1, -0e0), (2, 0e0);
SELECT COUNT(*)
FROM (
SELECT x FROM signed_zero_setop WHERE id = 1
UNION
SELECT x FROM signed_zero_setop WHERE id = 2
) q;
-- MatrixOne: 1
-- MySQL: 2
SELECT -0e0 INTERSECT SELECT 0e0;
-- MatrixOne: -0
-- MySQL: empty result
SELECT -0e0 EXCEPT SELECT 0e0;
-- MatrixOne: empty result
-- MySQL: -0The same UNION row-count difference was observed with both FLOAT and DOUBLE columns. DECIMAL -0.00/0.00 controls collapse to one row on both servers.
Stability and controls
UNIONcount: MatrixOne1/1/1, MySQL2/2/2.INTERSECTcount: MatrixOne1/1/1, MySQL0/0/0.EXCEPTcount: MatrixOne0/0/0, MySQL1/1/1.- Same-sign duplicate
UNIONreturns one row on both. UNION ALLretains both rows on both (unordered row order is not compared).-0e0 = 0e0returns true on both.
Expected behavior
If MatrixOne's MySQL compatibility contract includes set-operation duplicate semantics for FLOAT/DOUBLE, the row counts and membership should match MySQL 8.0.46 for these signed-zero inputs. The exact results above distinguish this from scalar equality and UNION ALL behavior.
Related
- [Bug]: COUNT(DISTINCT FLOAT/DOUBLE) splits signed zero when combined with another aggregate #27425 covers inconsistent MatrixOne
COUNT(DISTINCT FLOAT/DOUBLE)handling when combined with another aggregate; its merged fix canonicalizes signed zero to MatrixOne SQL equality semantics. - [Bug]: HLL distinct aggregates count positive and negative zero separately #28856 covers HLL aggregation of signed zero.
- [Bug]: PAD SPACE CHAR set operations return wrong UNION/INTERSECT/MINUS results #28952 covers PAD SPACE CHAR set-operation semantics, a different type/equality case.
Activity
XuPeng-SH commentedon Oct 22, 2026
QA follow-up for PR #30184 at current head
f4d2b87d4467b9e40c1a4eba6cd985f4ad27524e(2026-10-22).The latest commit is
chore: format planner helper; its commit diff only removes a blank line inpkg/sql/plan/flatten_subquery.go. The prior exact-code review on13d1d28capproved the signed-zero set-operation fix and reported 70 test roots across 14 packages, SQL probes under text/binary prepared execution, and exact-head CI. These are retained review/CI evidence; I did not rerun Go tests. The current head has no combined checks; the only visible workflow is unrelated Iceberg Connector E2E (success).I added Ariznawlll as an additional tester assignee and kept existing assignee iamlinjunhong. Please verify the FLOAT/DOUBLE -0/+0 UNION/INTERSECT/EXCEPT cases after the fix reaches main; keep this issue open for reporter confirmation. The review's limitation on fresh performance and live mixed-version testing remains noted.
Synchronize checkpoint — 2026-10-22
The PR has since synchronized onto
main@65b0738e3a50dbfb5b7c2b99de04a8b8c040ed1e; current head is3e0a8422f3a6b833b7e907fcfa3903fc2bd4ef5f(PR remains open). The latest commit advances this PR's set-key/scalar capability from MORPC 129 to 130 because the synchronized base now assigns 129 to selected JSON ELT/opaque-text execution. I checked the base and head protocol constants and the 14-file commit: the feature's placement, destination, send/receive, executor, CTAS and persisted-expression gates and tests move together; boundary tests retain rejection below 130 and acceptance at 130. No new actionable issue found in this protocol-number update.The exact-head combined status is empty. The only returned PR workflow is Iceberg Connector E2E (in progress), unrelated to SQL set operations. The PR body records updated official-main 129 / set-key 130 evidence and says new-head CI was triggered; those are author-provided records, not independent test execution. No submitted review after the earlier approval on
13d1d28cis present. This workspace is a shallow checkout on another SHA and has no Go runtime, so I could not run the protocol/planner/compiler tests locally.Issue #30155 remains open and assigned only to iamlinjunhong; no assignment or status change. Keep it with the implementer until the PR lands, then run the FLOAT/DOUBLE signed-zero UNION/INTERSECT/EXCEPT probes on the merge commit before handoff.
XuPeng-SH commentedon Oct 22, 2026
Correction to my previous QA follow-up on this issue.
#30184 (
fix(sql): preserve signed zero in float set operations) is still OPEN and not merged intomain, so per the QA transfer rule a hand-off to testing is premature: there is nothing onmainfor QA to verify yet.Action taken: removed
Ariznawlllfrom the assignees and restorediamlinjunhongas the sole owner, so the issue stays with the implementer until the fix lands. I will re-assign to QA (single assignee, dropping the implementer) once #30184 is merged and I have re-run the signed-zeroUNION/INTERSECT/EXCEPTprobes on a build of the merge commit.My earlier request to verify "after the fix reaches main" was the wrong sequencing.
XuPeng-SH commentedon Oct 22, 2026
QA finding for PR #30184 — last reviewed head 6424439
The prior submitted review reported a P2 SQL regression in
pkg/sql/plan/correlated_scalar_set.go:43: the blanketsubtreeContainsAggregateexclusion disabled scalar-set reaggregation when a UNION arm contained an aggregate independent of the outer correlation, and the arm-reuse proof stopped at the JOIN.Reported base/head probe: with
ot(i INT NOT NULL)= (1),(2),(3) andit(i INT NOT NULL, f DOUBLE NOT NULL)= (1,2.5),(2,2.5),(3,2.5), a correlated scalar subquery whose two identical UNION arms each joinitto(SELECT MAX(i) m FROM it)returned2:2.5at merge base060cb430e9ff59e60dc7bdade05758d343516acb, but failed at head6424439c70dcdeea3f52a3f62f01599d679fe145with error 20102: “correlated UNION branch identities differ or have unresolved types.” The corresponding single-arm DISTINCT control passed on both.Synchronize checkpoint — 2026-10-22
PR #30184 is still open and unmerged. Its current head is
1b9d9fd0d37619912adb307fcbb0fd7a2b6a3ad0(fix(plan): retain independent aggregates in scalar sets). I inspected that commit's diff: it changes admission from rejecting any aggregate to rejecting only correlated aggregates, and adds planner and SQL integration regression cases for the independent aggregate JOIN shape above. This is a code-level indication that the reported case is addressed; I have not independently run the new tests or the SQL repro on this head.The exact-head combined commit status returned no status checks. The only workflow run returned for this SHA is unrelated Iceberg Connector E2E (success). The PR description includes author-reported validation, but that is not treated here as my execution. The current workspace has no MatrixOne checkout/Go runtime, so local targeted execution is unavailable.
Issue #30155 remains open and assigned only to iamlinjunhong. No issue state or assignee change: keep it with the implementer until the fix is merged and the signed-zero compatibility probes plus this correlated aggregate regression are verified on the merged build.
2 remaining items
XuPeng-SH commentedon Oct 23, 2026
QA update — PR #30184 approval on current head
XuPeng-SH approved exact head
dc9467a31a49b31b5893f908b37ff32e1f803817on 2026-10-23. The approval reports the protobuf decoder/generator blocker fixed, four inline review threads resolved, and focused tests acrosspkg/pb/plan,pkg/pb/pipeline, and the string-literal postprocessor passing (89 top-level tests); it also reports postprocessor idempotence and linear nested-decode benchmark scaling.I independently checked the GitHub workflow record for that SHA: run 39871389802 completed successfully for UT, SCA, coverage, PROXY and PESSIMISTIC BVT, and CI Required. The local workspace has no MatrixOne checkout or Go runtime, so I did not rerun tests locally.
PR #30184 and this issue remain open; the issue stays assigned to the implementer until the fix is merged and the merge commit is verified.
XuPeng-SH commentedon Oct 23, 2026
Verification and tester handoff — PR #30184 (2026-10-23)
XuPeng-SH approved exact head
dc9467a31a49b31b5893f908b37ff32e1f803817in review 5631499611. The review records the signed-zero fix and protobuf decoder correction, 89 focused protobuf/postprocessor tests, 175 signed-zero subcases, and successful exact-head CI run 39871389802; these are reviewer-verified receipts, not tests I reran locally. This resolves the tracked set-operation compatibility finding for tester follow-up. Issue remains open; assigned toAriznawlllfor verification.iamlinjunhong commentedon Oct 26, 2026
Following review on #30184 (fengttt): MatrixOne will not match MySQL's signed-zero set membership here.
MatrixOne equality treats
-0and+0as equal, and set operations follow that equality.mainalready normalizes FLOAT/DOUBLE hash keys (keycodec.CanonicalFloat32Bits/CanonicalFloat64Bits: both zeros become0, and all NaN encodings become one canonical NaN). The current results are therefore the intended behavior:UNIONINTERSECTEXCEPTWhich zero is displayed depends on the input order, and is not part of the contract.
#30184 no longer changes behavior; it only adds regression tests locking the 1/1/0 results (including the
ALLvariants). For verification, please check those counts onmainrather than MySQL's 2/0/1.test(sql): lock normalized signed-zero set operations (#30184)
Ariznawlll commentedon Oct 29, 2026
结论
测试通过。按研发确认的 MatrixOne 契约,FLOAT/DOUBLE 的
-0和+0在集合运算中按数值相等处理;该语义与 MySQL 8.0.46 原报告的结果不同。关键证据
main@641c34d259447a6b70ce1ce0615a610e9d1a108e的隔离本地 1 CN、1 TN、1 LogService 上验证,运行版本为641c34d259。FLOAT/DOUBLE 两种列类型及左右输入互换均 3/3:单行-0与+0的UNION、INTERSECT、EXCEPT行数依次为 1、1、0;UNION ALL为 2,INTERSECT ALL为 1,EXCEPT ALL为 0。标量相等、NULL 和不同非零值对照通过;不要求输出零的符号固定。待解决点