plantest

package
v0.7.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package plantest contains utilities for testing each query planning phase

Index

Constants

View Source
const MockKind = "mock"

Variables

This section is empty.

Functions

func CompareLogicalPlanNodes

func CompareLogicalPlanNodes(p, q plan.PlanNode) error

CompareLogicalPlanNodes is a comparator fuction for LogicalPlanNodes

func ComparePhysicalPlanNodes

func ComparePhysicalPlanNodes(p, q plan.PlanNode) error

ComparePhysicalPlanNodes is a comparator function for PhysicalPlanNodes

func ComparePlans

func ComparePlans(p, q *plan.PlanSpec, f func(p, q plan.PlanNode) error) error

ComparePlans compares two query plans using an arbitrary comparator function f

func CreateLogicalMockNode

func CreateLogicalMockNode(id string) *plan.LogicalPlanNode

CreateLogicalMockNode creates a mock plan node that doesn't match any rules (other than rules that match any node)

func CreatePhysicalMockNode

func CreatePhysicalMockNode(id string) *plan.PhysicalPlanNode

CreatePhysicalMockNode creates a mock plan node that doesn't match any rules (other than rules that match any node)

func CreatePlanSpec

func CreatePlanSpec(spec *PlanSpec) *plan.PlanSpec

CreatePlanSpec creates a logical plan from a set of nodes and edges

Types

type MockProcedureSpec

type MockProcedureSpec struct {
	plan.DefaultCost
}

MockProcedureSpec provides a type that implements ProcedureSpec but does not require importing packages which register rules and procedure kinds, which makes it useful for unit testing.

func (MockProcedureSpec) Copy

func (MockProcedureSpec) Kind

type PlanSpec

type PlanSpec struct {
	Nodes []plan.PlanNode

	// Edges is a list of predecessor-to-successor edges.
	// [1, 3] => Nodes[1] is a predecessor of Nodes[3].
	// Predecessor ordering must be encoded in this list.
	Edges [][2]int

	Resources flux.ResourceManagement

	Now time.Time
}

PlanSpec is a set of nodes and edges of a logical query plan

type SimpleRule

type SimpleRule struct {
	SeenNodes []plan.NodeID
}

SimpleRule is a simple rule whose pattern matches any plan node and just stores the NodeIDs of nodes it has visited in SeenNodes.

func (*SimpleRule) Name

func (sr *SimpleRule) Name() string

func (*SimpleRule) Pattern

func (sr *SimpleRule) Pattern() plan.Pattern

func (*SimpleRule) Rewrite

func (sr *SimpleRule) Rewrite(node plan.PlanNode) (plan.PlanNode, bool, error)

Jump to

Keyboard shortcuts

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