Skip to content

fix(frontend): keep computed bool metadata numeric - #30191

Merged
mergify[bot] merged 10 commits into
matrixorigin:mainfrom
daviszhen:fix/metabase-sync-fields-bool
Oct 20, 2026
Merged

mergify[bot] merged 10 commits into
matrixorigin:mainfrom
daviszhen:fix/metabase-sync-fields-bool

Conversation

@daviszhen

@daviszhen daviszhen commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #29952

What this PR does / why we need it:

Metabase sync-fields queries produce computed BOOLEAN results that Connector/J must expose as Number. Advertise these results with TINYINT width 8 while retaining BOOL value encoding. Stored BOOLEAN columns keep width 1 and Java Boolean metadata. The separate SHOW GRANTS parser issue was fixed by #29993.

Resolve value provenance through the existing JOIN routing owner, keeping origin/key barriers intact. An extraction-local dependency graph handles shared/recursive producers without repeated traversal or output-order-dependent false results. It follows the correct aggregate/SAMPLE offsets, set-operation ownership, MARK markers and window value/default arguments. Lazy projection/binding indexes avoid repeated wide-JOIN scans; immutable reference keys reduce graph storage without a global cache or plan mutation. Non-BOOL outputs bypass classification.

Validation on the rebased source includes normal/race metadata and affected lifecycle tests, incremental SCA across the complete 11-package delivery closure, and real Connector/J 8.4.0 execution: 222 JOIN/composed cases, 144 MARK cases and the window probe, covering Statement, client-prepared and verified server-prepared execution.

Identical real-binder shared/recursive probes preserve result kinds and node counts. Compact keys reduce allocated bytes at the larger sizes from 32.9 to 20.1 MB (stored BOOL), 28.4 to 17.2 MB (computed BOOL), and 155.4 to 95.7 MB (recursive). These are metadata-extraction TotalAlloc measurements, not peak memory or SQL throughput. Full CI and TP throughput are not claimed.

@daviszhen
daviszhen requested a review from XuPeng-SH as a code owner October 14, 2026 10:48
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@daviszhen

Copy link
Copy Markdown
Contributor Author

Reviewed head b1f7a7f4c5812a432a0619e5191bfda715822c4d against base 51300cbd01fc9687211ef76d71470764e1d365e0. Recommendation: request changes.

[P2] Missing origin metadata does not establish that a BOOL is computed

Location: pkg/frontend/util.go:2848-2850, used to widen the result metadata at lines 2833-2835.

GetResultColumnsFromPlan deliberately does not preserve source/key metadata through DISTINCT and set operations. Consequently, a result that still consists of a stored BOOLEAN column can have all three origin/table fields empty. isComputedBooleanResult now treats that result as a computed predicate and changes its advertised TINYINT width from 1 to 8.

Minimal reproduction:

CREATE TABLE t (id INT PRIMARY KEY, flag BOOLEAN);
INSERT INTO t VALUES (1, TRUE), (2, FALSE), (3, NULL);
SELECT flag FROM t;
SELECT DISTINCT flag FROM t ORDER BY flag;
SELECT flag FROM t UNION ALL SELECT flag FROM t;

I tested the exact PR head with real Connector/J 8.0.30, tinyInt1isBit=true, against an embedded CN. The direct selection still returns java.lang.Boolean, but DISTINCT and UNION ALL return java.lang.Integer (0/1); their result metadata also reports Integer/TINYINT. This reproduces with Statement, client-prepared and actual server-prepared statements, including prepare-time and execute-time metadata: six failing cases in total. Running the same native-column controls on the exact base returns Boolean for both queries in all three modes. This is a new JDBC compatibility regression, contradicting the intended preservation of native BOOLEAN metadata. Connector/J's width-dependent conversion is documented here.

Please distinguish computed predicates from retained native BOOLEAN values independently of the origin/key-flag fields. Do not restore key flags through DISTINCT/UNION just to make this heuristic pass. Add real planner/wire regressions for native BOOLEAN DISTINCT and UNION ALL, alongside computed predicate controls, for ordinary and prepared queries. The new hand-built ColDef test cannot exercise this provenance-loss path.

