Skip to content

[R]: vctrs custom class errors on roundtrip #42220

Closed

Description

@jonkeane

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

I think that this is fallout from #41969 but when making some examples for how to make a custom vctrs class I ran into an error on round trip Error in '[<-': ! Can't convert 'value' <list> to <special>..

library(arrow, quietly = TRUE, warn.conflicts = FALSE)
#> Warning: package 'arrow' was built under R version 4.4.1
library(vctrs, quietly = TRUE, warn.conflicts = FALSE)

special <- function(n = integer()) {
  new_rcrd(
    fields = list(special = n),
    class = "special"
  )
}

frac_df <- data.frame(
  total = c(2, 2, 7, 9)
)

frac_df$special = special(frac_df$total)

as_arrow_table(frac_df)
#> Error in `[<-`:
#> ! Can't convert `value` <list> to <special>.

Created on 2024-06-20 with reprex v2.1.0

Component(s)

R

Activity

  1. nealrichardson commented on Jun 20, 2024

    @nealrichardson
    Member

    This is in the VctrsExtensionType code path, which as it turns out serializes a vec_ptype and not just a list of attributes. So that will need to be handled differently (here, specifically).

  2. added a commit that references this issue on Jun 20, 2024
  3. added a commit that references this issue on Jun 22, 2024
  4. added this to the 17.0.0 milestone on Jun 22, 2024
  5. thisisnic commented on Jun 22, 2024

    @thisisnic
    Member

    Issue resolved by pull request 42226
    #42226

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions