[Java] Should ListVector.reset() reset the position(index)?
- Lingua principale
- Java
- Stelle
- 94
- Fork
- 152
- Merge medio
- 3g 16h
- PR unite (30g)
- 11
Descrizione
```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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia eseguendo la riproduzione Java con ListVector, ValueVector.reset() e UnionListWriter.setPosition(index) per osservare il comportamento della posizione. Leggi le implementazioni coinvolte di reset e della posizione del writer, quindi stabilisci il risultato atteso dopo il reset e aggiungi la copertura per la sequenza dimostrata, in modo che il comportamento sia inequivocabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- data
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100