Skip to content

Commit a2869d4

Browse files
update the code as comments
1 parent c441777 commit a2869d4

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

sql/core/src/main/scala/org/apache/spark/sql/GroupedData.scala

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ import org.apache.spark.sql.catalyst.expressions._
2626
import org.apache.spark.sql.catalyst.plans.logical.{Rollup, Cube, Aggregate}
2727
import org.apache.spark.sql.types.NumericType
2828

29-
/**
30-
* The Grouping Type
31-
*/
32-
sealed private[sql] trait GroupType
33-
3429
/**
3530
* Companion object for GroupedData
3631
*/
@@ -39,9 +34,14 @@ private[sql] object GroupedData {
3934
df: DataFrame,
4035
groupingExprs: Seq[Expression],
4136
groupType: GroupType): GroupedData = {
42-
new GroupedData(df, groupingExprs).withNewGroupType(groupType)
37+
new GroupedData(df, groupingExprs, groupType: GroupType)
4338
}
4439

40+
/**
41+
* The Grouping Type
42+
*/
43+
private[sql] trait GroupType
44+
4545
/**
4646
* To indicate it's the GroupBy
4747
*/
@@ -65,15 +65,10 @@ private[sql] object GroupedData {
6565
* @since 1.3.0
6666
*/
6767
@Experimental
68-
class GroupedData protected[sql](df: DataFrame, groupingExprs: Seq[Expression]) {
69-
70-
private var groupType: GroupType = _
71-
72-
private[sql] def withNewGroupType(groupType: GroupType): GroupedData = {
73-
this.groupType = groupType
74-
this
75-
}
76-
68+
class GroupedData protected[sql](
69+
df: DataFrame,
70+
groupingExprs: Seq[Expression],
71+
private val groupType: GroupedData.GroupType) {
7772
private[sql] implicit def toDF(aggExprs: Seq[NamedExpression]): DataFrame = {
7873
val aggregates = if (df.sqlContext.conf.dataFrameRetainGroupColumns) {
7974
val retainedExprs = groupingExprs.map {

0 commit comments

Comments
 (0)