Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/6647#discussion_r31784199
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -130,13 +130,29 @@ class Analyzer(
}
}
- /**
- * Removes no-op Alias expressions from the plan.
- */
- object TrimGroupingAliases extends Rule[LogicalPlan] {
- def apply(plan: LogicalPlan): LogicalPlan = plan transform {
- case Aggregate(groups, aggs, child) =>
- Aggregate(groups.map(_.transform { case Alias(c, _) => c }), aggs,
child)
+ object ResolveAliases extends Rule[LogicalPlan] {
+ private def assignAliases(exprs: Seq[Expression]) = {
+ var i = -1
+ exprs.map(_ transformDown {
+ case u @ UnresolvedAlias(child) =>
+ child match {
+ case _: UnresolvedAttribute => u
+ case ne: NamedExpression => ne
+ case ev: ExtractValueWithStruct => Alias(ev, ev.field.name)()
+ case g: Generator if g.resolved && g.elementTypes.size > 1 =>
MultiAlias(g, Nil)
+ case e if !e.resolved => u
+ case other =>
+ i += 1
+ Alias(other, s"c$i")()
--- End diff --
Compare to `HiveQl`, it should be `_c$i` (underscore prefix)
---
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]