[Java] Should ListVector.reset() reset the position(index)?
- Langage dominant
- Java
- Étoiles
- 94
- Forks
- 152
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 11
Description
```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
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par exécuter la reproduction Java avec ListVector, ValueVector.reset() et UnionListWriter.setPosition(index) afin d’observer le comportement de la position. Lisez ensuite les implémentations concernées de reset et de la position du writer, puis établissez le résultat attendu après la réinitialisation et ajoutez une couverture pour la séquence démontrée afin que le comportement soit sans ambiguïté.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- data
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100