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

ResolveReferences

ResolveReferences Logical Resolution Rule

ResolveReferences is a logical resolution rule that the logical query plan analyzer uses to resolve FIXME in a logical query plan, i.e.

  1. Resolves…​FIXME

Technically, ResolveReferences is just a Catalyst rule for transforming logical plans, i.e. Rule[LogicalPlan].

ResolveReferences is part of Resolution fixed-point batch of rules.

Resolving Expressions of Logical Plan — resolve Internal Method

resolve resolves the input expression per type:

  1. UnresolvedAttribute expressions

  2. UnresolvedExtractValue expressions

  3. All other expressions

Note
resolve is used exclusively when ResolveReferences is requested to resolve reference expressions in a logical query plan.

Resolving Reference Expressions In Logical Query Plan (Applying ResolveReferences to Logical Plan) — apply Method

Note
apply is part of Rule Contract to apply a rule to a logical plan.

apply resolves the following logical operators:

  • Project logical operator with a Star expression to…​FIXME

  • Aggregate logical operator with a Star expression to…​FIXME

  • ScriptTransformation logical operator with a Star expression to…​FIXME

  • Generate logical operator with a Star expression to…​FIXME

  • Join logical operator with duplicateResolved…​FIXME

  • Intersect logical operator with duplicateResolved…​FIXME

  • Except logical operator with duplicateResolved…​FIXME

  • Sort logical operator unresolved with child operators resolved…​FIXME

  • Generate logical operator resolved…​FIXME

  • Generate logical operator unresolved…​FIXME

In the end, apply resolves the expressions of the input logical operator.

apply skips logical operators that:

  • Use UnresolvedDeserializer expressions

  • Have child operators unresolved

Expanding Star Expressions — buildExpandedProjectList Internal Method

buildExpandedProjectList expands (converts) Star expressions in the input named expressions recursively (down the expression tree) per expression:

  • For a Star expression, buildExpandedProjectList requests it to expand given the input child logical plan

  • For a UnresolvedAlias expression with a Star child expression, buildExpandedProjectList requests it to expand given the input child logical plan (similarly to a Star expression alone in the above case)

  • For exprs with Star expressions down the expression tree, buildExpandedProjectList expandStarExpression passing the input exprs and child

Note
buildExpandedProjectList is used when ResolveReferences is requested to resolve reference expressions (in Project and Aggregate operators with Star expressions).

expandStarExpression Method

expandStarExpression expands (transforms) the following expressions in the input expr expression:

  1. For UnresolvedFunction expressions with Star child expressions, expandStarExpression requests the Star expressions to expand given the input child logical plan and the resolver.

    • For CreateNamedStruct expressions with Star child expressions among the values, expandStarExpression…​FIXME

    • For CreateArray expressions with Star child expressions, expandStarExpression…​FIXME

    • For Murmur3Hash expressions with Star child expressions, expandStarExpression…​FIXME

For any other uses of Star expressions, expandStarExpression fails analysis with a AnalysisException:

Note
expandStarExpression is used exclusively when ResolveReferences is requested to expand Star expressions (in Project and Aggregate operators).

dedupRight Internal Method

dedupRight…​FIXME

Note
dedupRight is used when…​FIXME

dedupOuterReferencesInSubquery Internal Method

dedupOuterReferencesInSubquery…​FIXME

Note
dedupOuterReferencesInSubquery is used when…​FIXME
赞(0) 打赏
未经允许不得转载:spark技术分享 » ResolveReferences
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