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

Add map function #4806

Merged
merged 5 commits into from
Nov 3, 2023
Merged

Add map function #4806

merged 5 commits into from
Nov 3, 2023

Conversation

mattnibs
Copy link
Collaborator

The map function that applies a function to every element in an array or set value.

Also: rename the map aggregator to collect_map to avoid collision with this new function.

Closes #4610

@mattnibs mattnibs force-pushed the map-fn branch 3 times, most recently from 9977402 to 7e6986d Compare October 12, 2023 22:40
@mattnibs mattnibs requested a review from a team October 12, 2023 22:41
@mattnibs mattnibs force-pushed the map-fn branch 3 times, most recently from c3cfdca to eadfee5 Compare October 12, 2023 23:33
@philrz philrz linked an issue Oct 17, 2023 that may be closed by this pull request
@mattnibs mattnibs force-pushed the semantic-func-check branch 3 times, most recently from 94924cf to f9343e4 Compare October 18, 2023 19:20
Base automatically changed from semantic-func-check to main October 19, 2023 17:37
Comment on lines +65 to +69
MapCall struct {
Kind string `json:"kind" unpack:""`
Expr Expr `json:"expr"`
Inner Expr `json:"inner"`
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a downside to using Call rather than adding MapCall?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its kind of a different thing than a call. A call is made of args that you get the value of all by passing this into it, a map call you evaluate this, then iterate over each value an call the inner eval on each value. So I kind of think this should remain MapCall

runtime/expr/agg/map.go Outdated Show resolved Hide resolved
The map function that applies a function to every element in an array or set
value.

Also: rename the map aggregator to collect_map to avoid collision with
this new function.

Closes #4610
docs/language/functions/map.md Outdated Show resolved Hide resolved
runtime/expr/map.go Outdated Show resolved Hide resolved
docs/language/functions/map.md Outdated Show resolved Hide resolved
docs/language/functions/map.md Outdated Show resolved Hide resolved
@mattnibs mattnibs merged commit 3a40788 into main Nov 3, 2023
4 checks passed
Sign up for free to 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.

Call a function on every element of a complex value
3 participants