shivaram commented on a change in pull request #28907:
URL: https://github.com/apache/spark/pull/28907#discussion_r444284257



##########
File path: R/pkg/R/utils.R
##########
@@ -529,7 +529,10 @@ processClosure <- function(node, oldEnv, defVars, 
checkedFuncs, newEnv) {
         # Namespaces other than "SparkR" will not be searched.
         if (!isNamespace(func.env) ||
             (getNamespaceName(func.env) == "SparkR" &&
-               !(nodeChar %in% getNamespaceExports("SparkR")))) {
+               !(nodeChar %in% getNamespaceExports("SparkR")) &&
+                  # Note that generic S4 methods should not be set to the 
environment of
+                  # cleaned closure. It does not work with R 4.0.0+. See also 
SPARK-31918.
+                  nodeChar != "" && !methods::isGeneric(nodeChar, func.env))) {

Review comment:
       Just to confirm this will only exclude generics inside SparkR -- is that 
right?  

##########
File path: R/pkg/tests/fulltests/test_mllib_classification.R
##########
@@ -130,7 +130,7 @@ test_that("spark.logit", {
   summary <- summary(model)
 
   # test summary coefficients return matrix type
-  expect_true(class(summary$coefficients) == "matrix")
+  expect_true(any(class(summary$coefficients) == "matrix"))

Review comment:
       Thanks! This also reminds me that it'll be great to test on r-devel 
(which I guess is 4.0.3 right now)

##########
File path: R/pkg/tests/fulltests/test_context.R
##########
@@ -26,7 +26,8 @@ test_that("Check masked functions", {
                      "colnames", "colnames<-", "intersect", "rank", "rbind", 
"sample", "subset",
                      "summary", "transform", "drop", "window", 
"as.data.frame", "union", "not")
   version <- packageVersion("base")
-  if (as.numeric(version$major) >= 3 && as.numeric(version$minor) >= 3) {
+  if (as.numeric(version$major) >= 3 && as.numeric(version$minor) >= 3 ||

Review comment:
       minor nit: maybe put the major/minor check for > 3.3 inside separate 
`()`? i.e. 
   ```
   (as.numeric(version$major) >= 3 && as.numeric(version$minor) >= 3) || 
as.numeric(version$major) >= 4
   ```




----------------------------------------------------------------
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]

Reply via email to