The intended fix does work for the tested direct predicates and the Metabase-style information_schema.columns predicate query: these return Number values in all three modes. Native aliases, derived tables, CTEs and views also passed. Full pkg/frontend and pkg/sql/plan suites and PR whitespace checks passed. These results are SQL/JDBC checks, not a full Metabase application sync validation. Supplemental probes remain local; no production implementation was changed or pushed. Ordinary PR comment only; no formal review submitted.

@daviszhen

Copy link
Copy Markdown
Contributor Author

@XuPeng-SH Addressed review 5568831875 in 8803a292e60f15cde7a9739c45e8368647d68438, on top of the reviewed head dbdd93976c.

Root cause and fix: a remapped SAMPLE RelPos=0 reference names an emitted vector after the complete GroupBy and retained AggList prefixes. The provenance classifier was using that prefixed position directly as a child output slot. It now subtracts len(GroupBy)+len(AggList) before following the child. Group references (-1), sampled references (-2), ordinary AGG routing, origin/key metadata, row encoding and protobuf definitions are unchanged. Invalid prefix positions and missing child producers remain safe.

Regression coverage:

  • Six production-planner shapes exercise stored/predicate siblings through UNION ALL, both output orders, moving the sampled expression after its siblings, repeated siblings, and multiple independent sampled expressions. The test asserts that forwarded SAMPLE slots actually survive optimization.
  • A direct graph regression covers the combined group/sample offset, invalid positions and a missing child.
  • Six frontend cases check both COM_QUERY and COM_STMT_PREPARE column packets, additionally including UNION DISTINCT and an enclosing derived projection.
  • The committed Connector/J probe now retains SAMPLE(id+1,100 PERCENT) beside stored/predicate siblings and checks prepare/execute SQL types, Java classes, NULLs and exact duplicate-row multisets. Additional variants cover reordering, repetition and multiple sampled expressions.

Validation on the final source (Go 1.27.1, darwin/arm64):

  • Restoring only result_column_kind.go to dbdd93976c via a Go overlay makes all six new planner shapes and all six new frontend shapes fail; the direct offset regression also fails. With the fix, targeted planner/frontend regressions pass with -race -count=3.
  • Before the fix, a real Connector/J 8.4.0 execution of the review's query fails the stored-BOOL column type check: TINYINT instead of BIT. After the fix, 272 positive JDBC cases on each of two CNs (544 total) pass, including the six new SAMPLE shapes in Statement, client-prepared and verified server-prepared modes. tinyInt1isBit=true; server-prepared fallback is disabled and the implementation class is asserted. The existing bare-VALUES 1064/42000 control is not counted as a successful server-prepared case.
  • Full race suites pass: pkg/sql/plan 65.212s; pkg/frontend 23.831s; pkg/sql/compile 14.407s; pkg/sql/colexec/sample 2.686s.
  • Existing SAMPLE BVT: 149/149; existing VALUES BVT: 22/22, using the bundled local BVT driver.
  • The production-generated 32,765-node integer guard still measures 4 allocations/extraction, in each of three targeted repetitions. git diff --check is clean.

Separate exploratory failure, not included in the passing counts: SELECT SAMPLE(id+1,b,100 PERCENT),p,b FROM (SELECT id,flag b,n>0 p FROM t UNION ALL SELECT id,flag b,n>0 p FROM t) d hits an execution-time projection bounds panic when a sampled BOOL is also forwarded. Bypassing metadata assertions and reverting the sole production-file change to dbdd93976c reproduces the same index out of range [4] with length 4 / 20101 error on both CNs. That is an existing execution-layout issue, not resolved or hidden by this metadata change; the positive multi-column SAMPLE test uses independent numeric sample producers.

No full Metabase replay, mixed-version certification or throughput claim is made. This commit does not alter the unrelated 15-second UT scheduling fixture discussed in the previous CI diagnosis. Fresh CI and reviewer reassessment remain pending; previous request-changes reviews have not been dismissed.

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 8803a292e60f15cde7a9739c45e8368647d68438

Review completed. Read the assessment.

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · superseded

Commit: 8803a292e60f15cde7a9739c45e8368647d68438

"interrupted"

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 8803a292e60f15cde7a9739c45e8368647d68438

Assessment: request_changes

