spannerplan

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

README

spannerplan

Spanner QueryPlan manipulation module.

Sub-projects

Disclaimer

This module is alpha quality.

Documentation

Overview

Package spannerplan provides helper functions to process PlanNodes (EXPERIMENTAL)

Index

Constants

View Source
const (
	// KnownFlagFormatRaw prints known boolean flag metadata as is.
	KnownFlagFormatRaw KnownFlagFormat = iota

	// KnownFlagFormatLabel prints known boolean flag metadata without value if true or omits if false.
	KnownFlagFormatLabel

	// Deprecated: FullScanFormatRaw is an alias of KnownFlagFormatRaw.
	FullScanFormatRaw = KnownFlagFormatRaw

	// Deprecated: FullScanFormatLabel is an alias of KnownFlagFormatLabel.
	FullScanFormatLabel = KnownFlagFormatLabel
)

Variables

This section is empty.

Functions

func ExtractQueryPlan

func ExtractQueryPlan(b []byte) (*sppb.ResultSetStats, *sppb.StructType, error)

func NodeTitle

func NodeTitle(node *sppb.PlanNode, opts ...Option) string

Types

type ExecutionMethodFormat

type ExecutionMethodFormat int64
const (
	// ExecutionMethodFormatRaw prints execution_method metadata as is.
	ExecutionMethodFormatRaw ExecutionMethodFormat = iota

	// ExecutionMethodFormatAngle prints execution_method metadata after display_name with angle bracket like `Scan <Row>`.
	ExecutionMethodFormatAngle
)

type FullScanFormat

type FullScanFormat = KnownFlagFormat

type KnownFlagFormat

type KnownFlagFormat int64

type Option

type Option func(o *option)

func EnableCompact

func EnableCompact() Option

func WithExecutionMethodFormat

func WithExecutionMethodFormat(fmt ExecutionMethodFormat) Option

func WithFullScanFormat deprecated

func WithFullScanFormat(fmt FullScanFormat) Option

Deprecated: WithFullScanFormat is an alias of WithKnownFlagFormat.

func WithKnownFlagFormat

func WithKnownFlagFormat(fmt KnownFlagFormat) Option

func WithTargetMetadataFormat

func WithTargetMetadataFormat(fmt TargetMetadataFormat) Option

type QueryPlan

type QueryPlan struct {
	// contains filtered or unexported fields
}

func New

func New(planNodes []*sppb.PlanNode) *QueryPlan
func (qp *QueryPlan) GetNodeByChildLink(link *sppb.PlanNode_ChildLink) *sppb.PlanNode

GetNodeByChildLink returns PlanNode indicated by `link`. If `link` is nil, return the root node.

func (*QueryPlan) GetNodeByIndex

func (qp *QueryPlan) GetNodeByIndex(id int32) *sppb.PlanNode

func (*QueryPlan) GetParentNodeByChildIndex

func (qp *QueryPlan) GetParentNodeByChildIndex(index int32) *sppb.PlanNode
func (qp *QueryPlan) GetParentNodeByChildLink(link *sppb.PlanNode_ChildLink) *sppb.PlanNode

func (*QueryPlan) IsFunction

func (qp *QueryPlan) IsFunction(childLink *sppb.PlanNode_ChildLink) bool

func (*QueryPlan) IsPredicate

func (qp *QueryPlan) IsPredicate(childLink *sppb.PlanNode_ChildLink) bool

func (*QueryPlan) IsVisible

func (qp *QueryPlan) IsVisible(link *sppb.PlanNode_ChildLink) bool

func (*QueryPlan) PlanNodes

func (qp *QueryPlan) PlanNodes() []*sppb.PlanNode
func (qp *QueryPlan) ResolveChildLink(item *sppb.PlanNode_ChildLink) *ResolvedChildLink
func (qp *QueryPlan) VisibleChildLinks(node *sppb.PlanNode) []*sppb.PlanNode_ChildLink
type ResolvedChildLink struct {
	ChildLink *sppb.PlanNode_ChildLink
	Child     *sppb.PlanNode
}

type TargetMetadataFormat

type TargetMetadataFormat int64
const (
	// TargetMetadataFormatRaw prints scan_target and distribution_table metadata as is.
	TargetMetadataFormatRaw TargetMetadataFormat = iota

	// TargetMetadataFormatOn prints scan_target and distribution_table metadata as `on <target>`.
	TargetMetadataFormatOn
)

Directories

Path Synopsis
cmd
lintplan command
rendertree command
Package plantree provides functionality to render PlanNode as ASCII tree (EXPERIMENTAL)
Package plantree provides functionality to render PlanNode as ASCII tree (EXPERIMENTAL)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL