From a9bbe0bd08c2b37c3bc9ff9cbd6d577b9458a94f Mon Sep 17 00:00:00 2001 From: cafreeman Date: Thu, 26 Feb 2015 10:17:13 -0600 Subject: [PATCH] Update existing SparkSQL functions Updated methods to work with new `x` argument in the RDD methods. --- pkg/R/DataFrame.R | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/R/DataFrame.R b/pkg/R/DataFrame.R index 71564064caa17..0a69825d85dff 100644 --- a/pkg/R/DataFrame.R +++ b/pkg/R/DataFrame.R @@ -128,10 +128,10 @@ setMethod("count", #' } setMethod("collect", - signature(rdd = "DataFrame"), - function(rdd) { + signature(x = "DataFrame"), + function(x) { # listCols is a list of raw vectors, one per column - listCols <- callJStatic("edu.berkeley.cs.amplab.sparkr.SQLUtils", "dfToCols", rdd@sdf) + listCols <- callJStatic("edu.berkeley.cs.amplab.sparkr.SQLUtils", "dfToCols", x@sdf) cols <- lapply(listCols, function(col) { objRaw <- rawConnection(col) numRows <- readInt(objRaw) @@ -139,7 +139,7 @@ setMethod("collect", close(objRaw) col }) - colNames <- callJMethod(rdd@sdf, "columns") + colNames <- callJMethod(x@sdf, "columns") names(cols) <- colNames dfOut <- do.call(cbind.data.frame, cols) dfOut @@ -187,9 +187,9 @@ setMethod("limit", #' } setMethod("take", - signature(rdd = "DataFrame", num = "numeric"), - function(rdd, num) { - limited <- limit(rdd, num) + signature(x = "DataFrame", num = "numeric"), + function(x, num) { + limited <- limit(x, num) collect(limited) }) @@ -264,15 +264,15 @@ setMethod("mapPartitions", }) setMethod("foreach", - signature(rdd = "DataFrame", func = "function"), - function(rdd, func) { - rddIn <- toRDD(rdd) - foreach(rddIn, func) + signature(x = "DataFrame", func = "function"), + function(x, func) { + rdd <- toRDD(x) + foreach(rdd, func) }) setMethod("foreachPartition", - signature(rdd = "DataFrame", func = "function"), - function(rdd, func) { - rddIn <- toRDD(rdd) - foreachPartition(rddIn, func) + signature(x = "DataFrame", func = "function"), + function(x, func) { + rdd <- toRDD(x) + foreachPartition(rdd, func) })