apache / apache/arrow-java

Java: What is the best way to concat two vectors?

オープン
#196 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: usage
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
11

説明

### Describe the usage question you have. Please include as many useful details as possible.

Given two `IntVector`s `one: {1, 2, 3}` and `another: {null, 5, 6}`,
how can I concat them into avector `result: {1, 2, 3, 4, 5, 6}`?

Should I copy element one by one using `copyFromSafe` or is there any convenient method to achieve the same result?

If I should copy element one by one, how can I calculate value count and null count of the result?

```scala
val one : IntVector = ??? // suppose {1, 2, 3,}
val another: IntVector = ??? // suppose {null, 5, 6}

val offset = one.getValueCount() +one.getNullCount() // 3
val len = another.getValueCount() + another.getNullCount() // 3
var i = 0
while i < len do
one.copyFromSafe(i, offset + i, another)
// can I detect whether copied value is null here so that I can respectively count non-null value and null value?
// for example
// val isNull = one.nullAwareCopyFromSafe(i, offset + i, another)
// if isNull then j += 1 else i += 1
i += 1
one.setValueCount(offset + i)
// offset + i is 6, but another may contain null, so value count could be different from actual value.
```

### Component(s)

Java

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

copyFromSafe、getValueCount、getNullCount、setValueCount の IntVector API ドキュメントから始めます。2 つのベクトルを連結するためにサポートされている方法と、null が値のカウントおよび null のカウントにどのように影響するかを確認し、報告された入力に対する修正済みの例を使ってそのアプローチを文書化します。

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

評価

技術スタック
java
領域
data
issue の種類
ドキュメント
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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