Skip to content
New issue

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

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

Already on GitHub? # to your account

Implementing row function syntax to Map transform #291

Closed
wants to merge 2 commits into from

Conversation

davibarreira
Copy link

Addressing #290.

Enables row functions such as:

Map(row->row.a + row.b => :NewColumnName)
Map(row->sum(row) => :NewColumnName)

This PR has the following limitation:

a = [4, 7, 8, 5, 8, 1]
b = [1, 9, 1, 7, 9, 4]
c = [2, 8, 6, 3, 2, 2]
d = [7, 5, 9, 5, 3, 4]
t = Table(; a, b, c, d)

t |> Map(row->row.a) # This works!

t |> Map((a,b,c,d)->a) # This fails!

@codecov-commenter
Copy link

codecov-commenter commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.95%. Comparing base (d5207e1) to head (b86101d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
+ Coverage   94.93%   94.95%   +0.01%     
==========================================
  Files          48       48              
  Lines        1382     1387       +5     
==========================================
+ Hits         1312     1317       +5     
  Misses         70       70              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eliascarv
Copy link
Member

I think I may have expressed myself poorly, @davibarreira, I'm sorry.
But the idea was to stop supporting the current syntax and only support this syntax:

Map(fun_1, fun_2 => target_2, ...)

Where fun is a function that takes a row and returns a value (fun(row) -> value) and target is optional.

@davibarreira
Copy link
Author

No problem. I thought preserving the current syntax would be desired since it would avoid a breaking version.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants