Skip to content

Commit 36a99f9

Browse files
committed
Added a line of comment to explain why the extra sort exists in pivot.
(cherry picked from commit 34ca392) Signed-off-by: Reynold Xin <[email protected]>
1 parent 6d8c4c6 commit 36a99f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class GroupedData protected[sql](
304304
// Get the distinct values of the column and sort them so its consistent
305305
val values = df.select(pivotColumn)
306306
.distinct()
307-
.sort(pivotColumn)
307+
.sort(pivotColumn) // ensure that the output columns are in a consistent logical order
308308
.map(_.get(0))
309309
.take(maxValues + 1)
310310
.toSeq

0 commit comments

Comments
 (0)