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

Rolling Aggregations #313

Open
Max-Meldrum opened this issue Feb 23, 2022 · 0 comments
Open

Rolling Aggregations #313

Max-Meldrum opened this issue Feb 23, 2022 · 0 comments
Labels
domain: api Anything related to the Arcon API feature

Comments

@Max-Meldrum
Copy link
Member

While it is possible to implement by hand, provide a way to express rolling aggregations in the API.

#[arcon::proto]
#[derive(Arcon, Copy, Clone)]
#[arcon(unsafe_ser_id = 12, reliable_ser_id = 13, version = 1)]
pub struct Event {
    pub id: u64,
    pub data: u64,
}

let mut app = Application::default()
   .iterator((0..1000000).map(|x| Event { id: x, data: 1.5 }), |conf| {
         conf.set_timestamp_extractor(|x: &Event| x.id);
   })
  .key_by(|event: &Event| &event.id)
  .sum(|event: Event|  event.data) // output: (key, current_sum)
  .build();
@Max-Meldrum Max-Meldrum added feature domain: api Anything related to the Arcon API labels Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: api Anything related to the Arcon API feature
Projects
None yet
Development

No branches or pull requests

1 participant