ResolveOrdinalInOrderByAndGroupBy Logical Resolution Rule¶
ResolveOrdinalInOrderByAndGroupBy
is a logical resolution rule that <
ResolveOrdinalInOrderByAndGroupBy
is part of the Resolution fixed-point batch in the standard batches of the Analyzer.
ResolveOrdinalInOrderByAndGroupBy
is a Catalyst rule for transforming logical plans, i.e. Rule[LogicalPlan]
.
[[creating-instance]] ResolveOrdinalInOrderByAndGroupBy
takes no arguments when created.
[source, scala]¶
// FIXME: DEMO val rule = spark.sessionState.analyzer.ResolveOrdinalInOrderByAndGroupBy
val plan = ??? val planResolved = rule(plan) scala> println(planResolved.numberedTreeString) 00 'UnresolvedRelation t1
=== [[apply]] Executing Rule -- apply
Method
[source, scala]¶
apply(plan: LogicalPlan): LogicalPlan¶
apply
walks the logical plan from children up the tree and looks for <
For a <apply
replaces all the <SortOrder
expressions and the expression at the index - 1
position in the output schema of the <
For a <apply
replaces all the expressions (with <index - 1
position in the <Aggregate
logical operator.
apply
throws a AnalysisException
(and hence fails an analysis) if the ordinal is outside the range:
ORDER BY position [index] is not in select list (valid range is [1, [output.size]])
GROUP BY position [index] is not in select list (valid range is [1, [aggs.size]])
apply
is part of the Rule abstraction.