apache / apache/parquet-java

Parquet-Avro does not support field removal

Đang mở
#1,932 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Component: Avro Component: Parquet Priority: Major Type: bug
Ngôn ngữ chính
Java
Star
3.1k
Fork
1.6k
Merge trung bình
3 ngày 12 giờ
Pull request đã merge (30 ngày)
33

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu tại AvroRecordConverter.java:159 và theo dõi cách schema đọc Avro đã cấu hình được so sánh với các trường có trong tệp Parquet. Tái hiện việc đọc từ v1 sang v2 bằng các thiết lập tương thích trong issue; được xem là hoàn tất khi trường foo đã bị xóa được bỏ qua trong khi bar được đọc thành công mà không có InvalidRecordException.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
data-engineering
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.