-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add integral function for time_weight #526
Conversation
6882a6f
to
daefd4b
Compare
@@ -691,7 +779,7 @@ mod tests { | |||
agg, | |||
bucket, | |||
'1 day'::interval, | |||
LAG(agg) OVER (ORDER BY bucket), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the trailing whitespace here for consistency with the similar SQL for getting the integrals.
daefd4b
to
6aad8a4
Compare
6aad8a4
to
9477a59
Compare
59ec1aa
to
2ce21ce
Compare
2ce21ce
to
bfdda22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes! Looks good to me though I'd wait for someone else to weigh in :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
bors r+ |
Build succeeded: |
Implements functionality requested in #455:
integral(tws[, unit]) -> float8
function (unit defaults to'second'
)interpolated_integral(tws, start, interval, prev, next[, unit]) -> float8
function (unit defaults to'second'
)integral
/interpolated_integral
trapezoidal
an alias forlinear
in thetime_weight
functionThe
unit
parameter tointegral
/interpolated_integral
is a string that specifies what time unit to use for the returnedf64
. It can be any fixed-duration unit that PostgreSQL allows in ainterval
. An alternative would be to have aninterval
be passed as the unit instead, butinterval
s can have variable length units (days and months) which might not be wanted. Also,integral(..., 'hour')
is clearer thanintegral(..., '1 hour'::interval)
.