HyukjinKwon commented on a change in pull request #28372:
URL: https://github.com/apache/spark/pull/28372#discussion_r416247772
##########
File path: R/pkg/R/types.R
##########
@@ -94,27 +94,23 @@ checkSchemaInArrow <- function(schema) {
}
# Both cases below produce a corrupt value for unknown reason. It needs to
be investigated.
- if (any(sapply(schema$fields(), function(x) x$dataType.toString() ==
"FloatType"))) {
+ field_strings <- sapply(schema$fields(), function(x) x$dataType.toString())
+ if (any(field_strings == "FloatType")) {
stop("Arrow optimization in R does not support float type yet.")
}
- if (any(sapply(schema$fields(), function(x) x$dataType.toString() ==
"BinaryType"))) {
+ if (any(field_strings == "BinaryType")) {
stop("Arrow optimization in R does not support binary type yet.")
}
- if (any(sapply(schema$fields(),
- function(x) startsWith(x$dataType.toString(),
- "ArrayType")))) {
+ if (any(startsWith(field_strings, "ArrayType"))) {
stop("Arrow optimization in R does not support array type yet.")
}
# Arrow optimization in Spark does not yet support both cases below.
- if (any(sapply(schema$fields(),
- function(x) startsWith(x$dataType.toString(),
- "StructType")))) {
+ if (any(startsWith(field_strings, "StructType"))) {
stop("Arrow optimization in R does not support nested struct type yet.")
}
- if (any(sapply(schema$fields(),
- function(x) startsWith(x$dataType.toString(),
- "MapType")))) {
+ if (any(startsWith(field_strings, "MapType"))) {
stop("Arrow optimization in R does not support map type yet.")
}
+ return(invisible())
Review comment:
Quick question, why do we need this?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]