Commits

Romain Francois authored c16468554ab
ARROW-5625: [R] convert Array of struct type to data frame columns struct arrays become data frame columns, i.e. ``` r library(arrow, warn.conflicts = FALSE) library(tibble) tf <- tempfile() writeLines(' { "hello": 3.5, "world": false, "yo": "thing", "nuf": {} } { "hello": 3.25, "world": null, "nuf": null } { "hello": 3.125, "world": null, "yo": "\u5fcd", "nuf": { "ps": 78.0, "house": "Gryffindor"} } { "hello": 0.0, "world": true, "yo": null, "nuf": { "ps": 90.0, "house": "Slytherin" } } ', tf) tab1 <- read_json_arrow(tf, as_tibble = FALSE) array <- tab1$column(3)$data()$chunk(0) array$field(0) #> arrow::Array #> [ #> null, #> null, #> 78, #> 90 #> ] array$as_vector() #> ps house #> 1 NA <NA> #> 2 NA <NA> #> 3 78 Gryffindor #> 4 90 Slytherin as.data.frame(tab1) #> # A tibble: 4 x 4 #> hello world yo nuf$ps $house #> <dbl> <lgl> <chr> <dbl> <chr> #> 1 3.5 FALSE thing NA <NA> #> 2 3.25 NA <NA> NA <NA> #> 3 3.12 NA 忍 78 Gryffindor #> 4 0 TRUE <NA> 90 Slytherin ``` <sup>Created on 2019-06-17 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0.9000)</sup> Author: Romain Francois <romain@rstudio.com> Closes #4593 from romainfrancois/ARROW-5625/struct_arrays and squashes the following commits: b1f087e9 <Romain Francois> expand on unit test and added comment 17fd51e1 <Romain Francois> effectively use arrays 059c2442 <Romain Francois> lint 394a3d76 <Romain Francois> Converter_Struct::Ingest.*() a76f2671 <Romain Francois> Converter_Struct::Allocate() e425c5b2 <Romain Francois> More StrucrtArray methods bd71f388 <Romain Francois> + methods GetFieldIndex() and GetFieldByName() to arrow::StructType