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

WindowsSubstitution

WindowsSubstitution Logical Evaluation Rule

WindowsSubstitution is a logical evaluation rule (i.e. Rule[LogicalPlan]) that the logical query plan analyzer uses to resolve (aka substitute) WithWindowDefinition unary logical operators with UnresolvedWindowExpression to their corresponding WindowExpression with resolved WindowSpecDefinition.

WindowsSubstitution is part of Substitution fixed-point batch of rules.

Note
It appears that WindowsSubstitution is exclusively used for pure SQL queries because WithWindowDefinition unary logical operator is created exclusively when AstBuilder parses window definitions.

If a window specification is not found, WindowsSubstitution fails analysis with the following error:

Note
The analysis failure is unlikely to happen given AstBuilder builds a lookup table of all the named window specifications defined in a SQL text and reports a ParseException when a WindowSpecReference is not available earlier.

For every WithWindowDefinition, WindowsSubstitution takes the child logical plan and transforms its UnresolvedWindowExpression expressions to be a WindowExpression with a window specification from the WINDOW clause (see WithWindowDefinition Example).

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

关注公众号:spark技术分享

联系我们联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