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

    https://github.com/apache/spark/pull/3531#discussion_r21077554
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/basicOperators.scala ---
    @@ -148,20 +148,15 @@ case class Limit(limit: Int, child: SparkPlan)
       }
     
       override def execute() = {
    -    val rdd: RDD[_ <: Product2[Boolean, Row]] = if (sortBasedShuffleOn) {
    -      child.execute().mapPartitions { iter =>
    -        iter.take(limit).map(row => (false, row.copy()))
    +    if (sortBasedShuffleOn) {
    +      child.execute().map(_.copy).coalesce(1).mapPartitions { iter =>
    +        iter.take(limit)
    --- End diff --
    
    Hmm, I will try this. Actually i am not clear why we need ```copy``` here, 
@rxin added it to fix a bug. Hi @rxin, can you explain this?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to