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

CheckAnalysis — Analysis Validation

CheckAnalysis — Analysis Validation

CheckAnalysis defines checkAnalysis method that Analyzer uses to check if a logical plan is correct (after all the transformations) by applying validation rules and in the end marking it as analyzed.

Note
An analyzed logical plan is correct and ready for execution.

CheckAnalysis defines extendedCheckRules extension point that allows for extra analysis check rules.

Validating Analysis of Logical Plan (and Marking Plan As Analyzed) — checkAnalysis Method

checkAnalysis recursively checks the correctness of the analysis of the input logical plan and marks it as analyzed.

Note
checkAnalysis fails analysis when finds UnresolvedRelation in the input LogicalPlan…​FIXME What else?

Internally, checkAnalysis processes nodes in the input plan (starting from the leafs, i.e. nodes down the operator tree).

Table 1. checkAnalysis’s Validation Rules (in the order of execution)
LogicalPlan/Operator Behaviour

UnresolvedRelation

Fails analysis with the error message:

Unresolved Attribute

Fails analysis with the error message:

Expression with incorrect input data types

Fails analysis with the error message:

Unresolved Cast

Fails analysis with the error message:

Grouping

Fails analysis with the error message:

GroupingID

Fails analysis with the error message:

WindowExpressions with a AggregateExpression window function with isDistinct flag on

Fails analysis with the error message:

Example:

WindowExpressions with a OffsetWindowFunction window function with an empty order specification or a non-offset window frame specification

Fails analysis with the error message:

WindowExpressions with a window function that is not one of the following expressions: AggregateExpression, AggregateWindowFunction or OffsetWindowFunction

Fails analysis with the error message:

Nondeterministic expressions

FIXME

UnresolvedHint

FIXME

FIXME

FIXME

checkAnalysis then checks if plan is analyzed correctly (i.e. no logical plans are left unresolved). If there is one, checkAnalysis fails the analysis with AnalysisException and the following error message:

In the end, checkAnalysis marks the entire logical plan as analyzed.

Note

checkAnalysis is used when:

Extended Analysis Check Rules — extendedCheckRules Extension Point

extendedCheckRules is a collection of rules (functions) that checkAnalysis uses for custom analysis checks (after the main validations have been executed).

Note
When a condition of a rule does not hold the function throws an AnalysisException directly or using failAnalysis method.

checkSubqueryExpression Internal Method

checkSubqueryExpression…​FIXME

Note
checkSubqueryExpression is used exclusively when CheckAnalysis is requested to validate analysis of a logical plan (for SubqueryExpression expressions).
赞(0) 打赏
未经允许不得转载:spark技术分享 » CheckAnalysis — Analysis Validation
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