GitHub user mn-mikke opened a pull request:
https://github.com/apache/spark/pull/21121
[SPARK-24042][SQL] Collection function: zip_with_index
## What changes were proposed in this pull request?
Implement function zip_with_index(array[, indexFirst]) that transforms the
input array by encapsulating elements into pairs with indexes indicating the
order.
```
zip_with_index(array("d", "a", null, "b")) =>
[("d",0),("a",1),(null,2),("b",3)]
zip_with_index(array("d", "a", null, "b"), true) =>
[(0,"d"),(1,"a"),(2,null),(3,"b")]
```
## How was this patch tested?
New tests added into:
- CollectionExpressionSuite
- DataFrameFunctionsSuite
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/AbsaOSS/spark
feature/array-api-zip_with_index-to-master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/21121.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 #21121
----
commit 9f090309b8d13e37efaf7824b6d960a6f61ca79f
Author: mn-mikke <mrkaha12346github>
Date: 2018-04-18T08:00:27Z
[SPARK-24042][SQL] Collection function: zip_with_index
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]