romainfrancois commented on a change in pull request #11751:
URL: https://github.com/apache/arrow/pull/11751#discussion_r754518629
##########
File path: r/R/type.R
##########
@@ -40,7 +40,8 @@ DataType <- R6Class("DataType",
fields = function() {
DataType__fields(self)
},
- export_to_c = function(ptr) ExportType(self, ptr)
+ export_to_c = function(ptr) ExportType(self, ptr),
+ code = function() call2("unknown_type", self$ToString())
Review comment:
So I added `arrow:::DayTimeInterval__initialize()` to make a
`DayTimeInterval` type, which don't have an R function yet. Bit artificial, but
then we get to be able to test what it looks like when we error, e.g.
``` r
library(arrow, warn.conflicts = FALSE)
#> See arrow_info() for available features
try_ <- function(code) tryCatch(code, error = function(cnd) print(cnd,
backtrace = FALSE))
try_(
arrow:::DayTimeInterval__initialize()$code()
)
#> <error/rlang_error>
#> Error in `code()`: Unsupported type: <day_time_interval>.
#> ℹ The arrow package currently has no function to make these.
try_(
schema(x = int32(), y = arrow:::DayTimeInterval__initialize())$code()
)
#> <error/rlang_error>
#> Error in `code()`:
#> Problem getting code for field "y".
#> Caused by error in `code()`:
#> Unsupported type: <day_time_interval>.
#> ℹ The arrow package currently has no function to make these.
try_(
struct(a = arrow:::DayTimeInterval__initialize())$code()
)
#> <error/rlang_error>
#> Error in `code()`:
#> Problem getting code for field "a".
#> Caused by error in `code()`:
#> Unsupported type: <day_time_interval>.
#> ℹ The arrow package currently has no function to make these.
try_(
list_of(arrow:::DayTimeInterval__initialize())$code()
)
#> <error/rlang_error>
#> Error in `code()`:
#> Problem getting code for list type.
#> Caused by error in `code()`:
#> Unsupported type: <day_time_interval>.
#> ℹ The arrow package currently has no function to make these.
try_(
large_list_of(arrow:::DayTimeInterval__initialize())$code()
)
#> <error/rlang_error>
#> Error in `code()`:
#> Problem getting code for large list type.
#> Caused by error in `code()`:
#> Unsupported type: <day_time_interval>.
#> ℹ The arrow package currently has no function to make these.
try_(
fixed_size_list_of(arrow:::DayTimeInterval__initialize(), list_size =
4L)$code()
)
#> <error/rlang_error>
#> Error in `code()`:
#> Problem getting code for fixed size list type.
#> Caused by error in `code()`:
#> Unsupported type: <day_time_interval>.
#> ℹ The arrow package currently has no function to make these.
try_(
schema(x = int32(), y = struct(a =
arrow:::DayTimeInterval__initialize()))$code()
)
#> <error/rlang_error>
#> Error in `code()`:
#> Problem getting code for field "y".
#> Caused by error in `code()`:
#> Problem getting code for field "a".
#> Caused by error in `code()`:
#> Unsupported type: <day_time_interval>.
#> ℹ The arrow package currently has no function to make these.
```
<sup>Created on 2021-11-22 by the [reprex
package](https://reprex.tidyverse.org) (v2.0.1.9000)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]