Repository navigation
Fix returned JSON numeric comparison boundary cases (#30539) - #31719
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? |
|
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: 9c1c2fee49a0138074fa0f4df15dae03f7c5647a
Assessment: approve
The fix removes inappropriate integer narrowing from implicit JSON comparisons while preserving parameter validation, floating-point behavior and explicit CAST errors. Consumer tests retain error propagation and reuse coverage. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Reviewed all eight changed files, affected consumers, both discussion entries and linked QA follow-ups.
-
Static checks and independent numeric/golden oracles passed. Receipt: checks/1793277328664726898-2.json; log: review-check.log.
-
Reused supplied current-head UT, coverage, SCA, build and BVT success; verified earlier author-tested production/function/BVT inputs are unchanged.
-
Saved review-plan.md, discussion-assessment.json and validation-audit.json.
Limitations:
- No Go or SQL tests were rerun locally; raw per-test CI and author logs were not supplied.
|
Queued — the merge queue status continues in this comment ↓. |
aunjgr
left a comment
There was a problem hiding this comment.
Approved. The change removes the integer-peer range check from JSON-row comparison while retaining validation of the prepared numeric peer and the existing floating-point path. I checked the comparison orientations, wider signed/unsigned values, prepared reuse, explicit CAST controls, and caller regressions. No blocking issue found. I reused passing product CI and the documented validation; no separate local service test was run.
🛑 Pull request from fork cannot be queuedDetailsThis pull request comes from a fork, and Mergify needs the author's permission to update its branch. |
|
@Mergifyio queue |
🛑 Pull request from fork cannot be queuedDetailsThis pull request comes from a fork, and Mergify needs the author's permission to update its branch. |
9563933 to
6c2d00a
Compare
🚫 Left the queue42 min in the queue, with no time running CI. So far
Reason Pull request #31719 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 not met when it left the queue
Tick the box to put this pull request back in the merge queue (same as
2 merge conditions met
Times in UTC · dashboard · how the merge queue works |
…mixed-domain contract The rebase onto main (adopting matrixorigin#31719) exposed four consumer assertions in pkg/tests/issues still pinning the pre-matrixorigin#31121 conflation semantics that this branch removes deliberately: - issue_27529_test.go: the '{"active":null}' row expected SQL NULL folding; a character parameter 'true' was expected to parse into the JSON boolean document; object/array JSON vs a prepared boolean peer expected the removed JSON -> BOOLEAN cast error. - issue_27187_test.go: the '{"enabled":null}' row expected the same SQL NULL fold. JSON literal null is a ranked value and a character parameter is a JSON string scalar in every mixed domain (inventoried in func_json_scalar_semantics_31121 and func_json_extract.result on this branch), so those rows now expect valid false / ranked-comparable results. Each row was reproduced red on the rebased head before the correction and both fixtures pass afterwards.
…mixed-domain contract The rebase onto main (adopting matrixorigin#31719) exposed four consumer assertions in pkg/tests/issues still pinning the pre-matrixorigin#31121 conflation semantics that this branch removes deliberately: - issue_27529_test.go: the '{"active":null}' row expected SQL NULL folding; a character parameter 'true' was expected to parse into the JSON boolean document; object/array JSON vs a prepared boolean peer expected the removed JSON -> BOOLEAN cast error. - issue_27187_test.go: the '{"enabled":null}' row expected the same SQL NULL fold. JSON literal null is a ranked value and a character parameter is a JSON string scalar in every mixed domain (inventoried in func_json_scalar_semantics_31121 and func_json_extract.result on this branch), so those rows now expect valid false / ranked-comparable results. Each row was reproduced red on the rebased head before the correction and both fixtures pass afterwards.
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: - #30539 ## What this PR does / why we need it: Comparing a valid JSON number such as `1e100` with a FLOAT currently fails the whole query when the JSON value exceeds the FLOAT32 range. Compare out-of-range JSON values using their FLOAT64 value while preserving FLOAT32 rounding inside its range and the existing validation of the FLOAT peer. Explicit CAST behavior remains unchanged. This follows up on #31719, which removed the integer-domain restriction but retained the FLOAT32 range check. ### Validation - Focused JSON numeric and direct/prepared comparison unit tests; full function Go package, vet and lint passed on the same product code. - `function/func_json_extract.test`: 364/364 twice; ASOF: 74/74; join: 1254/1254 on a single-node instance. - The full function directory exited with 105 failures in four cases that hard-code port 6001 while the test instance used 37101. With only those case ports changed in temporary copies, all 166/166 assertions in those four cases passed. The original directory run did not pass. - Historical MySQL 8.0.45 comparisons covered the reported `1e100` equality case in both directions. MySQL FLOAT32 adjacent values were not measured, and no FLOAT performance benchmark was run. CI remains pending. ### CI repair validation (8bd4755) The [coverage failure](https://github.com/matrixorigin/matrixone/actions/runs/41617804875/job/125855672749) at `840bed3237960971b9c03eb62ef47ac52f820a8a` was reproduced locally: `TestPreparedJSONComparisonSelection` still expected JSON `1e100` versus FLOAT to fail. Updated that consumer oracle to assert nonmatching results for positive/negative out-of-range JSON values, selected rows, and FLOAT → DOUBLE → FLOAT rebinding. Product code is unchanged by this repair. New validation on Darwin/arm64, Go 1.27.1 at `8bd475530ba03fca6f9abec32cc1d2da2faca1a5`: - `mo-cgo-test -count=1 -timeout=120s -short -tags matrixone_test -covermode=set -run '^TestPreparedJSONComparisonSelection$' -v ./pkg/sql/colexec`: passed. - `mo-cgo-test -count=1 -timeout=240s ./pkg/sql/colexec ./pkg/sql/plan/function`: both full packages passed. - `go vet -mod=readonly` and incremental `golangci-lint run --new-from-rev c337122` for those two packages, with repository CGo inputs: passed (0 lint issues). The earlier SQL/BVT results above are reused because product code and BVT inputs did not change. Linux/x64 CI for this repair remains pending; the failed old run is not rerun. Approved-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #30539
What this PR does / why we need it:
QA returned #30539 after the previous fix (#30707): mixed JSON/numeric comparisons still reject valid JSON numbers outside an integer peer's CAST range. This follow-up fixes the returned numeric-boundary cases. A JSON value of 128 compared with a TINYINT 1, UINT64_MAX compared with BIGINT 1, or 1e100 compared with integer 1 aborts the query instead of producing a nonmatch.
Compare JSON numeric rows through the existing exact integer/decimal comparator without imposing the integer peer's width or signedness. Retain numeric parameter adapter validation, explicit CAST behavior, and existing floating-point conversion semantics. The correction removes a per-row integer conversion and adds no allocation, state, storage, or wire-format changes.
Update the existing direct/prepared comparison suites and JSON_EXTRACT BVT with numeric boundaries, negative/unsigned comparisons, all operators and operand orientations, precision and NULL/category controls, prepared reuse, scalar subqueries, joins, and explicit CAST errors.
Validation on macOS arm64, Go 1.27.1:
New regression assertions fail on unchanged production at official main 792a65b with the reported JSON-to-integer errors, then pass with the fix.
Focused JSON comparison tests and the complete function package pass (2360 top-level tests); incremental go vet and golangci-lint pass.
Repository native and mo-service builds pass. The JSON_EXTRACT BVT passes 342/342 commands twice on one isolated 1 LOG / 1 TN / 1 CN instance, with database/table teardown verified between and after runs. The three returned QA queries (TINYINT 128, UINT64_MAX, and 1e100) each return only id=1. Projection, reversed comparisons, JOIN, prepared execution/reuse, and explicit CAST controls also pass.
GPT-6 Astra medium design and integrated final review recorded locally. Local checks passed on commit b18e042; remote PR CI is pending.
CI repair validation on 9c1c2fe (macOS arm64, Go 1.27.1): coverage run 40836203108 exposed three consumer tests still expecting the integer-range errors removed by this fix. All three reproduced locally before the test correction. Updated selected-row, ASOF, direct SQL and prepared SQL assertions; retained FLOAT32 range/rebind, residual-error propagation/reuse, and explicit CAST rejection controls. The complete colexec/hashjoin packages and the full
TestIssue27529JSONStringsDoNotCompareAsBooleansfixture pass viamo-cgo-testwith-count=1 -short -tags matrixone_test -covermode=set; focused JSON consumer tests, incremental vet and lint also pass. Function-package CI (14.312s) and prior build/BVT evidence above are reused because their inputs are unchanged. This follow-up changes tests only; new-head CI is pending.CI refresh on 6c2d00a, rebased onto official main 950ef51:
git range-diffconfirms both original patches are unchanged. Focused JSON domain, direct-type resolution, adapter metadata/reuse, coercion, selected-row and ASOF tests, plus the fullTestIssue27529JSONStringsDoNotCompareAsBooleansSQL fixture, pass on macOS arm64/Go 1.27.1 throughmo-cgo-test -count=1 -short -tags matrixone_test; incremental vet/lint for all four affected packages and delivery-artifact checks pass. Prior unchanged-comparator/package/BVT evidence above is reused. In run 41273226176, SCA, UT Coverage, Coverage and both BVT lanes passed; ordinary race UT failed while initializing the shared two-CN fixture forTestAutoIDCachePublicLifecycle, before its callback. This refresh does not claim that startup failure is fixed or proven unrelated; new-head full CI remains pending.FLOAT32 rounding/range checks and FLOAT64 conversion retain their existing contract. This focused stateless comparison correction does not change planner eligibility, RPC capability, or distributed execution paths; multi-CN and rolling upgrade were not exercised.