Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/10052#discussion_r48045604
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -178,6 +179,46 @@ class Analyzer(
}
}
+ /**
+ * Replaces queries of the form "SELECT expr FROM A GROUP BY 1 ORDER BY
1"
+ * with a query of the form "SELECT expr FROM A GROUP BY expr ORDER BY
expr"
+ */
+ object ResolveNumericReferences extends Rule[LogicalPlan] {
+
+ def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators {
+ case Aggregate(groups, aggs, child) =>
+ val newGroups = groups.map {
+ case group if group.isInstanceOf[Literal] &&
group.dataType.isInstanceOf[IntegralType] =>
--- End diff --
```case Literal(index: Int) => ``` is easier. It also eliminates the need
for ```group.toString.toInt```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]