Repository navigation
fix(data branch): skip generated columns during apply - #26580
Conversation
aa718d6 to
c200482
Compare
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? |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
All previous blockers are fixed: generated columns remain visible while apply paths use writable columns only; incompatible generated definitions are rejected; and column references are compared by logical identity. The new single non-merge commit preserves those fixes and makes unsupported generated-expression kinds fail closed. No blocker or non-blocking finding remains. Diff/format checks passed; focused frontend tests could not start because cgo/libmo.dylib is absent.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed the full PR and the single commit added after my previous approval. The increment only tightens generated-expression canonicalization: leaf oneof kinds without column references remain comparable, while endpoint-dependent kinds that GeneratedColBinder rejects now fail closed; the earlier logical ColRef mapping and all visible/writable apply semantics are unchanged. The new boundary tests are deterministic, cover nil/origin/storage/resolution failures and unsupported oneof kinds, and both new focused tests passed under -race -count=100. Latest CI is also green. No correctness, compatibility, hot-path, lifecycle, wait-for, or unbounded-growth blocker remains.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26040
What this PR does / why we need it:
Root cause
DATA BRANCH used one column classification for both read-only output and destination writes. Generated columns are user-visible and participate in DIFF/row identity, but they are not writable. Including them in MERGE, PICK, and portable-SQL INSERT layouts caused error 20301; excluding them from the shared visible layout instead removed them from plain DIFF,
COLUMNS(...), andOUTPUT AS.Schema compatibility also treated generated expressions as endpoint-local protobuf values. Generated column references store local column ordinals, so reordered unrelated schemas could make different logical references protobuf-equal, or make equivalent references unequal. That could let MERGE succeed while the destination recomputed a different value and could also corrupt generated-primary-key row identity.
Changes
OUTPUT AS, and row identity, while STORED and VIRTUAL generated columns are omitted from all apply/portable-SQL writes.OUTPUT AS.Tests
make buildgo vet -mod=readonly ./pkg/frontendgo test -count=1 -timeout=600s -coverprofile=... ./pkg/frontendgo test -race -count=1 -timeout=600s ./pkg/frontendTestCanonicalizeDataBranchGeneratedExpr,TestDataBranchGeneratedColumnsLogicallyEqualBoundaries, andTestCheckSchemaCompatibility_GeneratedDefinitionsUseLogicalColumnIdentitypassed independently with-race -count=100(Tbelow timer resolution,B=30s,N=100).parse_coverage.pyagainst the complete PR diff and local frontend profile: 57/72 changed lines covered, 79.17% (required >75%).mo-tester -i merge_generated_column -r 100: 80/80 statements passed; the generated result was manually inspected against the SQL semantics.Residual risks
No known residual risk. Generated-definition comparison is deliberately fail-closed when usable expression metadata or logical reference identity is absent. The change is confined to DATA BRANCH schema classification/validation and tests; it adds no concurrency, resource-lifecycle, or storage-lifecycle behavior.