Skip to content

Commit 8526d2e

Browse files
cafreemanDavies Liu
authored andcommitted
Remove tojson functions
1 parent 6ef5f2d commit 8526d2e

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

pkg/R/schema.R

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,3 @@ print.structField <- function(x, ...) {
140140
")",
141141
sep = "")
142142
}
143-
144-
# cfreeman: Don't think we need this function since we can create
145-
# structType in R and pass to createDataFrame
146-
#
147-
# #' dump the schema into JSON string
148-
# tojson <- function(x) {
149-
# if (inherits(x, "struct")) {
150-
# # schema object
151-
# l <- paste(lapply(x, tojson), collapse = ", ")
152-
# paste('{\"type\":\"struct\", \"fields\":','[', l, ']}', sep = '')
153-
# } else if (inherits(x, "field")) {
154-
# # field object
155-
# names <- names(x)
156-
# items <- lapply(names, function(n) {
157-
# safe_n <- gsub('"', '\\"', n)
158-
# paste(tojson(safe_n), ':', tojson(x[[n]]), sep = '')
159-
# })
160-
# d <- paste(items, collapse = ", ")
161-
# paste('{', d, '}', sep = '')
162-
# } else if (is.character(x)) {
163-
# paste('"', x, '"', sep = '')
164-
# } else if (is.logical(x)) {
165-
# if (x) "true" else "false"
166-
# } else {
167-
# stop(paste("unexpected type:", class(x)))
168-
# }
169-
# }

sql/core/src/main/scala/org/apache/spark/sql/api/r/SQLUtils.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ private[r] object SQLUtils {
6666
StructField(name, dtObj, nullable)
6767
}
6868

69-
// cfreeman: I don't think we need this anymore since we can pass structType from R
70-
// def createDF(rdd: RDD[Array[Byte]], schemaString: String, sqlContext: SQLContext): DataFrame = {
71-
// val schema = DataType.fromJson(schemaString).asInstanceOf[StructType]
72-
// val num = schema.fields.size
73-
// val rowRDD = rdd.map(bytesToRow)
74-
// sqlContext.createDataFrame(rowRDD, schema)
75-
// }
76-
7769
def createDF(rdd: RDD[Array[Byte]], schema: StructType, sqlContext: SQLContext): DataFrame = {
7870
val num = schema.fields.size
7971
val rowRDD = rdd.map(bytesToRow)

0 commit comments

Comments
 (0)