Skip to content

Document the rows-less ResultSet envelope as an ExtractQueryPlan interchange shape #63

Description

@apstndb

Context

spannerplan.ExtractQueryPlan already accepts three top-level JSON/YAML shapes (extract.go on v0.3.0):

  1. ResultSetStats (queryPlan at the top level)
  2. QueryPlan (planNodes at the top level)
  3. ResultSet (stats at the top level), which is the only path that also returns metadata.rowType

The third shape is the one diagram rendering needs: spannerplanviz.visualize.BuildPlan(rowType, stats, ...) wants both the plan and the row type. Console-downloaded JSON is usually bare ResultSetStats and therefore loses rowType.

execspansql now emits a rows-less ResultSet envelope (metadata + full stats, no rows) as the --plan-output JSON/YAML artifact so the same bytes can be fed to ExtractQueryPlan without a new schema:

https://github.com/apstndb/execspansql/blob/ff4f7d15df6a88d8d4c9d9ba57e636fcc0c54bb7/output.go#L435-L458

spannerplan README does not mention ExtractQueryPlan or these shapes. spannerplanviz README shows ExtractQueryPlan(input) but does not describe the envelope. ECOSYSTEM.md talks about “Spanner plan input” without listing accepted documents.

Verified against github.com/apstndb/spannerplan@v0.3.0 (extract.go, README.md, ECOSYSTEM.md) and GitHub main. No existing issue.

Request

Document the rows-less ResultSet envelope (metadata.rowType + stats including queryPlan / queryStats / rowCount*, without rows) as an interchange shape that ExtractQueryPlan already accepts, alongside bare ResultSetStats and bare QueryPlan. README or ECOSYSTEM.md is enough; no API change required.

Note that only the ResultSet path returns rowType; callers who persist bare ResultSetStats cannot reconstruct it later.

Alternatives considered

  • Treat Console ResultSetStats JSON as the only public interchange. That drops rowType, which spannerplanviz uses for SerializeResult labels.
  • Invent a new document type. Unnecessary: the protobuf ResultSet with empty/omitted rows is already the wire type.

Downstream evidence

execspansql PR #95 (split --plan-output artifact) and #94 (in-process rendering that consumes rowType + stats). Merged at ff4f7d1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions