Skip to content

[codex] fix flight sql explain plan rows#885

Merged
bill-ph merged 5 commits into
mainfrom
codex/fix-explain-two-column
Jul 6, 2026
Merged

[codex] fix flight sql explain plan rows#885
bill-ph merged 5 commits into
mainfrom
codex/fix-explain-two-column

Conversation

@bill-ph

@bill-ph bill-ph commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix Flight SQL EXPLAIN streaming when Duckgres advertises a synthetic one-column plan schema but DuckDB returns native explain_key / explain_value rows.

Root cause

GetQuerySchema intentionally returns a one-column physical_plan / analyzed_plan schema for EXPLAIN so schema discovery does not execute EXPLAIN ANALYZE. RowsToRecord then sized its scan destinations from that synthetic schema, while the actual DuckDB result still had two physical columns, causing sql: expected 2 destination arguments in Scan, not 1.

Changes

  • Detect raw DuckDB EXPLAIN rows shaped as explain_key, explain_value when paired with the synthetic one-column plan schema.
  • Scan both physical columns and emit only explain_value into the Arrow record batch.
  • Add a regression test using a dedicated *sql.Conn, matching the worker session path.

Validation

  • go test ./duckdbservice -run TestRowsToRecordExplainUsesPlanValueColumn -count=1
  • go test ./duckdbservice -count=1
  • go test ./tests/integration -run TestExplain -count=1
  • just lint

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Test Impact Plan

Deterministic summary of how this PR changes tests, CI runners, and coverage-risk signals.

Summary

Area Added Changed Deleted
Test files 0 3 0
E2E/journey files 0 2 0
Workflow files 0 0 0

Signals

  • Test cases: +1 / -0
  • Assertions: +18 / -0
  • Skips or known failures added: 0
  • Workflow continue-on-error added: 0
  • Workflow path filters added: 0
  • Test commands removed from justfile: 0
  • E2E/journey retry lines added: 1

Coverage risk: needs review

Warnings

  • E2E or journey retry behavior changed (needs review)
    • 1 retry/attempt line(s) added

@bill-ph bill-ph marked this pull request as ready for review July 2, 2026 17:49
@bill-ph bill-ph merged commit d90944f into main Jul 6, 2026
28 checks passed
@bill-ph bill-ph deleted the codex/fix-explain-two-column branch July 6, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant