-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[SPARK-12393] [SparkR] Add read.text and write.text for SparkR #10348
Conversation
Test build #47904 has finished for PR 10348 at commit
|
#' @rdname write.text | ||
#' @export | ||
setGeneric("write.text", function(x, path) { standardGeneric("write.text") }) | ||
|
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.
shouldn't read.text be added too?
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 found all functions in SQLContext.R did not use setGeneric
, is this on purpose or a bug?
If it's a bug, I can fix it.
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.
This is historical legacy:) (you can find same cases in context.R.) I guess that because we did not implement SparkContext and SQLContext as S4 classes. If there is no strong reason, we can keep it as is.
cc @shivaram.
Test build #48000 has finished for PR 10348 at commit
|
#' sc <- sparkR.init() | ||
#' sqlContext <- sparkRSQL.init(sc) | ||
#' path <- "path/to/file.json" | ||
#' df <- read.json(sqlContext, path) |
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.
is this a bit odd as an example? it's loading a DF as json and writing it out as text (which requires one string column?
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 will update it with read.text
.
Test build #48185 has finished for PR 10348 at commit
|
LGTM |
@@ -661,6 +661,34 @@ setMethod("saveAsParquetFile", | |||
write.parquet(x, path) | |||
}) | |||
|
|||
#' write.text | |||
#' | |||
#' Saves the content of the DataFrame in a text file at the specified path. |
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.
might want to add the DataFrame must have a column with the name "value" I recall there is a similar doc clarification in Scala recently.
Test build #48813 has finished for PR 10348 at commit
|
looks good |
LGTM. Thanks @yanboliang for the patch an @sun-rui @felixcheung for reviewing. Merging this to master and |
Add ```read.text``` and ```write.text``` for SparkR. cc sun-rui felixcheung shivaram Author: Yanbo Liang <ybliang8@gmail.com> Closes #10348 from yanboliang/spark-12393. (cherry picked from commit d1fea41) Signed-off-by: Shivaram Venkataraman <shivaram@cs.berkeley.edu>
Add
read.text
andwrite.text
for SparkR.cc @sun-rui @felixcheung @shivaram