-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31571][R] Overhaul stop/message/warning calls to be more canonical #28365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4da5ded
overhaul stop/message/warning calls to be more translation-friendly/c…
b84c6f3
some missing whitespace
1940eb8
linting
e4b8ca9
fix broken test
b0cf844
Merge branch 'master' into r-stop-paste
06fac7d
Merge branch 'master' into r-stop-paste
dac07eb
Merge branch 'master' into r-stop-paste
54556c3
Merge branch 'master' into r-stop-paste
06ae5a7
Merge branch 'master' into r-stop-paste
5f36b1a
revert usage of gettextf
4d86dc6
missing .
2c92360
missing some call.=FALSE
f278f95
sQuote(., FALSE) is a relatively new addition to R
961ec34
Merge branch 'master' into r-stop-paste
3b3c1af
pick a more logical ordering for valid joinTypes
0c47c19
Merge branch 'master' into r-stop-paste
671288c
Merge branch 'master' into r-stop-paste
02d1728
camelCase
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -431,7 +431,7 @@ setMethod("coltypes", | |
| if (is.null(type)) { | ||
| specialtype <- specialtypeshandle(x) | ||
| if (is.null(specialtype)) { | ||
| stop(paste("Unsupported data type: ", x)) | ||
| stop("Unsupported data type: ", x) | ||
| } | ||
| type <- PRIMITIVE_TYPES[[specialtype]] | ||
| } | ||
|
|
@@ -691,13 +691,13 @@ setMethod("storageLevel", | |
|
|
||
| #' Coalesce | ||
| #' | ||
| #' Returns a new SparkDataFrame that has exactly \code{numPartitions} partitions. | ||
| #' Returns a new SparkDataFrame that has exactly \code{"rtitions} partitions. | ||
| #' This operation results in a narrow dependency, e.g. if you go from 1000 partitions to 100 | ||
| #' partitions, there will not be a shuffle, instead each of the 100 new partitions will claim 10 of | ||
| #' the current partitions. If a larger number of partitions is requested, it will stay at the | ||
| #' current number of partitions. | ||
| #' | ||
| #' However, if you're doing a drastic coalesce on a SparkDataFrame, e.g. to numPartitions = 1, | ||
| #' However, if you're doing a drastic coalesce on a SparkDataFrame, e.g. to "rtitions = 1, | ||
| #' this may result in your computation taking place on fewer nodes than | ||
| #' you like (e.g. one node in the case of numPartitions = 1). To avoid this, | ||
| #' call \code{repartition}. This will add a shuffle step, but means the | ||
|
|
@@ -829,8 +829,8 @@ setMethod("repartitionByRange", | |
| jcol <- lapply(cols, function(c) { c@jc }) | ||
| sdf <- callJMethod(x@sdf, "repartitionByRange", numToInt(numPartitions), jcol) | ||
| } else { | ||
| stop(paste("numPartitions and col must be numeric and Column; however, got", | ||
| class(numPartitions), "and", class(col))) | ||
| stop("numPartitions and col must be numeric and Column; however, got ", | ||
| class(numPartitions), " and ", class(col)) | ||
| } | ||
| } else if (!is.null(col)) { | ||
| # only columns are specified | ||
|
|
@@ -839,7 +839,7 @@ setMethod("repartitionByRange", | |
| jcol <- lapply(cols, function(c) { c@jc }) | ||
| sdf <- callJMethod(x@sdf, "repartitionByRange", jcol) | ||
| } else { | ||
| stop(paste("col must be Column; however, got", class(col))) | ||
| stop("col must be Column; however, got ", class(col)) | ||
| } | ||
| } else if (!is.null(numPartitions)) { | ||
| # only numPartitions is specified | ||
|
|
@@ -1068,10 +1068,10 @@ setMethod("sample", | |
| signature(x = "SparkDataFrame"), | ||
| function(x, withReplacement = FALSE, fraction, seed) { | ||
| if (!is.numeric(fraction)) { | ||
| stop(paste("fraction must be numeric; however, got", class(fraction))) | ||
| stop("fraction must be numeric; however, got ", class(fraction)) | ||
| } | ||
| if (!is.logical(withReplacement)) { | ||
| stop(paste("withReplacement must be logical; however, got", class(withReplacement))) | ||
| stop("withReplacement must be logical; however, got ", class(withReplacement)) | ||
| } | ||
|
|
||
| if (!missing(seed)) { | ||
|
|
@@ -1211,11 +1211,10 @@ setMethod("collect", | |
| checkSchemaInArrow(schema(x)) | ||
| TRUE | ||
| }, error = function(e) { | ||
| warning(paste0("The conversion from Spark DataFrame to R DataFrame was attempted ", | ||
| "with Arrow optimization because ", | ||
| "'spark.sql.execution.arrow.sparkr.enabled' is set to true; ", | ||
| "however, failed, attempting non-optimization. Reason: ", | ||
| e)) | ||
| warning("The conversion from Spark DataFrame to R DataFrame was attempted ", | ||
| "with Arrow optimization because ", | ||
| "'spark.sql.execution.arrow.sparkr.enabled' is set to true; ", | ||
| "however, failed, attempting non-optimization. Reason: ", e) | ||
| FALSE | ||
| }) | ||
| } | ||
|
|
@@ -1513,8 +1512,8 @@ dapplyInternal <- function(x, func, schema) { | |
| if (inherits(schema, "structType")) { | ||
| checkSchemaInArrow(schema) | ||
| } else if (is.null(schema)) { | ||
| stop(paste0("Arrow optimization does not support 'dapplyCollect' yet. Please disable ", | ||
| "Arrow optimization or use 'collect' and 'dapply' APIs instead.")) | ||
| stop("Arrow optimization does not support 'dapplyCollect' yet. Please disable ", | ||
| "Arrow optimization or use 'collect' and 'dapply' APIs instead.") | ||
| } else { | ||
| stop("'schema' should be DDL-formatted string or structType.") | ||
| } | ||
|
|
@@ -2017,8 +2016,8 @@ setMethod("[", signature(x = "SparkDataFrame"), | |
| x | ||
| } else { | ||
| if (class(i) != "Column") { | ||
| stop(paste0("Expressions other than filtering predicates are not supported ", | ||
| "in the first parameter of extract operator [ or subset() method.")) | ||
| stop("Expressions other than filtering predicates are not supported ", | ||
| "in the first parameter of extract operator [ or subset() method.") | ||
| } | ||
| filter(x, i) | ||
| } | ||
|
|
@@ -2609,18 +2608,17 @@ 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", | ||
MichaelChirico marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "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, fixed = TRUE) | ||
| 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("joinType must be one of the following types: ", | ||
| "'", paste(valid_join_types, collapse = "', '"), "'") | ||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here,
pastewas creating an extra space, now fixed