apache / apache/parquet-java

Enums are incorrectly handled by parquet-avro when using GenericRecords

未关闭
#1,952 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Component: Parquet Priority: Minor Type: bug
主要语言
Java
星标
3.1k
派生
1.6k
平均合并
3 天 12 小时
30 天内合并 PR
33

描述

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.*

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 parquet-avro/src/main/java/org/apache/parquet/avro/AvroIndexedRecordConverter.java 中第 236-238 行附近的 FieldEnumConverter 代码开始,然后对比 Avro 的 GenericData.java 中所引用的 GenericData.EnumSymbol 行为。验证 generic record 读取会保留 enum schema 表示,而不是回退为字符串;当生成的 records 与 schema 一致时,该 issue 即完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
data-engineering
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。