MichaelChirico commented on a change in pull request #28365:
URL: https://github.com/apache/spark/pull/28365#discussion_r415704429



##########
File path: R/pkg/R/DataFrame.R
##########
@@ -2587,18 +2589,18 @@ setMethod("join",
               if (is.null(joinType)) {
                 sdf <- callJMethod(x@sdf, "join", y@sdf, joinExpr@jc)
               } else {
-                if (joinType %in% c("inner", "cross",
+                valid_join_types <- c("inner", "cross",
                     "outer", "full", "fullouter", "full_outer",
                     "left", "leftouter", "left_outer",
                     "right", "rightouter", "right_outer",
-                    "semi", "left_semi", "leftsemi", "anti", "left_anti", 
"leftanti")) {
+                    "semi", "left_semi", "leftsemi", "anti", "left_anti", 
"leftanti")
+                if (joinType %in% valid_join_types) {
                   joinType <- gsub("_", "", joinType)
                   sdf <- callJMethod(x@sdf, "join", y@sdf, joinExpr@jc, 
joinType)
                 } else {
-                  stop(paste("joinType must be one of the following types:",
-                       "'inner', 'cross', 'outer', 'full', 'fullouter', 
'full_outer',",
-                       "'left', 'leftouter', 'left_outer', 'right', 
'rightouter', 'right_outer',",
-                       "'semi', 'leftsemi', 'left_semi', 'anti', 'leftanti' or 
'left_anti'."))
+                  stop(gettextf("joinType must be one of the following types: 
'%s'",

Review comment:
       noting here that i changed this error message slightly (removed the `or` 
and aligned the ordering (`leftsemi`/`left_semi` and `leftanti`/`left_anti` are 
swapped vis-a-vis the `%in%` condition).
   
   it may be preferable to just change the test not to be so exact. LMK




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to