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

    https://github.com/apache/spark/pull/21859#discussion_r209417551
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/ShuffleExchangeExec.scala
 ---
    @@ -294,7 +296,12 @@ object ShuffleExchangeExec {
               sorter.sort(iter.asInstanceOf[Iterator[UnsafeRow]])
             }
           } else {
    -        rdd
    +        part match {
    +          case partitioner: RangePartitioner[InternalRow @unchecked, _]
    +            if partitioner.getSampledArray != null =>
    +            sparkContext.parallelize(partitioner.getSampledArray.toSeq, 
rdd.getNumPartitions)
    --- End diff --
    
    ```
    part match {
              case partitioner: RangePartitioner[InternalRow @unchecked, _]
                if partitioner.getSampledArray != null =>
                sparkContext.parallelize(partitioner.getSampledArray.toSeq, 
rdd.getNumPartitions)
              case _ => rdd
            }
    ```
    When the optimization works, It will return the parallelized sampled data 
instead of the rdd. So I keep the number of the partitions same as the rdd's 
here


---

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

Reply via email to