diff --git a/R/pkg/R/mllib_classification.R b/R/pkg/R/mllib_classification.R index 093467ecf7d28..7204f8bb7dff4 100644 --- a/R/pkg/R/mllib_classification.R +++ b/R/pkg/R/mllib_classification.R @@ -322,7 +322,7 @@ setMethod("spark.logit", signature(data = "SparkDataFrame", formula = "formula") } if (!is.null(lowerBoundsOnCoefficients)) { - if (class(lowerBoundsOnCoefficients) != "matrix") { + if (!is.matrix(lowerBoundsOnCoefficients)) { stop("lowerBoundsOnCoefficients must be a matrix.") } row <- nrow(lowerBoundsOnCoefficients) @@ -331,7 +331,7 @@ setMethod("spark.logit", signature(data = "SparkDataFrame", formula = "formula") } if (!is.null(upperBoundsOnCoefficients)) { - if (class(upperBoundsOnCoefficients) != "matrix") { + if (!is.matrix(upperBoundsOnCoefficients)) { stop("upperBoundsOnCoefficients must be a matrix.") } diff --git a/R/pkg/R/serialize.R b/R/pkg/R/serialize.R index 7760d9be16f0b..85c318f30c338 100644 --- a/R/pkg/R/serialize.R +++ b/R/pkg/R/serialize.R @@ -58,7 +58,12 @@ writeObject <- function(con, object, writeType = TRUE) { # Checking types is needed here, since 'is.na' only handles atomic vectors, # lists and pairlists if (type %in% c("integer", "character", "logical", "double", "numeric")) { - if (is.na(object)) { + if (is.na(object[[1]])) { + # Uses the first element for now to keep the behavior same as R before + # 4.2.0. This is wrong because we should differenciate c(NA) from a + # single NA as the former means array(null) and the latter means null + # in Spark SQL. However, it requires non-trivial comparison to distinguish + # both in R. We should ideally fix this. object <- NULL type <- "NULL" } diff --git a/dev/appveyor-install-dependencies.ps1 b/dev/appveyor-install-dependencies.ps1 index d469c98fdb3a2..19b49b90b3859 100644 --- a/dev/appveyor-install-dependencies.ps1 +++ b/dev/appveyor-install-dependencies.ps1 @@ -129,7 +129,7 @@ $env:PATH = "$env:HADOOP_HOME\bin;" + $env:PATH Pop-Location # ========================== R -$rVer = "4.0.2" +$rVer = "4.2.0" $rToolsVer = "4.0.2" InstallR