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

Support for flatMap or arrayAgg #93

Closed
niviksha opened this issue Feb 6, 2021 · 2 comments
Closed

Support for flatMap or arrayAgg #93

niviksha opened this issue Feb 6, 2021 · 2 comments

Comments

@niviksha
Copy link

niviksha commented Feb 6, 2021

Really loving Arquero so far! One thing I constantly run into is the need for a flatMap or equivalently SQL array_agg operation - Often grouping by a key, I want to collect the values into an array-valued output. I can use Javascript flatMap, but it would be great to have Arquero support this in its native ops

@niviksha
Copy link
Author

niviksha commented Feb 7, 2021

Nevermind, I figured this out! This works perfectly

table.groupby('colA').rollup({ array_agg_col: d => op.concat(op.values(d.colB))})

@niviksha niviksha closed this as completed Feb 7, 2021
@jheer
Copy link
Member

jheer commented Mar 17, 2021

For anyone who may come across this issue: As v4.0.0, Arquero has an array_agg aggregate function, whereas the values method now extracts the values of an object (similar to how keys returns its keys).

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

No branches or pull requests

2 participants