You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/05/27 05:39:54 UTC
[GitHub] [spark] aokolnychyi commented on a diff in pull request #36644: [SPARK-37523][SQL] Re-optimize partitions in Distribution and Ordering if numPartitions is not specified
aokolnychyi commented on code in PR #36644:
URL: https://github.com/apache/spark/pull/36644#discussion_r883290220
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DistributionAndOrderingUtils.scala:
##########
@@ -41,15 +40,16 @@ object DistributionAndOrderingUtils {
}
val queryWithDistribution = if (distribution.nonEmpty) {
- val finalNumPartitions = if (numPartitions > 0) {
- numPartitions
- } else {
- conf.numShufflePartitions
- }
+ val optNumPartitions = if (numPartitions > 0) Some(numPartitions) else None
// the conversion to catalyst expressions above produces SortOrder expressions
// for OrderedDistribution and generic expressions for ClusteredDistribution
- // this allows RepartitionByExpression to pick either range or hash partitioning
- RepartitionByExpression(distribution, query, finalNumPartitions)
+ // this allows RebalancePartitions/RepartitionByExpression to pick either
+ // range or hash partitioning
+ if (!write.distributionStrictlyRequired()) {
Review Comment:
nit: I find it a bit easier to read when the condition is not negated so I'd flip the if statement
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org