-
Notifications
You must be signed in to change notification settings - Fork 50
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
Integral function #455
Comments
@mayku00 thank you for the feature request! I think I have a general idea of what you are asking for. It would be great to learn your specific use case for this function. It can help us design the function better. |
Hi! Sure. I use the table as the historical register for the bitrate, but also I need to calculate the volume consumed in a period of time. As I have a line/curve of values ordered by the timestamp, I calculate the volume as the area under this line/curve: On Influx I was using: https://docs.influxdata.com/flux/v0.x/stdlib/universe/integral/ I asked for a similar function KR |
Thanks! Leaving as much context here is awesome because the links to Slack eventually break because we don't have full history there! So feel free to edit or add more if you think of anything. But I think |
Having integral built on top of
|
There's another request from the community slack channel. |
Assigning myself as discussed in the standup. |
Another use case is calculating power consumption from raw time/watt data. |
That's an awesome use case, was actually just using that to explain it, essentially you want to go from kW to kWh. We'll definitely want to make sure we have |
526: Add integral function for time_weight r=Smittyvb a=Smittyvb Implements functionality requested in #455: - Adds an experimental `integral(tws[, unit]) -> float8` function (unit defaults to `'second'`) - Adds an experimental `interpolated_integral(tws, start, interval, prev, next[, unit]) -> float8` function (unit defaults to `'second'`) - Adds experimental arrow functions for `integral`/`interpolated_integral` - Makes `trapezoidal` an alias for `linear` in the `time_weight` function The `unit` parameter to `integral`/`interpolated_integral` is a string that specifies what time unit to use for the returned `f64`. It can be any fixed-duration unit that PostgreSQL allows in a `interval`. An alternative would be to have an `interval` be passed as the unit instead, but `interval`s can have variable length units (days and months) which might not be wanted. Also, `integral(..., 'hour')` is clearer than `integral(..., '1 hour'::interval)`. Co-authored-by: Smitty <smitty@timescale.com>
Closed by #526 |
Hi, I asked in the slack about how to get the function integral (like in influxDB)
The answer:
“Time weighted average def does that! Sounds like we should be exposing that! can you create an issue here: https://github.com/timescale/timescaledb-toolkit/issues? I think we have what we need in time_weight but just need to expose it the right way, so probably would be relatively quick to implement, and will just be an accessor, so if you want to, say, create continuous aggregates you can use the time_weight aggregate and when we make this accessor, you'll just be able to use it on that.”
so open is!!
The text was updated successfully, but these errors were encountered: