// Using Catalyst DSL
import org.apache.spark.sql.catalyst.dsl.plans._
val t1 = table("t1")
val logicalPlan = t1.subquery('a)
import org.apache.spark.sql.catalyst.analysis.EliminateSubqueryAliases
val afterEliminateSubqueryAliases = EliminateSubqueryAliases(logicalPlan)
scala> println(afterEliminateSubqueryAliases.numberedTreeString)
00 'UnresolvedRelation `t1`
EliminateSubqueryAliases Logical Optimization
EliminateSubqueryAliases
is a base logical optimization that removes (eliminates) SubqueryAlias logical operators from a logical query plan.
EliminateSubqueryAliases
is part of the Finish Analysis once-executed batch in the standard batches of the Catalyst Optimizer.
EliminateSubqueryAliases
is simply a Catalyst rule for transforming logical plans, i.e. Rule[LogicalPlan]
.
Executing Rule — apply
Method
apply(plan: LogicalPlan): LogicalPlan
Note
|
apply is part of the Rule Contract to execute (apply) a rule on a TreeNode (e.g. LogicalPlan).
|
apply
simply removes (eliminates) SubqueryAlias unary logical operators from the input logical plan.