apache / apache/arrow-java

Avro adapter: AvroNullableConsumer should use readIndex

Đang mở
#834 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Type: bug
Ngôn ngữ chính
Java
Star
94
Fork
152
Merge trung bình
3 ngày 16 giờ
Pull request đã merge (30 ngày)
11

Mô tả

### Describe the bug, including details regarding any error messages, version, and platform.

When using Avro's `ValidatingDecoder`, any schema with a nullable field fails with the following exception:

```
Exception in thread "main" org.apache.avro.AvroTypeException: Attempt to process a int when a union was expected.
at org.apache.avro.io.parsing.Parser.advance(Parser.java:91)
at org.apache.avro.io.ValidatingDecoder.readInt(ValidatingDecoder.java:81)
at org.apache.arrow.adapter.avro.consumers.AvroNullableConsumer.consume(AvroNullableConsumer.java:44)
```

Reason: `AvroNullableConsumer` uses `readInt` to read the index, but it should use `readIndex` instead. It's irrelevant in case of a `BinaryDecoder`, for example (`readIndex` is the same as `readInt`), but `ValidatingDecoder`s and any Decoders based on that have different logic.

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

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu trong AvroNullableConsumer.consume, tại lệnh gọi readInt được xác định trong stack trace, và so sánh nó với API decoder của Avro cũng như hành vi của ValidatingDecoder. Hoàn tất khi các trường nullable có thể được consume bằng ValidatingDecoder mà không gặp exception union-versus-int.

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
backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
52/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.