Skip to content

Commit 59d61bf

Browse files
committed
remove GroupExpression
1 parent e8422c5 commit 59d61bf

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ class Analyzer(catalog: Catalog,
156156
* expressions which equal GroupBy expressions with Literal(null), if those expressions
157157
* are not set for this grouping set (according to the bit mask).
158158
*/
159-
private[this] def expand(g: GroupingSets): Seq[GroupExpression] = {
160-
val result = new scala.collection.mutable.ArrayBuffer[GroupExpression]
159+
private[this] def expand(g: GroupingSets): Seq[Seq[Expression]] = {
160+
val result = new scala.collection.mutable.ArrayBuffer[Seq[Expression]]
161161

162162
g.bitmasks.foreach { bitmask =>
163163
// get the non selected grouping attributes according to the bit mask
@@ -173,7 +173,7 @@ class Analyzer(catalog: Catalog,
173173
Literal(bitmask, IntegerType)
174174
})
175175

176-
result += GroupExpression(substitution)
176+
result += substitution
177177
}
178178

179179
result.toSeq

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,3 @@ abstract class UnaryExpression extends Expression with trees.UnaryNode[Expressio
285285
self: Product =>
286286
}
287287

288-
// TODO Semantically we probably not need GroupExpression
289-
// All we need is holding the Seq[Expression], and ONLY used in doing the
290-
// expressions transformation correctly. Probably will be removed since it's
291-
// not like a real expressions.
292-
case class GroupExpression(children: Seq[Expression]) extends Expression {
293-
self: Product =>
294-
type EvaluatedType = Seq[Any]
295-
override def eval(input: Row): EvaluatedType = ???
296-
override def nullable = false
297-
override def foldable = false
298-
override def dataType = ???
299-
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ case class Aggregate(
161161
* @param child Child operator
162162
*/
163163
case class Expand(
164-
projections: Seq[GroupExpression],
164+
projections: Seq[Seq[Expression]],
165165
output: Seq[Attribute],
166166
child: LogicalPlan) extends UnaryNode
167167

sql/core/src/main/scala/org/apache/spark/sql/execution/Expand.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import org.apache.spark.sql.catalyst.plans.physical.{UnknownPartitioning, Partit
3333
*/
3434
@DeveloperApi
3535
case class Expand(
36-
projections: Seq[GroupExpression],
36+
projections: Seq[Seq[Expression]],
3737
output: Seq[Attribute],
3838
child: SparkPlan)
3939
extends UnaryNode {
@@ -48,7 +48,7 @@ case class Expand(
4848
// workers via closure. However we can't assume the Projection
4949
// is serializable because of the code gen, so we have to
5050
// create the projections within each of the partition processing.
51-
val groups = projections.map(ee => newProjection(ee.children, child.output)).toArray
51+
val groups = projections.map(newProjection(_, child.output)).toArray
5252

5353
new Iterator[Row] {
5454
private[this] var result: Row = _

0 commit comments

Comments
 (0)