-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up template for fill average Change fill(average) to fill(linear) Update average to linear in infuxql spec Add Integer Tests and associated fixes Update CHANGELOG for fill(linear)
- Loading branch information
Showing
9 changed files
with
218 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package influxql | ||
|
||
// linearFloat computes the the slope of the line between the points (previousTime, previousValue) and (nextTime, nextValue) | ||
// and returns the value of the point on the line with time windowTime | ||
// y = mx + b | ||
func linearFloat(windowTime, previousTime, nextTime int64, previousValue, nextValue float64) float64 { | ||
m := (nextValue - previousValue) / float64(nextTime-previousTime) // the slope of the line | ||
x := float64(windowTime - previousTime) // how far into the interval we are | ||
b := previousValue | ||
return m*x + b | ||
} | ||
|
||
// linearInteger computes the the slope of the line between the points (previousTime, previousValue) and (nextTime, nextValue) | ||
// and returns the value of the point on the line with time windowTime | ||
// y = mx + b | ||
func linearInteger(windowTime, previousTime, nextTime int64, previousValue, nextValue int64) int64 { | ||
m := float64(nextValue-previousValue) / float64(nextTime-previousTime) // the slope of the line | ||
x := float64(windowTime - previousTime) // how far into the interval we are | ||
b := float64(previousValue) | ||
return int64(m*x + b) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters