Nested records are not properly read if none of their fields are requested
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.6k
- Merge moyen
- 3 j 12 h
- PR mergées (30 j)
- 33
Description
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.*
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez dans parquet-column/src/main/java/org/apache/parquet/io/MessageColumnIO.java autour des lignes 97-99, et examinez comment EmptyRecordReader est sélectionné lorsqu'aucune colonne feuille du schéma demandé n'existe dans le fichier physique. Reproduisez le cas S1-to-S2 et vérifiez que la lecture de l'enregistrement produit n avec c et d définis à null, plutôt que n défini à null.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- data-engineering
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100