Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9364#discussion_r43452005
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/partitioning.scala
 ---
    @@ -38,3 +38,11 @@ case class SortPartitions(sortExpressions: 
Seq[SortOrder], child: LogicalPlan)
      */
     case class RepartitionByExpression(partitionExpressions: Seq[Expression], 
child: LogicalPlan)
       extends RedistributeData
    +
    +/**
    + * This method repartitions data using [[Expression]]s into 
`numPartitions`. If numPartitions is
    + * less than zero, a default is used. Otherwise this behaves identically 
to RepartitionByExpression.
    + */
    +case class PartitionByExpression(partitionExpressions: Seq[Expression],
    +                                 child: LogicalPlan, numPartitions: Int = 
-1)
    +  extends RedistributeData
    --- End diff --
    
    How about we just use `RepartitionByExpression`? Since users do not use 
classes in catalyst directly, it is fine to change the signature of the 
constructor. For the type of `numPartitions`, how about `Option[Int]`? If it is 
`None`, the number of partition is not specified. We can add a `require` clause 
to make sure this value is larger than 0 if `numPartitions` is a `Some`.
    
    btw, regarding the format, the following one is preferred.
    ```
    case class PartitionByExpression(
        partitionExpressions: Seq[Expression],
        numPartitions: Option[Int] = None,
        child: LogicalPlan)
      extends RedistributeData
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to