Skip to content

Commit 71372d9

Browse files
cafreemanDavies Liu
authored andcommitted
Update docs and examples
1 parent 8526d2e commit 71372d9

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

pkg/R/schema.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1+
# A set of S3 classes and methods that support the SparkSQL `StructType` and `StructField
2+
# datatypes. These are used to create and interact with DataFrame schemas.
3+
14
#' structType
25
#'
36
#' Create a structType object that contains the metadata for a DataFrame. Intended for
47
#' use with createDataFrame and toDF.
58
#'
6-
#' @param x a Field object (created with the field() function)
7-
#' @param ... additional Field objects
9+
#' @param x a structField object (created with the field() function)
10+
#' @param ... additional structField objects
811
#' @return a structType object
912
#' @export
1013
#' @examples
1114
#'\dontrun{
1215
#' sc <- sparkR.init()
1316
#' sqlCtx <- sparkRSQL.init(sc)
1417
#' rdd <- lapply(parallelize(sc, 1:10), function(x) { list(x, as.character(x)) })
15-
#' schema <- buildSchema(field("a", "integer"), field("b", "string"))
18+
#' schema <- structType(structField("a", "integer"), structField("b", "string"))
1619
#' df <- createDataFrame(sqlCtx, rdd, schema)
1720
#' }
1821
structType <- function(x, ...) {
@@ -63,16 +66,16 @@ print.structType <- function(x, ...) {
6366
#' @param x The name of the field
6467
#' @param type The data type of the field
6568
#' @param nullable A logical vector indicating whether or not the field is nullable
66-
#' @return a Field object
69+
#' @return a structField object
6770
#' @export
6871
#' @examples
6972
#'\dontrun{
7073
#' sc <- sparkR.init()
7174
#' sqlCtx <- sparkRSQL.init(sc)
7275
#' rdd <- lapply(parallelize(sc, 1:10), function(x) { list(x, as.character(x)) })
73-
#' field1 <- field("a", "integer", TRUE)
74-
#' field2 <- field("b", "string", TRUE)
75-
#' schema <- buildSchema(field1, field2)
76+
#' field1 <- structField("a", "integer", TRUE)
77+
#' field2 <- structField("b", "string", TRUE)
78+
#' schema <- structType(field1, field2)
7679
#' df <- createDataFrame(sqlCtx, rdd, schema)
7780
#' }
7881

0 commit comments

Comments
 (0)