You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yhuai <gi...@git.apache.org> on 2016/06/21 23:58:23 UTC

[GitHub] spark pull request #13830: [SPARK-16121] ListingFileCatalog does not list in...

GitHub user yhuai opened a pull request:

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

    [SPARK-16121] ListingFileCatalog does not list in parallel anymore

    ## What changes were proposed in this pull request?
    Seems the fix of SPARK-14959 breaks the parallel partitioning discovery. This PR fixes the problem
    
    
    ## How was this patch tested?
    Will manually test it. (This PR also adds a proper test for SPARK-14959)

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

    $ git pull https://github.com/yhuai/spark SPARK-16121

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

    https://github.com/apache/spark/pull/13830.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 #13830
    
----
commit 03b4497524bb62c8a87dd3b3775006ad162a1270
Author: Yin Huai <yh...@databricks.com>
Date:   2016-06-21T23:53:38Z

    [SPARK-16121] ListingFileCatalog does not list in parallel anymore
    
    This PR also provides an alternative fix for https://issues.apache.org/jira/browse/SPARK-14959

commit dff33388c15fcf5ebefeb52a4f67b6fd930f7d2c
Author: Yin Huai <yh...@databricks.com>
Date:   2016-06-21T23:56:44Z

    Merge remote-tracking branch 'upstream/master' into SPARK-16121

----


