You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by liancheng <gi...@git.apache.org> on 2014/11/23 19:07:40 UTC

[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

GitHub user liancheng opened a pull request:

    https://github.com/apache/spark/pull/3422

    [SPARK-4479][SQL] Avoids unnecessary defensive copies when sort based shuffle is on

    This PR is a workaround for SPARK-4479. Two changes are introduced: when merge sort is bypassed in `ExternalSorter`,
    
    1. also bypass RDD elements buffering as buffering is the reason that `MutableRow` backed row objects must be copied, and
    2. avoids defensive copies in `Exchange` operator

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/liancheng/spark avoids-defensive-copies

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/3422.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3422
    
----
commit f75089be7268339a6610f9193b1885a9f9278276
Author: Cheng Lian <li...@databricks.com>
Date:   2014-11-23T17:57:37Z

    Avoids unnecessary defensive copies when sort based shuffle is on

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by mateiz <gi...@git.apache.org>.
Github user mateiz commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64256480
  
    LGTM from the sort side.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64128006
  
      [Test build #23766 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23766/consoleFull) for   PR 3422 at commit [`f75089b`](https://github.com/apache/spark/commit/f75089be7268339a6610f9193b1885a9f9278276).
     * This patch merges cleanly.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by mateiz <gi...@git.apache.org>.
Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3422#discussion_r20773812
  
    --- Diff: core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
    @@ -350,7 +359,7 @@ private[spark] class ExternalSorter[K, V, C](
           }
         }
     
    -    val it = collection.iterator  // No need to sort stuff, just write each element out
    +    val it = iterator     // No need to sort stuff, just write each element out
    --- End diff --
    
    Maybe just use `iterator` in the code below instead of giving it a different name here


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64237266
  
      [Test build #23789 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23789/consoleFull) for   PR 3422 at commit [`591f2e9`](https://github.com/apache/spark/commit/591f2e9fc1b0c3a503394b7309a71b22dbfabc08).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64237279
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23789/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3422#discussion_r20774702
  
    --- Diff: core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
    @@ -132,7 +132,7 @@ private[spark] class ExternalSorter[K, V, C](
       // files open at a time and thus more memory allocated to buffers.
       private val bypassMergeThreshold = conf.getInt("spark.shuffle.sort.bypassMergeThreshold", 200)
       private val bypassMergeSort =
    -    (numPartitions <= bypassMergeThreshold && aggregator.isEmpty && ordering.isEmpty)
    +    numPartitions <= bypassMergeThreshold && aggregator.isEmpty && ordering.isEmpty
    --- End diff --
    
    Sure.
    
    (Maybe I should disable some more IDEA inspections, just couldn't help to make these changes as they are highlighted there and shouting at me...)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by marmbrus <gi...@git.apache.org>.
Github user marmbrus commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64260740
  
    Thanks Cheng!  I'm going to merge this into branch 1.2 and master.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64131419
  
      [Test build #23766 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23766/consoleFull) for   PR 3422 at commit [`f75089b`](https://github.com/apache/spark/commit/f75089be7268339a6610f9193b1885a9f9278276).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3422#discussion_r20774173
  
    --- Diff: core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
    @@ -132,7 +132,7 @@ private[spark] class ExternalSorter[K, V, C](
       // files open at a time and thus more memory allocated to buffers.
       private val bypassMergeThreshold = conf.getInt("spark.shuffle.sort.bypassMergeThreshold", 200)
       private val bypassMergeSort =
    -    (numPartitions <= bypassMergeThreshold && aggregator.isEmpty && ordering.isEmpty)
    +    numPartitions <= bypassMergeThreshold && aggregator.isEmpty && ordering.isEmpty
    --- End diff --
    
    do you mind reverting some of these style changes (e.g. heap empty below). I'd like to be as surgical as possible with this patch and keep the surface area of the changes minimal.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64217895
  
    @mateiz @pwendell Thanks for reviewing this! Failed test suites and styling issues addressed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64131422
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23766/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/3422


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64218612
  
      [Test build #23789 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23789/consoleFull) for   PR 3422 at commit [`591f2e9`](https://github.com/apache/spark/commit/591f2e9fc1b0c3a503394b7309a71b22dbfabc08).
     * This patch merges cleanly.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-4479][SQL] Avoids unnecessary defensive...

Posted by mateiz <gi...@git.apache.org>.
Github user mateiz commented on the pull request:

    https://github.com/apache/spark/pull/3422#issuecomment-64154933
  
    Change to ExternalSorter looks okay to me, though it will now create files in cases where none might've been needed. But it seems fine as a way to fix this. The main place where it could be less efficient is on the reduce side, where you'd call iterator() instead of writePartitionedFile(), but in that case you always have aggregator or ordering set in the current code, so bypassMergeSort would be false.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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