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 2021/01/27 19:36:45 UTC

[GitHub] [spark] HeartSaVioR commented on a change in pull request #31355: [SPARK-34255][SQL] Support partitioning with static number on required distribution and ordering on V2 write

HeartSaVioR commented on a change in pull request #31355:
URL: https://github.com/apache/spark/pull/31355#discussion_r565581188



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/distributions/distributions.scala
##########
@@ -29,31 +29,47 @@ private[sql] object LogicalDistributions {
     ClusteredDistributionImpl(clustering)
   }
 
+  def clustered(clustering: Array[Expression], numPartitions: Int): ClusteredDistribution = {
+    ClusteredDistributionImpl(clustering, Some(numPartitions))
+  }
+
   def ordered(ordering: Array[SortOrder]): OrderedDistribution = {
     OrderedDistributionImpl(ordering)
   }
+
+  def ordered(ordering: Array[SortOrder], numPartitions: Int): OrderedDistribution = {
+    OrderedDistributionImpl(ordering, Some(numPartitions))
+  }
 }
 
 private[sql] object UnspecifiedDistributionImpl extends UnspecifiedDistribution {
   override def toString: String = "UnspecifiedDistribution"
 }
 
 private[sql] final case class ClusteredDistributionImpl(
-    clusteringExprs: Seq[Expression]) extends ClusteredDistribution {
+    clusteringExprs: Seq[Expression],
+    numPartitions: Option[Int] = None) extends ClusteredDistribution {

Review comment:
       I thought None is clearer than non-negative value in toString form but no big deal once we define the condition.
   Actually I wanted to define the return type of requiredNumPartitions() as Optional for the same reason, but didn't do it as I was already concerning about language interop.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org