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

ResolveFunctions

ResolveFunctions Logical Resolution Rule — Resolving grouping__id UnresolvedAttribute, UnresolvedGenerator And UnresolvedFunction Expressions

ResolveFunctions is a logical resolution rule that the logical query plan analyzer uses to resolve grouping__id UnresolvedAttribute, UnresolvedGenerator and UnresolvedFunction expressions in an entire logical query plan.

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

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

Note
ResolveFunctions is a Scala object inside Analyzer class.

Resolving grouping__id UnresolvedAttribute, UnresolvedGenerator and UnresolvedFunction Expressions In Entire Query Plan (Applying ResolveFunctions to Logical Plan) — apply Method

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

apply takes a logical plan and transforms each expression (for every logical operator found in the query plan) as follows:

  • For UnresolvedAttributes with names as groupingid, apply creates a Alias (with a GroupingID child expression and groupingid name).

    That case seems mostly for compatibility with Hive as grouping__id attribute name is used by Hive.

  • For UnresolvedGenerators, apply requests the SessionCatalog to find a Generator function by name.

    If some other non-generator function is found for the name, apply fails the analysis phase by reporting an AnalysisException:

  • For UnresolvedFunctions, apply requests the SessionCatalog to find a function by name.

  • AggregateWindowFunctions are returned directly or apply fails the analysis phase by reporting an AnalysisException when the UnresolvedFunction has isDistinct flag enabled.

  • AggregateFunctions are wrapped in a AggregateExpression (with Complete aggregate mode)

  • All other functions are returned directly or apply fails the analysis phase by reporting an AnalysisException when the UnresolvedFunction has isDistinct flag enabled.

apply skips unresolved expressions.

赞(0) 打赏
未经允许不得转载:spark技术分享 » ResolveFunctions
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