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

UnresolvedAttribute

UnresolvedAttribute Leaf Expression

UnresolvedAttribute is a named Attribute leaf expression (i.e. it has a name) that represents a reference to an entity in a logical query plan.

UnresolvedAttribute is created when:

UnresolvedAttribute can never be resolved (and is replaced at analysis phase).

Note

UnresolvedAttribute is resolved when Analyzer is executed by the following logical resolution rules:


Given UnresolvedAttribute can never be resolved it should not come as a surprise that it cannot be evaluated either (i.e. produce a value given an internal row). When requested to evaluate, UnresolvedAttribute simply reports a UnsupportedOperationException.

UnresolvedAttribute takes name parts when created.

UnresolvedAttribute can be created with a fully-qualified name with dots to separate name parts.

Tip

Use backticks () around names with dots (.) to disable them as separators.

The following is a two-part attribute name with a.b and c name parts.

UnresolvedAttribute can also be created without the dots with the special meaning.

Note

Catalyst DSL defines two Scala implicits to create an UnresolvedAttribute:

  • StringToAttributeConversionHelper is a Scala implicit class that converts $"colName" into an UnresolvedAttribute

  • symbolToUnresolvedAttribute is a Scala implicit method that converts 'colName into an UnresolvedAttribute

Both implicits are part of ExpressionConversions Scala trait of Catalyst DSL.

Import expressions object to get access to the expression conversions.

Note

A UnresolvedAttribute can be replaced by (resolved) a NamedExpression using an analyzed logical plan (of the structured query the attribute is part of).

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

关注公众号:spark技术分享

联系我们联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