Repository navigation
fix(plan): preserve grouping-extension CTAS semantics on 4.1.6-hotfix - #32520
Conversation
Keep grouping expansion local, preserve synthesized-NULL output types and grouping-set SQL round trips, and accept qualified GROUPING columns. Add parser/planner and SQL regressions while retaining duplicate grouping sets. Fixes matrixorigin#32265
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? |
|
This pull request is merged. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Requesting changes: the grouping/CTAS contract is still incorrect in four independently reproducible cases. Some underlying planner defects predate this PR, but the formatter change exposes two of them in newly executed CTAS paths. All results below were reproduced on 5918e55dcbc94478fd07c511af179917133962ed; I compared the same SQL against base cbb7da471a495f21361fcfdc8fa715f6bdd346a0.
-
[P1] Apply SELECT DISTINCT after combining grouping sets. With
src(g)containing1,1,2,CREATE TABLE d AS SELECT DISTINCT g FROM src GROUP BY GROUPING SETS ((g),(g))succeeds but writes(1),(2),(1),(2); DISTINCT requires two rows. The exact base wrote two rows, so this is a CTAS regression after the formatter started preserving duplicate sets. The expanded clauses each receiveDistinct, but they are then joined withUNION ALLwithout an outer distinct (query_builder.go). Preserve duplicate grouping sets for ordinary SELECT, but enforce DISTINCT over their combined result. Please cover both SELECT and CTAS, with and without DISTINCT. -
[P1] Do not mark unrelated grouping keys present for a composite key. For rows
(g,h,v)=(1,10,5),(1,20,7),(2,10,9),SELECT g,h+1 AS hh,SUM(v) FROM src GROUP BY CUBE(g,h+1)should have eight rows, including(NULL,11,14)and(NULL,21,7). It instead returns nine rows: those two subtotals are absent and the three detail rows are duplicated. CTAS now succeeds and stores the same wrong rows (the base CTAS failed). GroupBinder.BindExpr sets grouping flags for recursive operands as well as the complete grouping expression; a missing map lookup defaults to index zero, turning the(h+1)set's[false,true]into[true,true]. The new output-nullability logic also relies on this flag. Match only actual grouping expressions and check the lookup; add expression-key CUBE/GROUPING SETS and CTAS regressions. -
[P2] Keep subtotal aggregation when a grouping key is a primary key. For
CREATE TABLE p(id INT PRIMARY KEY); INSERT INTO p VALUES (1),(2),SELECT id FROM p GROUP BY id WITH ROLLUPreturns(1),(2),(1),(2)instead of(1),(2),(NULL). CTAS persists those four rows and declaresid NOT NULL. The existing effectless-aggregate rewrite removes both aggregation nodes based on the input PK without checking that the subtotal branch omits that key. This directly bypasses the new grouping output type and NULL synthesis. Preserve the aggregate for omitted-key branches and exercise the no-aggregate projection against a real PK, including CTAS rows and nullability. -
[P2] Execute an explicit empty grouping set even without aggregate functions. On a three-row
src,SELECT 1 FROM src GROUP BY GROUPING SETS ((),())returns six rows; it should return two, one per empty grouping set. On empty input, the single-set form returns zero rows instead of one;SELECT COUNT(*) ... GROUP BY GROUPING SETS (())correctly returns the one global aggregate row. CTAS on the head also writes six rows for the three-row case (the base wrote three). The AGG admission condition ignores an explicit empty grouping set when there are no group keys or aggregate functions. Retain the global grouping operation for that case and cover populated/empty inputs and duplicate sets through CTAS.
Validation: exact-head and base standalone SQL instances with separate fresh data directories; rows compared to independent ordinary GROUP BY/global-aggregate controls. Focused parser round-trip tests passed, and regenerating the parser from the changed grammar matched the committed output apart from the output-path text in its generated header. The two instances were stopped after the checks.
… issue-32265-4.1.6-hotfix
Apply DISTINCT after combining grouping sets; mark only complete grouping keys present; retain PK subtotal aggregation; and execute explicit empty sets through a hidden global aggregate with a protected HAVING boundary. Add planner and SQL regressions for SELECT/CTAS multiplicity, expression keys, PK nullability, empty inputs and adjacent controls. Refs matrixorigin#32265.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Request changes: this has grown beyond a localized CTAS fix into a major grouping-planner restructuring. grouping_stage.go introduces a new branch-local transport/global-consumer boundary and the patch changes projection identity, nullability proofs, SAMPLE, DISTINCT, window, ORDER BY and subquery binding across it; the non-generated production change exceeds 500 lines. The PR describes the implemented behavior and extensive test runs, but does not link an approved, versioned design for this new ownership boundary. Before approving, please provide and review that design: define which stage owns each expression and its identity/nullability, explain the existing planner boundary and alternatives, document correctness and performance invariants (including volatile aliases, grouping markers, SAMPLE and windows), and map the prior review counterexamples and mixed-version/release-branch impact to the validation plan. The previous correctness reviews were on earlier heads; this is a design gate on the current head, not a claim that their individual witnesses still fail.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Request changes:head 0e711ba98e4005b868b94af4305c02bbe2091a16 尚未满足设计 v3 的两个明确契约,而且其中一项已在真实 CTAS 中写入错误数据。
设计方向:query-local 的 groupingStage 在现有 AGG/SAMPLE 与全局 WINDOW/DISTINCT/ORDER 边界传递 typed slots,复用现有执行算子、不增加协议或持久状态,是可以成立的职责划分。复杂度的主要来源确实是求值顺序、行来源和类型证明,不能靠仅修 formatter 解决。但设计文档中的 D7 / §4.7(DISTINCT 隐藏 GROUPING 准入)以及 D8 / §4.6(最早消费者前发布分支 NULL 证明)并没有落实到当前实现;文档和历史评审记录不能作为它们已经闭环的证据。
验证使用 57、Go 1.26.4、相同 native/module 输入和 exact-head Go source overlay,真实单 CN SQL 服务,对照 base 9937f1b74a7a7a01f8e0dcb6e7d3ff447e0ce29e。原有 grouping/planner/tree focused tests 通过,新增独立 oracle 失败。CI 失败未纳入结论。
- SAMPLE + ROLLUP + HAVING NOT IN:源 t(g INT NOT NULL,v INT) 只有 (1,10),u(x INT NOT NULL) 只有 (2)。查询
select g,sample(v,100 percent) from t group by g with rollup having not(g+0 in(select x from u))应只有 (1,10),当前多返回 (NULL,10);CTAS 成功并实际持久化这两行。白盒显示 omitted SAMPLE key 已是 typed NULL,但其后 ANTI JOIN 比较的 g+0 仍携带 NotNullable=true。普通 AGG、COALESCE fallback、空 RHS 对照分别给出正确结果。base 的 SELECT 也有旧错误,但 base CTAS 会因旧 SAMPLE formatter 解析失败;本 PR 新打通的物化路径不能因此直接写入旧错误。 t(g)=(NULL),(1)上,select distinct g from t group by g with rollup order by grouping(g) desc,g is null,g limit 1按 v3 应在绑定/规划时 1149 拒绝,当前却成功返回 1,CTAS 也成功建表。单独 BuildPlan 同样错误接受;显式选出grouping(g) flag的对照正确区分实际 NULL 与 subtotal NULL。
请在已有类型/绑定 owner 处补齐证明发布时序,并统一执行已决定的 DISTINCT 准入规则,避免继续在最终运输层补偿。回归测试应覆盖真实 SELECT 与管理员回读 CTAS,而不只手动调用 rebind helper 检查自身输出。
因此目前不能确认“所有 comment 都解决了”。当前基线的多 CN 和受支持已发布版本升级验收也仍未验证;这些限界不替代上述两个实际阻塞问题。本轮没有据历史单 CN 性能样例授予性能/分布式发布批准。
|
mo-bot review · Commit: Review discussion changed before publication; a fresh contextual review is queued. |
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed exact head 28da04af7e67afb71e4429e7aff8171b4198b91e against 9937f1b74a7a7a01f8e0dcb6e7d3ff447e0ce29e (4.1.6-hotfix), within #32265. No confirmed in-scope findings remain from this review. APPROVE.
The earlier DISTINCT placement, expression-key membership, PK subtotal, empty-set cardinality, binary-marker transport, SAMPLE omitted keys, window nullability, nested sort dependency and unused-key transport concerns have corresponding corrections and regression coverage in this head. The latest two correctness concerns are addressed at their owners: grouping-output nullability is published during HAVING/projection binding, before subquery flattening; DISTINCT ordering rejects unselected GROUPING dependencies after selected-output matching. This is a code/coverage assessment, not a claim of fresh SQL reproduction. The supplied conversation and inline threads contain no explicit author replies; commits and PR-description updates were not counted as replies. This is the first review by this reviewer.
The versioned design and historical design-review record are present. They explicitly retain pending maintainer design approval and release-validation limitations; this review does not substitute for those decisions.
CI snapshot: 12 success, 13 skipped, 2 neutral (27 total), with no failed or pending checks. Thus the checks are not all successful. CI Required succeeded; upgrade compatibility jobs were skipped. No failure triage or rerun was applicable.
Local validation: git diff --check and the supplied PR-artifact checker passed. Generated parser action inspection matches the qualified-column grammar change. Attempted go test ./pkg/sql/plan -run 'TestGrouping(BranchConsumerProof|DistinctLineageAdmission)$' -count=1 with Go 1.27.1 stopped at compilation because native headers usearch.h, xxhash.h, roaring.h and jemalloc.h are unavailable. No local planner-test pass or runtime SQL result is claimed; no SQL service was started. Source files were not modified.
|
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: 28da04af7e67afb71e4429e7aff8171b4198b91e
Assessment: approve
No actionable correctness or design findings remain. The query-local grouping stage reuses existing binders and execution operators while preserving necessary expression identity, lineage and nullability boundaries. Current corrections address the earlier review findings.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed all 32 changed files, all 11 discussion entries and supplied linked-issue context; saved discussion-assessment.json with exact key coverage.
-
Isolation preflight passed. Repository Makefiles built native prerequisites from 165 fingerprinted frozen inputs.
-
Planner, tree and MySQL parser packages passed with -short: 927 root tests and 1,523 subtests; three subtests skipped. Evidence: package-tests.log and checks/1794587461206750964-2.json.
-
Regenerated MySQL parser matches the candidate byte-for-byte: parser-generation.json.
-
Eight BuildPlan probes confirmed matching ordinary/grouping subquery-sort admission. Independently calculated the corrected hint fixture's ten rows.
-
Formatting, whitespace, native provenance, source cleanliness and receipt audit passed: validation-audit.json. Source remained unchanged.
Limitations:
-
Local checks used Linux/amd64 and Go 1.26.6. Runtime SQL, CTAS and performance evidence was assessed from supplied author reports.
-
CI reports 12 successful, 13 skipped and two neutral checks. Missing reusable-workflow inputs and raw logs prevent confirming this case's actual remote contribution; upgrade jobs were skipped.
-
This code assessment does not grant the separately pending maintainer design approval or release-source upgrade and restore acceptance.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32265
What this PR does / why we need it:
Restore consistent grouping-extension results and nullability across SELECT, views, CTAS, and repeated planning on
4.1.6-hotfix.Design documentation — maintainer approval pending. This is now a grouping-planner ownership restructuring, not just a localized CTAS/formatter fix. The current hand-written production Go diff is 655 additions + 38 deletions (693 lines), plus five grammar lines; generated parser and tests are excluded. Before this follow-up it was 686 lines; the earlier 786-line estimate was incorrect.
Versioned design v3 at
0e711ba98e: compares scope reduction, outer-AST normalization, typed internal transport, and native grouping aggregation; defines ownership, expression identity, branch/union nullability proofs, lineage, SAMPLE/windows/subqueries, cost, release compatibility and counterexample validation. This edition refines the public summary while retaining the technical design contracts.Design-review record at
0e711ba98e: records the exact historical v1 REQUEST_CHANGES and v2 design-only PASS revisions. No new independent review was performed for this editorial v3 update. This is retrospective design documentation, not evidence of pre-implementation approval, current implementation acceptance or GitHub maintainer approval. Maintainer approval of the exact design revision is pending.The latest merge incorporates target
9937f1b74a([4.1.6-hotfix] fix(readutil): preserve unary NULL predicate pruning #32609/[4.1.6-hotfix] fix: isolate background execution and harden authentication/runtime filters #32596/[4.1.6-hotfix] fix(compile): preserve remote receiver ownership #32591) without conflicts. This follow-up implements the two contracts requested in review 5887871372: branch-output proof publication before HAVING consumers (§4.6/D8), and uniform DISTINCT GROUPING admission (§4.7/D7). The versioned v3 design/review documents are unchanged. Fresh validation for the listed affected boundaries appears below; historical results are not automatically promoted to this target. Actual multi-CN and release-source compatibility validation remain unverified.No new GitHub review request/comment, CI monitoring, or
mo-self-reviewwas performed. The following implementation/evidence history does not substitute for maintainer review.Format ROLLUP, CUBE, and GROUPING SETS as reparsable SQL, preserving explicit empty and duplicate sets rather than flattening or deduplicating them.
Keep ROLLUP/CUBE expansion and the derived HAVING marker local to each planning invocation. Rebinding a source AST no longer adds subtotal levels or loses CUBE keys; CTAS retains the original grouping syntax for its generated INSERT.
Publish omitted-key nullability when HavingBinder/ProjectionBinder first bind grouping output references, before branch HAVING subquery flattening can consume the proof. Reuse the same output-type rule in remapping/transport; preserve the evaluated AGG inputs and raw SAMPLE value types. Parent functions and quantified operands bind bottom-up from the correct child proof; retain the post-UNION refresh as a separate boundary. Ordinary/common keys, COUNT and proven COALESCE fallbacks retain NOT NULL. MARK/ANTI algorithms are unchanged.
Accept qualified column names in GROUPING so that binding-generated
GROUPING(table.column)survives the CTAS format/reparse boundary. Regenerate the MySQL parser through the repository Makefile; the large generated diff is parser tables and line directives, with only the corresponding GROUPING semantic action changed. Repeated generation produces identical output.Apply SELECT DISTINCT to the combined grouping-set result, not separately to its UNION ALL branches. Deduplicate before hidden ORDER BY expressions and LIMIT/offset are introduced; ordinary grouping sets still preserve duplicate rows.
Mark grouping-set membership only for complete root grouping expressions with a successful key lookup. Recursive operands of arithmetic/function keys must not accidentally mark key zero present.
Retain subtotal aggregates when any key is omitted, even if the evaluated input contains a primary key. Ordinary PK grouping retains its existing effectless-aggregate optimization.
Give an explicit empty grouping set a hidden COUNT when neither an aggregate nor SAMPLE owns its cardinality, so each set produces one global row on populated or empty input. Preserve its HAVING boundary, reject ungrouped source columns, and leave ordinary constant scans unchanged.
Preserve predicates on omitted grouping keys above the aggregate instead of replacing output NULLs with input values. Keep output predicates above keyless global aggregates as well: filtering their input to zero rows still produces a global aggregate row. Predicates on present/common grouping keys retain safe pushdown.
Split expanded grouping queries into a branch-local grouping stage and a single combined-result stage. Carry only grouping/aggregate inputs consumed by the final/window/order/post-window-HAVING expressions through UNION ALL; evaluate windows and final projection once over that complete result, then DISTINCT, ORDER BY and LIMIT. Rebind through a private slot map rather than assuming all group keys are present. Internal homogeneous transport bypasses SQL common-type coercion, preserving BINARY/VARBINARY grouping bitmaps; public set-operation coercion is unchanged. This also supports windows used only in ORDER BY, partitioning, ranking, aggregate-over-aggregate windows, and reused CTAS/prepared ASTs without text rewriting.
Rebind quantified subqueries' outer operands, including
SubqueryRef.Child, to the combined grouping output. Flatten scalar and quantified subqueries before constructing the DISTINCT key projection, not only in the ordinary final projection; preserve the existing unsupported-left-subquery rejection.Keep SAMPLE branch-local and materialize its selected post-sample outputs, including already-supported input passthrough. Omitted keys become independently typed NULL grouping expressions, so subtotal branches really sample the correct group; branch-local GROUPING masks distinguish omitted keys from actual NULLs. Preserve physical group-column ordinals when unused group outputs are pruned. Reconstruct legal hidden ORDER BY expressions (including
chosen+1) from selected results after DISTINCT, without transporting unused computed sort columns or sampling again. Serialize the complete SAMPLE call for CTAS, retaining columns/star, percentage precision, row count, and row/block unit.Refresh WINDOW arguments/results from their actual remapped child types before publishing their nullable proofs. FIRST/LAST_VALUE now see synthesized grouping NULLs, including view/CTAS consumers; partition-only keys retain their upstream PARTITION coordinate ownership. COUNT/ranking and proven literal fallbacks retain their non-null guarantees.
Validate every DISTINCT sort dependency recursively, including expression lists/tuples. Match exact selected slots or safe complete selected expressions first; reject any remaining GROUPING invocation with error 1149, uniformly for AGG and SAMPLE. Do not reconstruct lineage from deduplicated key values or add hidden markers to DISTINCT keys. Selected GROUPING aliases/complete expressions and ordinary value expressions remain supported; admission does not depend on primary keys, NOT NULL, current data or whether a particular grouping set omits a key. Unselected dependencies fail before SELECT execution or CTAS target creation.
Preserve SAMPLE sort dependencies before branch-local GROUPING folding. A detail-arm zero must not be promoted into a global constant or confused with a literal zero. For non-DISTINCT SAMPLE sorting, hidden GROUPING (including when its key is selected) stays in the branch payload unless the complete GROUPING result is already selected/materialized; ordinary value expressions still reconstruct from selected outputs. This fixes subtotal-first LIMIT selection and the corresponding silent CTAS writes while retaining legal
chosen+1sorting.Recompute composite expression proofs bottom-up immediately after rebinding to merged grouping outputs, before quantified-subquery flattening/MARK optimization. A nullable
g+0must not retain its old NOT NULL promise and become a NULL-unaware ANTI filter; explicit non-null COALESCE controls retain their guarantee.Bind grouping DISTINCT/SAMPLE ORDER BY aliases to exact selected-output references, not copies of their expression trees, retaining alias names in the source AST for CTAS/repeated planning. Map the selected tag and ordinal explicitly across projection boundaries; independent structurally identical volatile outputs
a/bretain their own identity in nested sorting expressions. Structural fallback reuse rejects volatile/real-time calls, including under deterministic wrappers. Resolve DISTINCT sort dependencies before subquery flattening replaces expression identity with join tags. Independent selected subqueries are not merged by SQL text, aliases are not re-executed for sorting, and unselected dependencies still raise syntax errors.Split mixed SAMPLE sort dependencies recursively rather than falling back to an entire branch PROJECT expression. Selected aliases consume their already-materialized outputs; branch-only GROUPING/column dependencies are transported separately and folded only at their branch owner. Evaluate the combined arithmetic/CASE/list expression after UNION; keep scalar and quantified subqueries at that global consumer boundary, including their selected outer operands. This prevents future-output/self references in SELECT and CTAS without copying/re-executing volatile selected expressions, and preserves DISTINCT dependency rejection.
Resolve GROUPING's alias arguments to their bound projection origins during initial function-argument binding. Unlike ordinary ORDER BY value functions, GROUPING describes grouping-key lineage and must not consume future selected-output slots. Preserve the source alias AST for CTAS/rebinding; ordinary volatile aliases retain exact output references, and actual NULL values are not used to infer subtotal membership.
Keep transport-column type/provenance separate from the user projection. A literal NULL in a user output slot must not cause an unrelated transport aggregate at the same slot to be retyped as text; restore bare-NULL provenance for enclosing set operations.
Add focused parser/planner regressions and a small SQL case covering rows, schema, NULL insertion constraints, empty inputs, actual versus synthesized NULLs, duplicate sets, views, CTE reuse, prepared execution, HAVING, and projection pruning. Correct only the five duplicate subtotal/grand-total expectations in the existing hint CTE fixture after independently verifying its ten correct rows.
Latest review-follow-up validation (implementation
28da04af7e; local darwin/arm64, Go 1.26.4, matching native/module inputs, target9937f1b74a):0e711ba98ereproduces the extra(NULL,10)in SAMPLE HAVING SELECT and administrator CTAS readback, and wrongly accepts hidden-GROUPING DISTINCT SELECT/CTAS. New typed planner tests fail before repair and pass afterward; they check real binding/MARK consumers, immutable input proofs, and BuildPlan admission for both SELECT and CTAS.mo-self-review, multi-CN acceptance or release-upgrade approval is claimed.Historical implementation validation (recorded at
0a88c1d8cd, not a fresh validation of the documentation/new-target head; local darwin/arm64, Go 1.26.4, matching worktree-built native libraries; validated target baseaf531771cc, merged without rebasing; previous result-proof basebf18d10904; original reproduction basecbb7da471a):512f10f324source/binary, covering binary markers, SAMPLE subtotal grouping, stale window metadata, tuple-order acceptance, unnecessary transport columns, and rejected computed sample ordering. The exact54feca6423Go source was independently built via an audited overlay with unchanged module/native inputs; the same computed SAMPLE ordering SELECT completes there. Its known old duplicate-DISTINCT rows are not used as the new result oracle.0a88c1d8cd, the fullpkg/sql/plan,pkg/sql/plan/function,pkg/sql/colexec/sample,pkg/sql/colexec/loopjoin,pkg/sql/colexec/group, andpkg/sql/colexec/windowtests pass (4,753 test/subtest pass events; three existing planner skips, no new skipped regression). That planner evidence was refreshed after theaf531771ccbase merge and includes GROUPING-alias key origins, mixed SAMPLE branch/global dependencies, exact volatile alias output slots, independent-call structural fallback, compound-operand proofs, selected-subquery identity and repeated-CTAS regressions; the five unchanged owning/consumer package runs reuse sixth-review evidence. The unchanged tree/MySQL parser suites reuse third-review evidence. Build, matching gofmt, vet, and affected-package golangci-lint 2.6.2 pass.(NULL),(1),(2), DISTINCT removes only result duplicates, and each explicit empty set contributes one constant row on either empty or populated input. SELECT and CTAS agree, including LIMIT/offset and nullability/insertion constraints; original explicit INSERT and literal fallback controls remain green.g=1excludes synthesized NULL, an outer false predicate over an explicit empty set returns zero rows, and COUNT OVER sees all three grouped rows in both SELECT and CTAS. Ranking, partitioning, nested aggregates, HAVING/window ordering, DISTINCT/LIMIT, empty/duplicate sets, actual/synthesized NULLs and view consumers have additional value controls. The separate generic ordered-SUM write failure is explicitly excluded below, not recorded as a pass.5,5,7LIMIT result and identical CTAS rows. Old-owner overlay UT rejects the same hidden-marker transport loss and literal-to-flag dependency substitution. Final independent ordered-result/CTAS checks pass twice for hidden, selected and wrapped markers, actual NULL, mixed sets, int/bigint samples, literal zero, DISTINCT, and computed-order controls.a2103870aareproduces a NULL row fromNOT flagoverg+0 IN (...), including the same incorrect CTAS write, plus 1149 for the legal scalar-subquery alias ordering SELECT/CTAS. Exactbf18d10904independently confirms the alias SELECT/CTAS control succeeds. Final ordered/value oracles pass twice for IN/NOT IN/ANY/ALL, compound/cast operands, empty/NULL RHS, non-null fallback, scalar/count/wrapped aliases, multiple independent aliases, repeated source binding and CTAS cleanup. All earlier review/original oracles pass again.bcec0af15dfails deterministic typed slot-ownership tests and six public nested-bordering witnesses (plain DISTINCT, DISTINCT SAMPLE and ordinary SAMPLE); threeacontrols remain ordered. Exactbf18d10904passes all nine SELECT ordering controls. The candidate passes all nine SELECT/CTAS checks twice, comparing actual returned values rather than fixed random strings. CTAS records row ordinals before storage and verifies them when read back; nested wrappers, reverse order and SAMPLE LIMIT are covered. All six earlier review/original result oracles pass again. The exact base's volatile-alias CTAS has a separate 1149 format/rebind limitation, so it is not claimed as a successful CTAS oracle.7674e4e2c4reproduces 1064 column-remapping failures for mixed selected-alias/branch-marker sorting, in both SELECT and CTAS; typed tests directly reject the branch PROJECT's reference to its own future output. Frozenbcec0af15dpasses the same eight deterministic SELECT/CTAS controls. The candidate passes them twice (arithmetic, reverse direction, CASE, multiple CUBE masks, literal zero, scalar/quantified subqueries), plus mixed volatile alias/hidden GROUPING ordering, selected-marker DISTINCT and unselected-marker rejection/CTAS rollback. All earlier review/original oracles pass again.f0b27a96edfails GROUPING-alias key-origin assertions and the public alias SELECT/CTAS controls; frozenbcec0af15dpasses the same deterministic controls. The candidate passes eight SELECT/CTAS shapes twice: aliases, source-name shadowing, quoted names, nested CASE/arithmetic, multiple CUBE arguments, qualified sources, selected-marker SAMPLE DISTINCT and ordinary aggregate DISTINCT. Additional checks cover actual NULL versus subtotal lineage, GROUPING(alias) mixed with independently selected volatileb, and unselected-marker 1149/CTAS rollback. All earlier review/original oracles pass again.NOtoYES) required by [4.1.6-hotfix] fix(plan): infer result nullability from explicit proofs #32519; the same metadata is independently verified on exactbf18d10904and candidate controls. Existing SAMPLE BVT passes unchanged: 78/78 and 51/51. Existing hint CTE passes: 65/65. Existing ROLLUP passes with 107 successes and two unchanged skips; existing CTAS passes with 1,284 successes and 30 unchanged skips (including the new target-base cases). Generated results were reviewed against independent expected values before normal comparison runs.43223581993atf14f314d58: arm64 SCA failed because its self-hosted runner lost communication (check annotation), not because of a reported lint finding. Ubuntu race UT reports twelve failed roots across checkpoint quiescence, ISCP watermarks and embedded bootstrap/RPC paths. The target update brings Fix 4.1.6 fixture cleanup, test endpoints and WAL replay ordering #32629 fixture/endpoint corrections and fix(sql): optimize scalar CTEs and ZoneMap admission on 4.1.6-hotfix #32550 scalar-CTE/ZoneMap changes; these are merged, not reimplemented in this PR.-race -short -tags matrixone_testmode; an audited exact-af531771ccGo-source overlay passes the same twelve roots. These Darwin/arm64 focused checks do not reproduce the concurrent Linux lane or establish that its causes are fixed/pre-existing/harmless. Snapshot checkpoint waiting is tracked separately in [Bug]: TestSnapshotGC checkpoint-quiescence assertion expires in release-branch race CI #32640; the ten-root bootstrap/RPC episode in [Bug]: Embedded release-branch race UTs cascade through HAKeeper bootstrap and RPC resets #32641; ISCP watermark timing already has [Bug]: ISCP watermark waits and sink comparisons fail in 4.1.6-hotfix race UT retry #32636/[Bug]: TestISCPExecutor4 one-second recovery watermark assertion fails in 4.1.6-hotfix race UT #32639. No assertions, timeouts or test-body retries are weakened here.make err-checkpass. The initial local embedded run exceeded Darwin's Unix-socket path limit before SQL; a short task-owned TMPDIR fixes that precondition, and only the subsequent completed runs are counted.Review coordination: Per request, the previous re-review request was withdrawn. This update does not request another review. Historical AI design review of v2 is recorded above; the editorial v3 update adds no approval claim. Maintainer design approval and independent acceptance remain pending.
Previously tracked limitation: #32531 recorded the generic ordered-SUM CTAS failure on the earlier source baseline. After merging #32519, the exact
bf18d10904and candidate controls both write the correct(NULL,21,21),(1,12,33),(2,9,42)rows. This improvement comes from the target base, not an extra generic SUM repair in this PR; the historical failing probes remain retained.Separate known limitation: #32549 tracks the pre-existing grouped SAMPLE passthrough-column execution panic.
SELECT g,h,SAMPLE(v,100 PERCENT) FROM src GROUP BY gfails without any grouping extension on the original source baseline; the generic passthrough-input offset remains outside this repair (the required group-output ordinal correction does not repair that separate path). This is not counted as a passing test, nor fixed through a generic SAMPLE runtime/remapping change. Already-supported nongrouped passthrough is covered through repeated empty sets.Separate known limitation: #32595 tracks the generic binder selecting the wrong expression after SAMPLE (
SELECT SAMPLE(v,100 PERCENT),7 ...repeatsv). It independently reproduces without grouping on exactbf18d10904; the reversed projection order is a successful control. It is not repaired here. New literal/marker regressions place SAMPLE last so they test this PR's sort-origin boundary rather than that separate binder defect.Scope and limits: The PR diff does not include #32263's MARK optimization or #32264's general function/aggregate/window nullability redesign. The latest base includes #32315 and #32519; merge conflict resolution retains upstream's explicit nullability proofs plus the grouping/window consumer boundary, with no additional MARK changes here. Empty-input ROLLUP retains the existing zero-row behavior, cross-checked against MySQL 8.4.11. No operator lifecycle, wire/catalog format, or distributed-protocol changes are introduced. Validation is single-CN/local; no production replay, multi-CN/race claim, or remote CI result is claimed.