fix(r): Convert I()-wrapped vectors without arrow installed - #954
Merged
Merged
Conversation
The schema side already strips the `AsIs` class and dispatches again, but `as_nanoarrow_array()` had no counterpart, so an `I()`-wrapped base vector fell through to the default method's arrow fallback. The new method does not forward `...`, which can carry `.from_c = TRUE` and would still route the unwrapped value to arrow.
Removing the first class assumes `AsIs` leads the class vector. That holds for `I()`, but when another class comes first it was dropped instead: a Date reaching the array method through `NextMethod()` with an int32 schema was converted as its number of days. Strip exactly `AsIs`, as base R's `print.AsIs()` and vctrs' `asis_strip()` do.
nbenn
marked this pull request as ready for review
September 28, 2026 16:18
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #954 +/- ##
=======================================
Coverage 78.19% 78.20%
=======================================
Files 106 106
Lines 16845 16847 +2
Branches 1985 1985
=======================================
+ Hits 13172 13175 +3
+ Misses 2439 2438 -1
Partials 1234 1234 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
as_nanoarrow_array()method forAsIsthat strips the class and dispatches again, mirroring theinfer_nanoarrow_schema()method. AnI()-wrapped base vector, such as a list column kept whole in adata.frame(), no longer falls through to the arrow fallback....: when the C conversion calls back for a data frame column,...carries.from_c = TRUE, which would still route the unwrapped value to arrow.AsIsmethods, including the existing schema one, remove only theAsIsclass, as base R'sprint.AsIs()does. Removing the first class instead is the same for anythingI()returns, but otherwise drops whatever class comes ahead ofAsIs, so ac("Date", "AsIs")value reaching the array method throughNextMethod()would be converted to int32 as its day count.I(as.Date(...))or anI()-wrapped blob, convert as before, with or without arrow. AnI()-wrapped matrix, which failed even with arrow installed, and anI()-wrappedinteger64with missing values, which needed arrow, now convert too.nanoarrow.without_arrowoption, so it fails on main even where arrow is installed, as it is in CI.Fixes #953