Skip to content

Commit d9f8c25

Browse files
committed
[SPARK-12298][SQL] Fix infinite loop in DataFrame.sortWithinPartitions
Modifies the String overload to call the Column overload and ensures this is called in a test.
1 parent 1b82203 commit d9f8c25

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/DataFrame.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ class DataFrame private[sql](
609609
*/
610610
@scala.annotation.varargs
611611
def sortWithinPartitions(sortCol: String, sortCols: String*): DataFrame = {
612-
sortWithinPartitions(sortCol, sortCols : _*)
612+
sortWithinPartitions((sortCol +: sortCols).map(Column(_)) : _*)
613613
}
614614

615615
/**

sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,8 +1090,8 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
10901090
}
10911091

10921092
// Distribute into one partition and order by. This partition should contain all the values.
1093-
val df6 = data.repartition(1, $"a").sortWithinPartitions($"b".asc)
1094-
// Walk each partition and verify that it is sorted descending and not globally sorted.
1093+
val df6 = data.repartition(1, $"a").sortWithinPartitions("b")
1094+
// Walk each partition and verify that it is sorted ascending and not globally sorted.
10951095
df6.rdd.foreachPartition { p =>
10961096
var previousValue: Int = -1
10971097
var allSequential: Boolean = true

0 commit comments

Comments
 (0)