mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #16901 from filimonov/timeSeriesGroupSum-remove-docs
Remove timeSeriesGroupRateSum from docs
This commit is contained in:
commit
d4c99a64b4
@ -50,8 +50,6 @@ ClickHouse-specific aggregate functions:
|
|||||||
- [skewPop](../../../sql-reference/aggregate-functions/reference/skewpop.md)
|
- [skewPop](../../../sql-reference/aggregate-functions/reference/skewpop.md)
|
||||||
- [kurtSamp](../../../sql-reference/aggregate-functions/reference/kurtsamp.md)
|
- [kurtSamp](../../../sql-reference/aggregate-functions/reference/kurtsamp.md)
|
||||||
- [kurtPop](../../../sql-reference/aggregate-functions/reference/kurtpop.md)
|
- [kurtPop](../../../sql-reference/aggregate-functions/reference/kurtpop.md)
|
||||||
- [timeSeriesGroupSum](../../../sql-reference/aggregate-functions/reference/timeseriesgroupsum.md)
|
|
||||||
- [timeSeriesGroupRateSum](../../../sql-reference/aggregate-functions/reference/timeseriesgroupratesum.md)
|
|
||||||
- [uniq](../../../sql-reference/aggregate-functions/reference/uniq.md)
|
- [uniq](../../../sql-reference/aggregate-functions/reference/uniq.md)
|
||||||
- [uniqExact](../../../sql-reference/aggregate-functions/reference/uniqexact.md)
|
- [uniqExact](../../../sql-reference/aggregate-functions/reference/uniqexact.md)
|
||||||
- [uniqCombined](../../../sql-reference/aggregate-functions/reference/uniqcombined.md)
|
- [uniqCombined](../../../sql-reference/aggregate-functions/reference/uniqcombined.md)
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
toc_priority: 171
|
|
||||||
---
|
|
||||||
|
|
||||||
# timeSeriesGroupRateSum {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
Syntax: `timeSeriesGroupRateSum(uid, ts, val)`
|
|
||||||
|
|
||||||
Similarly to [timeSeriesGroupSum](../../../sql-reference/aggregate-functions/reference/timeseriesgroupsum.md), `timeSeriesGroupRateSum` calculates the rate of time-series and then sum rates together.
|
|
||||||
Also, timestamp should be in ascend order before use this function.
|
|
||||||
|
|
||||||
Applying this function to the data from the `timeSeriesGroupSum` example, you get the following result:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
@ -1,57 +0,0 @@
|
|||||||
---
|
|
||||||
toc_priority: 170
|
|
||||||
---
|
|
||||||
|
|
||||||
# timeSeriesGroupSum {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
Syntax: `timeSeriesGroupSum(uid, timestamp, value)`
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` can aggregate different time series that sample timestamp not alignment.
|
|
||||||
It will use linear interpolation between two sample timestamp and then sum time-series together.
|
|
||||||
|
|
||||||
- `uid` is the time series unique id, `UInt64`.
|
|
||||||
- `timestamp` is Int64 type in order to support millisecond or microsecond.
|
|
||||||
- `value` is the metric.
|
|
||||||
|
|
||||||
The function returns array of tuples with `(timestamp, aggregated_value)` pairs.
|
|
||||||
|
|
||||||
Before using this function make sure `timestamp` is in ascending order.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
And the result will be:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
@ -464,69 +464,6 @@ The kurtosis of the given distribution. Type — [Float64](../../sql-reference/d
|
|||||||
SELECT kurtSamp(value) FROM series_with_value_column
|
SELECT kurtSamp(value) FROM series_with_value_column
|
||||||
```
|
```
|
||||||
|
|
||||||
## Para obtener más información, consulta nuestra Política de privacidad y nuestras Condiciones de uso) {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` puede agregar diferentes series de tiempo que muestran la marca de tiempo no la alineación.
|
|
||||||
Utilizará la interpolación lineal entre dos marcas de tiempo de muestra y luego sumará series temporales juntas.
|
|
||||||
|
|
||||||
- `uid` es la identificación única de la serie temporal, `UInt64`.
|
|
||||||
- `timestamp` es el tipo Int64 para admitir milisegundos o microsegundos.
|
|
||||||
- `value` es la métrica.
|
|
||||||
|
|
||||||
La función devuelve una matriz de tuplas con `(timestamp, aggregated_value)` par.
|
|
||||||
|
|
||||||
Antes de utilizar esta función, asegúrese de `timestamp` está en orden ascendente.
|
|
||||||
|
|
||||||
Ejemplo:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
Y el resultado será:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## También puede utilizar el siguiente ejemplo:) {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
De manera similar a `timeSeriesGroupSum`, `timeSeriesGroupRateSum` calcula la tasa de series temporales y luego suma las tasas juntas.
|
|
||||||
Además, la marca de tiempo debe estar en orden ascendente antes de usar esta función.
|
|
||||||
|
|
||||||
Aplicando esta función a los datos del `timeSeriesGroupSum` ejemplo, se obtiene el siguiente resultado:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Acerca de) {#agg_function-avg}
|
## Acerca de) {#agg_function-avg}
|
||||||
|
|
||||||
Calcula el promedio.
|
Calcula el promedio.
|
||||||
|
@ -464,69 +464,6 @@ The kurtosis of the given distribution. Type — [جسم شناور64](../../sql
|
|||||||
SELECT kurtSamp(value) FROM series_with_value_column
|
SELECT kurtSamp(value) FROM series_with_value_column
|
||||||
```
|
```
|
||||||
|
|
||||||
## هشدار داده می شود) {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` می توانید سری های زمانی مختلف که برچسب زمان نمونه هم ترازی جمع نمی.
|
|
||||||
این برون یابی خطی بین دو برچسب زمان نمونه و سپس مجموع زمان سری با هم استفاده کنید.
|
|
||||||
|
|
||||||
- `uid` سری زمان شناسه منحصر به فرد است, `UInt64`.
|
|
||||||
- `timestamp` است نوع درون64 به منظور حمایت میلی ثانیه یا میکروثانیه.
|
|
||||||
- `value` متریک است.
|
|
||||||
|
|
||||||
تابع گرداند مجموعه ای از تاپل با `(timestamp, aggregated_value)` جفت
|
|
||||||
|
|
||||||
قبل از استفاده از این تابع اطمینان حاصل کنید `timestamp` به ترتیب صعودی است.
|
|
||||||
|
|
||||||
مثال:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
و نتیجه خواهد بود:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## هشدار داده می شود) {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
به طور مشابه به `timeSeriesGroupSum`, `timeSeriesGroupRateSum` محاسبه نرخ زمان سری و سپس مجموع نرخ با هم.
|
|
||||||
همچنین, برچسب زمان باید در جهت صعود قبل از استفاده از این تابع باشد.
|
|
||||||
|
|
||||||
استفاده از این تابع به داده ها از `timeSeriesGroupSum` مثال, شما نتیجه زیر را دریافت کنید:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## میانگین) {#agg_function-avg}
|
## میانگین) {#agg_function-avg}
|
||||||
|
|
||||||
محاسبه متوسط.
|
محاسبه متوسط.
|
||||||
|
@ -464,69 +464,6 @@ The kurtosis of the given distribution. Type — [Float64](../../sql-reference/d
|
|||||||
SELECT kurtSamp(value) FROM series_with_value_column
|
SELECT kurtSamp(value) FROM series_with_value_column
|
||||||
```
|
```
|
||||||
|
|
||||||
## timeSeriesGroupSum(uid, horodatage, valeur) {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` peut agréger différentes séries temporelles qui échantillonnent l'horodatage et non l'alignement.
|
|
||||||
Il utilisera une interpolation linéaire entre deux échantillons d'horodatage, puis additionnera les séries temporelles ensemble.
|
|
||||||
|
|
||||||
- `uid` la série temporelle est elle unique, `UInt64`.
|
|
||||||
- `timestamp` est de type Int64 afin de prendre en charge la milliseconde ou la microseconde.
|
|
||||||
- `value` est la métrique.
|
|
||||||
|
|
||||||
La fonction renvoie un tableau de tuples avec `(timestamp, aggregated_value)` pair.
|
|
||||||
|
|
||||||
Avant d'utiliser cette fonction, assurez-vous `timestamp` est dans l'ordre croissant.
|
|
||||||
|
|
||||||
Exemple:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
Et le résultat sera:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## timeSeriesGroupRateSum(uid, ts, val) {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
De la même manière à `timeSeriesGroupSum`, `timeSeriesGroupRateSum` calcule le taux de séries chronologiques, puis additionne les taux ensemble.
|
|
||||||
En outre, l'horodatage doit être dans l'ordre croissant avant d'utiliser cette fonction.
|
|
||||||
|
|
||||||
Application de cette fonction aux données du `timeSeriesGroupSum` exemple, vous obtenez le résultat suivant:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## avg (x) {#agg_function-avg}
|
## avg (x) {#agg_function-avg}
|
||||||
|
|
||||||
Calcule la moyenne.
|
Calcule la moyenne.
|
||||||
|
@ -464,69 +464,6 @@ The kurtosis of the given distribution. Type — [Float64](../../sql-reference/d
|
|||||||
SELECT kurtSamp(value) FROM series_with_value_column
|
SELECT kurtSamp(value) FROM series_with_value_column
|
||||||
```
|
```
|
||||||
|
|
||||||
## timeSeriesGroupSum(uid,タイムスタンプ,値) {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` 総異なる時系列のサンプルのタイムスタンプなアライメントを実施します。
|
|
||||||
これは、二つのサンプルタイムスタンプ間の線形補間を使用して、一緒に時系列を合計します。
|
|
||||||
|
|
||||||
- `uid` 時系列は一意のidですか, `UInt64`.
|
|
||||||
- `timestamp` ミリ秒またはマイクロ秒をサポートするためにInt64型です。
|
|
||||||
- `value` は指標です。
|
|
||||||
|
|
||||||
この関数は、次のような組の配列を返します `(timestamp, aggregated_value)` ペア。
|
|
||||||
|
|
||||||
この関数を使用する前に、必ず `timestamp` 昇順です。
|
|
||||||
|
|
||||||
例:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
結果は次のようになります:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## タイムセリエスグロプラテスム(uid,ts,val) {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
同様に `timeSeriesGroupSum`, `timeSeriesGroupRateSum` 時系列のレートを計算し、レートを合計します。
|
|
||||||
また、timestampはこの関数を使用する前に上昇順にする必要があります。
|
|
||||||
|
|
||||||
のデータにこの関数を適用します。 `timeSeriesGroupSum` 例では、次の結果が得られます:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## avg(x) {#agg_function-avg}
|
## avg(x) {#agg_function-avg}
|
||||||
|
|
||||||
平均を計算します。
|
平均を計算します。
|
||||||
|
@ -45,8 +45,6 @@ toc_hidden: true
|
|||||||
- [skewPop](../../../sql-reference/aggregate-functions/reference/skewpop.md)
|
- [skewPop](../../../sql-reference/aggregate-functions/reference/skewpop.md)
|
||||||
- [kurtSamp](../../../sql-reference/aggregate-functions/reference/kurtsamp.md)
|
- [kurtSamp](../../../sql-reference/aggregate-functions/reference/kurtsamp.md)
|
||||||
- [kurtPop](../../../sql-reference/aggregate-functions/reference/kurtpop.md)
|
- [kurtPop](../../../sql-reference/aggregate-functions/reference/kurtpop.md)
|
||||||
- [timeSeriesGroupSum](../../../sql-reference/aggregate-functions/reference/timeseriesgroupsum.md)
|
|
||||||
- [timeSeriesGroupRateSum](../../../sql-reference/aggregate-functions/reference/timeseriesgroupratesum.md)
|
|
||||||
- [uniq](../../../sql-reference/aggregate-functions/reference/uniq.md)
|
- [uniq](../../../sql-reference/aggregate-functions/reference/uniq.md)
|
||||||
- [uniqExact](../../../sql-reference/aggregate-functions/reference/uniqexact.md)
|
- [uniqExact](../../../sql-reference/aggregate-functions/reference/uniqexact.md)
|
||||||
- [uniqCombined](../../../sql-reference/aggregate-functions/reference/uniqcombined.md)
|
- [uniqCombined](../../../sql-reference/aggregate-functions/reference/uniqcombined.md)
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
toc_priority: 171
|
|
||||||
---
|
|
||||||
|
|
||||||
# timeSeriesGroupRateSum {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
Синтаксис: `timeSeriesGroupRateSum(uid, ts, val)`
|
|
||||||
|
|
||||||
Аналогично timeSeriesGroupSum, timeSeriesGroupRateSum будет вычислять производные по timestamp для рядов, а затем суммировать полученные производные для всех рядов для одного значения timestamp.
|
|
||||||
Также ряды должны быть отсортированы по возрастанию timestamp.
|
|
||||||
|
|
||||||
Для пример из описания timeSeriesGroupSum результат будет следующим:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
||||||
|
|
||||||
[Оригинальная статья](https://clickhouse.tech/docs/en/sql-reference/aggregate-functions/reference/timeseriesgroupratesum/) <!--hide-->
|
|
@ -1,59 +0,0 @@
|
|||||||
---
|
|
||||||
toc_priority: 170
|
|
||||||
---
|
|
||||||
|
|
||||||
# timeSeriesGroupSum {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
Синтаксис: `timeSeriesGroupSum(uid, timestamp, value)`
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` агрегирует временные ряды в которых не совпадают моменты.
|
|
||||||
Функция использует линейную интерполяцию между двумя значениями времени, а затем суммирует значения для одного и того же момента (как измеренные так и интерполированные) по всем рядам.
|
|
||||||
|
|
||||||
- `uid` уникальный идентификатор временного ряда, `UInt64`.
|
|
||||||
- `timestamp` имеет тип `Int64` чтобы можно было учитывать милли и микросекунды.
|
|
||||||
- `value` представляет собой значение метрики.
|
|
||||||
|
|
||||||
Функция возвращает массив кортежей с парами `(timestamp, aggregated_value)`.
|
|
||||||
|
|
||||||
Временные ряды должны быть отсортированы по возрастанию `timestamp`.
|
|
||||||
|
|
||||||
Пример:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
И результат будет:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
||||||
|
|
||||||
[Оригинальная статья](https://clickhouse.tech/docs/en/sql-reference/aggregate-functions/reference/timeseriesgroupsum/) <!--hide-->
|
|
@ -464,69 +464,6 @@ The kurtosis of the given distribution. Type — [Float64](../../sql-reference/d
|
|||||||
SELECT kurtSamp(value) FROM series_with_value_column
|
SELECT kurtSamp(value) FROM series_with_value_column
|
||||||
```
|
```
|
||||||
|
|
||||||
## timeSeriesGroupSum(uıd, zaman damgası, değer) {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` örnek zaman damgası değil hizalama farklı zaman serileri toplayabilir.
|
|
||||||
İki örnek zaman damgası arasında doğrusal enterpolasyon kullanacak ve daha sonra zaman serilerini birlikte toplayacaktır.
|
|
||||||
|
|
||||||
- `uid` zaman serisi benzersiz kimliği mi, `UInt64`.
|
|
||||||
- `timestamp` milisaniye veya mikrosaniye desteklemek için Int64 türüdür.
|
|
||||||
- `value` metr .iktir.
|
|
||||||
|
|
||||||
İşlev, tuples dizisini döndürür `(timestamp, aggregated_value)` çiftliler.
|
|
||||||
|
|
||||||
Bu işlevi kullanmadan önce emin olun `timestamp` artan düzende.
|
|
||||||
|
|
||||||
Örnek:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
Ve sonuç olacak:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## timeSeriesGroupRateSum(uıd, ts, val) {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
Benzer şekilde `timeSeriesGroupSum`, `timeSeriesGroupRateSum` zaman serilerinin oranını hesaplar ve daha sonra toplam oranları birlikte hesaplar.
|
|
||||||
Ayrıca, bu işlevi kullanmadan önce zaman damgası yükseliş sırasına göre olmalıdır.
|
|
||||||
|
|
||||||
Bu fonksiyon dataun ver theiye uygulanması `timeSeriesGroupSum` örnek, aşağıdaki sonucu alırsınız:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## avg (x) {#agg_function-avg}
|
## avg (x) {#agg_function-avg}
|
||||||
|
|
||||||
Ortalama hesaplar.
|
Ortalama hesaplar.
|
||||||
|
@ -462,69 +462,6 @@ kurtSamp(expr)
|
|||||||
SELECT kurtSamp(value) FROM series_with_value_column
|
SELECT kurtSamp(value) FROM series_with_value_column
|
||||||
```
|
```
|
||||||
|
|
||||||
## timeSeriesGroupSum(uid,timestamp,value) {#agg-function-timeseriesgroupsum}
|
|
||||||
|
|
||||||
`timeSeriesGroupSum` 可以聚合不同的时间序列,即采样时间戳不对齐。
|
|
||||||
它将在两个采样时间戳之间使用线性插值,然后将时间序列和在一起。
|
|
||||||
|
|
||||||
- `uid` 是时间序列唯一id, `UInt64`.
|
|
||||||
- `timestamp` 是Int64型,以支持毫秒或微秒。
|
|
||||||
- `value` 是指标。
|
|
||||||
|
|
||||||
函数返回元组数组 `(timestamp, aggregated_value)` 对。
|
|
||||||
|
|
||||||
在使用此功能之前,请确保 `timestamp` 按升序排列
|
|
||||||
|
|
||||||
示例:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
┌─uid─┬─timestamp─┬─value─┐
|
|
||||||
│ 1 │ 2 │ 0.2 │
|
|
||||||
│ 1 │ 7 │ 0.7 │
|
|
||||||
│ 1 │ 12 │ 1.2 │
|
|
||||||
│ 1 │ 17 │ 1.7 │
|
|
||||||
│ 1 │ 25 │ 2.5 │
|
|
||||||
│ 2 │ 3 │ 0.6 │
|
|
||||||
│ 2 │ 8 │ 1.6 │
|
|
||||||
│ 2 │ 12 │ 2.4 │
|
|
||||||
│ 2 │ 18 │ 3.6 │
|
|
||||||
│ 2 │ 24 │ 4.8 │
|
|
||||||
└─────┴───────────┴───────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
``` sql
|
|
||||||
CREATE TABLE time_series(
|
|
||||||
uid UInt64,
|
|
||||||
timestamp Int64,
|
|
||||||
value Float64
|
|
||||||
) ENGINE = Memory;
|
|
||||||
INSERT INTO time_series VALUES
|
|
||||||
(1,2,0.2),(1,7,0.7),(1,12,1.2),(1,17,1.7),(1,25,2.5),
|
|
||||||
(2,3,0.6),(2,8,1.6),(2,12,2.4),(2,18,3.6),(2,24,4.8);
|
|
||||||
|
|
||||||
SELECT timeSeriesGroupSum(uid, timestamp, value)
|
|
||||||
FROM (
|
|
||||||
SELECT * FROM time_series order by timestamp ASC
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
其结果将是:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0.2),(3,0.9),(7,2.1),(8,2.4),(12,3.6),(17,5.1),(18,5.4),(24,7.2),(25,2.5)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## timeSeriesGroupRateSum(uid,ts,val) {#agg-function-timeseriesgroupratesum}
|
|
||||||
|
|
||||||
同样 `timeSeriesGroupSum`, `timeSeriesGroupRateSum` 计算时间序列的速率,然后将速率总和在一起。
|
|
||||||
此外,使用此函数之前,时间戳应该是上升顺序。
|
|
||||||
|
|
||||||
应用此功能从数据 `timeSeriesGroupSum` 例如,您将得到以下结果:
|
|
||||||
|
|
||||||
``` text
|
|
||||||
[(2,0),(3,0.1),(7,0.3),(8,0.3),(12,0.3),(17,0.3),(18,0.3),(24,0.3),(25,0.1)]
|
|
||||||
```
|
|
||||||
|
|
||||||
## avg(x) {#agg_function-avg}
|
## avg(x) {#agg_function-avg}
|
||||||
|
|
||||||
计算平均值。
|
计算平均值。
|
||||||
|
Loading…
Reference in New Issue
Block a user