GitHub user codeatri opened a pull request:
https://github.com/apache/spark/pull/22045
[SPARK-23939][SQL] Add transform_values SQL function
## What changes were proposed in this pull request?
This pr adds `transform_values` function which applies the function to each
entry of the map and transforms the values.
```javascript
> SELECT transform_values(map(array(1, 2, 3), array(1, 2, 3), (k,v) -> v +
1);
map(1->2, 2->3, 3->4)
> SELECT transform_keys(map(array(1, 2, 3), array(1, 2, 3), (k,v) -> k + v);
map(1->2, 2->4, 3->6)
```
## How was this patch tested?
New Tests added to
`DataFrameFunctionsSuite`
`HigherOrderFunctionsSuite`
`SQLQueryTestSuite`
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/codeatri/spark SPARK-23940
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/22045.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 #22045
----
commit 68392e31d86f26663fbb8e5badac82b356081f47
Author: codeatri <nehapatil6@...>
Date: 2018-08-08T18:42:36Z
Added transform_values function
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]