Repository navigation
fix(geo): preserve point-touching components in ST_SymDifference - #28818
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at current head 6e5f68314e2570fdb511aa8e9e65271df920fbb8: no verified correctness blocker found.
I reviewed all six changed files from base a68a200c0bfb0c18f1b7f49d26b20b8d0d9b017f. The new connector directs selected edges with result interior on the left, pairs branch incidences by angular predecessor, enforces unique predecessors and closed bounded cycles, and splits repeated branch vertices before the existing shell/hole assembly. I checked all four Boolean operations, empty/identical/shared-edge/corner/vertex contacts, operand/ring reversals, shear, hole nesting, and multipolygon controls. SQL type/SRID/empty behavior and geometry encoding remain unchanged; graph errors propagate without partial results.
The updated large-coordinate BVT output is a ring-start rotation of the same polygon. The exact-head CI run 34763445116 completed successfully, including SCA, Ubuntu UT, coverage, shared build, PROXY and PESSIMISTIC multi-CN BVT. I also ran the exact-head pkg/geo tests and reviewer-only tangent-hole/four-contact/point-touching-hole probes plus 400 rectangle pairs across all four operators; area and simple-ring checks passed.
## What type of PR is this? - [x] Test and CI ## Which issue(s) this PR fixes: Related to #28538 (this PR is diagnostic and optimization work; it does not close the issue). ## What this PR does / why we need it: - The #28818 race UT run hit the existing 70-minute hard timeout during aggregate suite execution. It had no assertion failures in the emitted stream, but the suite was incomplete. - Adds cgroup memory diagnostics for every visible finite boundary, including current/peak and OOM counters, plus a final snapshot after all UT helpers join. - Keeps the existing bounded `UT_OVERLAP_LIGHT=1` treatment opt-in; the defaults remain `0` in both Makefile and optools/run_ut.sh because same-runner measurements regressed wall time and did not meet the memory-headroom gate. When explicitly enabled, HNSW runs first; light uses at most two package workers and overlaps only with the exclusive pkg/tests/issues stage. Each test/package still runs once. - Keeps ut_sharded: false and the existing runner/workflow/job count. No runner, job, or matrix is added. - Run 34770551755 / job 103759372556 completed successfully in 46m16s but logged LIGHT OVERLAP: 0 because Makefile still overrode the script default. Treat it as the serial baseline, not an optimization result. Its cgroup limit was 16 GiB, peak was 17,181,179,904 bytes, memory.events.max was 10, and OOM/OOM-kill were both 0; the hierarchy and event counters were visible. - No default-on performance claim is made. If an operator explicitly runs with `UT_OVERLAP_LIGHT=1`, compare it to the serial baseline and prior complete runs with matching runner/configuration/test scope; do not spend CI on extra serial controls. Exclude timed-out/cancelled runs from total-duration comparisons. - The stage-gap arithmetic ceiling from the prior trace is 21m24s, not a measured saving; contention could reduce the gain or make the result worse. ## Validation - bash -n optools/run_ut.sh - make -pn confirms the default `UT_OVERLAP_LIGHT = 0` (the overlap treatment remains an explicit opt-in) - GOWORK=off go test -mod=readonly -count=1 ./optools - git diff --check This PR is a diagnostic/guardrail change. Do not change the default to overlap=1 until a same-runner result is compared with the serial baseline and the cgroup/OOM evidence is reviewed.
…rixorigin#28818) ## What type of PR is this? - [x] BUG - [ ] API-change - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28183 ## What this PR does / why we need it: `ST_SymDifference` selected the correct XOR boundary edges for the reported polygons, but the old connector chose the next edge from event order at a multi-edge vertex. At `(0,1)` this joined two polygon components that touch at one point into a self-intersecting `POLYGON`, producing area 5 instead of 9. The connector now directs each selected edge with result interior on its left, groups incidences by snapped vertex, and uses the clockwise predecessor in angular order at branch vertices. Ordinary degree-two vertices use a no-sort path. Successor/predecessor uniqueness and closed-cycle invariants are checked; malformed boundary graphs return an internal error rather than being silently closed into invalid geometry. Repeated branch vertices are split into simple rings. Regression coverage checks both operand orders, reversed/rotated input rings, a sheared equivalent, the Boolean area identity, valid simple result rings, and point-touching components. Controls cover identical/shared-edge/corner/vertex-on-edge/contained/hole/multipolygon cases and 120 deterministic rectangle pairs. The public SQL fixture checks result type, component count, area, and each returned polygon's validity for both operand orders. ### Risks and performance - The change is limited to overlay result-boundary selection/connection; it does not change intersection detection, snap precision, SQL signatures, or geometry constructors. For an inconsistent noded boundary graph, the new behavior is an explicit internal error instead of the old connector's potentially invalid geometry. - On Apple M4, synthetic `BenchmarkOverlayUnion256/1024` runs show about 3–9% higher latency depending on run (baseline approximately 128 µs / 665 µs; final approximately 135–139 µs / 685–702 µs). Allocated bytes decrease from 215,384 to 212,392 B/op at 256 and from 928,089 to 888,341 B/op at 1024; allocation counts also decrease slightly. These small synthetic benchmarks are directional evidence, not a production workload claim. - Local distributed BVT was not run because another MatrixOne version is active on this host; it was not contacted or modified. Exact-head CI remains necessary for the SQL fixture. ### Validation - Confirmed the issue reproducer fails on the unchanged base and passes after the fix in package-level geo tests. - `GOWORK=off go test -mod=readonly -count=1 -timeout=180s ./pkg/geo` — PASS. - `GOWORK=off go vet -mod=readonly -vettool="$(command -v molint)" ./pkg/geo` — PASS. - `GOWORK=off golangci-lint run -c .golangci.yml ./pkg/geo` — PASS, 0 issues. - `git diff --check` — PASS. - GPT-6 Astra, reasoning effort medium: design review GO; final complete-diff review PASS at SHA-256 `73b72f78e7cca902781894a753d0b2c10e103f9d5f93f197237a5cdf01bd1321`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…rigin#28824) ## What type of PR is this? - [x] Test and CI ## Which issue(s) this PR fixes: Related to matrixorigin#28538 (this PR is diagnostic and optimization work; it does not close the issue). ## What this PR does / why we need it: - The matrixorigin#28818 race UT run hit the existing 70-minute hard timeout during aggregate suite execution. It had no assertion failures in the emitted stream, but the suite was incomplete. - Adds cgroup memory diagnostics for every visible finite boundary, including current/peak and OOM counters, plus a final snapshot after all UT helpers join. - Keeps the existing bounded `UT_OVERLAP_LIGHT=1` treatment opt-in; the defaults remain `0` in both Makefile and optools/run_ut.sh because same-runner measurements regressed wall time and did not meet the memory-headroom gate. When explicitly enabled, HNSW runs first; light uses at most two package workers and overlaps only with the exclusive pkg/tests/issues stage. Each test/package still runs once. - Keeps ut_sharded: false and the existing runner/workflow/job count. No runner, job, or matrix is added. - Run 34770551755 / job 103759372556 completed successfully in 46m16s but logged LIGHT OVERLAP: 0 because Makefile still overrode the script default. Treat it as the serial baseline, not an optimization result. Its cgroup limit was 16 GiB, peak was 17,181,179,904 bytes, memory.events.max was 10, and OOM/OOM-kill were both 0; the hierarchy and event counters were visible. - No default-on performance claim is made. If an operator explicitly runs with `UT_OVERLAP_LIGHT=1`, compare it to the serial baseline and prior complete runs with matching runner/configuration/test scope; do not spend CI on extra serial controls. Exclude timed-out/cancelled runs from total-duration comparisons. - The stage-gap arithmetic ceiling from the prior trace is 21m24s, not a measured saving; contention could reduce the gain or make the result worse. ## Validation - bash -n optools/run_ut.sh - make -pn confirms the default `UT_OVERLAP_LIGHT = 0` (the overlap treatment remains an explicit opt-in) - GOWORK=off go test -mod=readonly -count=1 ./optools - git diff --check This PR is a diagnostic/guardrail change. Do not change the default to overlap=1 until a same-runner result is compared with the serial baseline and the cgroup/OOM evidence is reviewed.
…rixorigin#28818) ## What type of PR is this? - [x] BUG - [ ] API-change - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28183 ## What this PR does / why we need it: `ST_SymDifference` selected the correct XOR boundary edges for the reported polygons, but the old connector chose the next edge from event order at a multi-edge vertex. At `(0,1)` this joined two polygon components that touch at one point into a self-intersecting `POLYGON`, producing area 5 instead of 9. The connector now directs each selected edge with result interior on its left, groups incidences by snapped vertex, and uses the clockwise predecessor in angular order at branch vertices. Ordinary degree-two vertices use a no-sort path. Successor/predecessor uniqueness and closed-cycle invariants are checked; malformed boundary graphs return an internal error rather than being silently closed into invalid geometry. Repeated branch vertices are split into simple rings. Regression coverage checks both operand orders, reversed/rotated input rings, a sheared equivalent, the Boolean area identity, valid simple result rings, and point-touching components. Controls cover identical/shared-edge/corner/vertex-on-edge/contained/hole/multipolygon cases and 120 deterministic rectangle pairs. The public SQL fixture checks result type, component count, area, and each returned polygon's validity for both operand orders. ### Risks and performance - The change is limited to overlay result-boundary selection/connection; it does not change intersection detection, snap precision, SQL signatures, or geometry constructors. For an inconsistent noded boundary graph, the new behavior is an explicit internal error instead of the old connector's potentially invalid geometry. - On Apple M4, synthetic `BenchmarkOverlayUnion256/1024` runs show about 3–9% higher latency depending on run (baseline approximately 128 µs / 665 µs; final approximately 135–139 µs / 685–702 µs). Allocated bytes decrease from 215,384 to 212,392 B/op at 256 and from 928,089 to 888,341 B/op at 1024; allocation counts also decrease slightly. These small synthetic benchmarks are directional evidence, not a production workload claim. - Local distributed BVT was not run because another MatrixOne version is active on this host; it was not contacted or modified. Exact-head CI remains necessary for the SQL fixture. ### Validation - Confirmed the issue reproducer fails on the unchanged base and passes after the fix in package-level geo tests. - `GOWORK=off go test -mod=readonly -count=1 -timeout=180s ./pkg/geo` — PASS. - `GOWORK=off go vet -mod=readonly -vettool="$(command -v molint)" ./pkg/geo` — PASS. - `GOWORK=off golangci-lint run -c .golangci.yml ./pkg/geo` — PASS, 0 issues. - `git diff --check` — PASS. - GPT-6 Astra, reasoning effort medium: design review GO; final complete-diff review PASS at SHA-256 `73b72f78e7cca902781894a753d0b2c10e103f9d5f93f197237a5cdf01bd1321`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…rigin#28824) ## What type of PR is this? - [x] Test and CI ## Which issue(s) this PR fixes: Related to matrixorigin#28538 (this PR is diagnostic and optimization work; it does not close the issue). ## What this PR does / why we need it: - The matrixorigin#28818 race UT run hit the existing 70-minute hard timeout during aggregate suite execution. It had no assertion failures in the emitted stream, but the suite was incomplete. - Adds cgroup memory diagnostics for every visible finite boundary, including current/peak and OOM counters, plus a final snapshot after all UT helpers join. - Keeps the existing bounded `UT_OVERLAP_LIGHT=1` treatment opt-in; the defaults remain `0` in both Makefile and optools/run_ut.sh because same-runner measurements regressed wall time and did not meet the memory-headroom gate. When explicitly enabled, HNSW runs first; light uses at most two package workers and overlaps only with the exclusive pkg/tests/issues stage. Each test/package still runs once. - Keeps ut_sharded: false and the existing runner/workflow/job count. No runner, job, or matrix is added. - Run 34770551755 / job 103759372556 completed successfully in 46m16s but logged LIGHT OVERLAP: 0 because Makefile still overrode the script default. Treat it as the serial baseline, not an optimization result. Its cgroup limit was 16 GiB, peak was 17,181,179,904 bytes, memory.events.max was 10, and OOM/OOM-kill were both 0; the hierarchy and event counters were visible. - No default-on performance claim is made. If an operator explicitly runs with `UT_OVERLAP_LIGHT=1`, compare it to the serial baseline and prior complete runs with matching runner/configuration/test scope; do not spend CI on extra serial controls. Exclude timed-out/cancelled runs from total-duration comparisons. - The stage-gap arithmetic ceiling from the prior trace is 21m24s, not a measured saving; contention could reduce the gain or make the result worse. ## Validation - bash -n optools/run_ut.sh - make -pn confirms the default `UT_OVERLAP_LIGHT = 0` (the overlap treatment remains an explicit opt-in) - GOWORK=off go test -mod=readonly -count=1 ./optools - git diff --check This PR is a diagnostic/guardrail change. Do not change the default to overlap=1 until a same-runner result is compared with the serial baseline and the cgroup/OOM evidence is reviewed.
…rixorigin#28818) ## What type of PR is this? - [x] BUG - [ ] API-change - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28183 ## What this PR does / why we need it: `ST_SymDifference` selected the correct XOR boundary edges for the reported polygons, but the old connector chose the next edge from event order at a multi-edge vertex. At `(0,1)` this joined two polygon components that touch at one point into a self-intersecting `POLYGON`, producing area 5 instead of 9. The connector now directs each selected edge with result interior on its left, groups incidences by snapped vertex, and uses the clockwise predecessor in angular order at branch vertices. Ordinary degree-two vertices use a no-sort path. Successor/predecessor uniqueness and closed-cycle invariants are checked; malformed boundary graphs return an internal error rather than being silently closed into invalid geometry. Repeated branch vertices are split into simple rings. Regression coverage checks both operand orders, reversed/rotated input rings, a sheared equivalent, the Boolean area identity, valid simple result rings, and point-touching components. Controls cover identical/shared-edge/corner/vertex-on-edge/contained/hole/multipolygon cases and 120 deterministic rectangle pairs. The public SQL fixture checks result type, component count, area, and each returned polygon's validity for both operand orders. ### Risks and performance - The change is limited to overlay result-boundary selection/connection; it does not change intersection detection, snap precision, SQL signatures, or geometry constructors. For an inconsistent noded boundary graph, the new behavior is an explicit internal error instead of the old connector's potentially invalid geometry. - On Apple M4, synthetic `BenchmarkOverlayUnion256/1024` runs show about 3–9% higher latency depending on run (baseline approximately 128 µs / 665 µs; final approximately 135–139 µs / 685–702 µs). Allocated bytes decrease from 215,384 to 212,392 B/op at 256 and from 928,089 to 888,341 B/op at 1024; allocation counts also decrease slightly. These small synthetic benchmarks are directional evidence, not a production workload claim. - Local distributed BVT was not run because another MatrixOne version is active on this host; it was not contacted or modified. Exact-head CI remains necessary for the SQL fixture. ### Validation - Confirmed the issue reproducer fails on the unchanged base and passes after the fix in package-level geo tests. - `GOWORK=off go test -mod=readonly -count=1 -timeout=180s ./pkg/geo` — PASS. - `GOWORK=off go vet -mod=readonly -vettool="$(command -v molint)" ./pkg/geo` — PASS. - `GOWORK=off golangci-lint run -c .golangci.yml ./pkg/geo` — PASS, 0 issues. - `git diff --check` — PASS. - GPT-6 Astra, reasoning effort medium: design review GO; final complete-diff review PASS at SHA-256 `73b72f78e7cca902781894a753d0b2c10e103f9d5f93f197237a5cdf01bd1321`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…rigin#28824) ## What type of PR is this? - [x] Test and CI ## Which issue(s) this PR fixes: Related to matrixorigin#28538 (this PR is diagnostic and optimization work; it does not close the issue). ## What this PR does / why we need it: - The matrixorigin#28818 race UT run hit the existing 70-minute hard timeout during aggregate suite execution. It had no assertion failures in the emitted stream, but the suite was incomplete. - Adds cgroup memory diagnostics for every visible finite boundary, including current/peak and OOM counters, plus a final snapshot after all UT helpers join. - Keeps the existing bounded `UT_OVERLAP_LIGHT=1` treatment opt-in; the defaults remain `0` in both Makefile and optools/run_ut.sh because same-runner measurements regressed wall time and did not meet the memory-headroom gate. When explicitly enabled, HNSW runs first; light uses at most two package workers and overlaps only with the exclusive pkg/tests/issues stage. Each test/package still runs once. - Keeps ut_sharded: false and the existing runner/workflow/job count. No runner, job, or matrix is added. - Run 34770551755 / job 103759372556 completed successfully in 46m16s but logged LIGHT OVERLAP: 0 because Makefile still overrode the script default. Treat it as the serial baseline, not an optimization result. Its cgroup limit was 16 GiB, peak was 17,181,179,904 bytes, memory.events.max was 10, and OOM/OOM-kill were both 0; the hierarchy and event counters were visible. - No default-on performance claim is made. If an operator explicitly runs with `UT_OVERLAP_LIGHT=1`, compare it to the serial baseline and prior complete runs with matching runner/configuration/test scope; do not spend CI on extra serial controls. Exclude timed-out/cancelled runs from total-duration comparisons. - The stage-gap arithmetic ceiling from the prior trace is 21m24s, not a measured saving; contention could reduce the gain or make the result worse. ## Validation - bash -n optools/run_ut.sh - make -pn confirms the default `UT_OVERLAP_LIGHT = 0` (the overlap treatment remains an explicit opt-in) - GOWORK=off go test -mod=readonly -count=1 ./optools - git diff --check This PR is a diagnostic/guardrail change. Do not change the default to overlap=1 until a same-runner result is compared with the serial baseline and the cgroup/OOM evidence is reviewed.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28183
What this PR does / why we need it:
ST_SymDifferenceselected the correct XOR boundary edges for the reported polygons, but the old connector chose the next edge from event order at a multi-edge vertex. At(0,1)this joined two polygon components that touch at one point into a self-intersectingPOLYGON, producing area 5 instead of 9.The connector now directs each selected edge with result interior on its left, groups incidences by snapped vertex, and uses the clockwise predecessor in angular order at branch vertices. Ordinary degree-two vertices use a no-sort path. Successor/predecessor uniqueness and closed-cycle invariants are checked; malformed boundary graphs return an internal error rather than being silently closed into invalid geometry. Repeated branch vertices are split into simple rings.
Regression coverage checks both operand orders, reversed/rotated input rings, a sheared equivalent, the Boolean area identity, valid simple result rings, and point-touching components. Controls cover identical/shared-edge/corner/vertex-on-edge/contained/hole/multipolygon cases and 120 deterministic rectangle pairs. The public SQL fixture checks result type, component count, area, and each returned polygon's validity for both operand orders.
Risks and performance
BenchmarkOverlayUnion256/1024runs show about 3–9% higher latency depending on run (baseline approximately 128 µs / 665 µs; final approximately 135–139 µs / 685–702 µs). Allocated bytes decrease from 215,384 to 212,392 B/op at 256 and from 928,089 to 888,341 B/op at 1024; allocation counts also decrease slightly. These small synthetic benchmarks are directional evidence, not a production workload claim.Validation
GOWORK=off go test -mod=readonly -count=1 -timeout=180s ./pkg/geo— PASS.GOWORK=off go vet -mod=readonly -vettool="$(command -v molint)" ./pkg/geo— PASS.GOWORK=off golangci-lint run -c .golangci.yml ./pkg/geo— PASS, 0 issues.git diff --check— PASS.73b72f78e7cca902781894a753d0b2c10e103f9d5f93f197237a5cdf01bd1321.