You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Dewey Dunnington (Jira)" <ji...@apache.org> on 2021/11/09 15:32:00 UTC

[jira] [Commented] (ARROW-13858) [R] Create a field ref to a field in a struct

    [ https://issues.apache.org/jira/browse/ARROW-13858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17441225#comment-17441225 ] 

Dewey Dunnington commented on ARROW-13858:
------------------------------------------

Just doing some exploring:

Where the field reference is created in from /R: https://github.com/apache/arrow/blob/master/r/R/expression.R#L170-L173

Where the field reference is created in /src: https://github.com/apache/arrow/blob/master/r/src/expression.cpp#L72-L74

Example of creating a nested field reference from a test (but it appears it wasn't implemented?) https://github.com/lidavidm/arrow/blob/master/cpp/src/arrow/compute/exec/expression_test.cc#L506-L509

You can do this kind of thing in dplyr using {{$}}:

{code:R}
library(arrow, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)

RecordBatch$create(df_col = tibble(a = 1)) %>% 
  mutate(df_col_a = df_col$a) %>% 
  collect()
#> # A tibble: 1 × 1
#>   df_col$a
#>      <dbl>
#> 1        1

tibble(df_col = tibble(a = 1)) %>% 
  mutate(df_col_a = df_col$a)
#> # A tibble: 1 × 2
#>   df_col$a df_col_a
#>      <dbl>    <dbl>
#> 1        1        1
{code}



> [R] Create a field ref to a field in a struct
> ---------------------------------------------
>
>                 Key: ARROW-13858
>                 URL: https://issues.apache.org/jira/browse/ARROW-13858
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Neal Richardson
>            Priority: Major
>              Labels: query-engine
>             Fix For: 7.0.0
>
>
> See also ARROW-11259. This probably needs to be a {{$}} and {{[[}} method on {{Expression}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)