- Functions
- Aggregate functions
- Aggregate Functions
- exponentialTimeDecayedCount
exponentialTimeDecayedCount
exponentialTimeDecayedCount
Introduced in: v21.12
Returns the cumulative exponential decay over a time series at the index t in time.
Syntax
exponentialTimeDecayedCount(x)(t)
Parameters
Arguments
t— Time.(U)Int*orFloat*orDecimalorDateTimeorDateTime64
Returned value
Returns the cumulative exponential decay at the given point in time. Float64
Examples
Window function usage with visual representation
SELECT
value,
time,
round(exp_smooth, 3),
bar(exp_smooth, 0, 20, 50) AS bar
FROM
(
SELECT
(number % 5) = 0 AS value,
number AS time,
exponentialTimeDecayedCount(10)(time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth
FROM numbers(50)
)
┌─value─┬─time─┬─round(exp_smooth, 3)─┬─bar────────────────────────┐
│ 1 │ 0 │ 1 │ ██▌ │
│ 0 │ 1 │ 1.905 │ ████▊ │
│ 0 │ 2 │ 2.724 │ ██████▊ │
│ 0 │ 3 │ 3.464 │ ████████▋ │
│ 0 │ 4 │ 4.135 │ ██████████▎ │
│ 1 │ 5 │ 4.741 │ ███████████▊ │
│ 0 │ 6 │ 5.29 │ █████████████▏ │
│ 0 │ 7 │ 5.787 │ ██████████████▍ │
│ 0 │ 8 │ 6.236 │ ███████████████▌ │
│ 0 │ 9 │ 6.643 │ ████████████████▌ │
│ 1 │ 10 │ 7.01 │ █████████████████▌ │
│ 0 │ 11 │ 7.343 │ ██████████████████▎ │
│ 0 │ 12 │ 7.644 │ ███████████████████ │
│ 0 │ 13 │ 7.917 │ ███████████████████▊ │
│ 0 │ 14 │ 8.164 │ ████████████████████▍ │
│ 1 │ 15 │ 8.387 │ ████████████████████▉ │
│ 0 │ 16 │ 8.589 │ █████████████████████▍ │
│ 0 │ 17 │ 8.771 │ █████████████████████▉ │
│ 0 │ 18 │ 8.937 │ ██████████████████████▎ │
│ 0 │ 19 │ 9.086 │ ██████████████████████▋ │
│ 1 │ 20 │ 9.222 │ ███████████████████████ │
│ 0 │ 21 │ 9.344 │ ███████████████████████▎ │
│ 0 │ 22 │ 9.455 │ ███████████████████████▋ │
│ 0 │ 23 │ 9.555 │ ███████████████████████▉ │
│ 0 │ 24 │ 9.646 │ ████████████████████████ │
│ 1 │ 25 │ 9.728 │ ████████████████████████▎ │
│ 0 │ 26 │ 9.802 │ ████████████████████████▌ │
│ 0 │ 27 │ 9.869 │ ████████████████████████▋ │
│ 0 │ 28 │ 9.93 │ ████████████████████████▊ │
│ 0 │ 29 │ 9.985 │ ████████████████████████▉ │
│ 1 │ 30 │ 10.035 │ █████████████████████████ │
│ 0 │ 31 │ 10.08 │ █████████████████████████▏ │
│ 0 │ 32 │ 10.121 │ █████████████████████████▎ │
│ 0 │ 33 │ 10.158 │ █████████████████████████▍ │
│ 0 │ 34 │ 10.191 │ █████████████████████████▍ │
│ 1 │ 35 │ 10.221 │ █████████████████████████▌ │
│ 0 │ 36 │ 10.249 │ █████████████████████████▌ │
│ 0 │ 37 │ 10.273 │ █████████████████████████▋ │
│ 0 │ 38 │ 10.296 │ █████████████████████████▋ │
│ 0 │ 39 │ 10.316 │ █████████████████████████▊ │
│ 1 │ 40 │ 10.334 │ █████████████████████████▊ │
│ 0 │ 41 │ 10.351 │ █████████████████████████▉ │
│ 0 │ 42 │ 10.366 │ █████████████████████████▉ │
│ 0 │ 43 │ 10.379 │ █████████████████████████▉ │
│ 0 │ 44 │ 10.392 │ █████████████████████████▉ │
│ 1 │ 45 │ 10.403 │ ██████████████████████████ │
│ 0 │ 46 │ 10.413 │ ██████████████████████████ │
│ 0 │ 47 │ 10.422 │ ██████████████████████████ │
│ 0 │ 48 │ 10.43 │ ██████████████████████████ │
│ 0 │ 49 │ 10.438 │ ██████████████████████████ │
└───────┴──────┴──────────────────────┴────────────────────────────┘