[Java] UnionListWriter.writeVarChar get a empty string list
- 主要语言
- Java
- 星标
- 94
- 派生
- 152
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 11
描述
```
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
贡献指南
调研方向
首先复现 writeListVector 中的示例并跟踪 UnionListWriter.writeVarChar,重点关注为什么输出保留了元素数量和长度,却丢失了字符串内容。当通过 list vector 写入的字符串元素能够以其原始值而不是空字符串返回时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- data
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100