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

Stats agg #141

Merged
merged 4 commits into from
Jun 17, 2021
Merged

Stats agg #141

merged 4 commits into from
Jun 17, 2021

Conversation

davidkohn88
Copy link
Contributor

No description provided.

```SQL
moving_average(window => '30 minutes', slide => '5 minutes', data)
```
However, because set-returning aggregates cannot not exist in Postgres, this will not work outside of the timeseries API. Currently, doing rolling average properly requires windowed aggregates. In base SQL it is a real PITA because you have to do sum and count separately and then divide them yourself.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably also think about the continuous aggregate implications ie #138 in this document.

@davidkohn88 davidkohn88 marked this pull request as ready for review June 16, 2021 16:44
@davidkohn88 davidkohn88 requested a review from JLockerman June 16, 2021 16:44

#[pg_extern(schema = "timescale_analytics_experimental")]
pub fn stats1d_summary_trans<'s, 'v>(
state: Option<Internal<StatsSummary1D<'s>>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the logic of all of these pg aggregate functions would be streamlined if the internal representation was a StatsSummary1DInternal. This would require a separate trans function for the rollup, but still seems like it might be cleaner.

@davidkohn88
Copy link
Contributor Author

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 17, 2021

Build succeeded:

@bors bors bot merged commit 6d89805 into main Jun 17, 2021
@bors bors bot deleted the stats-agg branch June 17, 2021 18:30
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

Successfully merging this pull request may close these issues.

3 participants