Skip to content

Commit a5743af

Browse files
Davies Liuyhuai
authored andcommitted
[SPARK-12077][SQL] change the default plan for single distinct
Use try to match the behavior for single distinct aggregation with Spark 1.5, but that's not scalable, we should be robust by default, have a flag to address performance regression for low cardinality aggregation. cc yhuai nongli Author: Davies Liu <davies@databricks.com> Closes apache#10075 from davies/agg_15. (cherry picked from commit 96691fe) Signed-off-by: Yin Huai <yhuai@databricks.com>
1 parent 84c44b5 commit a5743af

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ private[spark] object SQLConf {
451451

452452
val SPECIALIZE_SINGLE_DISTINCT_AGG_PLANNING =
453453
booleanConf("spark.sql.specializeSingleDistinctAggPlanning",
454-
defaultValue = Some(true),
454+
defaultValue = Some(false),
455455
isPublic = false,
456456
doc = "When true, if a query only has a single distinct column and it has " +
457457
"grouping expressions, we will use our planner rule to handle this distinct " +

sql/core/src/test/scala/org/apache/spark/sql/execution/PlannerSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ class PlannerSuite extends SharedSQLContext {
4444
fail(s"Could query play aggregation query $query. Is it an aggregation query?"))
4545
val aggregations = planned.collect { case n if n.nodeName contains "Aggregate" => n }
4646

47-
// For the new aggregation code path, there will be three aggregate operator for
47+
// For the new aggregation code path, there will be four aggregate operator for
4848
// distinct aggregations.
4949
assert(
50-
aggregations.size == 2 || aggregations.size == 3,
50+
aggregations.size == 2 || aggregations.size == 4,
5151
s"The plan of query $query does not have partial aggregations.")
5252
}
5353

0 commit comments

Comments
 (0)