Repository navigation
fix(frontend): preserve prepared EXPLAIN result metadata - #26620
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 1350e7b. No blocking findings. The change derives prepared result metadata from the outer EXPLAIN AST while preserving the ordinary plan-projection fallback, covers EXPLAIN, EXPLAIN ANALYZE, and EXPLAIN PHYPLAN, and refreshes both the cached and current-execution column definitions on plan rebuild without committing partial state on metadata-generation failure. I also checked the prepare/execute packet reuse path and transaction-DDL title selection. Local validation passed: focused prepared-EXPLAIN tests, full ./pkg/frontend tests, go build, go vet, and git diff --check.
Merge Queue Status
This pull request spent 36 minutes 39 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26620 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
…n#26620) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26602 ## What this PR does / why we need it: Prepared `EXPLAIN ANALYZE` statements cached the result metadata of the inner query while execution returned a single text plan column. The protocol therefore attempted to serialize non-text vectors through the bytes result path and returned `internal error: invalid bytes based slice`. This change centralizes prepared EXPLAIN result-column derivation so that: - `EXPLAIN` and `EXPLAIN ANALYZE` expose one VARCHAR logical-plan column; - `EXPLAIN PHYPLAN` exposes one VARCHAR physical-plan column; - prepared-plan rebuilds preserve the same metadata contract; and - ordinary prepared statements continue to use their plan projection columns. The regression tests cover parameter metadata, result-column metadata, the existing prepared `EXPLAIN` behavior, `EXPLAIN ANALYZE`, `EXPLAIN PHYPLAN`, and metadata refresh after a prepared-plan rebuild. ## Testing - `GOWORK=off go list -mod=readonly ./pkg/frontend` - `GOWORK=off go build -mod=readonly ./pkg/frontend` with the repository CGo include and library paths - `GOWORK=off go vet -mod=readonly ./pkg/frontend` with the repository CGo include and library paths - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^(TestInitExecuteStmtParamUsesTxnSnapshotAfterRebuild|TestSendPrepareResponseForExplainUsesExplainColumn|TestRebuildPreparedExplainAnalyzeKeepsExplainColumn)$' ./pkg/frontend` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/frontend` Focused coverage: - `getPreparedResultColumns`: 100.0% - `getPreparedResultColumnsFromPlan`: 88.9% Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…n#26620) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26602 ## What this PR does / why we need it: Prepared `EXPLAIN ANALYZE` statements cached the result metadata of the inner query while execution returned a single text plan column. The protocol therefore attempted to serialize non-text vectors through the bytes result path and returned `internal error: invalid bytes based slice`. This change centralizes prepared EXPLAIN result-column derivation so that: - `EXPLAIN` and `EXPLAIN ANALYZE` expose one VARCHAR logical-plan column; - `EXPLAIN PHYPLAN` exposes one VARCHAR physical-plan column; - prepared-plan rebuilds preserve the same metadata contract; and - ordinary prepared statements continue to use their plan projection columns. The regression tests cover parameter metadata, result-column metadata, the existing prepared `EXPLAIN` behavior, `EXPLAIN ANALYZE`, `EXPLAIN PHYPLAN`, and metadata refresh after a prepared-plan rebuild. ## Testing - `GOWORK=off go list -mod=readonly ./pkg/frontend` - `GOWORK=off go build -mod=readonly ./pkg/frontend` with the repository CGo include and library paths - `GOWORK=off go vet -mod=readonly ./pkg/frontend` with the repository CGo include and library paths - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^(TestInitExecuteStmtParamUsesTxnSnapshotAfterRebuild|TestSendPrepareResponseForExplainUsesExplainColumn|TestRebuildPreparedExplainAnalyzeKeepsExplainColumn)$' ./pkg/frontend` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/frontend` Focused coverage: - `getPreparedResultColumns`: 100.0% - `getPreparedResultColumnsFromPlan`: 88.9% Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…n#26620) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#26602 ## What this PR does / why we need it: Prepared `EXPLAIN ANALYZE` statements cached the result metadata of the inner query while execution returned a single text plan column. The protocol therefore attempted to serialize non-text vectors through the bytes result path and returned `internal error: invalid bytes based slice`. This change centralizes prepared EXPLAIN result-column derivation so that: - `EXPLAIN` and `EXPLAIN ANALYZE` expose one VARCHAR logical-plan column; - `EXPLAIN PHYPLAN` exposes one VARCHAR physical-plan column; - prepared-plan rebuilds preserve the same metadata contract; and - ordinary prepared statements continue to use their plan projection columns. The regression tests cover parameter metadata, result-column metadata, the existing prepared `EXPLAIN` behavior, `EXPLAIN ANALYZE`, `EXPLAIN PHYPLAN`, and metadata refresh after a prepared-plan rebuild. ## Testing - `GOWORK=off go list -mod=readonly ./pkg/frontend` - `GOWORK=off go build -mod=readonly ./pkg/frontend` with the repository CGo include and library paths - `GOWORK=off go vet -mod=readonly ./pkg/frontend` with the repository CGo include and library paths - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^(TestInitExecuteStmtParamUsesTxnSnapshotAfterRebuild|TestSendPrepareResponseForExplainUsesExplainColumn|TestRebuildPreparedExplainAnalyzeKeepsExplainColumn)$' ./pkg/frontend` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/frontend` Focused coverage: - `getPreparedResultColumns`: 100.0% - `getPreparedResultColumnsFromPlan`: 88.9% Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #26602
What this PR does / why we need it:
Prepared
EXPLAIN ANALYZEstatements cached the result metadata of the inner query while execution returned a single text plan column. The protocol therefore attempted to serialize non-text vectors through the bytes result path and returnedinternal error: invalid bytes based slice.This change centralizes prepared EXPLAIN result-column derivation so that:
EXPLAINandEXPLAIN ANALYZEexpose one VARCHAR logical-plan column;EXPLAIN PHYPLANexposes one VARCHAR physical-plan column;The regression tests cover parameter metadata, result-column metadata, the existing prepared
EXPLAINbehavior,EXPLAIN ANALYZE,EXPLAIN PHYPLAN, and metadata refresh after a prepared-plan rebuild.Testing
GOWORK=off go list -mod=readonly ./pkg/frontendGOWORK=off go build -mod=readonly ./pkg/frontendwith the repository CGo include and library pathsGOWORK=off go vet -mod=readonly ./pkg/frontendwith the repository CGo include and library paths.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^(TestInitExecuteStmtParamUsesTxnSnapshotAfterRebuild|TestSendPrepareResponseForExplainUsesExplainColumn|TestRebuildPreparedExplainAnalyzeKeepsExplainColumn)$' ./pkg/frontend.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/frontendFocused coverage:
getPreparedResultColumns: 100.0%getPreparedResultColumnsFromPlan: 88.9%