Replies: 1 comment
-
After some quick initial feedback to my comment in #323 I'm a bit surprised that there hasn't been any comment on this proposal yet. Maybe it's the wrong place after all? I can also implement these null-aware aggregates in a separate extension for myself, but I had hoped to integrate this with timescaledb-toolkit in order to benefit from existing infrastructure and give back to this great project, too. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Following up on #323, #548 and several other issues around processing time-weighted averages:
Similar to the already-present
treat_null_as_missing
argument to thelocf
function, there are different ways to interpretnull
values in time-weighted aggregates:They could either be interpreted as "0" - which can be easily represented by using
COALESCE(value, 0.0)
in the query - or alternatively mark time ranges for which data should be excluded from calculation.I propose enhancing the
time_weight
constructor and associatedTimeWeightSummary
state with an additional parametertreat_null_as_missing
to supportnull
values. At the moment, anull
value will yield anull
TimeWeightSummary
instance. But an additionaltreat_null_as_missing
parameter might yield anTimeWeightSummary
instance which can still be filled with additional points.Finally, the points contained within should have their value changed from
f64
toOption<f64>
so they can processnull
values according to thetreat_null_as_missing
parameter.In that case, depending on the interpolation,
null
values should be treated differently:linear
interpolation, data can only be interpolated up to the point preceding thenull
datumlocf
interpolation, the value can be carried up to thenull
datum (this is probably the most useful combination)duration(TimeWeightSummary)
which returns that duration (might also be related to Add duration_in(state, start, end) accessor for Timeline Agg #687?).As I'm still learning a lot about TimescaleDB, I'm not sure whether this might have unwanted impact on other functionality, like
rollup
or others. So I'm looking for feedback on the concept - but if we find that it goes together with everything else, I'm willing to take a shot at implementing it as I have already put together very similar functionality as a prototype based onpgx
- I'd just prefer to not have to maintain & deploy it separately and in addition to the regular TimescaleDB toolkit 😉Beta Was this translation helpful? Give feedback.
All reactions