Repository: spark
Updated Branches:
  refs/heads/master 86d251c58 -> 24f09b39c


[SPARK-19828][R][FOLLOWUP] Rename asJsonArray to as.json.array in from_json 
function in R

## What changes were proposed in this pull request?

This was suggested to be `as.json.array` at the first place in the PR to 
SPARK-19828 but we could not do this as the lint check emits an error for 
multiple dots in the variable names.

After SPARK-20278, now we are able to use `multiple.dots.in.names`. 
`asJsonArray` in `from_json` function is still able to be changed as 2.2 is not 
released yet.

So, this PR proposes to rename `asJsonArray` to `as.json.array`.

## How was this patch tested?

Jenkins tests, local tests with `./R/run-tests.sh` and manual `./dev/lint-r`. 
Existing tests should cover this.

Author: hyukjinkwon <gurwls...@gmail.com>

Closes #17653 from HyukjinKwon/SPARK-19828-followup.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/24f09b39
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/24f09b39
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/24f09b39

Branch: refs/heads/master
Commit: 24f09b39c7b947e52fda952676d5114c2540e732
Parents: 86d251c
Author: hyukjinkwon <gurwls...@gmail.com>
Authored: Mon Apr 17 09:04:24 2017 -0700
Committer: Felix Cheung <felixche...@apache.org>
Committed: Mon Apr 17 09:04:24 2017 -0700

----------------------------------------------------------------------
 R/pkg/R/functions.R                       | 8 ++++----
 R/pkg/inst/tests/testthat/test_sparkSQL.R | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/24f09b39/R/pkg/R/functions.R
----------------------------------------------------------------------
diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R
index 449476d..c311921 100644
--- a/R/pkg/R/functions.R
+++ b/R/pkg/R/functions.R
@@ -2438,12 +2438,12 @@ setMethod("date_format", signature(y = "Column", x = 
"character"),
 #' from_json
 #'
 #' Parses a column containing a JSON string into a Column of \code{structType} 
with the specified
-#' \code{schema} or array of \code{structType} if \code{asJsonArray} is set to 
\code{TRUE}.
+#' \code{schema} or array of \code{structType} if \code{as.json.array} is set 
to \code{TRUE}.
 #' If the string is unparseable, the Column will contains the value NA.
 #'
 #' @param x Column containing the JSON string.
 #' @param schema a structType object to use as the schema to use when parsing 
the JSON string.
-#' @param asJsonArray indicating if input string is JSON array of objects or a 
single object.
+#' @param as.json.array indicating if input string is JSON array of objects or 
a single object.
 #' @param ... additional named properties to control how the json is parsed, 
accepts the same
 #'            options as the JSON data source.
 #'
@@ -2459,8 +2459,8 @@ setMethod("date_format", signature(y = "Column", x = 
"character"),
 #'}
 #' @note from_json since 2.2.0
 setMethod("from_json", signature(x = "Column", schema = "structType"),
-          function(x, schema, asJsonArray = FALSE, ...) {
-            if (asJsonArray) {
+          function(x, schema, as.json.array = FALSE, ...) {
+            if (as.json.array) {
               jschema <- callJStatic("org.apache.spark.sql.types.DataTypes",
                                      "createArrayType",
                                      schema$jobj)

http://git-wip-us.apache.org/repos/asf/spark/blob/24f09b39/R/pkg/inst/tests/testthat/test_sparkSQL.R
----------------------------------------------------------------------
diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R 
b/R/pkg/inst/tests/testthat/test_sparkSQL.R
index 3fbb618..6a6c9a8 100644
--- a/R/pkg/inst/tests/testthat/test_sparkSQL.R
+++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R
@@ -1454,7 +1454,7 @@ test_that("column functions", {
   jsonArr <- "[{\"name\":\"Bob\"}, {\"name\":\"Alice\"}]"
   df <- as.DataFrame(list(list("people" = jsonArr)))
   schema <- structType(structField("name", "string"))
-  arr <- collect(select(df, alias(from_json(df$people, schema, asJsonArray = 
TRUE), "arrcol")))
+  arr <- collect(select(df, alias(from_json(df$people, schema, as.json.array = 
TRUE), "arrcol")))
   expect_equal(ncol(arr), 1)
   expect_equal(nrow(arr), 1)
   expect_is(arr[[1]][[1]], "list")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to