GitHub user HyukjinKwon opened a pull request:
https://github.com/apache/spark/pull/17178
[SPARK-19828][R] Support array type in from_json in R
## What changes were proposed in this pull request?
Since we could not directly define the array type in R, this PR proposes to
support array types in R as string types that are used in `structField` as
below:
```R
jsonArr <- "[{\"name\":\"Bob\"}, {\"name\":\"Alice\"}]"
df <- as.DataFrame(list(list("people" = jsonArr)))
collect(select(df, alias(from_json(df$people,
"array<struct<name:string>>"), "arrcol")))
```
prints
```R
arrcol
1 Bob, Alice
```
## How was this patch tested?
Unit tests in `test_sparkSQL.R`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/HyukjinKwon/spark SPARK-19828
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/17178.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #17178
----
commit 10feb9d2e9e4d027f874e6f508e7e7421c95cd6d
Author: hyukjinkwon <[email protected]>
Date: 2017-03-06T11:15:45Z
Support array in from_json in R
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]