---
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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    **[Test build #60983 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60983/consoleFull)** for PR 13830 at commit [`dff3338`](https://github.com/apache/spark/commit/dff33388c15fcf5ebefeb52a4f67b6fd930f7d2c).


---
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 #13830: [SPARK-16121] ListingFileCatalog does not list in...

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

    https://github.com/apache/spark/pull/13830#discussion_r74684998
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ListingFileCatalog.scala ---
    @@ -73,21 +73,67 @@ class ListingFileCatalog(
         cachedPartitionSpec = null
       }
     
    -  protected def listLeafFiles(paths: Seq[Path]): mutable.LinkedHashSet[FileStatus] = {
    +  /**
    +   * List leaf files of given paths. This method will submit a Spark job to do parallel
    +   * listing whenever there is a path having more files than the parallel partition discovery
    +   * discovery threshold.
    +   */
    +  protected[spark] def listLeafFiles(paths: Seq[Path]): mutable.LinkedHashSet[FileStatus] = {
         if (paths.length >= sparkSession.sessionState.conf.parallelPartitionDiscoveryThreshold) {
           HadoopFsRelation.listLeafFilesInParallel(paths, hadoopConf, sparkSession)
         } else {
    +      // Right now, the number of paths is less than the value of
    +      // parallelPartitionDiscoveryThreshold. So, we will list file statues at the driver.
    +      // If there is any child that has more files than the threshold, we will use parallel
    +      // listing.
    +
           // Dummy jobconf to get to the pathFilter defined in configuration
           val jobConf = new JobConf(hadoopConf, this.getClass)
           val pathFilter = FileInputFormat.getInputPathFilter(jobConf)
    +
           val statuses: Seq[FileStatus] = paths.flatMap { path =>
             val fs = path.getFileSystem(hadoopConf)
             logTrace(s"Listing $path on driver")
    -        Try {
    -          HadoopFsRelation.listLeafFiles(fs, fs.getFileStatus(path), pathFilter)
    -        }.getOrElse(Array.empty[FileStatus])
    +
    +        val childStatuses = {
    +          // TODO: We need to avoid of using Try at here.
    +          val stats = Try(fs.listStatus(path)).getOrElse(Array.empty[FileStatus])
    +          if (pathFilter != null) stats.filter(f => pathFilter.accept(f.getPath)) else stats
    +        }
    +
    +        childStatuses.map {
    +          case f: LocatedFileStatus => f
    +
    +          // NOTE:
    +          //
    +          // - Although S3/S3A/S3N file system can be quite slow for remote file metadata
    +          //   operations, calling `getFileBlockLocations` does no harm here since these file system
    +          //   implementations don't actually issue RPC for this method.
    +          //
    --- End diff --
    
    Maybe just say "Location aware object stores may trigger queries of the object store here" without being specific about the store. As an example: `org.apache.hadoop.fs.swift.snative.SwiftNativeFileSystem` does 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 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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    Merged build finished. 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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60995/
    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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/60983/
    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 #13830: [SPARK-16121] ListingFileCatalog does not list in...

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

    https://github.com/apache/spark/pull/13830#discussion_r72242750
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ListingFileCatalog.scala ---
    @@ -73,21 +73,67 @@ class ListingFileCatalog(
         cachedPartitionSpec = null
       }
     
    -  protected def listLeafFiles(paths: Seq[Path]): mutable.LinkedHashSet[FileStatus] = {
    +  /**
    +   * List leaf files of given paths. This method will submit a Spark job to do parallel
    +   * listing whenever there is a path having more files than the parallel partition discovery
    +   * discovery threshold.
    +   */
    +  protected[spark] def listLeafFiles(paths: Seq[Path]): mutable.LinkedHashSet[FileStatus] = {
         if (paths.length >= sparkSession.sessionState.conf.parallelPartitionDiscoveryThreshold) {
           HadoopFsRelation.listLeafFilesInParallel(paths, hadoopConf, sparkSession)
         } else {
    +      // Right now, the number of paths is less than the value of
    +      // parallelPartitionDiscoveryThreshold. So, we will list file statues at the driver.
    +      // If there is any child that has more files than the threshold, we will use parallel
    +      // listing.
    +
           // Dummy jobconf to get to the pathFilter defined in configuration
           val jobConf = new JobConf(hadoopConf, this.getClass)
           val pathFilter = FileInputFormat.getInputPathFilter(jobConf)
    +
           val statuses: Seq[FileStatus] = paths.flatMap { path =>
             val fs = path.getFileSystem(hadoopConf)
             logTrace(s"Listing $path on driver")
    -        Try {
    -          HadoopFsRelation.listLeafFiles(fs, fs.getFileStatus(path), pathFilter)
    -        }.getOrElse(Array.empty[FileStatus])
    +
    +        val childStatuses = {
    +          // TODO: We need to avoid of using Try at here.
    +          val stats = Try(fs.listStatus(path)).getOrElse(Array.empty[FileStatus])
    +          if (pathFilter != null) stats.filter(f => pathFilter.accept(f.getPath)) else stats
    +        }
    +
    +        childStatuses.map {
    +          case f: LocatedFileStatus => f
    +
    +          // NOTE:
    +          //
    +          // - Although S3/S3A/S3N file system can be quite slow for remote file metadata
    +          //   operations, calling `getFileBlockLocations` does no harm here since these file system
    +          //   implementations don't actually issue RPC for this method.
    +          //
    --- End diff --
    
    while you are correct about s3a, the openstack swift client does do RPC here, as swift instances can exhibit locality, as does Azure. This comment isn't actually correct.


---
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 #13830: [SPARK-16121] ListingFileCatalog does not list in...

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

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


---
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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    **[Test build #60995 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60995/consoleFull)** for PR 13830 at commit [`d898735`](https://github.com/apache/spark/commit/d898735cdb41cbab190d6bc267b2347d3978481e).
     * 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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    **[Test build #60983 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60983/consoleFull)** for PR 13830 at commit [`dff3338`](https://github.com/apache/spark/commit/dff33388c15fcf5ebefeb52a4f67b6fd930f7d2c).
     * 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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    **[Test build #60995 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/60995/consoleFull)** for PR 13830 at commit [`d898735`](https://github.com/apache/spark/commit/d898735cdb41cbab190d6bc267b2347d3978481e).


---
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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    LGTM, merging to master and branch-2.0.


---
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 issue #13830: [SPARK-16121] ListingFileCatalog does not list in parall...

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

    https://github.com/apache/spark/pull/13830
  
    Merged build finished. 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 #13830: [SPARK-16121] ListingFileCatalog does not list in...

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

    https://github.com/apache/spark/pull/13830#discussion_r72515446
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ListingFileCatalog.scala ---
    @@ -73,21 +73,67 @@ class ListingFileCatalog(
         cachedPartitionSpec = null
       }
     
    -  protected def listLeafFiles(paths: Seq[Path]): mutable.LinkedHashSet[FileStatus] = {
    +  /**
    +   * List leaf files of given paths. This method will submit a Spark job to do parallel
    +   * listing whenever there is a path having more files than the parallel partition discovery
    +   * discovery threshold.
    +   */
    +  protected[spark] def listLeafFiles(paths: Seq[Path]): mutable.LinkedHashSet[FileStatus] = {
         if (paths.length >= sparkSession.sessionState.conf.parallelPartitionDiscoveryThreshold) {
           HadoopFsRelation.listLeafFilesInParallel(paths, hadoopConf, sparkSession)
         } else {
    +      // Right now, the number of paths is less than the value of
    +      // parallelPartitionDiscoveryThreshold. So, we will list file statues at the driver.
    +      // If there is any child that has more files than the threshold, we will use parallel
    +      // listing.
    +
           // Dummy jobconf to get to the pathFilter defined in configuration
           val jobConf = new JobConf(hadoopConf, this.getClass)
           val pathFilter = FileInputFormat.getInputPathFilter(jobConf)
    +
           val statuses: Seq[FileStatus] = paths.flatMap { path =>
             val fs = path.getFileSystem(hadoopConf)
             logTrace(s"Listing $path on driver")
    -        Try {
    -          HadoopFsRelation.listLeafFiles(fs, fs.getFileStatus(path), pathFilter)
    -        }.getOrElse(Array.empty[FileStatus])
    +
    +        val childStatuses = {
    +          // TODO: We need to avoid of using Try at here.
    +          val stats = Try(fs.listStatus(path)).getOrElse(Array.empty[FileStatus])
    +          if (pathFilter != null) stats.filter(f => pathFilter.accept(f.getPath)) else stats
    +        }
    +
    +        childStatuses.map {
    +          case f: LocatedFileStatus => f
    +
    +          // NOTE:
    +          //
    +          // - Although S3/S3A/S3N file system can be quite slow for remote file metadata
    +          //   operations, calling `getFileBlockLocations` does no harm here since these file system
    +          //   implementations don't actually issue RPC for this method.
    +          //
    --- End diff --
    
    Thank you for pointing out that. Can you also provide some pointers? We can put those pointers in the comment.


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