Repository navigation
fix(plan): preserve CTAS and division nullability on 4.2-dev - #32153
Conversation
|
mo-bot review · Commit: Review discussion changed before publication; a fresh contextual review is queued. |
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed 8f63e5c against 4.2-dev. No blocking finding. CTAS derives output nullability after optimization while retaining source defaults/ENUM metadata and the complete pre-optimization parameter graph for PREPARE. The independent Steps slice prevents root-ID remapping from corrupting that graph. Internal query parameter normalization preserves pruned ordinal gaps on both initial and retry builds; DDL/DCL retain their existing owner. Division-family functions correctly decline a non-NULL proof for zero divisors. Reviewed the NULL-group, outer-join, empty-aggregate, prepared pruning/arity/repeated-EXECUTE and explicit NOT NULL controls. Ordinary bug-fix exemption applies. Reused current-head green CI and the reported scoped SQL/BVT red-green evidence; no full local suite rerun.
|
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: 8f63e5ca63836f1dac75863fb1e3d0cb7e21a27d
Assessment: approve
No blocking findings. The fix reuses existing optimization and parameter-normalization owners. The prepare-only query copy preserves original arity while CTAS constraints follow optimized output semantics.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed the complete nine-file delta, all four discussion entries and linked issue context; recorded source reasoning and complete discussion dispositions.
-
Parsing/formatting of seven Go files, SQL/result command alignment and frozen-input integrity passed. Receipt: checks/1793795447322047909-2.json; retained logs and validation-receipt-audit.json reconcile both audit attempts.
-
Reused successful current-head build, UT, SCA, coverage and multi-CN BVT statuses. Verified that the author's reported baseline matches six relevant merge-base source files.
Limitations:
-
No local product tests or SQL execution were repeated. Author SQL/BVT results remain reported evidence; raw execution logs were unavailable.
-
Application retries, result loading and deployment latency in matrixflow #20285 remain outside this fix.
|
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: 6b972d4e1ab30073c1aee02acc9a754c6f53015d
Assessment: approve
No actionable defects remain. CTAS reuses optimized output nullability while preserving source metadata; the prepare-only snapshot retains arity, and existing normalization preserves parameter positions on initial build and retry.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed all nine changed files, affected owners and consumers, all six discussion entries, and linked issue context. Saved review-plan.md and discussion-assessment.json.
-
Local receipt 1793852550214859083-2 exited 0: frozen-source checks, seven-file gofmt check, 93 SQL/result statement alignments, and 35 independent expected-output checks including 24 metadata rows. Retained review-audit.log and review-audit-report.json.
-
Reused supplied current-head successful shared build, Ubuntu UT, arm64 static analysis, coverage, complementary PROXY/PESSIMISTIC multi-CN BVT, and CI Required results.
-
Completion receipt 1793852712471165359-2 exited 0: verified receipt/log correlation, complete discussion coverage, retained artifact hashes, and unchanged clean source.
Limitations:
-
No local Go product tests or database workloads were executed. Author-reported baseline/fixed SQL and dedicated BVT results lacked supplied raw logs.
-
Application retry/result-loading behavior and deployment-related latency are outside this kernel nullability fix.
What type of PR is this?
Which issue(s) this PR fixes:
Related to https://github.com/matrixorigin/matrixflow/issues/20285#issuecomment-6594984801
Addresses the kernel nullability failures, not the application-level retry and result-loading behavior tracked by that issue.
What this PR does / why we need it:
Two nullability defects on
4.2-devreject valid materialization or silently discard NULL groups:/,DIVandMODcan return NULL for a zero divisor even with NOT NULL operands. Mark this operator family nullable at the shared function-inference owner so COALESCE/IFNULL cannot turn their results into false non-null guarantees for GROUP BY, DISTINCT or CTAS.Preserve the complete bound query before CTAS optimization for PREPARE parameter/schema collection, including an independent root-ID slice; continue deriving target constraints from the optimized output. Regression tests cover unused placeholders and leading/middle/trailing pruning, CTEs, repeated EXECUTE, wrong arity and outer-join null extension.
Also fix a pre-existing positional bug on the same consumer path: the CTAS follow-up INSERT used to compact surviving parameter ordinals and could bind the first supplied value where the second was required. Internal prepared query plans now use the existing gap-preserving normalization on initial and retry builds. DDL/DCL retain their previous handling.
Existing UNION nullability merging and MARK-join execution are unchanged. Correct the old CTAS MIN/MAX NOT NULL expectations: empty-input aggregates can produce NULL, while COUNT remains non-null.
Validation against exact baseline
88e5fb5417, with Go 1.26.4 and native artifacts built in the isolated worktree:pkg/sql/planandpkg/sql/compiletests, gofmt, vet and incremental golangci-lint v2.6.2 pass after the parameter fix. Whole-PR changed-block Go UT statement coverage: 19/24 (79.17%), distinct from whole-package coverage.prepare_all364 successes/one existing skip;prepared_projection_cardinality26 successes;prepare_ddl_schema_change293 successes. Zero failures in all three.No production changes or production-query replay were performed. This does not claim a comprehensive audit of every function's nullability.