Skip to content

Commit 00eb298

Browse files
committed
Make it compile.
1 parent a3ca551 commit 00eb298

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import org.apache.spark.sql.catalyst.plans._
2626
import org.apache.spark.sql.catalyst.plans.logical.{BroadcastHint, LogicalPlan}
2727
import org.apache.spark.sql.catalyst.plans.physical._
2828
import org.apache.spark.sql.columnar.{InMemoryColumnarTableScan, InMemoryRelation}
29-
import org.apache.spark.sql.execution.{DescribeCommand => RunnableDescribeCommand, aggregate}
29+
import org.apache.spark.sql.execution.{DescribeCommand => RunnableDescribeCommand}
3030
import org.apache.spark.sql.execution.datasources.{CreateTableUsing, CreateTempTableUsing, DescribeCommand => LogicalDescribeCommand, _}
3131
import org.apache.spark.sql.parquet._
3232
import org.apache.spark.sql.types._
@@ -409,9 +409,21 @@ private[sql] abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
409409
execution.Filter(condition, planLater(child)) :: Nil
410410
case e @ logical.Expand(_, _, _, child) =>
411411
execution.Expand(e.projections, e.output, planLater(child)) :: Nil
412-
case a @ logical.Aggregate(group, agg, child)
413-
if !aggregate.Utils.tryConvert(a, sqlContext.conf.useSqlAggregate2).isDefined =>
414-
execution.Aggregate(partial = false, group, agg, planLater(child)) :: Nil
412+
case a @ logical.Aggregate(group, agg, child) => {
413+
val useNewAggregation =
414+
aggregate.Utils.tryConvert(
415+
a,
416+
sqlContext.conf.useSqlAggregate2,
417+
sqlContext.conf.codegenEnabled).isDefined
418+
if (useNewAggregation) {
419+
// If this logical.Aggregate can be planned to use new aggregation code path
420+
// (i.e. it can be planned by the Strategy Aggregation), we will not use the old
421+
// aggregation code path.
422+
Nil
423+
} else {
424+
execution.Aggregate(partial = false, group, agg, planLater(child)) :: Nil
425+
}
426+
}
415427
case logical.Window(projectList, windowExpressions, spec, child) =>
416428
execution.Window(projectList, windowExpressions, spec, planLater(child)) :: Nil
417429
case logical.Sample(lb, ub, withReplacement, seed, child) =>

sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,3 @@ object Utils {
338338
finalAndCompleteAggregate :: Nil
339339
}
340340
}
341-
342-
object NewAggregation {
343-
type ReturnType = (Seq[Expression], Seq[NamedExpression], LogicalPlan)
344-
345-
def unapply(plan: LogicalPlan): Option[ReturnType] = {
346-
Utils.tryConvert(plan, true).map(agg =>
347-
(agg.groupingExpressions, agg.aggregateExpressions, agg.child))
348-
}
349-
}

0 commit comments

Comments
 (0)