[Java] Should ListVector.reset() reset the position(index)?
- Lenguaje dominante
- Java
- Estrellas
- 94
- Forks
- 152
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 11
Descripción
```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
Guía de contribución
Línea de trabajo
Comienza ejecutando la reproducción en Java con ListVector, ValueVector.reset() y UnionListWriter.setPosition(index) para observar el comportamiento de la posición. Lee las implementaciones implicadas de reset y de la posición del writer; después, establece el resultado esperado tras restablecer y añade cobertura para la secuencia demostrada, de modo que el comportamiento no sea ambiguo.
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
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100