apache / apache/arrow-java

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

Aberta
#1,125 0 comentários 0 reações 0 responsáveis Ver no GitHub
Type: bug
Linguagem predominante
Java
Estrelas
94
Forks
152
Merge médio
3d 16h
PRs com merge (30d)
11

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece com UnionListReader.setPosition e rastreie as chamadas a partir de SingleStructReaderImpl.reader(String); compare os caminhos relacionados de UnionMapReader e UnionLargeListReader descritos na issue. Reproduza o caso de uma lista vazia após IPC e, em seguida, verifique se esses readers não lançam mais IndexOutOfBoundsException quando os offsets ou a capacidade estiverem vazios ou forem menores do que o esperado.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
java
Domínio
data
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
67/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.