apache / apache/parquet-java

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

Abierto
#1,417 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Component: Java Component: Parquet Priority: Major Type: bug
Lenguaje dominante
Java
Estrellas
3.1k
Forks
1.6k
Merge medio
3 d 12 h
PR fusionados (30 d)
33

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza en parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java, en getSplits y en la ruta de recuperación del footer enlazada en el issue. Rastrea cómo se obtienen los objetos FileStatus y, después, verifica que getSplits ya no los obtiene secuencialmente para cada part-file; compara también el tiempo de S3 o de archivos grandes descrito en el informe.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
performance
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.