apache / apache/parquet-java

Unnecessary getFileStatus() calls on all part-files in ParquetInputFormat.getSplits

オープン
#1,417 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
Component: Java Component: Parquet Priority: Major Type: bug
主要言語
Java
スター
3.1k
フォーク
1.6k
平均マージ
3日 12時間
マージ済み PR(30日)
33

説明

When testing Spark SQL Parquet support, we found that accessing large Parquet files located in S3 can be very slow. To be more specific, we have a S3 Parquet file with over 3,000 part-files, calling `ParquetInputFormat.getSplits` on it takes several minutes. (We were accessing this file from our office network rather than AWS.)

After some investigation, we found that `ParquetInputFormat.getSplits` is trying to call `getFileStatus()` on all part-files one by one sequentially ([here](https://github.com/apache/incubator-parquet-mr/blob/parquet-1.5.0/parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java#L370)). And in the case of S3, each `getFileStatus()` call issues an HTTP request and wait for the reply in a blocking manner, which is considerably expensive.

Actually all these `FileStatus` objects have already been fetched when footers are retrieved ([here](https://github.com/apache/incubator-parquet-mr/blob/parquet-1.5.0/parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java#L443)). Caching these `FileStatus` objects can greatly improve our S3 case (reduced from over 5 minutes to about 1.4 minutes).

Will submit a PR for this issue soon.

**Reporter**: [Cheng Lian](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=lian+cheng) / @liancheng
#### Related issues:
- [Use LRU caching for footers in ParquetInputFormat.](https://github.com/apache/parquet-java/issues/1394) (relates to)
- [Cleanup FilteringParquetRowInputFormat](https://issues.apache.org/jira/browse/SPARK-2551) (is related to)
- [Reading Parquet InputSplits dominates query execution time when reading off S3](https://issues.apache.org/jira/browse/SPARK-2119) (is related to)
- [Improve Parquet IO Performance within cloud datalakes](https://github.com/apache/parquet-java/issues/2912) (is depended upon by)

**Note**: *This issue was originally created as [PARQUET-16](https://issues.apache.org/jira/browse/PARQUET-16). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java の getSplits と、issue でリンクされている footer 取得パスから始めます。FileStatus オブジェクトがどのように取得されるかを追跡し、その後、getSplits が各 part-file についてそれらを逐次取得しなくなっていることを確認して、レポートに記載された S3 または大きなファイルでの所要時間と比較します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。