File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -782,6 +782,17 @@ def test_narrow_dependency_in_join(self):
782782 jobId = tracker .getJobIdsForGroup ("test4" )[0 ]
783783 self .assertEqual (3 , len (tracker .getJobInfo (jobId ).stageIds ))
784784
785+ def test_sortByKey_uses_all_partitions_not_only_first_and_last (self ):
786+ # Regression test for SPARK-5969
787+ seq = [(i * 59 % 101 , i ) for i in range (101 )] # unsorted sequence
788+ rdd = self .sc .parallelize (seq )
789+ for ascending in [True , False ]:
790+ sort = rdd .sortByKey (ascending = ascending , numPartitions = 5 )
791+ self .assertEqual (sort .collect (), sorted (seq , reverse = not ascending ))
792+ sizes = sort .glom ().map (len ).collect ()
793+ for size in sizes :
794+ self .assertGreater (size , 0 )
795+
785796
786797class ProfilerTests (PySparkTestCase ):
787798
You can’t perform that action at this time.
0 commit comments