apache / apache/arrow-java

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

Aberta
#196 2 comentários 0 reações 0 responsáveis Ver no GitHub
Type: usage
Linguagem predominante
Java
Estrelas
94
Forks
152
Merge médio
3d 16h
PRs com merge (30d)
11

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece pela documentação da API IntVector para copyFromSafe, getValueCount, getNullCount e setValueCount. Determine a forma compatível de concatenar os dois vetores e como os valores nulos afetam as contagens de valores e nulos; em seguida, documente a abordagem com um exemplo corrigido para as entradas informadas.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
java
Domínio
data
Tipo de issue
Documentação
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.