[Java] UnionListWriter.writeVarChar get a empty string list
- Dominant language
- Java
- Stars
- 94
- Forks
- 152
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 11
Description
```
def writeListVector(writer: UnionListWriter, arr: Array[_], pose: Int): Unit = {
writer.startList()
writer.setPosition(pose)
arr.foreach {
case e: Short => writer.smallInt().writeSmallInt(e)
case e: Int => writer.integer().writeInt(e)
case e: Byte => writer.writeTinyInt(e)
case e: String =>
val rootAllocator = new RootAllocator()
val tempBuf = rootAllocator.buffer(2048)
val bytes = e.getBytes(StandardCharsets.UTF_8)
tempBuf.setBytes(0, bytes, 0, bytes.length)
writer.varChar().writeVarChar(0, bytes.length, tempBuf)
}
writer.setValueCount(arr.length)
writer.endList()
}
````
I use a function like above to write an array to a list vector, everything is normal except case String. It just returns a empty string list,which every elements' length is correct, like:
`[["", ""], [""], ["", "", ""]]`
can somebody help me?
### Component(s)
Java
Contributor guide
Research direction
Start by reproducing the example in writeListVector and tracing UnionListWriter.writeVarChar, focusing on why the output preserves element counts and lengths but loses string contents. Done means string elements written through the list vector are returned with their original values rather than empty strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100