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

    https://github.com/apache/spark/pull/15651#discussion_r85411204
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
    @@ -482,6 +483,33 @@ class Dataset[T] private[sql](
       @InterfaceStability.Evolving
       def isStreaming: Boolean = logicalPlan.isStreaming
     
    +  @Experimental
    +  @InterfaceStability.Evolving
    +  def checkpoint(): Dataset[T] = {
    +    val internalRdd = queryExecution.toRdd.map(_.copy())
    +    internalRdd.checkpoint()
    +
    +    val physicalPlan = queryExecution.executedPlan
    +
    +    def firstLeafPartitioning(partitioning: Partitioning): Partitioning = {
    +      partitioning match {
    +        case p: PartitioningCollection => 
firstLeafPartitioning(p.partitionings.head)
    +        case p => p
    +      }
    +    }
    --- End diff --
    
    There can be cases where the optimizer fails to eliminate an unnecessary 
shuffle if we strip all the other partitionings. But that's still better than 
an exponentially growing `PartitioningCollection`, which basically runs into 
the same slow query planning issue this PR tries to solve.
    
    I talked to @yhuai offline about exactly the same issue you brought up 
before sending out this PR, and we decided to have a working version first and 
optimize it later since we still need feedback from ML people to see whether 
the basic mechanism works for their workloads.


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