GitHub user windpiger opened a pull request:

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

    [SPARK-19761][SQL]create InMemoryFileIndex with an empty rootPaths when set 
PARALLEL_PARTITION_DISCOVERY_THRESHOLD to zero failed

    ## What changes were proposed in this pull request?
    
    If we create a InMemoryFileIndex with an empty rootPaths when set 
PARALLEL_PARTITION_DISCOVERY_THRESHOLD to zero, it will throw an  exception:
    
    ```
    Positive number of slices required
    java.lang.IllegalArgumentException: Positive number of slices required
            at 
org.apache.spark.rdd.ParallelCollectionRDD$.slice(ParallelCollectionRDD.scala:119)
            at 
org.apache.spark.rdd.ParallelCollectionRDD.getPartitions(ParallelCollectionRDD.scala:97)
            at 
org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:252)
            at 
org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:250)
            at scala.Option.getOrElse(Option.scala:121)
            at org.apache.spark.rdd.RDD.partitions(RDD.scala:250)
            at 
org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
            at 
org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:252)
            at 
org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:250)
            at scala.Option.getOrElse(Option.scala:121)
            at org.apache.spark.rdd.RDD.partitions(RDD.scala:250)
            at 
org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
            at 
org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:252)
            at 
org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:250)
            at scala.Option.getOrElse(Option.scala:121)
            at org.apache.spark.rdd.RDD.partitions(RDD.scala:250)
            at org.apache.spark.SparkContext.runJob(SparkContext.scala:2084)
            at org.apache.spark.rdd.RDD$$anonfun$collect$1.apply(RDD.scala:936)
            at 
org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
            at 
org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
            at org.apache.spark.rdd.RDD.withScope(RDD.scala:362)
            at org.apache.spark.rdd.RDD.collect(RDD.scala:935)
            at 
org.apache.spark.sql.execution.datasources.PartitioningAwareFileIndex$.org$apache$spark$sql$execution$datasources$PartitioningAwareFileIndex$$bulkListLeafFiles(PartitioningAwareFileIndex.scala:357)
            at 
org.apache.spark.sql.execution.datasources.PartitioningAwareFileIndex.listLeafFiles(PartitioningAwareFileIndex.scala:256)
            at 
org.apache.spark.sql.execution.datasources.InMemoryFileIndex.refresh0(InMemoryFileIndex.scala:74)
            at 
org.apache.spark.sql.execution.datasources.InMemoryFileIndex.<init>(InMemoryFileIndex.scala:50)
            at 
org.apache.spark.sql.execution.datasources.FileIndexSuite$$anonfun$9$$anonfun$apply$mcV$sp$2.apply$mcV$sp(FileIndexSuite.scala:186)
            at 
org.apache.spark.sql.test.SQLTestUtils$class.withSQLConf(SQLTestUtils.scala:105)
            at 
org.apache.spark.sql.execution.datasources.FileIndexSuite.withSQLConf(FileIndexSuite.scala:33)
            at 
org.apache.spark.sql.execution.datasources.FileIndexSuite$$anonfun$9.apply$mcV$sp(FileIndexSuite.scala:185)
            at 
org.apache.spark.sql.execution.datasources.FileIndexSuite$$anonfun$9.apply(FileIndexSuite.scala:185)
            at 
org.apache.spark.sql.execution.datasources.FileIndexSuite$$anonfun$9.apply(FileIndexSuite.scala:185)
            at 
org.scalatest.Transformer$$anonfun$apply$1.apply$mcV$sp(Transformer.scala:22)
            at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
    ```
    
    ## How was this patch tested?
    unit test added

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

    $ git pull https://github.com/windpiger/spark fixEmptiPathInBulkListFiles

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

    https://github.com/apache/spark/pull/17093.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 #17093
    
----
commit 96898a2332c64b101efc54d1ccbbf29102b88e68
Author: windpiger <[email protected]>
Date:   2017-02-28T02:21:29Z

    [SPARK-19761][SQL]create InMemoryFileIndex with an empty rootPaths when set 
PARALLEL_PARTITION_DISCOVERY_THRESHOLD to zero 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 [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