Reviewed all 38 changed files and supplied discussion. Planner-owned provenance and the non-BOOLEAN fast path are reasonable, and the latest SAMPLE correction passes real JDBC validation. One confirmed TIME_WINDOW mapping defect remains: grouped INTERVAL queries reverse stored and computed BOOLEAN metadata.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

  • P2 pkg/sql/plan/result_column_kind.go:288: For t(ts TIMESTAMP, flag BOOLEAN, n INT), execute SELECT flag, MAX(n>0) FROM t GROUP BY flag INTERVAL(ts,1,MINUTE), including with reversed projection order.
    Impact: Stored flag is advertised as numeric and returned by Connector/J as Integer, breaking stored-BOOLEAN compatibility. MAX(n>0) is advertised as BOOLEAN and returned as Boolean, leaving the computed-result contract unsatisfied. Statement, client-prepared and verified server-prepared execution all reproduce this.
    Evidence: The fallback follows child columns using unchanged ordinals. TIME_WINDOW emits aggregates before partition keys, whereas its child AGG places group keys first. Here, aggregate slot 0 follows stored flag and partition slot 1 follows computed time truncation. Packet widths are [8,1], expected [1,8]. Resolve provenance through existing BuildTimeWindowLayout, AggList and TimeWindowPartitionBy mappings, with regression coverage for reordered projections, boundaries and FILL. time-window-confirm.log and TimeWindowBooleanProbe.log reproduce the defect; receipts checks/1792403553275081326-4.json and checks/1792403736849772626-3.json both record exit 1. Ordinary GROUP BY controls pass.

Validation:

  • Artifacts are retained under /home/xupeng/.local/state/mo-bot/jobs/f85540f6956c581ff52ec302/attempt-1. evidence-index.json reconciles all 14 command/source/exit receipts with logs and input hashes; review-record.json records the complete review.

  • Isolation preflight passed. Repository-owned native build passed; final audit verified 197 input hashes, seven native output hashes, exact HEAD and unchanged source.

  • 54 selected committed test roots passed across planner, frontend, compile, objectio, SQL integration and upgrade packages (receipt 1792403604871888367-3).

  • Connector/J 8.4.0 passed the committed 272-case JOIN/composition/SAMPLE probe. The supplemental TIME_WINDOW probe failed six query/mode combinations; all three ordinary GROUP BY controls passed. The combined JDBC check correctly exited 1.

  • Supplemental planner/packet validation reproduced seven failing TIME_WINDOW shapes with four passing controls. Descriptor compatibility and six existing golden-file audits passed.

  • At 32,765 plan nodes, the current-head extraction benchmark measured integer metadata at 1.58 microseconds/488 bytes, stored BOOLEAN at 11.32 milliseconds/20.05 MB, and computed BOOLEAN at 7.57 milliseconds/17.22 MB. These measure extraction cost, not SQL throughput or improvement over base.

Limitations:

  • No full Metabase replay, fresh whole-repository/race suite, mixed-version deployment or base/head SQL-throughput comparison was performed.

  • Supplied exact-head CI success statuses were reviewed; raw CI logs and local_validation gates were not supplied. The linked issue body was absent, so its behavioral contract was assessed from the frozen PR and discussion.

  • An initial audit dependency failure was resolved with a dependency-free audit. Its exit-1 receipt and recovered tool transcript are preserved separately from successful validation.

@daviszhen

Copy link
Copy Markdown
Contributor Author

Addressed @XuPeng-SH's TIME_WINDOW P2 review in 821b9b2.

The ordinal mismatch is fixed at the value-provenance owner: TIME_WINDOW now uses BuildTimeWindowLayout to distinguish its aggregate/boundary prefix from its partition-key suffix. Aggregates and synthetic boundaries are computed values; partition keys follow the corresponding TimeWindowPartitionBy input expression, not the same-numbered child output. The layout is cached once per node per metadata extraction, avoiding repeated layout construction for many BOOL outputs. Non-BOOL extraction and row encoding are unchanged.

Regression coverage added:

  • Ten real-planner shapes and an explicit layout test cover both projection orders, repeated outputs, shared/reordered boundary slots, aggregate pruning, stored/computed partition producers, invalid positions and missing-child handling.
  • Thirteen frontend packet shapes check COM_QUERY and COM_STMT_PREPARE display widths, including NULL/value/prev/next FILL, a computed partition key, a pruned derived projection, and a stored BOOL next to a numeric LINEAR-FILL aggregate.
  • Committed test/manual/issue30191/TimeWindowBooleanMetadataProbe.java checks six projections without FILL and with real GAPFILL(PARTITION) rows under NULL/value/prev/next FILL, plus ordinary GROUP BY and derived/pruned controls. It checks prepare/execute metadata, verified server preparation without fallback, Java Boolean versus Number classes, exact row multisets, NULLs and timestamp boundaries. JVM and session time zones are fixed to UTC.

