apache / apache/arrow-java

[Java] UnionListWriter.writeVarChar get a empty string list

オープン
#214 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: usage
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
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 を介して書き込まれた string 要素が、空の文字列ではなく元の値で返されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
data
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。