apache / apache/parquet-java

Parquet-Avro does not support field removal

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

描述

Parquet avro does not support removal of fields, when used with the new compatibility layer:

Given a parquet file written with parquet avro at v1 and the following schema:

```Java
record FooBar {
long foo;
string bar;
}
```

And the following configuration settings:

```Java
job.getConfiguration.setBoolean(AvroReadSupport.AVRO_COMPATIBILITY, false)
AvroParquetInputFormat.setAvroReadSchema(job, avroReaderSchema)
```

A job fails when trying to read it using schema version v2:

```Java
record FooBar {
string bar;
}
```

With the error:

```Java
org.apache.parquet.io.InvalidRecordException: Parquet/Avro schema mismatch: Avro field 'foo' not found
at org.apache.parquet.avro.AvroRecordConverter.getAvroField(AvroRecordConverter.java:159)
```

It looks like because it sees the field in the original version it assumes the new version must expect it, but this case just means that the field was removed. Avro schema resolution dictates that you just ignore this field, since it is not relevant in the new version.

**Reporter**: [Thomas Omans](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=eggsby)

**Note**: *This issue was originally created as [PARQUET-465](https://issues.apache.org/jira/browse/PARQUET-465). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

贡献指南

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

调研方向

从 AvroRecordConverter.java:159 开始,跟踪配置的 Avro 读取器 schema 如何与 Parquet 文件中存在的字段进行比较。使用 issue 中的兼容性设置重现从 v1 到 v2 的读取;当被移除的 foo 字段被忽略且 bar 能够成功读取、不会出现 InvalidRecordException 时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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