Validation on the updated code (macOS arm64, Go 1.27.1, Connector/J 8.4.0):

go test -race -p 1 ./pkg/sql/plan ./pkg/frontend ./pkg/sql/compile \
  ./pkg/sql/colexec/sample ./pkg/sql/colexec/timewin ./pkg/sql/colexec/fill -count=1
PASS all six complete package suites (58.070s / 25.022s / 14.201s / 2.368s / 2.882s / 2.818s)

go test -race -p 1 ./pkg/sql/plan ./pkg/frontend \
  -run '^(TestTimeWindowProducerLayout|TestTimeWindowBooleanResultKinds|TestComposedBooleanResultsKeepWireMetadata)$' -count=100
PASS (4.168s / 7.382s)
  • Actual embedded two-CN cluster, real Connector/J: 96 new TIME_WINDOW/control cases per CN (192 total) passed across Statement, client-prepared and verified server-prepared execution. The existing 272-case JOIN/composition/SAMPLE probe per CN (544 total) also passed.
  • Restoring only the reviewed head's classifier via a Go overlay makes the new planner/packet regressions fail again. The same real-client probe then exits 1 on the original SELECT flag,MAX(n>0) ... GROUP BY flag INTERVAL(...): stored flag is JDBC TINYINT (-6), expected BIT (-7). The overlay does not edit the working source.
  • The 32,765-node integer extraction guard still reports 4 allocations/op. git diff --check passed.

Validation limits / non-passing control: the existing full time_window BVT directory is 62/93, with 31 failures on both reviewed head 8803a29 and the fixed classifier. The failed SQL list and metadata-error messages are identical: 30 boundary timestamp display-width differences (golden 64 versus 19/23/26), plus one value_sum DECIMAL/BIGINT metadata difference. These unchanged goldens were not rewritten or counted as passing. Native tests linked the existing local CGo libraries; this is not a fresh native-build attestation. No full Metabase replay, mixed-version deployment, whole-repository test pass, SQL throughput comparison, or green-new-head-CI claim is made.

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 821b9b24bd0f15c62d2ed8ad2dd748834e949a0e

Review completed. Read the assessment.

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · superseded

Commit: 821b9b24bd0f15c62d2ed8ad2dd748834e949a0e

"interrupted"

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 821b9b24bd0f15c62d2ed8ad2dd748834e949a0e

Assessment: approve

Reviewed the complete 40-file delta and supplied review concerns. The design correctly separates BOOLEAN value provenance from origin/key metadata, keeps classification local to result extraction, and reuses the authoritative TIME_WINDOW layout. No actionable defects remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • 57 focused planner, frontend and compiler test roots passed at the frozen head, including TIME_WINDOW, recursive producers, SAMPLE routing, allocation bounds and retry metadata.

  • Connector/J 8.4.0 against a running frontend passed 96 TIME_WINDOW, 272 JOIN/composition and 144 MARK cases across statement, client-prepared and server-prepared modes. The separate WINDOW probe passed after correcting the reviewer's database setup.

  • Reconciled retained lifecycle race evidence against unchanged relevant inputs: seven focused roots, adaptive repetitions, and full objectio/txnbase race suites.

  • Audited generated protobuf descriptors, serialization, deep copy and all golden changes. Existing golden changes affect only computed BOOLEAN metadata; source remained unchanged.

  • Current 32,765-node extraction benchmark: integer metadata used 488 bytes and four allocations; BOOLEAN cases took approximately 10–11 ms and 17–20 MB.

  • Frozen-head CI reports successful Ubuntu UT/coverage, arm64 SCA and PROXY/PESSIMISTIC multi-CN BVT. Receipt, command, source, log and outcome reconciliation is retained in /home/xupeng/.local/state/mo-bot/jobs/7eb40621d8608805a36e1e4d/attempt-1/evidence-index.json; final-audit.log passed.

