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

SortOrder

SortOrder Unevaluable Unary Expression

SortOrder is a unary expression that represents the following operators in a logical plan:

SortOrder is used to specify the output data ordering requirements of a physical operator.

SortOrder is an unevaluable expression and cannot be evaluated (i.e. produce a value given an internal row).

Note
An unevaluable expression cannot be evaluated to produce a value (neither in interpreted nor code-generated expression evaluations) and has to be resolved (replaced) to some other expressions or logical operators at analysis or optimization phases or they fail analysis.

SortOrder is never foldable (as an unevaluable expression with no evaluation).

Tip
Use asc, asc_nullsLast, desc or desc_nullsFirst operators from the Catalyst DSL to create a SortOrder expression, e.g. for testing or Spark SQL internals exploration.

Creating SortOrder Instance — apply Factory Method

apply is a convenience method to create a SortOrder with the defaultNullOrdering of the SortDirection.

Note
apply is used exclusively in window function.

Catalyst DSL — asc, asc_nullsLast, desc and desc_nullsFirst Operators

asc, asc_nullsLast, desc and desc_nullsFirst create a SortOrder expression with the Ascending or Descending sort direction, respectively.

Creating SortOrder Instance

SortOrder takes the following when created:

SortDirection Contract

SortDirection is the base of sort directions.

Table 1. SortDirection Contract
Method Description

defaultNullOrdering

Used when…​FIXME

sql

Used when…​FIXME

Ascending and Descending Sort Directions

There are two sorting directions available, i.e. Ascending and Descending.

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

关注公众号:spark技术分享

联系我们联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