ClickHouse/docs/en/sql-reference/functions/time-series-functions.md
2023-12-14 08:34:37 -08:00

1.2 KiB

slug sidebar_position sidebar_label
/en/sql-reference/functions/time-series-functions 172 Time Series

Time Series Functions

Below functions are used for time series analysis.

seriesPeriodDetectFFT

Finds the period of the given time series data using FFT FFT - Fast Fourier transform

Syntax

seriesPeriodDetectFFT(series);

Arguments

  • series - An array of numeric values

Returned value

  • A real value equal to the period of time series
  • Returns NAN when number of data points are less than four.

Type: Float64.

Examples

Query:

SELECT seriesPeriodDetectFFT([1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6, 1, 4, 6]) AS print_0;

Result:

┌───────────print_0──────┐
│                      3 │
└────────────────────────┘
SELECT seriesPeriodDetectFFT(arrayMap(x -> abs((x % 6) - 3), range(1000))) AS print_0;

Result:

┌─print_0─┐
│       6 │
└─────────┘