Repository navigation
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.
Reviewed exact head c152378 against base 2f25834 with GPT-6 High. No blocking findings. Checked the changed producer/consumer paths for binary-state marker transport versus computation type, SUM/AVG ENUM/SET storage semantics, integer-argument scalar constness through runtime CASTs, masked execution, and result-wrapper reset/free ownership. The tests retain distinct flat-versus-scalar, skipped-row, invalid-value recovery, plan-template reuse, and public SQL oracles. This restores existing contracts and does not require a separate design approval. Reused successful exact-head CI run 35992010685 (UT, SCA, coverage, and both active multi-CN BVT jobs). Combined integration with other open prepared-argument PRs #29345/#29349/#29350 was not tested. COMMENT only because this is self-authored.
…TAS (#29369) ## What type of PR is this? - [x] BUG - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes Fixes #29306 Fixes #29307 Fixes #29311 Fixes #29313 Fixes #29314 Supersedes #29349 and #29351 by combining their prepared-argument fixes with the downstream consumer, CTAS, and protocol closures. ## Root cause and changes Prepared values cross SQL and MySQL protocol boundaries as bytes/text while some consumers need the assignment or packet domain. The original fixes specialized direct calls but left downstream plans, internally reparsed CTAS inserts, cached execution, and mixed-CN dispatch with stale or incompatible domains. - Rebind `GENERATE_SERIES` consumers and result metadata at execution. Parameterized series gets a fresh runtime compilation because endpoint fractions and steps can change DATETIME scale without changing packet type. Real COM_STMT DATE/DATETIME packets keep temporal domain at series endpoints. - Refresh only inferred CTAS columns after specialization, map target-only columns correctly, reject incompatible inferred nullability/default changes, carry semantic parameter values through CTAS retry, and clear the sidecar on compile release/reset. - Bind direct prepared `UNNEST` JSON arguments to an old-operator-compatible JSON domain without a 65,535-byte TEXT cast. Keep HLL/bitmap state in a lossless internal binary domain, and preserve ENUM/SET numeric provenance. - Keep CEIL/FLOOR precision scalar through the private integer conversion. Introduce MORPC v95 placement and sender/receiver checks for this executor behavior; a new coordinator keeps affected work local while an older CN is present. The external MySQL protocol and persisted catalog/storage formats do not change. The approved rev4 design is `docs/design/20260924-prepared-argument-domains.md` (SHA-256 `7079eb07827ac8f81d87cd146d33a290b963ee4389cfba4ff495d56f4e33ce0f`). An earlier independent code review passed after its prior rebase; the current rebased head received a separate final review. ## Validation Evidence was gathered on the equivalent pre-rebase patch `99e419e925`; `git range-diff` maps all five PR commits unchanged to head `348d4e2f6d` on `main` `ac46f1a09b`. The sole new base change is in `pkg/sql/colexec/external` and does not intersect this PR. - `mo-cgo-test` with `-p 2 -count=1`: `pkg/defines`, `pkg/pb/plan`, `pkg/sql/plan`, `pkg/sql/compile`, `pkg/sql/colexec/table_function`, `pkg/frontend`, and `pkg/embed` all passed. - Focused regression checks passed for CTAS column order/defaults and retry cleanup, >65 KiB JSON and bitmap state, same binary statement across temporal scales, real DATE/DATETIME COM_STMT packets, and v94/v95 remote precision placement/send/receive gates. - Normal mo-tester comparison (`-n -g -o -p`) passed twice on one ready instance for `issue_29311_binary_state.sql` (26/26), `issue_29313_enum_set_aggregate.sql` (16/16), `issue_29314_scalar_precision.sql` (33/33), and `prepared_table_functions.sql` (37/37). Created tables were absent after teardown. - `make build-with-prebuilt-native`, incremental `go vet`, and incremental golangci-lint (0 issues) passed; `git diff --check` and gofmt clean. - Rolling mixed-CN check: a v94 CN initialized the cluster, then a v95 CN joined; SQL succeeded on both. A 4.2M-row table crossed the 512-block multi-CN threshold, and a prepared CEIL precision query on the v95 coordinator returned the expected sum. This external check did not record the identity of the worker that ran the query; the v94/v95 placement and fail-closed remote protocol branches are covered by the focused compile test. On the previous remote head `f464d449bc`, shared build and Ubuntu/x86 UT passed. ARM64 SCA found a missing `rows.Err`/Close in a test, fixed here. Both multi-CN BVT jobs failed during Quay MinIO image pulls before SQL (#29367; infrastructure fix #29370). UT Coverage timed out in `Checkout MatrixOne source` before tests, a recurrence of #28411; downstream Coverage lacked that producer and calculated no verdict. The new head's CI must be evaluated separately. Rollback: revert this PR's five commits; no data migration is required. ## Latest-main rebase and current validation Rebased onto `matrixorigin/main@44e5226` (including #29370). New head: `315ef452135f21335ff7e79281700cbd6ba127d2`. The complete binary diff against `main` is byte-for-byte identical to the diff before rebase, and `git diff --check` passes. Focused post-rebase CGo tests passed in `pkg/sql/plan`, `pkg/sql/compile`, `pkg/frontend`, and `pkg/embed`, including prepared series consumers, >65 KiB UNNEST, CTAS column mapping, precision protocol, temporal COM_STMT binding, and specialized-domain execution. The old BVT failures are not SQL test verdicts; CI on this new head is pending.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #29311
Fixes #29313
Fixes #29314
What this PR does / why we need it:
Prepared statements were losing three distinct argument-domain contracts:
HLL_CARDINALITY,HLL_MERGE_AGG, orBITMAP_OR_AGGin the binary-state computation domain while keeping the marker's TEXT transport type and identity.SUM/AVGthrough ordinary binding and apply the existing ENUM/SET storage-provenance rewrite on the marker-bearing numeric path. This preserves stored ordinal/bitmap arithmetic rather than attempting to parse display labels.Regression tests cover typed plans, cache-template reuse, vector constness and masks, three public prepared-SQL cases, malformed/NULL binary payload recovery, and DECIMAL/DOUBLE/text precision across multi-row and masked execution.
Performance scope: the binary/aggregate rewrites occur during binding; scalar preservation reuses the existing per-row conversion and adds no value-equality scan, cache, or extra data copy on the unmasked path. The masked path copies one selected scalar into its existing owned result wrapper.
Validation on a locally built MatrixOne service from
2f258340935018feb88221af7430fa5707e1bcc2:pkg/sql/plan,pkg/sql/plan/function, andpkg/sql/colexec; existingTestMathPrecisionNullContractretained.go vetfor the three owning packages andgit diff --check.No distributed CI result is claimed here.