ResolveOrdinalInOrderByAndGroupBy Logical Resolution Rule¶
ResolveOrdinalInOrderByAndGroupBy is a logical resolution rule that <
ResolveOrdinalInOrderByAndGroupBy takes no arguments when created.
// FIXME: DEMO val rule = spark.sessionState.analyzer.ResolveOrdinalInOrderByAndGroupBy
val plan = ??? val planResolved = rule(plan) scala> println(planResolved.numberedTreeString) 00 'UnresolvedRelation
=== [[apply]] Executing Rule --
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.