@@ -26,11 +26,6 @@ import org.apache.spark.sql.catalyst.expressions._
26
26
import org .apache .spark .sql .catalyst .plans .logical .{Rollup , Cube , Aggregate }
27
27
import org .apache .spark .sql .types .NumericType
28
28
29
- /**
30
- * The Grouping Type
31
- */
32
- sealed private [sql] trait GroupType
33
-
34
29
/**
35
30
* Companion object for GroupedData
36
31
*/
@@ -39,9 +34,14 @@ private[sql] object GroupedData {
39
34
df : DataFrame ,
40
35
groupingExprs : Seq [Expression ],
41
36
groupType : GroupType ): GroupedData = {
42
- new GroupedData (df, groupingExprs).withNewGroupType( groupType)
37
+ new GroupedData (df, groupingExprs, groupType : GroupType )
43
38
}
44
39
40
+ /**
41
+ * The Grouping Type
42
+ */
43
+ private [sql] trait GroupType
44
+
45
45
/**
46
46
* To indicate it's the GroupBy
47
47
*/
@@ -65,15 +65,10 @@ private[sql] object GroupedData {
65
65
* @since 1.3.0
66
66
*/
67
67
@ 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 ) {
77
72
private [sql] implicit def toDF (aggExprs : Seq [NamedExpression ]): DataFrame = {
78
73
val aggregates = if (df.sqlContext.conf.dataFrameRetainGroupColumns) {
79
74
val retainedExprs = groupingExprs.map {
0 commit comments