apache / apache/arrow-java

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

Abierto
#196 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Type: usage
Lenguaje dominante
Java
Estrellas
94
Forks
152
Merge medio
3 d 16 h
PR fusionados (30 d)
11

Descripción

### 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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comience con la documentación de la API de IntVector para copyFromSafe, getValueCount, getNullCount y setValueCount. Determine la forma compatible de concatenar los dos vectores y cómo afectan los valores nulos a los recuentos de valores y nulos; después, documente el enfoque con un ejemplo corregido para las entradas indicadas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
data
Tipo de issue
Documentación
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.