Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/10052#discussion_r46895252
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -178,6 +179,27 @@ class Analyzer(
}
}
+ /**
+ * Replaces queries of the form "SELECT expr FROM A GROUP BY 1"
+ * with a query of the form "SELECT expr FROM A GROUP BY expr"
+ */
+ object ResolveGroupByReferences extends Rule[LogicalPlan] {
+
+ def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators {
+ case Aggregate(groups, aggs, child) =>
+ Aggregate(groups.map(group => group match {
+ case g if g.prettyString forall Character.isDigit =>
--- End diff --
I'm not sure we want to match on the pretty string as I think this would
also trigger for things like `"1"`, instead I'd consider matching on a Literal
of NumericType.
---
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]