[Java] Should ListVector.reset() reset the position(index)?
- Linguagem predominante
- Java
- Estrelas
- 94
- Forks
- 152
- Merge médio
- 3d 16h
- PRs com merge (30d)
- 11
Descrição
```java
RootAllocator rootAllocator = new RootAllocator();
ListVector identity = ListVector.empty("identity", rootAllocator);
VectorSchemaRoot root = new VectorSchemaRoot(List.of(identity));
root.allocateNew();
UnionListWriter writer = identity.getWriter();
byte[] bytes1 = "hello1".getBytes(StandardCharsets.UTF_8);
ArrowBuf buffer = rootAllocator.buffer(bytes1.length);
buffer.setBytes(0,bytes1);
writer.startList();
writer.varChar().writeVarChar(0,bytes1.length,buffer);
writer.endList();
root.setRowCount(1);
System.out.println(root.contentToTSVString());
root.getFieldVectors().forEach(ValueVector::reset); //reset fieldVector
byte[] bytes2 = "hello2".getBytes(StandardCharsets.UTF_8);
buffer.setBytes(0,bytes2);
writer.startList();
writer.varChar().writeVarChar(0,bytes2.length,buffer);
writer.endList();
root.setRowCount(1);
System.out.println(root.contentToTSVString());
```
the result is
```
identity
["hello1"]
identity
null
```
The above results are confusing。
The correct way is using the `writer.setPosition(index)`,
I don't know if it's a bug or other something.
### Component(s)
Java
Guia de contribuição
Direção de pesquisa
Comece executando a reprodução em Java com ListVector, ValueVector.reset() e UnionListWriter.setPosition(index) para observar o comportamento da posição. Leia as implementações envolvidas de reset e da posição do writer e, em seguida, estabeleça o resultado esperado após o reset e adicione cobertura para a sequência demonstrada, para que o comportamento fique inequívoco.
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
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100