Added testcases, documentation and addressed comments

This commit is contained in:
Bhavna Jindal 2023-11-02 13:37:07 -07:00
parent 3fa104ec11
commit e3826786f1
5 changed files with 60 additions and 3 deletions

1
.gitmodules vendored
View File

@ -357,4 +357,3 @@
[submodule "contrib/pocketfft"]
path = contrib/pocketfft
url = https://gitlab.mpcdf.mpg.de/mtr/pocketfft.git
branch = cpp

View File

@ -1,3 +1,10 @@
option (ENABLE_POCKETFFT "Enable pocketfft" ${ENABLE_LIBRARIES})
if (NOT ENABLE_POCKETFFT)
message(STATUS "Not using pocketfft")
return()
endif()
add_library(_pocketfft INTERFACE)
target_include_directories(_pocketfft INTERFACE ${ClickHouse_SOURCE_DIR}/contrib/pocketfft)
add_library(ch_contrib::pocketfft ALIAS _pocketfft)

View File

@ -0,0 +1,45 @@
---
slug: /en/sql-reference/functions/time-series-functions
sidebar_position: 140
sidebar_label: Time Series
---
# Time Series Functions
Below functions are used for time series anlaysis.
## seriesPeriodDetect
Finds the period of the given time series data
**Syntax**
``` sql
seriesPeriodDetect(series);
```
**Arguments**
- `series` - An array of numeric values
**Returned value**
- A real value equal to the period of time series
Type: [Float64](../../sql-reference/data-types/float.md).
**Examples**
Query:
``` sql
SELECT seriesPeriodDetect([1,4,6,1,4,6,1,4,6,1,4,6]) AS print_0;
```
Result:
``` text
┌───────────print_0──────┐
│ 3 │
└────────────────────────┘
```

View File

@ -1,3 +1,6 @@
SELECT seriesPeriodDetect([139, 87, 110, 68, 54, 50, 51, 53, 133, 86, 141, 97, 156, 94, 149, 95, 140, 77, 61, 50, 54, 47, 133, 72, 152, 94, 148, 105, 162, 101, 160, 87, 63, 53, 55, 54, 151, 103, 189, 108, 183, 113, 175, 113, 178, 90, 71, 62, 62, 65, 165, 109, 181, 115, 182, 121, 178, 114, 170]);
SELECT seriesPeriodDetect([NULL, NULL, NULL]); -- { serverError 44 }
SELECT seriesPeriodDetect([10,20,30,10,202,30,NULL]); -- { serverError 44 }
SELECT seriesPeriodDetect([10,20,30,10,20,30,10,20,30, 10,20,30,10,20,30,10,20,30,10,20,30]);
SELECT seriesPeriodDetect([10.1, 20.45, 40.34, 10.1, 20.45, 40.34,10.1, 20.45, 40.34,10.1, 20.45, 40.34,10.1, 20.45, 40.34,10.1, 20.45, 40.34,10.1, 20.45, 40.34, 10.1, 20.45, 40.34]);
SELECT seriesPeriodDetect([10.1, 10, 400, 10.1, 10, 400, 10.1, 10, 400,10.1, 10, 400,10.1, 10, 400,10.1, 10, 400,10.1, 10, 400,10.1, 10, 400]);
SELECT seriesPeriodDetect([NULL, NULL, NULL]); -- { serverError ILLEGAL_COLUMN}
SELECT seriesPeriodDetect([10,20,30,10,202,30,NULL]); -- { serverError ILLEGAL_COLUMN }