GitHub user dongjoon-hyun opened a pull request: https://github.com/apache/spark/pull/17273
[MINOR][CORE] No need to call `prunePartitions` in case of empty partition ## What changes were proposed in this pull request? `PrunedInMemoryFileIndex.prunePartitions` shows `pruned NaN% partitions` for the following case. We can improve that by checking the number of partitions before calling `prunePartitions`. ```scala scala> Seq.empty[(String, String)].toDF("a", "p").write.partitionBy("p").saveAsTable("t1") scala> sc.setLogLevel("INFO") scala> spark.table("t1").filter($"p" === "1").select($"a").show ... 17/03/13 00:33:04 INFO PrunedInMemoryFileIndex: Selected 0 partitions out of 0, pruned NaN% partitions. ``` ## How was this patch tested? Pass the Jenkins with the existing tests. You can merge this pull request into a Git repository by running: $ git pull https://github.com/dongjoon-hyun/spark SPARK-EMPTY-PARTITION Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/17273.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 #17273 ---- commit 97a426d05480c447c7bae12f8ce6acc0282370a5 Author: Dongjoon Hyun <dongj...@apache.org> Date: 2017-03-13T08:01:37Z [MINOR][CORE] No need to call `prunePartitions` in case of empty partitions ---- --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org