-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-32822][SQL] Change the number of partitions to zero when a range is empty with WholeStageCodegen disabled or falled back #29681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -994,6 +994,20 @@ class PlannerSuite extends SharedSparkSession with AdaptiveSparkPlanHelper { | |
| } | ||
| } | ||
| } | ||
|
|
||
| test("Change the number of partitions to zero when a range is empty") { | ||
| withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "true") { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I didn't notice I can use it. Thanks. |
||
| val range = spark.range(1, 1, 1, 1000) | ||
| val numPartitions = range.rdd.getNumPartitions | ||
| assert(numPartitions == 0) | ||
| } | ||
|
|
||
| withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "false") { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch. nit: Just in case, could you test both cases with/without whole-stage codegen?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All right. |
||
| val range = spark.range(1, 1, 1, 1000) | ||
| val numPartitions = range.rdd.getNumPartitions | ||
| assert(numPartitions == 0) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Used for unit-testing EnsureRequirements | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: There are no changes within this
elseblock.The actual change is
ifblock above.