Skip to content

[R] Argument names ignored in schema supplied as in_type argument to register_scalar_function() #37761

Closed

Description

@csgillespie

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

For in_type, I would have expected the argument name should match the data. But this doesn't seem to be the case

library(arrow)
library(dplyr)
# Make data set
write.csv(sleep, "sleep.csv", row.names = F)

# Register function
register_scalar_function(
  name = "f",
  fun = function(context, x) as.integer(x),
  in_type = schema(blah = int64()), # NOTE: Schema name
  out_type = int32(),
  auto_convert = TRUE
)

open_dataset("sleep.csv", format = "csv") |>
  mutate(f(group)) |>
  head() |>
  collect()

Component(s)

R

Activity

  1. changed the title [-]Argument names ignored in schema[/-] [+][R] Argument names ignored in schema[/+] on Sep 18, 2023
  2. changed the title [-][R] Argument names ignored in schema[/-] [+][R] Argument names ignored in schema supplied as `in_type` argument to `register_scalar_function()`[/+] on Sep 18, 2023
  3. nealrichardson commented on Sep 18, 2023

    @nealrichardson
    Member

    We could add a check that identical(formalArgs(fun)[-1], names(in_type)) (if inherits(in_type, "Schema"), which it may not be if there's only one arg).

  4. added a commit that references this issue on Sep 18, 2026
  5. added this to the 26.0.0 milestone on Sep 18, 2026
  6. thisisnic commented on Sep 18, 2026

    @thisisnic
    Member

    Issue resolved by pull request 51324
    #51324

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions