Repository navigation
test(sql): lock normalized signed-zero set operations - #30184
Conversation
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? |
73912ed to
d48be22
Compare
|
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: d48be22e128ef9f3de3e0ff924533ab9626d867e
Assessment: request_changes
Reviewed the complete fourteen-file delta and affected consumers. Reusing physical equality keys is a sound way to isolate signed-zero set semantics. However, integration with correlated-query handling and predicate pushdown introduces two confirmed regressions.
Model: gpt-6-astra / xhigh
Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0
-
P2
pkg/sql/plan/query_builder.go:4868: On t(a INT,b INT,f DOUBLE), execute SELECT a FROM t o WHERE EXISTS (SELECT f FROM t i WHERE i.a=o.a AND i.b=o.b UNION SELECT f FROM t i WHERE i.a=o.a AND i.b=o.b). Identical arms using i.a>o.a also trigger the regression.
Impact: Previously supported queries now fail with error 20102. Prepared versions also fail when both arms select the integer constant 1. Preserve these correlation shapes when retaining float or prepared arms.
Evidence: All six public SQL probes pass with exact merge-base overlays. The candidate fails float/prepared multiple-predicate and range-predicate cases; single-equality controls pass. The new collapse restrictions expose flatten_subquery.go:4388–4404, which accepts only one matching equality identity per arm. Results are retained in public-base.log and public-head.log. -
P2
pkg/sql/plan/query_builder.go:4861: On t(k INT PRIMARY KEY,d DOUBLE), execute SELECT k,d FROM (SELECT k,d FROM t UNION SELECT k,d FROM t) u WHERE k=1.
Impact: Adding float physical keys activates the blanket filter-pushdown barrier, converting a selective primary-key lookup into full scans and hash aggregation. Preserve pushdown for predicates proven invariant under the equality key, including this predicate on the untouched integer column.
Evidence: With 4,096 finite rows, EXPLAIN PHYPLAN ANALYZE changes from one scanned row and 37 bytes of reported memory on base to two 4,096-row scans, an 8,192-input-row aggregate, and 761,904 bytes on HEAD. The integer-only control remains one scanned row and 25 bytes. The filter stays above aggregation because pushdown.go:944 rejects pushdown whenever PhysicalEqualityKeyList is populated. See perf-base.log and perf-head.log.
Validation:
-
Artifacts: /home/xupeng/.local/state/mo-bot/jobs/cf9b4aade4ab97927e6c6434/attempt-1. evidence-audit.json reconciles seven execution receipts with commands, source fingerprints, logs and overlay inputs. Final audit receipt 1792012368798373316-4.json exits 0; source remains unchanged.
-
Isolation preflight passed. Native provenance verified 192 current source inputs and 62 artifacts against the retained repository build-owner receipt and log.
-
Focused function, planner, group/spill and compile/remote-codec tests passed: receipt 1792012253239799077-3.json.
-
TestSetOperationSignedZero passed. Independent correlation probes passed on base and exposed four candidate failures: receipts 1792012264966570110-3.json and 1792012269810977520-3.json.
-
Both physical-work comparisons completed successfully: receipts 1792012294035663064-3.json and 1792012294734351744-3.json.
-
Frozen exact-head CI reports successful UT, static analysis, shared build, proxy/pessimistic multi-CN BVT and coverage.
Limitations:
-
The full linked issue body, raw CI logs and retained author validation artifacts were not supplied; local_validation was empty.
-
Local public SQL probes used one CN. Codec and compilation checks do not constitute a local multi-CN runtime run.
-
Performance evidence measures execution-plan work and memory, not sustained latency or concurrency. Full repository, BVT and race suites were not rerun locally.
fengttt
left a comment
There was a problem hiding this comment.
How about NaN? Is that handled correctly?
In any case, I think the fix should be in one (or 2) functions, float32/64 compare.
Those cryptic ScalaSetXXX should not exist at all. And preserve or not, is not important.
|
In response to review 5647929299, checked at exact head NaN: the set-key functions preserve the existing canonical NaN class. Only the exact negative-zero bit pattern takes their special branch; every NaN reaches Why comparison-only changes are insufficient: shared There is also a separate planning boundary: base Under the recorded acceptance boundary—set-only compatibility, unchanged ordinary equality, and repair of regressions made reachable by the fix—this PR does not implement a global comparator rewrite or remove the fallback without an equivalent replacement. Those proposed changes are not being reported as fixed. A smaller equivalent implementation is not ruled out, but comparison-only edits have not established one; no remaining NaN failure or replacement preserving the correlation/cardinality/resource contracts is demonstrated here. No code or test changes are made for this response. |
Review (fengttt) rejected preserving the zero sign in set membership: MatrixOne equality treats -0 and +0 as equal, and main already canonicalizes both (and every NaN encoding) in the hash key through keycodec.CanonicalFloat32Bits/CanonicalFloat64Bits. UNION, INTERSECT and EXCEPT therefore already return 1/1/0 for opposite zeros, which is the intended behavior; MySQL's 2/0/1 is not a compatibility target. This merge takes main's tree, dropping the set-only float keys, the ScalarSet* reaggregation path, the protocol gates and the RFC. Co-Authored-By: Claude Opus 5.5 <[email protected]>
FLOAT and DOUBLE -0/+0 are one set member for UNION, INTERSECT and EXCEPT (and the ALL variants), in either arm order; UNION ALL keeps both rows. The hash key test also covers FLOAT64 negative zero next to the existing FLOAT32 zero and NaN payload cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@fengttt You're right, and thanks for pushing back. The PR was chasing MySQL 8.0.46's signed-zero set membership (2/0/1), and that one decision is what pulled in the set-only keys and the MatrixOne equality treats -0 and +0 as equal, and The branch is now |
|
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: ea8981a438be31366f58bf173b66a060f6a00fda
Assessment: approve
Reviewed the complete two-file delta, affected owners and review concerns. No actionable findings remain. The tests preserve MatrixOne's existing normalized signed-zero semantics using the authoritative codec and shared SQL fixture. The earlier ScalarSet implementation is withdrawn; no production behavior or runtime cost changes.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Verified the frozen HEAD, clean source and complete 81-line test-only patch. Reviewed FLOAT/DOUBLE canonicalization, existing NaN coverage, SQL entry points, test oracles, timeout and cleanup ownership.
-
Reconciled exact-head CI run 40287595749. The SQL regression produced 15 named passing test/subtest events in race-enabled execution; its root completed in 1.33 seconds. All owning SQL-integration batches completed successfully.
-
Verified keycodec was selected without test filtering in the successful full-package race stage. Exact-head static analysis checked both changed packages; vet and lint succeeded with zero issues.
-
Recovered attempt-1 logs and seven command/source/exit receipts without repeating tests. Final reconciliation passed: attempt-2/checks/1793005914795943886-3.json. Evidence and scope are recorded in validation-ledger.json and review-record.json under /home/xupeng/.local/state/mo-bot/jobs/9df7e1a3901fc2b9e29a45a4/attempt-2.
Limitations:
-
Reused verified exact-head CI; no local native tests or separate BVT run was repeated. The retained summary omits the named codec-test event, but its unfiltered owning-stage execution and successful completion are recorded.
-
This locks MatrixOne's existing behavior; it does not implement MySQL's differing signed-zero set membership.
aptend
left a comment
There was a problem hiding this comment.
Re-reviewed exact head ea8981a438be31366f58bf173b66a060f6a00fda against merge-base 83c1e23526fc0ed31188abd7fc2ca87cd3a6d4b3, including the change from my previous reviewed head, all 41 historical reviews, 11 inline comments/replies, 33 discussion comments and all five threads. No blocking findings remain.
The complete current diff is two test files (+81). The production tree matches the declared base: the earlier set-only key/ScalarSet implementation and its related artifacts have been withdrawn. The tests lock the accepted existing MatrixOne normalized-zero membership contract; they do not implement MySQL's different signed-zero membership.
Validation:
- Full
keycodecsuite passed locally: 26 roots / 68 test-and-subtest executions, including the new FLOAT64 negative-zero assertion. TestSetOperationSignedZeroNormalizedpassed twice in one process on the shared single-CN fixture.- My temporary independent probe confirmed that the same INSERT inputs actually retain opposite IEEE zero signs for both FLOAT and DOUBLE through binary-prepared queries, and verified schema cleanup between repetitions. Both probe rounds passed; the overlay was removed.
- Audited and reused exact-head CI run 40287595749: all 15 named SQL test/subtest events and the owning race-enabled SQL-integration batches pass; configured static analysis for both changed packages succeeds. Skipped coverage/BVT jobs are not counted as executed.
No production behavior or new concurrency/resource mechanism is introduced by this final patch.
🚫 Left the queue35 min in the queue, with no time running CI. So far
Reason Pull request #30184 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:
What this PR does / why we need it:
MatrixOne treats
-0and+0as equal, and set operations follow that equality. We do not match MySQL 8.0.46, which keeps opposite signed zeros as separate set members.mainalready behaves this way. The hash key canonicalizes FLOAT/DOUBLE values inkeycodec.CanonicalFloat32Bits/CanonicalFloat64Bits: both zeros map to0, and every NaN sign/payload maps to one canonical NaN. As a result,UNION/INTERSECT/EXCEPTreturn 1/1/0 for opposite zeros, and NaN is a single set member.Following review, the earlier approach (set-only float keys,
ScalarSet*reaggregation, protocol gates, RFC) is withdrawn. The branch now carriesmain's tree plus regression tests:TestSetOperationSignedZeroNormalized: for FLOAT and DOUBLE, in both arm orders,UNION1,UNION ALL2,INTERSECT1,INTERSECT ALL1,EXCEPT0,EXCEPT ALL0, plus the literal-0e0 INTERSECT/EXCEPT 0e0cases.TestFloat32CodecContract: adds the missing FLOAT64 negative-zero assertion next to the existing FLOAT32 zero and NaN payload cases.Validation: both tests pass locally, and
go veton the two packages is clean.