-
Notifications
You must be signed in to change notification settings - Fork 29k
[SparkR] Fix bad examples in DataFrame methods and style issues #18003
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
Conversation
|
Test build #76976 has finished for PR 18003 at commit
|
| #' @param object a SparkDataFrame | ||
| #' @examples \dontrun{ | ||
| #' @examples | ||
| #' \dontrun{ |
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.
There are a lot of these in functions.R. Maybe you could fix them too with this PR?
|
@bdwyer2 Thanks for the suggestion. I ran a check on all the R scripts and fixed the style issues. |
|
Test build #76979 has finished for PR 18003 at commit
|
R/pkg/R/DataFrame.R
Outdated
| #' df <- read.json(path) | ||
| #' write.df(df, "myfile", "parquet", "overwrite") | ||
| #' saveDF(df, parquetPath2, "parquet", mode = saveMode, mergeSchema = mergeSchema) | ||
| #' saveDF(df, parquetPath2, "parquet", mode = "overwrite") |
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.
the example with these parameter are actually intentional - it is to show what additional properties can be set.
but I'd agree if they run as-is it would be preferred
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.
I'd prefer to keep the mergeSchema param though
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.
added it back
R/pkg/R/functions.R
Outdated
| #' @export | ||
| #' @examples \dontrun{abs(df$c)} | ||
| #' @examples | ||
| #' \dontrun{abs(df$c)} |
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.
I'm actually not sure about this change - if the example is simple and is single line, I think they can go on the same line as @example tag.
More importantly though, I don't think majority of SQL function examples like this is usable or useful actually, and would rather have multi-line "real" example
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.
Agree. Reverted the change.
This reverts commit a919d9f.
|
@felixcheung Thanks for your suggestion. I reverted back the change on single line example. |
|
Test build #76993 has finished for PR 18003 at commit
|
felixcheung
left a comment
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.
cool, thanks, LGTM.
|
FYI. Can't merge at the moment - give me a day or 2. |
|
Thanks for the update. I will work on better examples on these functions. |
|
merged to master |
## What changes were proposed in this pull request? Some examples in the DataFrame methods are syntactically wrong, even though they are pseudo code. Fix these and some style issues. Author: Wayne Zhang <actuaryzhang@uber.com> Closes apache#18003 from actuaryzhang/sparkRDoc3.
What changes were proposed in this pull request?
Some examples in the DataFrame methods are syntactically wrong, even though they are pseudo code. Fix these and some style issues.