Limitations:

  • The initial JDBC command exited 1 because the reviewer selected protected mo_catalog for WINDOW setup. Its three other probes passed; only WINDOW was rerun after correcting setup.

  • Local JDBC validation used one CN and did not run Metabase itself. Raw CI logs were unavailable; reported unsuccessful author BVT runs were not counted as passes.

  • Benchmark measurements cover metadata extraction, not production throughput or a measured speedup against the merge-base. Darwin and rolling-compatibility CI were skipped.

@daviszhen

Copy link
Copy Markdown
Contributor Author

Resolved the main-branch merge conflict in 0b71cd7 (main: d82e828b0a4df9ce635fe573c1e90c5cde978bf9).

The conflict was in the compressed plan.pb.go descriptor. Regenerated the plan binding from the merged schema with protoc 3.21.1 and the repository's postprocessors, preserving both ColDef.result_column_kind = 23 and main's CreateTable.ctas_execution_protocol_version = 19. Added descriptor-field assertions and a combined CTAS/result-kind wire round-trip regression for UNKNOWN/STORED/COMPUTED and a future enum value.

Validation after merging:

  • Complete race suites for pkg/pb/plan, pkg/sql/plan, pkg/frontend, and pkg/sql/compile passed. The protobuf suite was also rerun after adding the merge-contract regression.
  • Real Connector/J 8.4.0 against both CNs of an embedded two-CN cluster: 96 TIME_WINDOW/control cases and 272 existing JOIN/composition/SAMPLE cases per CN, 736 total, passed (Statement/client-prepared/verified server-prepared).
  • No unresolved merge entries; git diff --check passed. New-head CI remains a separate gate; no full-repository or mixed-version pass is claimed.

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-xupeng · done

Commit: 0b71cd731402aace6e47c83e2b29baf486eb77ce

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-xupeng · review

Commit: 0b71cd731402aace6e47c83e2b29baf486eb77ce

Assessment: request_changes

Complete delta reviewed. A confirmed RETURNING regression makes stored BOOLEAN metadata depend on the mutation expression.

Model: gpt-6-astra / xhigh

Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0

  • P2 pkg/sql/plan/result_column_kind.go:297: With Connector/J tinyInt1isBit=true and t(id INT PRIMARY KEY, flag BOOLEAN), execute INSERT INTO t VALUES (1,TRUE) RETURNING flag or UPDATE t SET flag=FALSE RETURNING flag.
    Impact: The stored column becomes TINYINT/java.lang.Integer, while SELECT, DELETE RETURNING and SET flag=flag RETURNING expose BIT/java.lang.Boolean. Preserve declared-column provenance across the RETURNING row-image boundary and add regression coverage.
    Evidence: appendReturningProjection creates a target-row-image SINK_SCAN with TableDef, but this traversal follows its producer into the assignment literal and marks flag computed. Reproduced on both CNs: jdbc-runtime-final.log lines 2371–2379 and 3426–3434 show Integer results alongside Boolean controls. The base protocol always emitted BOOL width 1.

Validation:

  • Complete normal suites passed: pkg/pb/plan, pkg/sql/plan, pkg/frontend and pkg/sql/compile. Transaction-selector and resumed cleanup tests also passed.

  • Connector/J 8.4.0 passed 1,024 committed JOIN/SAMPLE, MARK and TIME_WINDOW cases, plus window probes, across two CNs. The separate RETURNING diagnostic reproduced the regression on both.

  • Source remained unchanged. Repository-owned native builds, source/native hash verification and git diff --check passed.

  • Receipts, logs and recovered setup/build failures are reconciled in /home/xupeng/.local/state/mo-bot/jobs/3a8de3cef7170ea0699054bd/attempt-1/validation-audit.json.

Limitations:

  • No race, full BVT or Metabase run; ancillary embedded shutdown, CDC and logtail scenarios were source-reviewed but not rerun.

  • local_validation was empty; linked issue text and exact-head CI logs were not supplied. Prior author and approval claims were not treated as passing validation.

@daviszhen

Copy link
Copy Markdown
Contributor Author

Addressed @XuPeng-SH's RETURNING row-image P2 in 0908cf4.

