-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
As discussed at #9942 (comment) the as.double(), as.integer(), and as.character() methods for ArrowDatum return R vectors of the specified R types, whereas in dplyr, these same functions perform casts to the analogous Arrow types
Compare the definitions:
-
ArrowDatummethods:Lines 139 to 145 in ace2bfc
as.double.ArrowDatum <- function(x, ...) as.double(as.vector(x), ...) #' @export as.integer.ArrowDatum <- function(x, ...) as.integer(as.vector(x), ...) #' @export as.character.ArrowDatum <- function(x, ...) as.character(as.vector(x), ...) -
dplyr functions:
Lines 399 to 432 in f2db785
as.character = function(x) { FUN("cast", x, options = cast_options(to_type = string())) }, as.double = function(x) { FUN("cast", x, options = cast_options(to_type = float64())) }, as.integer = function(x) { FUN( "cast", x, options = cast_options( to_type = int32(), allow_float_truncate = TRUE, allow_decimal_truncate = TRUE ) ) }, as.integer64 = function(x) { FUN( "cast", x, options = cast_options( to_type = int64(), allow_float_truncate = TRUE, allow_decimal_truncate = TRUE ) ) }, as.logical = function(x) { FUN("cast", x, options = cast_options(to_type = boolean())) }, as.numeric = function(x) { FUN("cast", x, options = cast_options(to_type = float64())) }, Consider whether the
ArrowDatummethods should instead perform casts but keep the data in Arrow so that the user would have to also callas.vector()to return the data as an R vector.
Reporter: Ian Cook / @ianmcook
Assignee: Ian Cook / @ianmcook
Related issues:
- [R] Bindings for basic type convert functions in dplyr verbs (is related to)
Note: This issue was originally created as ARROW-12292. Please see the migration documentation for further details.