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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]