apache / apache/parquet-java

Empty projection returns the wrong number of rows when column index is enabled

Abierto
#2,702 1 comentario 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

Discovered in Spark, when returning an empty projection from a Parquet file with filter pushdown enabled (typically when doing filter + count), Parquet-Mr returns a wrong number of rows with column index enabled. When the column index feature is disabled, the result is correct.

 

This happens due to the following:
1. ParquetFileReader::getFilteredRowCount() ( selects row ranges to calculate the row count when column index is enabled.
1. In ColumnIndexFilter ( we filter row ranges and pass the set of paths which in this case is empty.
1. When evaluating the filter, if the column path is not in the set, we would return an empty list of rows ([https://github.com/apache/parquet-mr/blob/0819356a9dafd2ca07c5eab68e2bffeddc3bd3d9/parquet-column/src/main/java/org/apache/parquet/internal/filter2/columnindex/ColumnIndexFilter.java#L178)](https://github.com/apache/parquet-mr/blob/0819356a9dafd2ca07c5eab68e2bffeddc3bd3d9/parquet-column/src/main/java/org/apache/parquet/internal/filter2/columnindex/ColumnIndexFilter.java#L178).) which is always the case for an empty projection.
1. This results in the incorrect number of records reported by the library.

I will provide the full repro later.

 

 

**Reporter**: [Ivan Sadikov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivan.sadikov)
#### Related issues:
- [Filtered parquet data frame count() and show() produce inconsistent results when spark.sql.parquet.filterPushdown is true](https://issues.apache.org/jira/browse/SPARK-39833) (is related to)

**Note**: *This issue was originally created as [PARQUET-2170](https://issues.apache.org/jira/browse/PARQUET-2170). 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 con ParquetFileReader::getFilteredRowCount() y ColumnIndexFilter, siguiendo el conjunto vacío de rutas de columnas a través de la evaluación de rangos de filas. Reproduce el caso de Spark de filtro más conteo cuando esté disponible la reproducción completa y, después, verifica que una proyección vacía con índices de columnas y filter pushdown informe del número correcto de filas.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.