关注 spark技术分享,
撸spark源码 玩spark最佳实践

RewriteCorrelatedScalarSubquery

RewriteCorrelatedScalarSubquery Logical Optimization

RewriteCorrelatedScalarSubquery is a base logical optimization that transforms logical plans with the following operators:

  1. FIXME

RewriteCorrelatedScalarSubquery is part of the Operator Optimization before Inferring Filters fixed-point batch in the standard batches of the Catalyst Optimizer.

RewriteCorrelatedScalarSubquery is simply a Catalyst rule for transforming logical plans, i.e. Rule[LogicalPlan].

evalExpr Internal Method

evalExpr…​FIXME

Note
evalExpr is used exclusively when RewriteCorrelatedScalarSubquery is…​FIXME

evalAggOnZeroTups Internal Method

evalAggOnZeroTups…​FIXME

Note
evalAggOnZeroTups is used exclusively when RewriteCorrelatedScalarSubquery is…​FIXME

evalSubqueryOnZeroTups Internal Method

evalSubqueryOnZeroTups…​FIXME

Note
evalSubqueryOnZeroTups is used exclusively when RewriteCorrelatedScalarSubquery is requsted to constructLeftJoins.

constructLeftJoins Internal Method

constructLeftJoins…​FIXME

Note
constructLeftJoins is used exclusively when RewriteCorrelatedScalarSubquery logical optimization is executed (i.e. applied to Aggregate, Project or Filter logical operators with correlated scalar subqueries)

Executing Rule — apply Method

Note
apply is part of the Rule Contract to execute (apply) a rule on a TreeNode (e.g. LogicalPlan).

apply transforms the input logical plan as follows:

  1. For Aggregate operators, apply…​FIXME

  2. For Project operators, apply…​FIXME

  3. For Filter operators, apply…​FIXME

Extracting ScalarSubquery Expressions with Children — extractCorrelatedScalarSubqueries Internal Method

extractCorrelatedScalarSubqueries finds all ScalarSubquery expressions with at least one child in the input expression and adds them to the input subqueries collection.

extractCorrelatedScalarSubqueries traverses the input expression down (the expression tree) and, every time a ScalarSubquery with at least one child is found, returns the head of the output attributes of the subquery plan.

In the end, extractCorrelatedScalarSubqueries returns the rewritten expression.

Note
extractCorrelatedScalarSubqueries uses scala.collection.mutable.ArrayBuffer and mutates an instance inside (i.e. adds ScalarSubquery expressions) that makes for two output values, i.e. the rewritten expression and the ScalarSubquery expressions.
Note
extractCorrelatedScalarSubqueries is used exclusively when RewriteCorrelatedScalarSubquery is executed (i.e. applied to a logical plan).
赞(0) 打赏
未经允许不得转载:spark技术分享 » RewriteCorrelatedScalarSubquery
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