Documentation
¶
Overview ¶
Package plantest contains utilities for testing each query planning phase
Index ¶
- Constants
- func CompareLogicalPlanNodes(p, q plan.PlanNode) error
- func ComparePhysicalPlanNodes(p, q plan.PlanNode) error
- func ComparePlans(p, q *plan.PlanSpec, f func(p, q plan.PlanNode) error) error
- func CreateLogicalMockNode(id string) *plan.LogicalPlanNode
- func CreatePhysicalMockNode(id string) *plan.PhysicalPlanNode
- func CreatePlanSpec(spec *PlanSpec) *plan.PlanSpec
- func LogicalRuleTestHelper(t *testing.T, tc *RuleTestCase)
- func PhysicalRuleTestHelper(t *testing.T, tc *RuleTestCase)
- type CreateCycleRule
- type MergeFromRangePhysicalRule
- type MockProcedureSpec
- type PlanSpec
- type RuleTestCase
- type SimpleRule
- type SmashPlanRule
Constants ¶
const MockKind = "mock"
Variables ¶
This section is empty.
Functions ¶
func CompareLogicalPlanNodes ¶
CompareLogicalPlanNodes is a comparator fuction for LogicalPlanNodes
func ComparePhysicalPlanNodes ¶
ComparePhysicalPlanNodes is a comparator function for PhysicalPlanNodes
func ComparePlans ¶
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 ¶
CreatePlanSpec creates a logical plan from a set of nodes and edges
func LogicalRuleTestHelper ¶ added in v0.19.0
func LogicalRuleTestHelper(t *testing.T, tc *RuleTestCase)
LogicalRuleTestHelper will run a rule test case.
func PhysicalRuleTestHelper ¶ added in v0.19.0
func PhysicalRuleTestHelper(t *testing.T, tc *RuleTestCase)
PhysicalRuleTestHelper will run a rule test case.
Types ¶
type CreateCycleRule ¶ added in v0.10.0
type CreateCycleRule struct { Node plan.PlanNode Kind plan.ProcedureKind }
CreateCycleRule creates a cycle between the given `Node` and its predecessor. It creates exactly one cycle. After the rule is triggered once, it won't have any effect later. This rule breaks the integrity of the plan. If `Kind` is specified, it takes precedence over `Node`, and the rule will use it to match.
func (CreateCycleRule) Name ¶ added in v0.10.0
func (CreateCycleRule) Name() string
func (CreateCycleRule) Pattern ¶ added in v0.10.0
func (ccr CreateCycleRule) Pattern() plan.Pattern
type MergeFromRangePhysicalRule ¶ added in v0.18.0
type MergeFromRangePhysicalRule struct{}
MergeFromRangePhysicalRule merges a from and a subsequent range.
func (*MergeFromRangePhysicalRule) Name ¶ added in v0.18.0
func (sr *MergeFromRangePhysicalRule) Name() string
func (*MergeFromRangePhysicalRule) Pattern ¶ added in v0.18.0
func (sr *MergeFromRangePhysicalRule) Pattern() plan.Pattern
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) Copy() plan.ProcedureSpec
func (MockProcedureSpec) Kind ¶
func (MockProcedureSpec) Kind() plan.ProcedureKind
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 RuleTestCase ¶ added in v0.8.0
type RuleTestCase struct { Name string Rules []plan.Rule Before *PlanSpec After *PlanSpec NoChange bool }
RuleTestCase allows for concise creation of test cases that exercise rules
type SimpleRule ¶
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
type SmashPlanRule ¶ added in v0.10.0
SmashPlanRule adds an `Intruder` as predecessor of the given `Node` without marking it as successor of it. It breaks the integrity of the plan. If `Kind` is specified, it takes precedence over `Node`, and the rule will use it to match.
func (SmashPlanRule) Name ¶ added in v0.10.0
func (SmashPlanRule) Name() string
func (SmashPlanRule) Pattern ¶ added in v0.10.0
func (spp SmashPlanRule) Pattern() plan.Pattern