paleolimbot opened a new pull request #12324:
URL: https://github.com/apache/arrow/pull/12324


   This PR adds `concat_arrays()`, which is available in the Python bindings 
but not available in the R bindings. It's a difficult operation to replicate 
(although can be done using `ChunkedArray$Take()`) and is a fairly 
straightforward binding. I did a tiny bit more than the Python implementation 
to support a common type (like `Array$create()`) because it was easy...it 
sounds like a more robust approach is coming (via ARROW-14705 or by exposing 
`MergeOptions` to `arrow::Concatenate()`).
   
   Reprex:
   
   ``` r
   library(arrow, warn.conflicts = FALSE)
   
   concat_arrays()
   #> Array
   #> <null>
   #> 0 nulls
   concat_arrays(type = int64())
   #> Array
   #> <int64>
   #> []
   
   concat_arrays(Array$create(1:3), Array$create(4:5))
   #> Array
   #> <int32>
   #> [
   #>   1,
   #>   2,
   #>   3,
   #>   4,
   #>   5
   #> ]
   
   # limited support for concatenating Arrays of differing types since this
   # isn't exposed by arrow::Concatenate() yet
   concat_arrays(
     Array$create(1:3, type = float32()),
     Array$create(4:5, type = float64()),
     type = int64()
   )
   #> Array
   #> <int64>
   #> [
   #>   1,
   #>   2,
   #>   3,
   #>   4,
   #>   5
   #> ]
   
   concat_arrays(
     Array$create(1:3, type = float32()),
     Array$create(4:5, type = float64())
   )
   #> Error: Invalid: arrays to be concatenated must be identically typed, but 
float and double were encountered.
   ```


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


Reply via email to