Documentation
¶
Overview ¶
Package spannerplan provides helper functions to process PlanNodes (EXPERIMENTAL)
Index ¶
- Constants
- Variables
- func ExtractQueryPlan(b []byte) (*sppb.ResultSetStats, *sppb.StructType, error)
- func HasStats(nodes []*sppb.PlanNode) bool
- func NodeTitle(node *sppb.PlanNode, opts ...Option) string
- type ExecutionMethodFormat
- type FullScanFormat
- type KnownFlagFormat
- type Option
- func EnableCompact() Option
- func HideMetadata() Option
- func WithExecutionMethodFormat(fmt ExecutionMethodFormat) Option
- func WithFullScanFormat(fmt FullScanFormat) Optiondeprecated
- func WithInlineStatsFunc(f func(*sppb.PlanNode) []string) Option
- func WithKnownFlagFormat(fmt KnownFlagFormat) Option
- func WithTargetMetadataFormat(fmt TargetMetadataFormat) Option
- type QueryPlan
- func (qp *QueryPlan) GetLinkType(link *sppb.PlanNode_ChildLink) string
- func (qp *QueryPlan) GetNodeByChildLink(link *sppb.PlanNode_ChildLink) *sppb.PlanNode
- func (qp *QueryPlan) GetNodeByIndex(id int32) *sppb.PlanNode
- func (qp *QueryPlan) GetParentNodeByChildIndex(index int32) *sppb.PlanNode
- func (qp *QueryPlan) GetParentNodeByChildLink(link *sppb.PlanNode_ChildLink) *sppb.PlanNode
- func (qp *QueryPlan) HasStats() bool
- func (qp *QueryPlan) IsFunction(childLink *sppb.PlanNode_ChildLink) bool
- func (qp *QueryPlan) IsPredicate(childLink *sppb.PlanNode_ChildLink) bool
- func (qp *QueryPlan) IsVisible(link *sppb.PlanNode_ChildLink) bool
- 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
- type TargetMetadataFormat
Constants ¶
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 ¶
var ErrEmptyPlanNodes = errors.New("spannerplan: planNodes cannot be empty")
Functions ¶
func ExtractQueryPlan ¶
func ExtractQueryPlan(b []byte) (*sppb.ResultSetStats, *sppb.StructType, error)
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 )
func ParseExecutionMethodFormat ¶ added in v0.1.2
func ParseExecutionMethodFormat(s string) (ExecutionMethodFormat, error)
ParseExecutionMethodFormat parses string representation of ExecutionMethodFormat.
type FullScanFormat ¶
type FullScanFormat = KnownFlagFormat
type KnownFlagFormat ¶
type KnownFlagFormat int64
func ParseKnownFlagFormat ¶ added in v0.1.2
func ParseKnownFlagFormat(s string) (KnownFlagFormat, error)
ParseKnownFlagFormat parses string representation of KnownFlagFormat.
type Option ¶
type Option func(o *option)
func EnableCompact ¶
func EnableCompact() Option
func HideMetadata ¶ added in v0.1.3
func HideMetadata() Option
HideMetadata hides all metadata and labels even if KnownFlagFormatLabel is set. It is used by spannerplanviz.
func WithExecutionMethodFormat ¶
func WithExecutionMethodFormat(fmt ExecutionMethodFormat) Option
func WithFullScanFormat
deprecated
func WithFullScanFormat(fmt FullScanFormat) Option
Deprecated: WithFullScanFormat is an alias of WithKnownFlagFormat.
func WithInlineStatsFunc ¶ added in v0.1.2
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 (*QueryPlan) GetLinkType ¶ added in v0.1.3
func (qp *QueryPlan) GetLinkType(link *sppb.PlanNode_ChildLink) string
func (*QueryPlan) GetNodeByChildLink ¶
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) GetParentNodeByChildIndex ¶
func (*QueryPlan) GetParentNodeByChildLink ¶
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) ResolveChildLink ¶
func (qp *QueryPlan) ResolveChildLink(item *sppb.PlanNode_ChildLink) *ResolvedChildLink
func (*QueryPlan) VisibleChildLinks ¶
func (qp *QueryPlan) VisibleChildLinks(node *sppb.PlanNode) []*sppb.PlanNode_ChildLink
type ResolvedChildLink ¶
type ResolvedChildLink struct {
ChildLink *sppb.PlanNode_ChildLink
Child *sppb.PlanNode
}
type TargetMetadataFormat ¶
type TargetMetadataFormat int64
TargetMetadataFormat controls how to render target metadata. target metadata are scan_target, distribution_table, and table.
const ( // TargetMetadataFormatRaw prints target metadata as is. TargetMetadataFormatRaw TargetMetadataFormat = iota // TargetMetadataFormatOn prints target metadata as `on <target>`. TargetMetadataFormatOn )
func ParseTargetMetadataFormat ¶ added in v0.1.2
func ParseTargetMetadataFormat(s string) (TargetMetadataFormat, error)
ParseTargetMetadataFormat parses string representation of TargetMetadataFormat.
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) |
|
reference
Package reference provides a reference implementation for rendering Spanner query plans as ASCII tables with various formatting options.
|
Package reference provides a reference implementation for rendering Spanner query plans as ASCII tables with various formatting options. |
|
reference/tools/genexpected
command
|
|