apache / apache/arrow-java

Avro adapter: AvroNullableConsumer should use readIndex

未關閉
#834 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Type: bug
主要語言
Java
星號
94
分支
152
平均合併
3 天 16 小時
30 天內合併 PR
11

描述

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

貢獻指南

開啟貢獻指南

研究方向

從 AvroNullableConsumer.consume 中 stack trace 所識別的 readInt 呼叫開始,並將其與 Avro 的 decoder API 和 ValidatingDecoder 的行為進行比較。當 nullable 欄位可以使用 ValidatingDecoder 消費且不會出現 union-versus-int 例外時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
backend
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
描述清楚
新手友好度
52/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。