@@ -875,6 +875,36 @@ abstract class BucketedReadSuite extends QueryTest with SQLTestUtils {
875875 }
876876 }
877877
878+ test(" SPARK-32767 Bucket join should work if SHUFFLE_PARTITIONS larger than bucket number" ) {
879+ withSQLConf(
880+ SQLConf .SHUFFLE_PARTITIONS .key -> " 9" ,
881+ SQLConf .COALESCE_PARTITIONS_INITIAL_PARTITION_NUM .key -> " 10" ) {
882+
883+ val testSpec1 = BucketedTableTestSpec (
884+ Some (BucketSpec (8 , Seq (" i" , " j" ), Seq (" i" , " j" ))),
885+ numPartitions = 1 ,
886+ expectedShuffle = false ,
887+ expectedSort = false ,
888+ expectedNumOutputPartitions = Some (8 ))
889+ val testSpec2 = BucketedTableTestSpec (
890+ Some (BucketSpec (6 , Seq (" i" , " j" ), Seq (" i" , " j" ))),
891+ numPartitions = 1 ,
892+ expectedShuffle = true ,
893+ expectedSort = true ,
894+ expectedNumOutputPartitions = Some (8 ))
895+ Seq (false , true ).foreach { enableAdaptive =>
896+ withSQLConf(SQLConf .ADAPTIVE_EXECUTION_ENABLED .key -> s " $enableAdaptive" ) {
897+ Seq ((testSpec1, testSpec2), (testSpec2, testSpec1)).foreach { specs =>
898+ testBucketing(
899+ bucketedTableTestSpecLeft = specs._1,
900+ bucketedTableTestSpecRight = specs._2,
901+ joinCondition = joinCondition(Seq (" i" , " j" )))
902+ }
903+ }
904+ }
905+ }
906+ }
907+
878908 test(" bucket coalescing eliminates shuffle" ) {
879909 withSQLConf(SQLConf .COALESCE_BUCKETS_IN_JOIN_ENABLED .key -> " true" ) {
880910 // The side with bucketedTableTestSpec1 will be coalesced to have 4 output partitions.
0 commit comments