Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(r): Allow opt-out of warning for unregistered extension types #632

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

paleolimbot
Copy link
Member

@paleolimbot paleolimbot commented Sep 20, 2024

Closes #631.

# Using pak::pak("apache/arrow-nanoarrow/r#632")
library(nanoarrow)
array <- as_nanoarrow_array(data.frame(x = 1:5, y = letters[1:5]))
array$children$z <- nanoarrow_extension_array(letters[1:5], "some_extension")

# warns!
tibble::as_tibble(array)
#> Warning in warn_unregistered_extension_type(x): z: Converting unknown extension
#> some_extension{string} as storage type
#> Warning in warn_unregistered_extension_type(storage): z: Converting unknown
#> extension some_extension{string} as storage type
#> # A tibble: 5 × 3
#>       x y     z    
#>   <int> <chr> <chr>
#> 1     1 a     a    
#> 2     2 b     b    
#> 3     3 c     c    
#> 4     4 d     d    
#> 5     5 e     e

# doesn't!
options(nanoarrow.warn_unregistered_extension = FALSE)
tibble::as_tibble(array)
#> # A tibble: 5 × 3
#>       x y     z    
#>   <int> <chr> <chr>
#> 1     1 a     a    
#> 2     2 b     b    
#> 3     3 c     c    
#> 4     4 d     d    
#> 5     5 e     e

Created on 2024-09-20 with reprex v2.1.1

Copy link
Member

@amoeba amoeba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Did you consider extending the "Converting unknown extension %s as storage type" warning to include instructions for disabling the warning? Considering the report in the original issue, it seems likely that the user who gets the warning may not really know where to go for help or what they should do to hide the warning beyond suppressing warnings for the entire call.

So where the current warning is,

Warning message:
In warn_unregistered_extension_type(storage) :
  z: Converting unknown extension some_extension{string} as storage type

A possible improvement could be:

Warning message:
In warn_unregistered_extension_type(storage) :
  z: Converting unknown extension some_extension{string} as storage type. Disable warning with options(nanoarrow.warn_unregistered_extension = FALSE).

or to make it shorter, "See Details section in ?nanoarrow::convert_array.".

@paleolimbot paleolimbot merged commit 44e8eb9 into apache:main Sep 23, 2024
12 checks passed
@paleolimbot paleolimbot deleted the r-silence-unknown-extensions branch September 23, 2024 02:24
@paleolimbot paleolimbot modified the milestone: nanoarrow 0.6.0 Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide some way to suppress warning about unknown extension?
2 participants