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

Dewey Dunnington updated ARROW-15014:
-------------------------------------
    Summary: [C++] No kernel for logical operations on integer storage of 
boolean values  (was: [R] No kernel for logical operations on integer storage 
of boolean values)

> [C++] No kernel for logical operations on integer storage of boolean values
> ---------------------------------------------------------------------------
>
>                 Key: ARROW-15014
>                 URL: https://issues.apache.org/jira/browse/ARROW-15014
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Dewey Dunnington
>            Priority: Minor
>
> In R, we can use integers and doubles as input to logical functions. In 
> Arrow, there is no kernel for non-bool storage of logical values. This 
> affects some of our translations where we might want to cast to {{bool}} 
> rather than error. Perhaps not high priority, but ran into this when 
> prototyping zero-copy conversion of logicals to Arrow (since they're stored 
> as an int32 array under the hood).
> A few examples:
> {code:R}
> library(arrow, warn.conflicts = FALSE)
> library(dplyr, warn.conflicts = FALSE)
> Scalar$create(0L) | Scalar$create(1L)
> #> Error: NotImplemented: Function or_kleene has no kernel matching input 
> types (scalar[int32], scalar[int32])
> #> 
> /Users/deweydunnington/Desktop/rscratch/arrow/cpp/src/arrow/compute/function.cc:215
>   DispatchBest(&inputs)
> record_batch(numbers = c(0, 1, NA)) %>% 
>   mutate(!numbers)
> #> Error: NotImplemented: Function invert has no kernel matching input types 
> (array[double])
> #> 
> /Users/deweydunnington/Desktop/rscratch/arrow/cpp/src/arrow/compute/exec/expression.cc:340
>   call.function->DispatchBest(&descrs)
> tibble(numbers = c(0, 1, NA)) %>% 
>   mutate(!numbers)
> #> # A tibble: 3 × 2
> #>   numbers `!numbers`
> #>     <dbl> <lgl>     
> #> 1       0 TRUE      
> #> 2       1 FALSE     
> #> 3      NA NA
> {code}



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

Reply via email to