Nested records are not properly read if none of their fields are requested
- Lenguaje dominante
- Java
- Estrellas
- 3.1k
- Forks
- 1.6k
- Merge medio
- 3 d 12 h
- PR fusionados (30 d)
- 33
Descripción
Say we have a Parquet file `F` with the following schema `S1`:
```
message root {
required group n {
optional int32 a;
optional int32 b;
}
}
```
Later on, as the schema evolves, fields `a` and `b` are removed, while `c` and `d` are added. Now we have schema `S2`:
```
message root {
required group n {
optional int32 c;
optional int32 d;
}
}
```
`S1` and `S2` are compatible, so it should be OK to read `F` with `S2` as requested schema.
Say `F` contains a single record:
```
{"n": {"a": 1, "b": 2}}
```
When reading `F` with `S2`, expected output should be:
```
{"n": {"c": null, "d": null}}
```
But currently parquet-mr gives
```
{"n": null}
```
This is because `MessageColumnIO` finds that the physical Parquet file contains no leaf columns defined in the requested schema, and shortcuts record reading with an `EmptyRecordReader` for column `n`. See [here](https://github.com/apache/parquet-mr/blob/apache-parquet-1.8.1/parquet-column/src/main/java/org/apache/parquet/io/MessageColumnIO.java#L97-L99).
**Reporter**: [Cheng Lian](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=lian+cheng) / @liancheng
**Note**: *This issue was originally created as [PARQUET-370](https://issues.apache.org/jira/browse/PARQUET-370). 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-column/src/main/java/org/apache/parquet/io/MessageColumnIO.java alrededor de las líneas 97-99 e inspecciona cómo se selecciona EmptyRecordReader cuando no existen columnas hoja del esquema solicitado en el archivo físico. Reproduce el caso S1-to-S2 y verifica que la lectura del registro produzca n con c y d establecidos en null, en lugar de establecer n en null.
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
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100