You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "lfygh (via GitHub)" <gi...@apache.org> on 2023/04/13 15:07:49 UTC

[GitHub] [arrow] lfygh opened a new issue, #35111: Should ListVector.reset() reset the position(index)?

lfygh opened a new issue, #35111:
URL: https://github.com/apache/arrow/issues/35111

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   
   ```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[] bytes3 = "hello2".getBytes(StandardCharsets.UTF_8);
           buffer.setBytes(0,bytes3);
           writer.startList();
           writer.varChar().writeVarChar(0,bytes3.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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org