The value classifier now locates the dedicated target-row-image SINK_SCAN from the RETURNING step's unary input path, once per extraction. Column references stop at that declared row-image boundary instead of inheriting an INSERT/UPDATE assignment's computation. RETURNING expressions above the boundary remain computed. Other SINK_SCANs—including schema-bearing materialized producers in the same query—still follow their producers; this is not a blanket TableDef/SINK rule. The lookup is bounded and handles invalid roots, nil nodes and cycles without introducing a global cache or protobuf change.

Added regressions:

  • Ten real-planner SQL shapes and eleven COM_QUERY/COM_STMT_PREPARE packet shapes: INSERT literals/NULL/SELECT, UPDATE literals/predicates/self-assignment, DELETE, mixed/reordered/repeated outputs, expressions and RETURNING star.
  • A synthetic owner/control graph checks that ordinary schema-bearing sinks retain computed provenance, expressions remain numeric, and invalid RETURNING steps/roots, branching paths, cycles and absent schemas do not mark unrelated sinks as row images.
  • Committed ReturningBooleanMetadataProbe.java: 15 cases × Statement/client-prepared/verified server-prepared execution. Literal, NULL, predicate and default assignments preserve BIT/Boolean for target columns, while RETURNING predicates/literals remain TINYINT/Number. Server-prepare metadata, all executed metadata, actual Java classes and exact row multisets are checked. JDBC execute()/getResultSet() is used for DML; client-emulated metadata discovery is not invoked before a mutation.

Validation on the updated code (macOS arm64, Go 1.27.1, Connector/J 8.4.0):

go test -race -p 1 ./pkg/pb/plan ./pkg/sql/plan ./pkg/frontend ./pkg/sql/compile -count=1
PASS all four complete suites (1.718s / 54.650s / 22.674s / 14.060s)

go test -race -p 1 ./pkg/sql/plan ./pkg/frontend \
  -run '^(TestReturningBooleanResultKinds|TestReturningImageDoesNotHideOtherSinkProducers|TestComposedBooleanResultsKeepWireMetadata)$' -count=100
PASS (3.904s / 8.016s)
  • Real embedded two-CN fixture, real Connector/J: 45 new RETURNING/control cases per CN (90 total) passed. Existing JOIN/composition/SAMPLE (272), MARK (144) and TIME_WINDOW (96) probes also passed on each CN: 1,024 existing cases, 1,114 combined.
  • Existing committed RETURNING BVT directory: 64/64 passed through mo-tester.
  • The same corrected JDBC probe, using only an overlay restoring the original classifier at reviewed head 0b71cd7314, exits 1 on INSERT RETURNING: column 1 is JDBC TINYINT (-6), expected BIT (-7). Planner and packet counterexamples also failed before the fix. An initial probe invocation used Connector/J's unsupported executeQuery() for DML; that harness invocation was corrected before recording the metadata negative control and passing runs.
  • resultColumnReturningImage has 100% local statement coverage. The 32,765-node integer metadata guard still reports 4 allocations/op. git diff --check passed.

CI status clarification: at intake, exact-head ALL CI run 39256950638 was already green, including Required CI, Ubuntu UT, arm64 SCA, coverage and both multi-CN BVT groups. No unrelated timeout/CI harness changes were needed. The push starts new-head CI; this comment does not claim its result yet. Local native tests linked existing CGo libraries; no fresh native-build, whole-repository, full Metabase, mixed-version or throughput certification is claimed.

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 0908cf44ae618591107b727309c27af5ea5946b5

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 0908cf44ae618591107b727309c27af5ea5946b5

Assessment: approve

