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:
QueryExecutionutility is used to prepareForExecutionAdaptiveSparkPlanExecutility 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
ExperimentalMethodsis requested for extraOptimizations -
When
BaseSessionStateBuilderis requested for customResolutionRules, customPostHocResolutionRules, customOperatorOptimizationRules, and the Optimizer -
When
Analyzeris requested for extendedResolutionRules and postHocResolutionRules (see BaseSessionStateBuilder and HiveSessionStateBuilder) -
When
Optimizeris requested for extendedOperatorOptimizationRules -
When
QueryExecutionis requested for preparations