apache / apache/parquet-java

Enums are incorrectly handled by parquet-avro when using GenericRecords

Open
#1,952 0 comments 0 reactions 0 assignees View on GitHub
Component: Parquet Priority: Minor Type: bug
Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
3d 12h
Merged PRs (30d)
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.*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.