pan3793 commented on a change in pull request #2512:
URL: https://github.com/apache/iceberg/pull/2512#discussion_r657095040



##########
File path: 
spark3-extensions/src/main/scala/org/apache/spark/sql/catalyst/utils/DistributionAndOrderingUtils.scala
##########
@@ -80,7 +94,11 @@ object DistributionAndOrderingUtils {
       // 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, numShufflePartitions)
+      if (Spark3VersionUtil.isSpark30) {
+        repartitionByExpressionCtor.newInstance(distribution.toSeq, query, new 
Integer(numShufflePartitions))
+      } else {
+        repartitionByExpressionCtor.newInstance(distribution.toSeq, query, 
Some(numShufflePartitions))

Review comment:
       One thing that may out of the PR's scope. There is a feature introduced 
in SPARK-32056, iff `numShufflePartitions` is absent, partition coalesces for 
AQE will effect, which will avoid writing small files when AQE is enabled. But 
I don't if there are side effects when set `numShufflePartitions` to `None`.

##########
File path: 
spark3-extensions/src/main/scala/org/apache/spark/sql/catalyst/utils/DistributionAndOrderingUtils.scala
##########
@@ -80,7 +94,11 @@ object DistributionAndOrderingUtils {
       // 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, numShufflePartitions)
+      if (Spark3VersionUtil.isSpark30) {
+        repartitionByExpressionCtor.newInstance(distribution.toSeq, query, new 
Integer(numShufflePartitions))
+      } else {
+        repartitionByExpressionCtor.newInstance(distribution.toSeq, query, 
Some(numShufflePartitions))

Review comment:
       One thing that may out of the PR's scope. There is a feature introduced 
in SPARK-32056, iff `numShufflePartitions` is absent, partition coalesces for 
AQE will effect, which will avoid writing small files when AQE is enabled. But 
I don't know if there are side effects when set `numShufflePartitions` to 
`None`.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to