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

    https://github.com/apache/spark/pull/9364#discussion_r43559349
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/partitioning.scala
 ---
    @@ -31,10 +31,11 @@ case class SortPartitions(sortExpressions: 
Seq[SortOrder], child: LogicalPlan)
       extends RedistributeData
     
     /**
    - * This method repartitions data using [[Expression]]s, and receives 
information about the
    - * number of partitions during execution. Used when a specific ordering or 
distribution is
    - * expected by the consumer of the query result. Use [[Repartition]] for 
RDD-like
    + * This method repartitions data using [[Expression]]s into 
`numPartitions`, and receives
    + * information about the number of partitions during execution. Used when 
a specific ordering or
    + * distribution is expected by the consumer of the query result. Use 
[[Repartition]] for RDD-like
      * `coalesce` and `repartition`.
    + * If `numPartitions` is not specified, the partition in `child` is 
preserved.
      */
    -case class RepartitionByExpression(partitionExpressions: Seq[Expression], 
child: LogicalPlan)
    -  extends RedistributeData
    +case class RepartitionByExpression(partitionExpressions: Seq[Expression],
    +    child: LogicalPlan, numPartitions: Option[Int] = None) extends 
RedistributeData
    --- End diff --
    
    Also, how about we add a `require` to make sure we get a valid 
numPartitions?
    
    ```
    case class RepartitionByExpression(
        partitionExpressions: Seq[Expression],
        child: LogicalPlan,
        numPartitions: Option[Int] = None) extends RedistributeData {
    
      numPartitions match {
        case Some(n) => require(n > 0, "error message")
        case None => // OK
      }
    }
    ```


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