Skip to content

[R] Broken bindings in Math group generics #43163

@aboyoun

Description

@aboyoun

Describe the bug, including details regarding any error messages, version, and platform.

When support was added for cumsum in the Math group generics in the R client, it mistakenly mapped signif, expm1, log1p, cospi, sinpi, tanpi, cosh, sinh, tanh, acosh, asinh, atanh, lgamma, gamma, digamma, and trigamma to the cumulative_sum_checked arrow function.

Here is an example:

R> suppressMessages(library(arrow))
R> cumsum(Array$create(c(0.6, 2.1, 0)))
Array
<double>
[
  0.6,
  2.7,
  2.7
]
R> log1p(Array$create(c(0.6, 2.1, 0)))
Array
<double>
[
  0.6,
  2.7,
  2.7
]
R> packageVersion("arrow")
[1] ‘16.1.0’

The mismapping can be seen in the switch statement below:

> arrow:::Math.ArrowDatum
function (x, ..., base = exp(1), digits = 0) 
{
   switch(.Generic, abs = eval_array_expression("abs_checked", 
       x), ceiling = eval_array_expression("ceil", x), sign = , 
       floor = , trunc = , acos = , asin = , atan = , cos = , 
       sin = , tan = {
           eval_array_expression(.Generic, x)
       }, log = eval_array_expression("logb_checked", x, base), 
       log10 = eval_array_expression("log10_checked", x), round = eval_array_expression("round", 
           x, options = list(ndigits = digits, round_mode = RoundMode$HALF_TO_EVEN)), 
       sqrt = eval_array_expression("sqrt_checked", x), exp = eval_array_expression("power_checked", 
           exp(1), x), signif = , expm1 = , log1p = , cospi = , 
       sinpi = , tanpi = , cosh = , sinh = , tanh = , acosh = , 
       asinh = , atanh = , lgamma = , gamma = , digamma = , 
       trigamma = , cumsum = eval_array_expression("cumulative_sum_checked", 
           x), cumprod = , cummax = , cummin = , stop(paste0("Unsupported operation on `", 
           class(x)[1L], "` : "), .Generic, call. = FALSE))
}

Component(s)

R

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions