Repository navigation
fix(sql): handle inequality for GEOMETRY and GEOMETRY32 - #33261
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? |
|
Queue requested — the merge queue status continues in this comment ↓. |
|
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: ec405f52dd6f851e3c8e378d32152f6d3f81f862
Assessment: approve
GEOMETRY and GEOMETRY32 inequality now use the existing varlena comparison path, matching equality for non-NULL values and preserving ordinary NULL handling. The change adds no parallel comparison mechanism; the tests cover inline and area-backed values, constants and selected rows. No actionable unresolved defect was established.
Model: gpt-6.1-terra / max
Session: 01a212e9-10a4-7203-9194-162fe0e55042 · slot 0 · generation 13
Validation:
-
Reviewed the complete change, issue #33224, operator admission and execution paths, equality and null-safe controls, and the new geometry fixtures. All three discussion items are recorded in discussion-assessment.json.
-
Private /tmp and loopback preflight passed (checks/1795633003936537195-3.json; preflight.log), as did git diff --check (checks/1795633290038426293-3.json; diff-check.log).
-
The frozen-head CI snapshot reports successful shared build, Ubuntu unit tests, coverage, static analysis and two multi-CN BVT jobs. The author reports four named native geometry tests and 45 SQL assertions on the same production change.
Limitations:
-
No local geometry test completed. Dependency discovery timed out while fetching modules (checks/1795633594165277158-2.json; go-deps.log), and the task-local third-party build timed out before installing jemalloc (checks/1795633643895645006-2.json; native-thirdparties.log). An attempted copy of a source-matched allocator also timed out (checks/1795633791036908520-2.json; jemalloc-copy.log). These are setup outcomes, not product-test results.
-
The author's reported SQL assertions and native test results did not include individual execution logs in the supplied evidence; the completed CI statuses are retained in evidence.json.
✅ Merged into
|
Main brought matrixorigin#33199 (remove Attrs) and matrixorigin#33261 (GEOMETRY inequality). This branch already carries a squash of matrixorigin#33199 and builds on it, so conflicts resolve to this branch. The mixed-version relay wire names that matrixorigin#33199 gained late in review (MarshalBinaryWithNames, WireNames, relayWireNames, mergeblock WithAttrs) are dropped, consistent with this branch's single batch codec and removal of mixed-version gates. Kept from main: the preinsert unused-constant cleanup and the GEOMETRY fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…drop mixed-version gates (#33265) ## What type of PR is this? - [x] Refactoring ## Which issue(s) this PR fixes: Part of #33182 (batch cleanup, #32921). Builds on #33199 (remove `Attrs`), which is now merged into `main`. ## What this PR does / why we need it: ### 1. Remove `Attrs` from `Batch` (#33199, merged) This section summarizes #33199 for context; that change is now in `main`. Column names belong to whoever defines the columns: the plan, a table definition, or a workspace entry. They now travel beside the batch where an API needs them. - `Batch.Attrs`, `New(attrs)`, `SetAttributes` and `GetSchema` are gone. `NewWithTypes` replaces `NewWithSchema`, and `Types()` replaces `GetSchema()`. - `SelectColumns`, `CloneSelectedColumns` and `InsertVector` take no names. `BatchToProtoBatch(bat, attrs)` takes them explicitly. - `Relation.Write(ctx, bat, attrs)` and `Relation.Delete(ctx, bat, attrs, name)` take the names. disttae workspace entries own theirs, and CN→TN `api.Batch` carries the same names as before. - On TN, `cmd_util.WriteReq` and the catalog request structs carry the `api.Batch` names. `AppendDataToTable` and `containers.ToTNBatch` take them as arguments. logtailreplay keeps the logtail names in `ReplayBatch`. - Behaviour changes: - **Iceberg DML/append:** these now trust the plan's column positions. - **Data-branch hashdiff:** only the current base relation's batches are projected to the target layout (`currentBaseChangesHandle`). - **Legacy `checkDup` message:** it no longer reads names from a batch that has none. ### 2. One batch codec; no legacy decoders MatrixOne supports **shutdown upgrade only**. The batch encoding is **never persisted**: every use either travels between CNs within one query, or goes to a query-scoped spill file that is unlinked when it is created. So no reader ever sees bytes from an older binary, and the codec needs no compatibility sections. - **Format:** a batch is its row count, vectors, extra buffer, `Recursive` and `ShuffleIDX`. The column-name section is gone, together with `MarshalBinaryWithNames`, `MarshalBinaryWithBufferAndNames` and `WireNames`. Nothing writes names for older coordinators any more: not the remote-run relay, and not the `deletion` or `multi_update` relay blobs. - **Relay wire names from #33199 removed.** #33199 gained, late in review, column names on relay batches for older coordinators: `relayWireNames` in the remote-run sender, named marshalling in `deletion`, and `mergeblock.WithAttrs`. This PR removes them with the rest of the names section, along with `relay_wire_names_test.go` and the `WireNames` assertions. - **Legacy decoders removed:** - the ROLLUP grouping footer (`pipeline_codec.go`); - the prepared-parameter trailer; - the `…WithMetadata` decode variants. The decoders now reject trailing bytes. - **`spill_codec.go` removed:** - Spill files use `MarshalFramedTo` / `UnmarshalFramedFrom` (an int64 length, then the batch). - Spill files that frame their own records use `UnmarshalSizedFrom`. - Records keep the extra buffer: since #33184 it is pool-owned, which removes the old reason for dropping it. - **`mergeblock`:** it accepts only the insert S3 writer's `[BlockInfo, ObjectStats]` result. The older layouts are gone: a table-index column, inline data batches, and block infos without stats (which needed an S3 metadata load). `MergeBlock.Attrs` goes with them. ### 3. `BatchSet`: a small rebatching core `BatchSet` had grown three copy paths (`Extend`, `Union`, `UnionRange`) with their own fill, provenance and reuse helpers. It is now one append loop with `Append` (a row range), `AppendSels` (a selection) and `Push` (adopt an owned batch), plus the ready-batch counts, pop, take and clean. Shuffle and the delete writer use it. - Every batch except the last is full. The one exception is a batch closed early because the next rows come through a different pool. - `ReadyDelta` takes the pool and is exact. - A reuse buffer the set takes stays the set's even if the copy fails. - `Push` frees an empty batch. - Performance: the rewrite first made `BenchmarkShufflePoolProducerTails` about 4% slower. Counting instructions retired per op traced it to about 85 extra instructions per bucket append, from a non-inlined call chain. Inline fast paths restore parity: 37,817 → 37,789 instructions per op, and time is equal in alternating runs. - Other rebatching code (hash build, sinker, mergeutil, merge-sort reshape, the snapshot datasource) was evaluated and left alone. Each builds rows from values, streams through one buffer, or needs machinery specific to it. ### 4. Batch test cleanup - **`allocation_account_test.go`** keeps only the tests that need an allocation account. The rest moved to `unmarshal_test.go`, `framed_codec_test.go` and `clone_test.go`, or were dropped as duplicates. - **`bitmap_test_pool_test.go` removed.** Its users now allocate their selection bitmaps from their own pool and free them. - **`extra_buf_test.go` folded into `batch_test.go`.** It is the only test of `MoveExtraBufferFrom` and `DropExtraBuffer`. ### 5. Remove remote-run and group mixed-version gates With every CN on one binary, the capability checks for older peers always pass, so they only cost work and failure modes. - **`pkg/sql/compile`:** - **Capability predicates:** about 45 `supports*` predicates go, each call site keeping the up-to-date behaviour. - **Version probes:** the worker version probes (`remoteWorkersSupportProtocol*`, `AllCNsSupportProtocol*`) go. They sent a query-service RPC per send or placement. - **Pipeline validators:** about 35 `validateRemote*Protocol` validators go. - **Stream protocol check:** the `requiredProtocol` floor, `confirmProtocolOnStream` (a protocol-check round trip per stream for some queries) and the server's `PipelineProtocolCheck` handler go. - **Kept:** validators that check something real: rebind-required plans, collations, LAST_INSERT_ID / ODKU baselines, auto-ID cache, correlation, IVF placement and GROUP_CONCAT time-zone portability. - **`group` / `aggexec` / `hashmap`:** - The retired aggregate row-metadata trailer goes (decoder, gate and spill-record flag byte). A partial with bytes after its states is rejected. - The legacy aggregate-state, HLL, DISTINCT float key, H8 CHAR padding and GROUP_CONCAT provenance gates go, together with the entry points they leave without callers. - **Helpers left without callers go too:** - the compile-side version predicates for HLL add, variable-length group keys, the DISTINCT key wire, widened decimal SUM and `percentile_disc` extended types; - the remote function-expression walker. - **Tests:** tests that only exercised a gate are deleted. `TestRequiredIVFTopologyBroadcastAndRemoteFragment` is kept without its protocol-version setup and required-version assertion. It still checks same-version topology invariants: a required IVF membership filter rejects partial, duplicate, shuffled or unreachable senders, and an RPC-decoded fragment keeps producer and reader on one message board. ### Not in this PR - **`aggexec`'s internal legacy state formats.** HLL v2 states are persisted by HLL_ADD_AGG / HLL_MERGE_AGG, so separating persisted-format from peer compatibility needs its own pass. - **Other packages' version gates,** which are out of scope: the CDC checks in `ddl.go`, planner fallbacks, frontend, lockservice, txn RPC and others. ## Validation - `go build ./...`, `go vet ./pkg/... ./cmd/...` and gofmt are clean. - After the #33199 squash, `go test` passes on all 88 packages that differ from `main` (86 with tests). - After the codec change, `go test` passes on the 21 packages it touches. `-race` passes on `pkg/container/batch` and `pkg/sql/colexec/mergeblock`. - Gate cleanup: build, vet and gofmt are clean. `go test` passes on `compile`, `vectorscan`, `group`, `aggexec`, `hashmap`, `tests/dml`, `tests/sqlintegration/multicn`, `cnservice`, `shuffle` and `dispatch`. - BatchSet: `go test` and `-race` pass on `batch`, `shuffle` and `multi_update`, and `batch_set.go` is fully covered. - After merging `main` (#33199, #33261, #33058, #31460): - build and vet are clean; - `go test` passes on `batch`, `vector`, `compile`, `deletion`, `insert`, `mergeblock`, `mergedelete`, `multi_update`, `preinsert`, `colexec`, `materialized` and the geometry functions; - golangci-lint and molint are clean on every package the PR changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #33224
What this PR does / why we need it:
Route GEOMETRY and GEOMETRY32 through the existing varlena comparison path for
<>and!=. Non-NULL values use the same equality rules as=, and NULL operands still produce NULL.Validation
2b0038fbd1, covering inline and area-backed values, constants, NULLs and selected rows.make static-check-selected STATIC_CHECK_PACKAGES="<explicit affected packages>"passed for all 170 affected packages in default mode, withGOFLAGS=-tags=matrixone_test, and withGOFLAGS=-tags=integration. Both analyzers exited 0 in each mode.