You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Changelog.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ This changelog should be updated as part of a PR if the work is worth noting (mo
13
13
14
14
#### Stabilized features
15
15
-[#722](https://github.com/timescale/timescaledb-toolkit/pull/722): Stabilize heartbeat aggregate.
16
+
-[#724](https://github.com/timescale/timescaledb-toolkit/pull/724): Stabilize integral and interpolated_integral for time-weighted-average.
16
17
17
18
#### Other notable changes
18
19
-[#716](https://github.com/timescale/timescaledb-toolkit/issues/716): Add arrow operator support for counter aggregate and time-weighted aggregate interpolated accessors.
// Convert from num of milliseconds to DurationUnit and then to string
559
+
let unit = match accessor.unit{
560
+
1 => DurationUnit::Microsec,
561
+
1000 => DurationUnit::Millisec,
562
+
1_000_000 => DurationUnit::Second,
563
+
60_000_000 => DurationUnit::Minute,
564
+
3_600_000_000 => DurationUnit::Hour,
565
+
_ => todo!(),// This should never be reached, the accessor gets these numbers from microseconds() in duration.rs, which only matches on valid enum values
566
+
}
567
+
.to_string();
568
+
569
+
time_weighted_average_interpolated_integral(
570
+
tws,
571
+
accessor.start.into(),
572
+
accessor.interval.into(),
573
+
prev,
574
+
next,
575
+
unit,
576
+
)
577
+
}
578
+
551
579
#[cfg(any(test, feature = "pg_test"))]
552
580
#[pg_schema]
553
581
mod tests {
@@ -576,9 +604,9 @@ mod tests {
576
604
let stmt = "INSERT INTO test VALUES('2020-01-01 00:00:00+00', 10.0)";
577
605
client.update(stmt,None,None).unwrap();
578
606
579
-
let stmt = "SELECT toolkit_experimental.integral(time_weight('Trapezoidal', ts, val), 'hrs') FROM test";
607
+
let stmt = "SELECT integral(time_weight('Trapezoidal', ts, val), 'hrs') FROM test";
580
608
assert_eq!(select_one!(client, stmt,f64),0.0);
581
-
let stmt = "SELECT toolkit_experimental.integral(time_weight('LOCF', ts, val), 'msecond') FROM test";
609
+
let stmt = "SELECT integral(time_weight('LOCF', ts, val), 'msecond') FROM test";
582
610
assert_eq!(select_one!(client, stmt,f64),0.0);
583
611
584
612
// add another point
@@ -622,9 +650,9 @@ mod tests {
622
650
let stmt = "SELECT average(time_weight('LOCF', ts, val)) FROM test";
0 commit comments