Github user scwf commented on a diff in the pull request:
https://github.com/apache/spark/pull/5996#discussion_r29989679
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/GroupedData.scala ---
@@ -158,7 +159,15 @@ class GroupedData protected[sql](df: DataFrame,
groupingExprs: Seq[Expression])
case expr: NamedExpression => expr
case expr: Expression => Alias(expr, expr.prettyString)()
}
- DataFrame(df.sqlContext, Aggregate(groupingExprs, aggExprs,
df.logicalPlan))
+ if (df.sqlContext.conf.dataFrameRetainGroupColumns) {
+ val retainedExprs = groupingExprs.map {
+ case expr: NamedExpression => expr
+ case expr: Expression => Alias(expr, expr.prettyString)()
+ }
+ DataFrame(df.sqlContext, Aggregate(groupingExprs, retainedExprs ++
aggExprs, df.logicalPlan))
--- End diff --
how about `retainedExprs` and `aggExprs` have the same expressions, should
we distinct them?
---
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]