Java: What is the best way to concat two vectors?
- 主要语言
- Java
- 星标
- 94
- 派生
- 152
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 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
贡献指南
调研方向
从 IntVector API 文档中关于 copyFromSafe、getValueCount、getNullCount 和 setValueCount 的部分开始。确定连接两个向量的受支持方式,以及 null 如何影响值计数和 null 计数,然后使用针对所报告输入的修正示例记录该方法。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- data
- Issue 类型
- 文档
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100