Rule¶
Rule
is an abstraction of named transformations of TreeNodes.
Rule
can be executed on a TreeNode
to produce a new TreeNode
.
Rule
is primarily used to create a batch of rules for a RuleExecutor.
TreeType¶
Rule
is a Scala abstract class constructor (generic class) with TreeType
type that is a subtype of TreeNode (e.g. LogicalPlan, SparkPlan, Expression).
abstract class Rule[TreeType <: TreeNode[_]]
Contract¶
Executing Rule¶
apply(
plan: TreeType): TreeType
Applies the rule to a TreeType
Used when:
QueryExecution
utility is used to prepareForExecutionAdaptiveSparkPlanExec
utility is used to applyPhysicalRules
Name¶
ruleName: String
ruleName
is the name of a rule that is a class name with no ending $
(that Scala generates for objects).
Notable Use Cases¶
The other notable use cases of Rule
are as follows:
-
When
ExperimentalMethods
is requested for extraOptimizations -
When
BaseSessionStateBuilder
is requested for customResolutionRules, customPostHocResolutionRules, customOperatorOptimizationRules, and the Optimizer -
When
Analyzer
is requested for extendedResolutionRules and postHocResolutionRules (see BaseSessionStateBuilder and HiveSessionStateBuilder) -
When
Optimizer
is requested for extendedOperatorOptimizationRules -
When
QueryExecution
is requested for preparations