{"id":16547592,"url":"https://github.com/segeljakt/swag","last_synced_at":"2026-03-07T18:31:18.320Z","repository":{"id":134613307,"uuid":"256513074","full_name":"segeljakt/swag","owner":"segeljakt","description":"Sliding Window Aggregation","archived":false,"fork":false,"pushed_at":"2020-06-05T16:20:25.000Z","size":59,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-08T11:59:10.542Z","etag":null,"topics":["rust-lang","stream-processing","window-aggregation"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/segeljakt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-17T13:38:25.000Z","updated_at":"2024-02-21T11:15:35.000Z","dependencies_parsed_at":"2023-08-15T08:34:00.552Z","dependency_job_id":null,"html_url":"https://github.com/segeljakt/swag","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/segeljakt/swag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segeljakt%2Fswag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segeljakt%2Fswag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segeljakt%2Fswag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segeljakt%2Fswag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/segeljakt","download_url":"https://codeload.github.com/segeljakt/swag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segeljakt%2Fswag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30226246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T18:12:09.766Z","status":"ssl_error","status_checked_at":"2026-03-07T18:11:58.786Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust-lang","stream-processing","window-aggregation"],"created_at":"2024-10-11T19:14:47.668Z","updated_at":"2026-03-07T18:31:18.292Z","avatar_url":"https://github.com/segeljakt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSWAG - Sliding Window Aggregation\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003e(Work in progress)\u003c/h3\u003e\n\nThis is a crate for Sliding Window Aggregation (SWAG).\n\n# Windowing Problem\n\nThe Windowing Problem is defined by the following characteristics, definition from [1]:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/segeljakt/assets/raw/master/WindowingProblem.jpeg\"\u003e\n\u003c/p\u003e\n\n# API\n\n## Out-of-Order API [3]\n\n* Aggregation Functions\n  * Associativity (Required)\n* Stream Order\n  * Out-of-order (Focus)\n* Window Measures\n  * Time (Required)\n* State\n  * In-Memory (Required)\n\n\u003e **Definition 1.**\n\n\u003e Let(⊗, 1) be a binary operator from a monoid and its identity. The out-of-order sliding-window aggregation (OoO SWAG) ADT is to maintain a time-ordered sliding window (t1, v1) … (tn, vn), ti \u003c ti+1, supporting the following operations:\n\n\u003e — insert(t: Time, v: Agg) checks whether t is already in the window, i.e., whether there is an i such that t = ti. If so, it replaces vi by (ti, vi) by (ti,vi⊗v). Otherwise, it inserts v into the window at the appropriate location.\n\n\u003e — evict(t: Time) checks whether t is in the window, i.e., whether there is an i such that t=ti. If so, it removes ti from the window. Otherwise, it does nothing.\n\n\u003e — query(): Agg combines the values in time order using the ⊗ operator. In other words, it returns v1 ⊗ … ⊗ vn if the window is non-empty, or 1 if empty.\n\n# Algorithms\n\n| Algorithm                             | Alias | Time           | In-Order | Space | Invertible | Associative | Commutative | FIFO |\n|---------------------------------------|-------|----------------|----------|-------|------------|-------------|-------------|------|\n| **Subtract on Evict**                 [2] | SoE   | Worst O(1)     | Yes      | O(1)  | Yes        | No          | No          | No   |\n| **Recalculate from Scratch**          [2] | RFS   | Worst O(n)     | Yes      | O(n)  | No         | No          | No          | No   |\n| **Reactive Aggregator**               [4] | RA    | Avg O(log n)   | Yes      | O(n)  | No         | No          | No          | No   |\n| **Two-Stacks**                        [2] | 2S    | Avg O(1)       | Yes      | O(n)  | No         | No          | No          | Yes  |\n| **Functional Okasaki Aggregator**     [2] | FOA   | Worst O(1)     | Yes      | O(n)  | No         | No          | No          | Yes  |\n| **Imperative Okasaki Aggregator**     [2] | IOA   | Worst O(1)     | Yes      | O(n)  | No         | No          | No          | Yes  |\n| **De-Amortized Banker's Aggregator**  [2] | DABA  | Worst O(1)     | Yes      | O(n)  | No         | No          | No          | Yes  |\n| **Finger B-Tree Aggregator**          [3] | FiBA  | Worst O(log n) | No       | O(n)  | No         | Yes         | No          | No   |\n\n# References\n\n[1] Traub, J., Grulich, P.M., Cuéllar, A.R., Breß, S., Katsifodimos, A., Rabl, T. and Markl, V., 2019. **Efficient Window Aggregation with General Stream Slicing.** In EDBT (pp. 97-108).\n\n[2] Tangwongsan, K., Hirzel, M. and Schneider, S., 2017, June. **Low-Latency Sliding-Window Aggregation in Worst-Case Constant Time.** In Proceedings of the 11th ACM International Conference on Distributed and Event-based Systems (pp. 66-77).\n\n[3] Tangwongsan, K., Hirzel, M. and Schneider, S., 2019. **Optimal and General Out-of-Order Sliding-Window Aggregation.** Proceedings of the VLDB Endowment, 12(10), pp.1167-1180.\n\n[3] Tangwongsan, K., Hirzel, M., Schneider, S. and Wu, K.L., 2015. **General Incremental Sliding-Window Aggregation**. Proceedings of the VLDB Endowment, 8(7), pp.702-713.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegeljakt%2Fswag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsegeljakt%2Fswag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegeljakt%2Fswag/lists"}