Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transform with lambda #16

Open
mattpollock opened this issue Sep 21, 2018 · 1 comment
Open

transform with lambda #16

mattpollock opened this issue Sep 21, 2018 · 1 comment

Comments

@mattpollock
Copy link
Collaborator

from https://jira.apache.org/jira/browse/SPARK-23908

SELECT transform(ARRAY [], x -> x + 1); -- []
SELECT transform(ARRAY [5, 6], x -> x + 1); -- [6, 7]
SELECT transform(ARRAY [5, NULL, 6], x -> COALESCE(x, 0) + 1); -- [6, 1, 7]
SELECT transform(ARRAY ['x', 'abc', 'z'], x -> x || '0'); -- ['x0', 'abc0', 'z0']
SELECT transform(ARRAY [ARRAY [1, NULL, 2], ARRAY[3, NULL]], a -> filter(a, x -> x IS NOT NULL)); -- [[1, 2], [3]]

I'm thinking something like

df %>%
  transform(nested_col, y = x -> x + 1)

This might need revision though. Not sure what the most intuitive way to specify the output column name will be. Also undecided w.r.t. NSE or not

@mattpollock
Copy link
Collaborator Author

tracked with #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant