You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yin Huai (JIRA)" <ji...@apache.org> on 2015/01/10 00:01:35 UTC

[jira] [Commented] (SPARK-5184) Improve the performance of metadata operations

    [ https://issues.apache.org/jira/browse/SPARK-5184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14272026#comment-14272026 ] 

Yin Huai commented on SPARK-5184:
---------------------------------

Here is the doc from [~marmbrus].

Metadata operations are a huge bottleneck to reading data, especially when it is heavily partitioned.  The reasons here are twofold: the SparkContext calls [listStatus|https://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapred/FileInputFormat.html#listStatus(org.apache.hadoop.mapred.JobConf)] when generating the list of splits for a job.  The implementation in FileInputFormat is fast when reading from a single directory, but is very slow when reading from many different directories.  This issue is further complicated by the fact that we cannot cache the RDD when reading from partitioned tables, as the splits will change for each job based on partitioning predicates.

The current solution is to cache the FileStatus objects in an implementation of BaseRelation.  We then manually override listStatus in the created InputFormat to used this cached data.  This works but is a one off solution that needs to be implemented for each data source.

h4. Proposed Solution
After calculating the pruned partitions, used globStatus with brace expansion to describe the set of partitions to read.  For example, given the following table and query:
{code:Sql}
/table/a=1
/table/a=2
/table/a=3
/table/a=4

SELECT * FROM table WHERE a % 2 = 0
{code}
Spark SQL would produce 
{code}
/table/a={2,4}
{code}

This approach works with multiple hadoop versions. However, it will be harder to reason about when there are multiple levels of partitioning. Also, it doesn't help for other cases where FileInputFormat is slow (i.e., sc.textFile("file1,file2,...")).




> Improve the performance of metadata operations
> ----------------------------------------------
>
>                 Key: SPARK-5184
>                 URL: https://issues.apache.org/jira/browse/SPARK-5184
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>            Reporter: Yin Huai
>            Priority: Blocker
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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