You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/17 07:56:42 UTC

[GitHub] [spark] deshanxiao commented on a diff in pull request #37549: [SPARK-40103][R][FEATURE] Support read/write.csv() in SparkR

deshanxiao commented on code in PR #37549:
URL: https://github.com/apache/spark/pull/37549#discussion_r947573399


##########
R/pkg/R/SQLContext.R:
##########
@@ -492,6 +492,37 @@ read.text <- function(path, ...) {
   dataFrame(sdf)
 }
 
+#' Create a SparkDataFrame from a csv file.
+#'
+#' Loads a Parquet file, returning the result as a SparkDataFrame.
+#'
+#' @param path Path of file to read. A vector of multiple paths is allowed.
+#' @param ... additional external data source specific named properties.
+#'            You can find the csv-specific options for reading csv files in
+# nolint start
+#'            \url{https://spark.apache.org/docs/latest/sql-data-sources-csv.html#data-source-option}{Data Source Option} in the version you use.
+# nolint end
+#' @return SparkDataFrame
+#' @rdname read.spark.csv
+#' @examples
+#'\dontrun{
+#' sparkR.session()
+#' path <- "path/to/file.csv"
+#' df <- read.spark.csv(path)
+#' }
+#' @name read.spark.csv
+#' @note read.spark.csv since 3.3.0
+read.spark.csv <- function(path, ...) {

Review Comment:
   Yes, We can read csv file by following code:
   `df <- read.df("examples/src/main/resources/people.csv", "csv", sep = ";", inferSchema = TRUE, header = TRUE)
   `
   
   However, considering that other formats have corresponding advanced functions(read.text() etc.), it is necessary to add a high-level api here.



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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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