Java: What is the best way to concat two vectors?
- Ngôn ngữ chính
- Java
- Star
- 94
- Fork
- 152
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
### 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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với tài liệu API của IntVector cho copyFromSafe, getValueCount, getNullCount và setValueCount. Xác định cách được hỗ trợ để nối hai vector và null ảnh hưởng như thế nào đến số lượng giá trị và số lượng null, sau đó ghi lại cách tiếp cận bằng một ví dụ đã được sửa cho các đầu vào được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- data
- Loại issue
- Tài liệu
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100