Reviewed the complete 44-file delta, callers, ownership, failure paths, tests, documentation and frozen review concerns. No actionable findings remain. Planner-owned, extraction-local provenance correctly separates computed and stored BOOLEAN metadata. Shared operator layouts and the RETURNING target-image boundary avoid competing implementations; non-BOOLEAN results bypass graph construction.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Verified the frozen checkout remained clean and all 11,558 archived source files matched. Fresh native build and repository provenance verification passed; 196 native inputs and eight outputs were hash-checked.

  • Passed 74 root tests across protobuf, planner, frontend and compiler packages, including RETURNING, SAMPLE offsets, cyclic producer graphs, wire metadata and retry compatibility.

  • Passed real Connector/J 8.4 probes against the current-head server: 45 RETURNING, 272 JOIN/composed/SAMPLE, 144 MARK and 96 TIME_WINDOW cases, plus WINDOW checks. Verified text, client-prepared and server-prepared modes in the four counted probes.

  • Decoded protobuf descriptors confirmed only the additive enum and field 23. Existing golden-file changes preserve result rows and alter computed-BOOLEAN metadata headers only.

  • At 32,765 plan nodes, extraction measured 2.23 microseconds, 488 bytes and four allocations for integer output; BOOLEAN cases measured 12.0–13.7 milliseconds and 17.2–20.1 MB. The non-BOOLEAN allocation guard passed.

  • Reconciled seven retained race-check receipts and logs against unchanged lifecycle owners, test oracles, module and native inputs. These are explicitly older-head evidence, not fresh current-head executions. Frozen current-head CI also reports successful required checks.

  • Commands, source fingerprints, exits, log hashes and corrected audit-helper diagnostics are retained in /home/xupeng/.local/state/mo-bot/jobs/ada6a65fb1a88bed70d744e6/attempt-1/evidence-index.json. Final audit receipt 1792427744291116304-4.json exited successfully.

Limitations:

  • Local validation used one CN; no full Metabase replay, mixed-version deployment or throughput comparison was performed. Benchmark results are short extraction measurements.

  • The WINDOW probe permits prepared-statement fallback; verified server preparation is claimed only for the other four probes.

  • The standalone linked-issue body and raw CI logs were absent. Requirements were assessed from the frozen PR discussion. A missing prior-review artifact was explicitly excluded from reused evidence.

@aunjgr aunjgr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at 0908cf44ae618591107b727309c27af5ea5946b5.

This is a metadata correctness repair, not a new SQL value/type system. Computed BOOLEAN results keep BOOL execution/row encoding but advertise numeric TINYINT width8; declared stored BOOLEAN columns retain width1. Value provenance is correctly separate from origin/key metadata, so recovering a computed result does not accidentally restore a source key or NOT NULL flag.

Traced the complete production change through result extraction, additive ColDef kind23 and deep-copy/serialization, frontend conversion and ColumnDefinition41 encoding. The extraction-local dependency graph distinguishes expressions, output slots and references; reverse propagation handles shared/recursive producers without caching a cycle as a false answer or mutating the plan. Lazy indexes preserve the existing identity/name routing, including Unicode EqualFold semantics, and non-BOOL results bypass this classification.

Checked JOIN input/output ownership and null-extension barriers, MARK's own marker versus a forwarded AGG slot, aggregate/SAMPLE offsets, left-only MINUS/INTERSECT value provenance, VALUES, value-preserving windows and LAG/LEAD defaults, TIME_WINDOW layout, and the dedicated RETURNING target-row-image boundary. The SAMPLE emitted-slot correction preserves the actual selected grouping value as well as its metadata.

Also reviewed the cumulative CI/lifecycle changes: commit-wait injection is narrowed to the intended transaction without changing disabled-fault behavior; cross-CN final reads wait for the writer's committed frontier after the race; cleanup uses independent bounded contexts and retains errors/resource-absence oracles rather than retrying unknown-result DDL or skipping assertions.

Validation: inspected planner/protocol regressions, additive descriptor tests and BVT metadata/value expectations; reused green exact-head CI, the author’s source-qualified normal/race checks, and reported real Connector/J Statement/client-prepared/verified server-prepared controls. Manual probe instructions alone were not treated as new execution receipts. No fresh local JDBC, full-suite race or throughput run is claimed. I found no remaining blocking issue.

@mergify

mergify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-19 18:11 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-10-20 00:45 UTC · at 0908cf44ae618591107b727309c27af5ea5946b5

This pull request spent 6 hours 34 minutes 25 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

merge conflict between base and head

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

@daviszhen

Copy link
Copy Markdown
Contributor Author

@mergify refresh

@mergify

mergify Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@mergify

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-20 03:02 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-20 04:09 UTC · at 983ab88913462ebba9441d9626cad64e206f0884 · squash

This pull request spent 1 hour 6 minutes 8 seconds in the queue, including 1 hour 5 minutes 19 seconds running CI.

Required conditions to merge

This branch was previously deployed

1 inactive deployment
ci — e14f479b Deployed Oct 20, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/enhancement size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants