Skip to content

Commit

Permalink
Test for default value of integral arrow function
Browse files Browse the repository at this point in the history
  • Loading branch information
syvb committed Sep 16, 2022
1 parent 1e32983 commit 2ce21ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extension/src/time_weighted_average.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,10 @@ mod tests {
FROM test";
// arrow syntax should be the same
assert!((select_one!(client, stmt, f64) - 25500000000.00).abs() < f64::EPSILON);
let stmt = "SELECT time_weight('Linear', ts, val) \
->toolkit_experimental.integral() \
FROM test";
assert!((select_one!(client, stmt, f64) - 25500.00).abs() < f64::EPSILON);

let stmt = "SELECT average(time_weight('LOCF', ts, val)) FROM test";
// expected = (10 + 20 + 10 + 20 + 10*4 + 30*2 +10*.5 + 20*9.5) / 20 = 17.75 using last value and carrying for each point
Expand Down

0 comments on commit 2ce21ce

Please sign in to comment.