Skip to content

Commit a2c842e

Browse files
committed
Update comment and regenerate golden file.
1 parent 202a454 commit a2c842e

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ object AggUtils {
152152
// DISTINCT column and the referred attributes in the FILTER clause associated with each
153153
// aggregate function. For example,
154154
// 1.for AVG(DISTINCT value) GROUP BY key, the grouping expressions will be [key, value].
155-
// 2.for AVG (DISTINCT value) Filter (WHERE age > 20) GROUP BY key, the grouping expression
156-
// will be [key, value, age].
155+
// 2.for AVG (DISTINCT value) Filter (WHERE age > 20) GROUP BY key, this will be rewritten
156+
// as AVG (DISTINCT _gen_attr_$id) Filter (WHERE _gen_attr_$id is not null). the grouping
157+
// expression will be [key, _gen_attr_$id].
157158
createAggregate(
158159
groupingExpressions = groupingExpressions ++ normalizedNamedDistinctExpressions ++
159160
distinctFilterAttributes,

sql/core/src/test/resources/sql-tests/results/explain-aqe.sql.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -707,13 +707,13 @@ Location [not included in comparison]/{warehouse_dir}/explain_temp1]
707707
ReadSchema: struct<key:int,val:int>
708708

709709
(2) Project
710-
Output [3]: [val#x AS _gen_attr_324#x, cast(key#x as bigint) AS _gen_attr_326#xL, if ((val#x > 1)) key#x else null AS _gen_attr_328#x]
710+
Output [3]: [val#x AS _gen_attr_0#x, cast(key#x as bigint) AS _gen_attr_1#xL, if ((val#x > 1)) key#x else null AS _gen_attr_2#x]
711711
Input [2]: [key#x, val#x]
712712

713713
(3) HashAggregate
714-
Input [3]: [_gen_attr_324#x, _gen_attr_326#xL, _gen_attr_328#x]
714+
Input [3]: [_gen_attr_0#x, _gen_attr_1#xL, _gen_attr_2#x]
715715
Keys: []
716-
Functions [3]: [partial_count(_gen_attr_324#x), partial_sum(_gen_attr_326#xL), partial_count(_gen_attr_328#x) FILTER (WHERE isnotnull(_gen_attr_328#x))]
716+
Functions [3]: [partial_count(_gen_attr_0#x), partial_sum(_gen_attr_1#xL), partial_count(_gen_attr_2#x) FILTER (WHERE isnotnull(_gen_attr_2#x))]
717717
Aggregate Attributes [3]: [count#xL, sum#xL, count#xL]
718718
Results [3]: [count#xL, sum#xL, count#xL]
719719

@@ -724,9 +724,9 @@ Arguments: SinglePartition, true, [id=#x]
724724
(5) HashAggregate
725725
Input [3]: [count#xL, sum#xL, count#xL]
726726
Keys: []
727-
Functions [3]: [count(_gen_attr_324#x), sum(_gen_attr_326#xL), count(_gen_attr_328#x)]
728-
Aggregate Attributes [3]: [count(_gen_attr_324#x)#xL, sum(_gen_attr_326#xL)#xL, count(_gen_attr_328#x)#xL]
729-
Results [2]: [(count(_gen_attr_324#x)#xL + sum(_gen_attr_326#xL)#xL) AS TOTAL#xL, count(_gen_attr_328#x)#xL AS count(key) FILTER (WHERE (val > 1))#xL]
727+
Functions [3]: [count(_gen_attr_0#x), sum(_gen_attr_1#xL), count(_gen_attr_2#x)]
728+
Aggregate Attributes [3]: [count(_gen_attr_0#x)#xL, sum(_gen_attr_1#xL)#xL, count(_gen_attr_2#x)#xL]
729+
Results [2]: [(count(_gen_attr_0#x)#xL + sum(_gen_attr_1#xL)#xL) AS TOTAL#xL, count(_gen_attr_2#x)#xL AS count(key) FILTER (WHERE (val > 1))#xL]
730730

731731
(6) AdaptiveSparkPlan
732732
Output [2]: [TOTAL#xL, count(key) FILTER (WHERE (val > 1))#xL]

0 commit comments

Comments
 (0)