apache / apache/arrow-java

`UnionListReader.setPosition` throws IOOBE on a post-IPC empty List

Abierto
#1,125 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Type: bug
Lenguaje dominante
Java
Estrellas
94
Forks
152
Merge medio
3 d 16 h
PR fusionados (30 d)
11

Descripción

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

On 19.0.0 (and on master), calling `setPosition` on a `ListVector` that came off the wire via IPC with `valueCount == 0` throws `IndexOutOfBoundsException`.

Some callers may hit this without touching `setPosition` themselves as
- `SingleStructReaderImpl.reader(String)` calls `setPosition(idx())` the first time a child reader on a struct is looked up.
- `UnionMapReader` inherits from `UnionListReader` and breaks the same way.
- `UnionLargeListReader` has a related variant; capacity guard seems to be missing and it fails whenever the offset buffer is shorter than `(idx + 2) * 8` bytes.

The reader code hasn't changed. `ListVector.setReaderAndWriterIndex` changes and now correctly emits the leading `[0]` offset when `valueCount == 0` (as per the Arrow spec), so the receiver's offset buffer is no longer "zero-capacity" and if block `capacity() == 0` never enters.

### Repro

The shape we actually hit — a struct with a list-typed child, struct itself having `valueCount == 0`:

```java
StructVector parent = ...; // child "l" is LIST, valueCount == 0
parent.getReader().reader("l"); // IOOBE
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con UnionListReader.setPosition y sigue las llamadas desde SingleStructReaderImpl.reader(String); compara las rutas relacionadas de UnionMapReader y UnionLargeListReader descritas en el issue. Reproduce el caso de una lista vacía después de IPC y, a continuación, verifica que estos readers ya no lancen IndexOutOfBoundsException cuando los offsets o la capacidad estén vacíos o sean más cortos de lo esperado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
data
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
67/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.