Skip to content

[SPARK-23908][SQL] Add transform function. - #21954

Closed
ueshin wants to merge 1 commit into
apache:masterfrom
ueshin:issues/SPARK-23908/transform
Closed

[SPARK-23908][SQL] Add transform function.#21954
ueshin wants to merge 1 commit into
apache:masterfrom
ueshin:issues/SPARK-23908/transform

Conversation

@ueshin

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This pr adds transform function which transforms elements in an array using the function.
Optionally we can take the index of each element as the second argument.

>SELECT transform(array(1, 2, 3), x -> x +1);
array(2, 3, 4)
>SELECT transform(array(1, 2, 3), (x, i) -> x + i);
array(1, 3, 5)

How was this patch tested?

Added tests.

Loading
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@ueshin@holdensmagicalunicorn@gatorsmile@SparkQA@viirya@cloud-fan@arybin93@hvanhovell