@@ -129,8 +129,8 @@ class Analyzer(catalog: Catalog, registry: FunctionRegistry, caseSensitive: Bool
129129 */
130130 object ResolveSortReferences extends Rule [LogicalPlan ] {
131131 def apply (plan : LogicalPlan ): LogicalPlan = plan transformUp {
132- case s@ Sort (ordering, p@ Project (projectList, child)) if ! s.resolved && p.resolved =>
133- val unresolved = ordering.flatMap(_.collect { case UnresolvedAttribute (name) => name})
132+ case s @ Sort (ordering, p @ Project (projectList, child)) if ! s.resolved && p.resolved =>
133+ val unresolved = ordering.flatMap(_.collect { case UnresolvedAttribute (name) => name })
134134 val resolved = unresolved.flatMap(child.resolveChildren)
135135 val requiredAttributes = resolved.collect { case a : Attribute => a }.toSet
136136
@@ -143,19 +143,19 @@ class Analyzer(catalog: Catalog, registry: FunctionRegistry, caseSensitive: Bool
143143 } else {
144144 s // Nothing we can do here. Return original plan.
145145 }
146- case s@ Sort (ordering, a@ Aggregate (grouping, aggs, child)) if ! s.resolved && a.resolved =>
147- val unresolved = ordering.flatMap(_.collect { case UnresolvedAttribute (name) => name})
146+ case s @ Sort (ordering, a @ Aggregate (grouping, aggs, child)) if ! s.resolved && a.resolved =>
147+ val unresolved = ordering.flatMap(_.collect { case UnresolvedAttribute (name) => name })
148148 // A small hack to create an object that will allow us to resolve any references that
149149 // refer to named expressions that are present in the grouping expressions.
150150 val groupingRelation = LocalRelation (
151- grouping.collect { case ne : NamedExpression => ne.toAttribute}
151+ grouping.collect { case ne : NamedExpression => ne.toAttribute }
152152 )
153153
154154 logWarning(s " Grouping expressions: $groupingRelation" )
155155 val resolved = unresolved.flatMap(groupingRelation.resolve).toSet
156156 val missingInAggs = resolved -- a.outputSet
157157 logWarning(s " Resolved: $resolved Missing in aggs: $missingInAggs" )
158- if (missingInAggs.nonEmpty) {
158+ if (missingInAggs.nonEmpty) {
159159 // Add missing grouping exprs and then project them away after the sort.
160160 Project (a.output,
161161 Sort (ordering,
0 commit comments