|
188 | 188 | #' \item \code{to_json}: it is the column containing the struct, array of the structs,
|
189 | 189 | #' the map or array of maps.
|
190 | 190 | #' \item \code{from_json}: it is the column containing the JSON string.
|
| 191 | +#' \item \code{from_csv}: it is the column containing the CSV string. |
191 | 192 | #' }
|
192 | 193 | #' @param y Column to compute on.
|
193 | 194 | #' @param value A value to compute on.
|
@@ -2202,6 +2203,25 @@ setMethod("from_json", signature(x = "Column", schema = "characterOrstructType")
|
2202 | 2203 | column(jc)
|
2203 | 2204 | })
|
2204 | 2205 |
|
| 2206 | +#' @details |
| 2207 | +#' \code{from_csv}: Parses a column containing a CSV string into a Column of \code{structType} |
| 2208 | +#' with the specified \code{schema}. |
| 2209 | +#' If the string is unparseable, the Column will contain the value NA. |
| 2210 | +#' |
| 2211 | +#' @rdname column_collection_functions |
| 2212 | +#' @param schema a DDL-formatted string |
| 2213 | +#' @aliases from_csv from_csv,Column,character-method |
| 2214 | +#' |
| 2215 | +#' @note from_csv since 3.0.0 |
| 2216 | +setMethod("from_csv", signature(x = "Column", schema = "character"), |
| 2217 | + function(x, schema, ...) { |
| 2218 | + options <- varargsToStrEnv(...) |
| 2219 | + jc <- callJStatic("org.apache.spark.sql.functions", |
| 2220 | + "from_csv", |
| 2221 | + x@jc, schema, options) |
| 2222 | + column(jc) |
| 2223 | + }) |
| 2224 | + |
2205 | 2225 | #' @details
|
2206 | 2226 | #' \code{from_utc_timestamp}: Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a
|
2207 | 2227 | #' time in UTC, and renders that time as a timestamp in the given time zone. For example, 'GMT+1'
|
@@ -3720,24 +3740,3 @@ setMethod("current_timestamp",
|
3720 | 3740 | jc <- callJStatic("org.apache.spark.sql.functions", "current_timestamp")
|
3721 | 3741 | column(jc)
|
3722 | 3742 | })
|
3723 |
| - |
3724 |
| -#' @details |
3725 |
| -#' \code{from_csv}: Parses a column containing a CSV string into a Column of \code{structType} |
3726 |
| -#' with the specified \code{schema}. |
3727 |
| -#' If the string is unparseable, the Column will contain the value NA. |
3728 |
| -#' |
3729 |
| -#' @rdname column_collection_functions |
3730 |
| -#' @param schema a DDL-formatted string |
3731 |
| -#' @param ... options for CSV parser. Supported the same options as for CSV data source |
3732 |
| -#' @aliases from_csv from_csv,Column,character-method |
3733 |
| -#' |
3734 |
| -#' @note from_csv since 3.0.0 |
3735 |
| -setMethod("from_csv", signature(x = "Column", schema = "character"), |
3736 |
| - function(x, schema, ...) { |
3737 |
| - options <- varargsToStrEnv(...) |
3738 |
| - jc <- callJStatic("org.apache.spark.sql.functions", |
3739 |
| - "from_csv", |
3740 |
| - x@jc, schema, options) |
3741 |
| - column(jc) |
3742 |
| - }) |
3743 |
| - |
0 commit comments