GitHub user HyukjinKwon opened a pull request:

    https://github.com/apache/spark/pull/18809

    [SPARK-21602][R] Add map_keys and map_values functions to R

    ## What changes were proposed in this pull request?
    
    This PR adds `map_values` and `map_keys` to R API.
    
    ```r
    > df <- createDataFrame(cbind(model = rownames(mtcars), mtcars))
    > tmp <- mutate(df, v = create_map(df$model, df$cyl))
    > head(select(tmp, map_keys(tmp$v)))
    ```
    ```
            map_keys(v)
    1         Mazda RX4
    2     Mazda RX4 Wag
    3        Datsun 710
    4    Hornet 4 Drive
    5 Hornet Sportabout
    6           Valiant
    ```
    ```r
    > head(select(tmp, map_values(tmp$v)))
    ```
    ```
      map_values(v)
    1             6
    2             6
    3             4
    4             6
    5             8
    6             6
    ```
    
    ## How was this patch tested?
    
    Manual tests and unit tests in `R/pkg/tests/fulltests/test_sparkSQL.R`

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HyukjinKwon/spark map-keys-values-r

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18809.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 #18809
    
----
commit 75b615a5d0728f14a0219cb1f0576cfcb3e1f73d
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2017-08-02T04:10:29Z

    Add map_keys and map_values functions to R

commit d87f4c4a63067aba8d1dc4228fda5d94bd5c830c
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2017-08-02T04:39:02Z

    Add examples for documentation

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to