apache / apache/arrow-java

Avro adapter: AvroNullableConsumer should use readIndex

Offen
#834 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Type: bug
Vorherrschende Sprache
Java
Sterne
94
Forks
152
Ø Merge
3 T. 16 Std.
Gemergte PRs (30 T.)
11

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie in AvroNullableConsumer.consume beim im Stacktrace identifizierten readInt-Aufruf und vergleichen Sie ihn mit Avros Decoder-API und dem Verhalten von ValidatingDecoder. Als erledigt gilt die Aufgabe, wenn nullable-Felder mit einem ValidatingDecoder konsumiert werden können, ohne die union-versus-int-Exception.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.