Skip to content

Commit

Permalink
remove GroupExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
scwf committed Jan 16, 2015
1 parent e8422c5 commit 59d61bf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ class Analyzer(catalog: Catalog,
* expressions which equal GroupBy expressions with Literal(null), if those expressions
* are not set for this grouping set (according to the bit mask).
*/
private[this] def expand(g: GroupingSets): Seq[GroupExpression] = {
val result = new scala.collection.mutable.ArrayBuffer[GroupExpression]
private[this] def expand(g: GroupingSets): Seq[Seq[Expression]] = {
val result = new scala.collection.mutable.ArrayBuffer[Seq[Expression]]

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

result += GroupExpression(substitution)
result += substitution
}

result.toSeq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,3 @@ abstract class UnaryExpression extends Expression with trees.UnaryNode[Expressio
self: Product =>
}

// TODO Semantically we probably not need GroupExpression
// All we need is holding the Seq[Expression], and ONLY used in doing the
// expressions transformation correctly. Probably will be removed since it's
// not like a real expressions.
case class GroupExpression(children: Seq[Expression]) extends Expression {
self: Product =>
type EvaluatedType = Seq[Any]
override def eval(input: Row): EvaluatedType = ???
override def nullable = false
override def foldable = false
override def dataType = ???
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ case class Aggregate(
* @param child Child operator
*/
case class Expand(
projections: Seq[GroupExpression],
projections: Seq[Seq[Expression]],
output: Seq[Attribute],
child: LogicalPlan) extends UnaryNode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import org.apache.spark.sql.catalyst.plans.physical.{UnknownPartitioning, Partit
*/
@DeveloperApi
case class Expand(
projections: Seq[GroupExpression],
projections: Seq[Seq[Expression]],
output: Seq[Attribute],
child: SparkPlan)
extends UnaryNode {
Expand All @@ -48,7 +48,7 @@ case class Expand(
// workers via closure. However we can't assume the Projection
// is serializable because of the code gen, so we have to
// create the projections within each of the partition processing.
val groups = projections.map(ee => newProjection(ee.children, child.output)).toArray
val groups = projections.map(newProjection(_, child.output)).toArray

new Iterator[Row] {
private[this] var result: Row = _
Expand Down

0 comments on commit 59d61bf

Please sign in to comment.