-
I am struggling to figure out a way to aggregate Input: - name: api
sample:
count: 20
rate: 2
- name: api
sample:
count: 30
rate: 3
- name: data
sample:
count: 40
rate: 4
- name: data
sample:
count: 50
rate: 5
- name: users
sample:
value: 2
- name: users
sample:
value: 3 Expected output: - name: api
sample:
count: 50
rate: 5
- name: data
sample:
count: 90
rate: 9
- name: users
sample:
value: 5 |
Beta Was this translation helpful? Give feedback.
Answered by
mikefarah
Jul 21, 2024
Replies: 1 comment
-
This was a fun one - but it did require a nested reduce. I've got the answer in a sum_samples.yq
Then you can run it:
See reduce for more info. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dparmar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was a fun one - but it did require a nested reduce. I've got the answer in a
.yq
file so that I can comment on what's happening:sum_samples.yq
Then you can run it:
See reduce for more info.