-
Notifications
You must be signed in to change notification settings - Fork 5
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
Function proposal - groupBy() #7
Comments
Is this too high level? an alternate approach could be to add
|
As an inexperienced JMESPath user, that would definitely scare me off. As a side note I do think As a community of enthusiastic devs, I look forward to having discussions about the "why" of function support in JMESPath. I used to think we just needed to throw more functions at the problems but nowadays I much more skeptical. |
I'm guilty in the past, of proposing new JMESPath functions in the spec because it was a solution to a specific individual issue I was facing. It would have been better to reign in my enthusiasm with some checkpoints before drafting a proposal:
|
I agree with all of those points. # 4 is the item I generally struggle with, leaning on the conservative side. I am not strongly opposing this proposal, I just would prefer if any possible alternative is considered (contrived or otherwise) to better understand the problem being solved. My main concern is that the output of group_by is going to need to be re-transformed immediately after. My proposed alternative allows customization of the keys, values, value merge criteria (merge values rather than insert them in a list), and allows pulling in additional merge elements (think "three-way group_by") during the transformation. The other issue is that group_by would only work for lists of mappings of values with an equivalence relation and string conversion and no other data structure. We have started a wiki for common patterns to aid newer users. |
Given an array of objects, group the array on a key or expression such that:
In javascript (typescript) this might implemented as follows something like:
The text was updated successfully, but these errors were encountered: