Skip to content

[SPARK-5285][SQL] Removed GroupExpression in catalyst #4075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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