Skip to content

Commit d493b4b

Browse files
authored
Merge pull request apache-spark-on-k8s#431 from palantir/juang/merge-easy-upstream
2 parents f848706 + 8cc1955 commit d493b4b

File tree

618 files changed

+18336
-21262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

618 files changed

+18336
-21262
lines changed

R/pkg/NAMESPACE

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ importFrom("utils", "download.file", "object.size", "packageVersion", "tail", "u
2828

2929
# S3 methods exported
3030
export("sparkR.session")
31-
export("sparkR.init")
32-
export("sparkR.stop")
3331
export("sparkR.session.stop")
32+
export("sparkR.stop")
3433
export("sparkR.conf")
3534
export("sparkR.version")
3635
export("sparkR.uiWebUrl")
@@ -42,9 +41,6 @@ export("sparkR.callJStatic")
4241

4342
export("install.spark")
4443

45-
export("sparkRSQL.init",
46-
"sparkRHive.init")
47-
4844
# MLlib integration
4945
exportMethods("glm",
5046
"spark.glm",
@@ -70,7 +66,8 @@ exportMethods("glm",
7066
"spark.svmLinear",
7167
"spark.fpGrowth",
7268
"spark.freqItemsets",
73-
"spark.associationRules")
69+
"spark.associationRules",
70+
"spark.findFrequentSequentialPatterns")
7471

7572
# Job group lifecycle management methods
7673
export("setJobGroup",
@@ -150,15 +147,13 @@ exportMethods("arrange",
150147
"printSchema",
151148
"randomSplit",
152149
"rbind",
153-
"registerTempTable",
154150
"rename",
155151
"repartition",
156152
"repartitionByRange",
157153
"rollup",
158154
"sample",
159155
"sample_frac",
160156
"sampleBy",
161-
"saveAsParquetFile",
162157
"saveAsTable",
163158
"saveDF",
164159
"schema",
@@ -174,7 +169,6 @@ exportMethods("arrange",
174169
"toJSON",
175170
"transform",
176171
"union",
177-
"unionAll",
178172
"unionByName",
179173
"unique",
180174
"unpersist",
@@ -274,6 +268,7 @@ exportMethods("%<=>%",
274268
"floor",
275269
"format_number",
276270
"format_string",
271+
"from_csv",
277272
"from_json",
278273
"from_unixtime",
279274
"from_utc_timestamp",
@@ -413,18 +408,14 @@ export("as.DataFrame",
413408
"cacheTable",
414409
"clearCache",
415410
"createDataFrame",
416-
"createExternalTable",
417411
"createTable",
418412
"currentDatabase",
419-
"dropTempTable",
420413
"dropTempView",
421-
"jsonFile",
422414
"listColumns",
423415
"listDatabases",
424416
"listFunctions",
425417
"listTables",
426418
"loadDF",
427-
"parquetFile",
428419
"read.df",
429420
"read.jdbc",
430421
"read.json",

R/pkg/R/DataFrame.R

Lines changed: 30 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ setMethod("showDF",
226226

227227
#' show
228228
#'
229-
#' Print class and type information of a Spark object.
229+
#' If eager evaluation is enabled and the Spark object is a SparkDataFrame, evaluate the
230+
#' SparkDataFrame and print top rows of the SparkDataFrame, otherwise, print the class
231+
#' and type information of the Spark object.
230232
#'
231233
#' @param object a Spark object. Can be a SparkDataFrame, Column, GroupedData, WindowSpec.
232234
#'
@@ -244,11 +246,33 @@ setMethod("showDF",
244246
#' @note show(SparkDataFrame) since 1.4.0
245247
setMethod("show", "SparkDataFrame",
246248
function(object) {
247-
cols <- lapply(dtypes(object), function(l) {
248-
paste(l, collapse = ":")
249-
})
250-
s <- paste(cols, collapse = ", ")
251-
cat(paste(class(object), "[", s, "]\n", sep = ""))
249+
allConf <- sparkR.conf()
250+
prop <- allConf[["spark.sql.repl.eagerEval.enabled"]]
251+
if (!is.null(prop) && identical(prop, "true")) {
252+
argsList <- list()
253+
argsList$x <- object
254+
prop <- allConf[["spark.sql.repl.eagerEval.maxNumRows"]]
255+
if (!is.null(prop)) {
256+
numRows <- as.integer(prop)
257+
if (numRows > 0) {
258+
argsList$numRows <- numRows
259+
}
260+
}
261+
prop <- allConf[["spark.sql.repl.eagerEval.truncate"]]
262+
if (!is.null(prop)) {
263+
truncate <- as.integer(prop)
264+
if (truncate > 0) {
265+
argsList$truncate <- truncate
266+
}
267+
}
268+
do.call(showDF, argsList)
269+
} else {
270+
cols <- lapply(dtypes(object), function(l) {
271+
paste(l, collapse = ":")
272+
})
273+
s <- paste(cols, collapse = ", ")
274+
cat(paste(class(object), "[", s, "]\n", sep = ""))
275+
}
252276
})
253277

254278
#' DataTypes
@@ -497,32 +521,6 @@ setMethod("createOrReplaceTempView",
497521
invisible(callJMethod(x@sdf, "createOrReplaceTempView", viewName))
498522
})
499523

500-
#' (Deprecated) Register Temporary Table
501-
#'
502-
#' Registers a SparkDataFrame as a Temporary Table in the SparkSession
503-
#' @param x A SparkDataFrame
504-
#' @param tableName A character vector containing the name of the table
505-
#'
506-
#' @seealso \link{createOrReplaceTempView}
507-
#' @rdname registerTempTable-deprecated
508-
#' @name registerTempTable
509-
#' @aliases registerTempTable,SparkDataFrame,character-method
510-
#' @examples
511-
#'\dontrun{
512-
#' sparkR.session()
513-
#' path <- "path/to/file.json"
514-
#' df <- read.json(path)
515-
#' registerTempTable(df, "json_df")
516-
#' new_df <- sql("SELECT * FROM json_df")
517-
#'}
518-
#' @note registerTempTable since 1.4.0
519-
setMethod("registerTempTable",
520-
signature(x = "SparkDataFrame", tableName = "character"),
521-
function(x, tableName) {
522-
.Deprecated("createOrReplaceTempView")
523-
invisible(callJMethod(x@sdf, "createOrReplaceTempView", tableName))
524-
})
525-
526524
#' insertInto
527525
#'
528526
#' Insert the contents of a SparkDataFrame into a table registered in the current SparkSession.
@@ -932,7 +930,6 @@ setMethod("write.orc",
932930
#' path <- "path/to/file.json"
933931
#' df <- read.json(path)
934932
#' write.parquet(df, "/tmp/sparkr-tmp1/")
935-
#' saveAsParquetFile(df, "/tmp/sparkr-tmp2/")
936933
#'}
937934
#' @note write.parquet since 1.6.0
938935
setMethod("write.parquet",
@@ -943,17 +940,6 @@ setMethod("write.parquet",
943940
invisible(handledCallJMethod(write, "parquet", path))
944941
})
945942

946-
#' @rdname write.parquet
947-
#' @name saveAsParquetFile
948-
#' @aliases saveAsParquetFile,SparkDataFrame,character-method
949-
#' @note saveAsParquetFile since 1.4.0
950-
setMethod("saveAsParquetFile",
951-
signature(x = "SparkDataFrame", path = "character"),
952-
function(x, path) {
953-
.Deprecated("write.parquet")
954-
write.parquet(x, path)
955-
})
956-
957943
#' Save the content of SparkDataFrame in a text file at the specified path.
958944
#'
959945
#' Save the content of the SparkDataFrame in a text file at the specified path.
@@ -2738,18 +2724,6 @@ setMethod("union",
27382724
dataFrame(unioned)
27392725
})
27402726

2741-
#' unionAll is deprecated - use union instead
2742-
#' @rdname union
2743-
#' @name unionAll
2744-
#' @aliases unionAll,SparkDataFrame,SparkDataFrame-method
2745-
#' @note unionAll since 1.4.0
2746-
setMethod("unionAll",
2747-
signature(x = "SparkDataFrame", y = "SparkDataFrame"),
2748-
function(x, y) {
2749-
.Deprecated("union")
2750-
union(x, y)
2751-
})
2752-
27532727
#' Return a new SparkDataFrame containing the union of rows, matched by column names
27542728
#'
27552729
#' Return a new SparkDataFrame containing the union of rows in this SparkDataFrame

0 commit comments

Comments
 (0)