File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
core/src/main/scala/org/apache/spark/sql/execution/aggregate
hive/src/test/scala/org/apache/spark/sql/hive/execution Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -33,15 +33,14 @@ object Utils {
3333 resultExpressions : Seq [NamedExpression ],
3434 child : SparkPlan ): Seq [SparkPlan ] = {
3535
36- val groupingAttributes = groupingExpressions.map(_.toAttribute)
3736 val completeAggregateExpressions = aggregateExpressions.map(_.copy(mode = Complete ))
3837 val completeAggregateAttributes = completeAggregateExpressions.map {
3938 expr => aggregateFunctionToAttribute(expr.aggregateFunction, expr.isDistinct)
4039 }
4140
4241 SortBasedAggregate (
43- requiredChildDistributionExpressions = Some (groupingAttributes ),
44- groupingExpressions = groupingAttributes ,
42+ requiredChildDistributionExpressions = Some (groupingExpressions ),
43+ groupingExpressions = groupingExpressions ,
4544 aggregateExpressions = completeAggregateExpressions,
4645 aggregateAttributes = completeAggregateAttributes,
4746 initialInputBufferOffset = 0 ,
Original file line number Diff line number Diff line change @@ -193,6 +193,14 @@ abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils with Te
193193 sqlContext.dropTempTable(" emptyTable" )
194194 }
195195
196+ test(" group by function" ) {
197+ Seq ((1 , 2 )).toDF(" a" , " b" ).registerTempTable(" data" )
198+
199+ checkAnswer(
200+ sql(" SELECT floor(a) AS a, collect_set(b) FROM data GROUP BY floor(a) ORDER BY a" ),
201+ Row (1 , Array (2 )) :: Nil )
202+ }
203+
196204 test(" empty table" ) {
197205 // If there is no GROUP BY clause and the table is empty, we will generate a single row.
198206 checkAnswer(
You can’t perform that action at this time.
0 commit comments