deltaSumTimestamp
Adds the difference between consecutive rows. If the difference is negative, it is ignored.
This function is primarily for materialized views that store data ordered by some time bucket-aligned timestamp, for example, a toStartOfMinute
bucket. Because the rows in such a materialized view will all have the same timestamp, it is impossible for them to be merged in the correct order, without storing the original, unrounded timestamp value. The deltaSumTimestamp
function keeps track of the original timestamp
of the values it's seen, so the values (states) of the function are correctly computed during merging of parts.
To calculate the delta sum across an ordered collection you can simply use the deltaSum function.
構文
引数
value
— 入力値。必ず Integer 型または Float 型、または Date または DateTime でなければなりません。timestamp
— 値の順序付けに使用するパラメーター。必ず Integer 型または Float 型、または Date または DateTime でなければなりません。
戻り値
timestamp
パラメーターによって順序付けられた連続した値の差の累積。
タイプ: Integer または Float または Date または DateTime。
例
クエリ:
結果: