public class HepProgramBuilder extends Object
HepProgram.| Constructor and Description |
|---|
HepProgramBuilder()
Creates a new HepProgramBuilder with an initially empty program.
|
| Modifier and Type | Method and Description |
|---|---|
HepProgramBuilder |
addCommonRelSubExprInstruction()
Adds an instruction to attempt to match instances of
CommonRelSubExprRule, but only in cases where vertices have more
than one parent. |
HepProgramBuilder |
addConverters(boolean guaranteed)
Adds an instruction to attempt to match instances of
ConverterRule,
but only where a conversion is actually required. |
HepProgramBuilder |
addGroupBegin()
Adds an instruction to begin a group of rules.
|
HepProgramBuilder |
addGroupEnd()
Adds an instruction to end a group of rules, firing the group
collectively.
|
HepProgramBuilder |
addMatchLimit(int limit)
Adds an instruction to limit the number of pattern matches for subsequent
instructions.
|
HepProgramBuilder |
addMatchOrder(HepMatchOrder order)
Adds an instruction to change the order of pattern matching for
subsequent instructions.
|
HepProgramBuilder |
addRuleByDescription(String ruleDescription)
Adds an instruction to attempt to match a specific rule identified by its
unique description.
|
<R extends RelOptRule> |
addRuleClass(Class<R> ruleClass)
Adds an instruction to attempt to match any rules of a given class.
|
HepProgramBuilder |
addRuleCollection(Collection<RelOptRule> rules)
Adds an instruction to attempt to match any rules in a given collection.
|
HepProgramBuilder |
addRuleInstance(RelOptRule rule)
Adds an instruction to attempt to match a specific rule object.
|
HepProgramBuilder |
addSubprogram(HepProgram program)
Adds an instruction to execute a subprogram.
|
HepProgram |
build()
Returns the constructed program, clearing the state of this program
builder as a side-effect.
|
public HepProgramBuilder()
HepMatchOrder.ARBITRARY, and an initial match limit of
HepProgram.MATCH_UNTIL_FIXPOINT.public <R extends RelOptRule> HepProgramBuilder addRuleClass(Class<R> ruleClass)
Note that when this method is used, it is also necessary to add the
actual rule objects of interest to the planner via
RelOptPlanner.addRule(org.apache.calcite.plan.RelOptRule). If the planner does not have any
rules of the given class, this instruction is a nop.
TODO: support classification via rule annotations.
ruleClass - class of rules to fire, e.g. ConverterRule.classpublic HepProgramBuilder addRuleCollection(Collection<RelOptRule> rules)
Note that when this method is used, it is NOT necessary to add the
rules to the planner via RelOptPlanner.addRule(org.apache.calcite.plan.RelOptRule); the instances
supplied here will be used. However, adding the rules to the planner
redundantly is good form since other planners may require it.
rules - collection of rules to firepublic HepProgramBuilder addRuleInstance(RelOptRule rule)
Note that when this method is used, it is NOT necessary to add the
rule to the planner via RelOptPlanner.addRule(org.apache.calcite.plan.RelOptRule); the instance
supplied here will be used. However, adding the rule to the planner
redundantly is good form since other planners may require it.
rule - rule to firepublic HepProgramBuilder addRuleByDescription(String ruleDescription)
Note that when this method is used, it is necessary to also add the
rule object of interest to the planner via RelOptPlanner.addRule(org.apache.calcite.plan.RelOptRule).
This allows for some decoupling between optimizers and plugins: the
optimizer only knows about rule descriptions, while the plugins supply
the actual instances. If the planner does not have a rule matching the
description, this instruction is a nop.
ruleDescription - description of rule to firepublic HepProgramBuilder addGroupBegin()
public HepProgramBuilder addGroupEnd()
public HepProgramBuilder addConverters(boolean guaranteed)
ConverterRule,
but only where a conversion is actually required.guaranteed - if true, use only guaranteed converters; if false, use
only non-guaranteed converterspublic HepProgramBuilder addCommonRelSubExprInstruction()
CommonRelSubExprRule, but only in cases where vertices have more
than one parent.public HepProgramBuilder addMatchOrder(HepMatchOrder order)
order - new match direction to setpublic HepProgramBuilder addMatchLimit(int limit)
limit - limit to set; use HepProgram.MATCH_UNTIL_FIXPOINT to
remove limitpublic HepProgramBuilder addSubprogram(HepProgram program)
The subprogram has its own state for match order and limit (initialized to the defaults every time the subprogram is executed) and any changes it makes to those settings do not affect the parent program.
program - subprogram to executepublic HepProgram build()
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.