You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Thomas Sandmann (Jira)" <ji...@apache.org> on 2021/05/22 20:52:00 UTC

[jira] [Updated] (ARROW-12852) Creating a schema from a named list - names seem to be dropped?

     [ https://issues.apache.org/jira/browse/ARROW-12852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Sandmann updated ARROW-12852:
------------------------------------
    Description: 
I am trying to create a schema from a named list of data types, but can't figure out how. The manual page reads:

{{... named list of data types}}

When I pass a list with names to the [schema|#L140]] function I get an assertion error:

{{library(arrow)}}
x <- list(col1 = int8(), col2 = float32())

{{names(x)}}
[1] "col1" "col2"

{{schema(x)}}
Error: !is.null(nms <- names(.list)) is not TRUE

It seems that the internal [.fields|#L75]] function is dropping the names. Maybe I misunderstood the documentation and there is another way to define the ellipsis of the `schema` function?

{{arrow:::.fields(x)}}

{{[[1]]}}
Field
col1: int8}}{{[[2]]}}
Field
col2: float

 

  was:
I am trying to create a schema from a named list of data types, but can't figure out how. The manual page reads:

{{... named list of data types}}


When I pass a list with names to the [schema|[https://github.com/cran/arrow/blob/45beab2efdb0128a5494bb686357b6c3d6c63989/R/schema.R#L140]] function I get an assertion error:

{{library(arrow)}}
{{ x <- list(col1 = int8(), col2 = float32())}}

{{names(x)}}
{{ [1] "col1" "col2"}}

{{schema(x)}}
{{ Error: !is.null(nms <- names(.list)) is not TRUE}}

It seems that the internal [.fields|[https://github.com/cran/arrow/blob/45beab2efdb0128a5494bb686357b6c3d6c63989/R/field.R#L75]] function is dropping the names. Maybe I misunderstood the documentation and there is another way to define the ellipsis of the `schema` function?

{{arrow:::.fields(x)}}{{[[1]]}}
{{ Field}}
{{ col1: int8}}{{[[2]]}}
{{ Field}}
{{ col2: float}}

 


> Creating a schema from a named list - names seem to be dropped?
> ---------------------------------------------------------------
>
>                 Key: ARROW-12852
>                 URL: https://issues.apache.org/jira/browse/ARROW-12852
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: R
>    Affects Versions: 4.0.0
>         Environment: > sessionInfo()
> R version 4.0.3 (2020-10-10)
> Platform: x86_64-apple-darwin17.0 (64-bit)
> Running under: macOS Catalina 10.15.7Matrix products: default
> BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dyliblocale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8attached base packages:
> [1] stats graphics grDevices utils datasets methods
> [7] baseother attached packages:
> [1] arrow_4.0.0.1loaded via a namespace (and not attached):
> [1] assertthat_0.2.1 R6_2.5.0 sys_3.4
> [4] jsonlite_1.7.2 magrittr_2.0.1 credentials_1.3.0
> [7] rlang_0.4.10 curl_4.3 vctrs_0.3.7
> [10] tools_4.0.3 bit64_4.0.5 glue_1.4.2
> [13] purrr_0.3.4 bit_4.0.4 compiler_4.0.3
> [16] askpass_1.1 openssl_1.4.3 tidyselect_1.1.0
>            Reporter: Thomas Sandmann
>            Priority: Minor
>
> I am trying to create a schema from a named list of data types, but can't figure out how. The manual page reads:
> {{... named list of data types}}
> When I pass a list with names to the [schema|#L140]] function I get an assertion error:
> {{library(arrow)}}
> x <- list(col1 = int8(), col2 = float32())
> {{names(x)}}
> [1] "col1" "col2"
> {{schema(x)}}
> Error: !is.null(nms <- names(.list)) is not TRUE
> It seems that the internal [.fields|#L75]] function is dropping the names. Maybe I misunderstood the documentation and there is another way to define the ellipsis of the `schema` function?
> {{arrow:::.fields(x)}}
> {{[[1]]}}
> Field
> col1: int8}}{{[[2]]}}
> Field
> col2: float
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)