Details
-
Improvement
-
Status: In Progress
-
Critical
-
Resolution: Unresolved
-
None
Description
In ARROW-13371 we implemented the make_struct compute function bound to data.frame() / tibble() in dplyr evaluation; however, we didn't actually implement StructArray$create(). In ARROW-15168, it turns out that we need to do this to support StructArray creation from data.frames whose columns aren't all convertable using the internal C++ conversion. The hack used in that PR is below (but we should clearly implement the C++ function instead of using the hack):
library(arrow, warn.conflicts = FALSE) struct_array <- function(...) { batch <- record_batch(...) array_ptr <- arrow:::allocate_arrow_array() schema_ptr <- arrow:::allocate_arrow_schema() batch$export_to_c(array_ptr, schema_ptr) Array$import_from_c(array_ptr, schema_ptr) } struct_array(a = 1, b = "two") #> StructArray #> <struct<a: double, b: string>> #> -- is_valid: all not null #> -- child 0 type: double #> [ #> 1 #> ] #> -- child 1 type: string #> [ #> "two" #> ]
Attachments
Issue Links
- links to