Skip to content


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.


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[_]]


Executing Rule

  plan: TreeType): TreeType

Applies the rule to a TreeType

Used when:


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: