Enums are incorrectly handled by parquet-avro when using GenericRecords
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.6k
- Merge moyen
- 3 j 12 h
- PR mergées (30 j)
- 33
Description
It appears that enums are handled incorrectly when reading parquet as generic records.
Looking at the code:
https://github.com/apache/parquet-mr/blob/master/parquet-avro/src/main/java/org/apache/parquet/avro/AvroIndexedRecordConverter.java#L236-L238
FieldEnumConverter falls back to a string representation when it can't find the corresponding enum class. This is problematic when trying to read parquet files generically without specific records on the classpath because the records will no longer match the schema. I believe a more correct approach would be to wrap the enums in GenericData.EnumSymbol:
https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java#L397
**Reporter**: [Igor Bernstein](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=igorbernstein)
**Note**: *This issue was originally created as [PARQUET-557](https://issues.apache.org/jira/browse/PARQUET-557). 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-avro/src/main/java/org/apache/parquet/avro/AvroIndexedRecordConverter.java, au niveau du code de FieldEnumConverter autour des lignes 236-238, puis comparez le comportement référencé de GenericData.EnumSymbol dans GenericData.java d'Avro. Vérifiez que la lecture des enregistrements génériques conserve la représentation enum du schéma au lieu de revenir à une chaîne de caractères ; l'issue est terminée lorsque les enregistrements résultants correspondent au schéma.
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