nealrichardson commented on a change in pull request #11324:
URL: https://github.com/apache/arrow/pull/11324#discussion_r727494047
##########
File path: r/R/schema.R
##########
@@ -136,7 +136,16 @@ Schema <- R6Class("Schema",
}
)
)
-Schema$create <- function(...) schema_(.fields(list2(...)))
+Schema$create <- function(...) {
+
Review comment:
```suggestion
```
##########
File path: r/R/schema.R
##########
@@ -136,7 +136,16 @@ Schema <- R6Class("Schema",
}
)
)
-Schema$create <- function(...) schema_(.fields(list2(...)))
+Schema$create <- function(...) {
+
+ .list <- list2(...)
+ if (all(sapply(.list, function(x) inherits(x = x, what = "Field")))) {
Review comment:
Since we're already using `purrr` in this package we can make this a
little more concise (and type stable)
```suggestion
if (all(map_lgl(.list, ~ inherits(. "Field")))) {
```
##########
File path: r/R/schema.R
##########
@@ -136,7 +136,16 @@ Schema <- R6Class("Schema",
}
)
)
-Schema$create <- function(...) schema_(.fields(list2(...)))
+Schema$create <- function(...) {
+
+ .list <- list2(...)
+ if (all(sapply(.list, function(x) inherits(x = x, what = "Field")))) {
+ schema_(.list)
+ } else {
+ schema_(.fields(.list))
+ }
+
Review comment:
```suggestion
```
--
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]