sfc-gh-pfus opened a new issue, #35:
URL: https://github.com/apache/arrow-go/issues/35
### Describe the enhancement requested
Hi! We have a use case, in which we have existing Arrow arrays and we want
to compose them to struct. Unfortunately, currently `StructBuilder` does not
support it. So currently we have to copy all values from the specific Arrow
array to the similar array in struct one by one. It would be great if we can
just reuse existing array without manual copying.
What we do now?
Something like this:
```
for j := 0; j < int(numRows); j++ {
sb.Append(true)
for i := 0; i < structCol.NumField(); i++ {
newInternalCol := internalCols[i]
if newInternalCol.DataType().ID() == arrow.STRING {
sb.FieldBuilder(i).(*array.StringBuilder).Append(newInternalCol.(*array.String).Value(j))
} else if newInternalCol.DataType().ID() == arrow.INT8 {
sb.FieldBuilder(i).(*array.Int8Builder).Append(newInternalCol.(*array.Int8).Value(j))
```
What we want:
```
sb.SetColumn(i, newInternalCol[i])
```
The main problem here is not this few lines of code that we need to write,
but manual memory copying. Is it doable?
### Component(s)
Go
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]