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

Implement cumulative_sum() function #7388

Merged
merged 1 commit into from
Oct 7, 2016
Merged

Commits on Oct 7, 2016

  1. Implement cumulative_sum() function

    The `cumulative_sum()` function can be used to sum each new point and
    output the current total. For the following points:
    
        cpu value=2 0
        cpu value=4 10
        cpu value=6 20
    
    This would output the following points:
    
        > SELECT cumulative_sum(value) FROM cpu
        time    value
        ----    -----
        0       2
        10      6
        20      12
    
    As can be seen, each new point adds to the sum of the previous point and
    outputs the value with the same timestamp.
    
    The function can also be used with an aggregate like `derivative()`.
    
        > SELECT cumulative_sum(mean(value) FROM cpu WHERE time >= now() - 10m GROUP BY time(1m)
    jsternberg committed Oct 7, 2016
    Configuration menu
    Copy the full SHA
    6afc2a7 View commit details
    Browse the repository at this point in the history