From 7316aaf8b3b65c47c8389bd1c4ae9c3220ae5369 Mon Sep 17 00:00:00 2001 From: W1y1r <2730956796@qq.com> Date: Tue, 26 Nov 2024 16:19:22 +0800 Subject: [PATCH 1/2] Fix legacy issues --- src/.vuepress/sidebar/V1.3.3/en.ts | 20 +++++++++---------- src/.vuepress/sidebar/V1.3.3/zh.ts | 18 ++++++++--------- src/.vuepress/sidebar_timecho/V1.3.3/en.ts | 20 +++++++++---------- src/.vuepress/sidebar_timecho/V1.3.3/zh.ts | 18 ++++++++--------- .../Cluster-Concept.md | 0 .../Data-Type.md | 0 .../Operator-and-Expression.md | 0 .../UDF-Libraries_apache.md | 0 .../UDF-Libraries_timecho.md | 0 .../Cluster-Concept.md | 0 .../Cluster-Concept.md | 0 .../Data-Type.md | 0 .../Operator-and-Expression.md | 0 .../UDF-Libraries_apache.md | 0 .../UDF-Libraries_timecho.md | 0 .../Cluster-Concept.md | 0 .../Data-Type.md | 0 .../Operator-and-Expression.md | 0 .../UDF-Libraries_apache.md | 0 .../UDF-Libraries_timecho.md | 0 .../Cluster-Concept.md | 0 .../Cluster-Concept.md | 0 .../Data-Type.md | 0 .../Operator-and-Expression.md | 0 .../UDF-Libraries_apache.md | 0 .../UDF-Libraries_timecho.md | 0 26 files changed, 38 insertions(+), 38 deletions(-) rename src/UserGuide/Master/Tree/{Preparatory-knowledge => Background-knowledge}/Cluster-Concept.md (100%) rename src/UserGuide/Master/Tree/{Preparatory-knowledge => Background-knowledge}/Data-Type.md (100%) rename src/UserGuide/Master/Tree/{Reference => SQL-Manual}/Operator-and-Expression.md (100%) rename src/UserGuide/Master/Tree/{Reference => SQL-Manual}/UDF-Libraries_apache.md (100%) rename src/UserGuide/Master/Tree/{Reference => SQL-Manual}/UDF-Libraries_timecho.md (100%) rename src/UserGuide/V1.3.0-2/{Preparatory-knowledge => Basic-Concept}/Cluster-Concept.md (100%) rename src/UserGuide/latest/{Preparatory-knowledge => Background-knowledge}/Cluster-Concept.md (100%) rename src/UserGuide/latest/{Preparatory-knowledge => Background-knowledge}/Data-Type.md (100%) rename src/UserGuide/latest/{Reference => SQL-Manual}/Operator-and-Expression.md (100%) rename src/UserGuide/latest/{Reference => SQL-Manual}/UDF-Libraries_apache.md (100%) rename src/UserGuide/latest/{Reference => SQL-Manual}/UDF-Libraries_timecho.md (100%) rename src/zh/UserGuide/Master/Tree/{Preparatory-knowledge => Background-knowledge}/Cluster-Concept.md (100%) rename src/zh/UserGuide/Master/Tree/{Preparatory-knowledge => Background-knowledge}/Data-Type.md (100%) rename src/zh/UserGuide/Master/Tree/{Reference => SQL-Manual}/Operator-and-Expression.md (100%) rename src/zh/UserGuide/Master/Tree/{Reference => SQL-Manual}/UDF-Libraries_apache.md (100%) rename src/zh/UserGuide/Master/Tree/{Reference => SQL-Manual}/UDF-Libraries_timecho.md (100%) rename src/zh/UserGuide/V1.3.0-2/{Preparatory-knowledge => Basic-Concept}/Cluster-Concept.md (100%) rename src/zh/UserGuide/latest/{Preparatory-knowledge => Background-knowledge}/Cluster-Concept.md (100%) rename src/zh/UserGuide/latest/{Preparatory-knowledge => Background-knowledge}/Data-Type.md (100%) rename src/zh/UserGuide/latest/{Reference => SQL-Manual}/Operator-and-Expression.md (100%) rename src/zh/UserGuide/latest/{Reference => SQL-Manual}/UDF-Libraries_apache.md (100%) rename src/zh/UserGuide/latest/{Reference => SQL-Manual}/UDF-Libraries_timecho.md (100%) diff --git a/src/.vuepress/sidebar/V1.3.3/en.ts b/src/.vuepress/sidebar/V1.3.3/en.ts index a2faea76..0921e1ff 100644 --- a/src/.vuepress/sidebar/V1.3.3/en.ts +++ b/src/.vuepress/sidebar/V1.3.3/en.ts @@ -34,9 +34,9 @@ export const enSidebar = { ], }, { - text: 'Preparatory knowledge', + text: 'Background knowledge', collapsible: true, - prefix: 'Preparatory-knowledge/', + prefix: 'Background-knowledge/', children: [ { text: 'Data Type', link: 'Data-Type' }, { text: 'Cluster-related Concepts', link: 'Cluster-Concept' }, @@ -173,6 +173,14 @@ export const enSidebar = { // children: 'structure', children: [ { text: 'SQL Manual', link: 'SQL-Manual' }, + { + text: 'Functions and Operators', + collapsible: true, + children: [ + { text: 'UDF Libraries', link: 'UDF-Libraries_timecho' }, + { text: 'Functions and Operators', link: 'Operator-and-Expression' }, + ], + }, ], }, { @@ -201,14 +209,6 @@ export const enSidebar = { { text: 'DataNode Config Manual', link: 'DataNode-Config-Manual' }, ], }, - { - text: 'Functions and Operators', - collapsible: true, - children: [ - { text: 'UDF Libraries', link: 'UDF-Libraries_timecho' }, - { text: 'Functions and Operators', link: 'Operator-and-Expression' }, - ], - }, { text: 'Syntax-Rule', collapsible: true, diff --git a/src/.vuepress/sidebar/V1.3.3/zh.ts b/src/.vuepress/sidebar/V1.3.3/zh.ts index 0c4cf320..07bb6536 100644 --- a/src/.vuepress/sidebar/V1.3.3/zh.ts +++ b/src/.vuepress/sidebar/V1.3.3/zh.ts @@ -36,7 +36,7 @@ export const zhSidebar = { { text: '预备知识', collapsible: true, - prefix: 'Preparatory-knowledge/', + prefix: 'Background-knowledge/', children: [ { text: '数据类型', link: 'Data-Type' }, { text: '集群相关概念', link: 'Cluster-Concept' }, @@ -173,6 +173,14 @@ export const zhSidebar = { // children: 'structure', children: [ { text: 'SQL手册', link: 'SQL-Manual' }, + { + text: '函数与运算符', + collapsible: true, + children: [ + { text: 'UDF函数库', link: 'UDF-Libraries_apache' }, + { text: '函数与运算符', link: 'Operator-and-Expression' }, + ], + }, ], }, { @@ -201,14 +209,6 @@ export const zhSidebar = { { text: 'DataNode配置参数', link: 'DataNode-Config-Manual' }, ], }, - { - text: '函数与运算符', - collapsible: true, - children: [ - { text: 'UDF函数库', link: 'UDF-Libraries_apache' }, - { text: '函数与运算符', link: 'Operator-and-Expression' }, - ], - }, { text: '语法约定', collapsible: true, diff --git a/src/.vuepress/sidebar_timecho/V1.3.3/en.ts b/src/.vuepress/sidebar_timecho/V1.3.3/en.ts index 1b95f5b2..9cf36c4b 100644 --- a/src/.vuepress/sidebar_timecho/V1.3.3/en.ts +++ b/src/.vuepress/sidebar_timecho/V1.3.3/en.ts @@ -34,9 +34,9 @@ export const enSidebar = { ], }, { - text: 'Preparatory knowledge', + text: 'Background knowledge', collapsible: true, - prefix: 'Preparatory-knowledge/', + prefix: 'Background-knowledge/', children: [ { text: 'Data Type', link: 'Data-Type' }, { text: 'Cluster-related Concepts', link: 'Cluster-Concept' }, @@ -186,6 +186,14 @@ export const enSidebar = { // children: 'structure', children: [ { text: 'SQL Manual', link: 'SQL-Manual' }, + { + text: 'Functions and Operators', + collapsible: true, + children: [ + { text: 'UDF Libraries', link: 'UDF-Libraries_timecho' }, + { text: 'Functions and Operators', link: 'Operator-and-Expression' }, + ], + }, ], }, { @@ -214,14 +222,6 @@ export const enSidebar = { { text: 'DataNode Config Manual', link: 'DataNode-Config-Manual' }, ], }, - { - text: 'Functions and Operators', - collapsible: true, - children: [ - { text: 'UDF Libraries', link: 'UDF-Libraries_timecho' }, - { text: 'Functions and Operators', link: 'Operator-and-Expression' }, - ], - }, { text: 'Syntax-Rule', collapsible: true, diff --git a/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts b/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts index bc914a89..22faab84 100644 --- a/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts +++ b/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts @@ -36,7 +36,7 @@ export const zhSidebar = { { text: '预备知识', collapsible: true, - prefix: 'Preparatory-knowledge/', + prefix: 'Background-knowledge/', children: [ { text: '数据类型', link: 'Data-Type' }, { text: '集群相关概念', link: 'Cluster-Concept' }, @@ -186,6 +186,14 @@ export const zhSidebar = { // children: 'structure', children: [ { text: 'SQL手册', link: 'SQL-Manual' }, + { + text: '函数与运算符', + collapsible: true, + children: [ + { text: 'UDF函数库', link: 'UDF-Libraries_timecho' }, + { text: '函数与运算符', link: 'Operator-and-Expression' }, + ], + }, ], }, { @@ -214,14 +222,6 @@ export const zhSidebar = { { text: 'DataNode配置参数', link: 'DataNode-Config-Manual' }, ], }, - { - text: '函数与运算符', - collapsible: true, - children: [ - { text: 'UDF函数库', link: 'UDF-Libraries_timecho' }, - { text: '函数与运算符', link: 'Operator-and-Expression' }, - ], - }, { text: '语法约定', collapsible: true, diff --git a/src/UserGuide/Master/Tree/Preparatory-knowledge/Cluster-Concept.md b/src/UserGuide/Master/Tree/Background-knowledge/Cluster-Concept.md similarity index 100% rename from src/UserGuide/Master/Tree/Preparatory-knowledge/Cluster-Concept.md rename to src/UserGuide/Master/Tree/Background-knowledge/Cluster-Concept.md diff --git a/src/UserGuide/Master/Tree/Preparatory-knowledge/Data-Type.md b/src/UserGuide/Master/Tree/Background-knowledge/Data-Type.md similarity index 100% rename from src/UserGuide/Master/Tree/Preparatory-knowledge/Data-Type.md rename to src/UserGuide/Master/Tree/Background-knowledge/Data-Type.md diff --git a/src/UserGuide/Master/Tree/Reference/Operator-and-Expression.md b/src/UserGuide/Master/Tree/SQL-Manual/Operator-and-Expression.md similarity index 100% rename from src/UserGuide/Master/Tree/Reference/Operator-and-Expression.md rename to src/UserGuide/Master/Tree/SQL-Manual/Operator-and-Expression.md diff --git a/src/UserGuide/Master/Tree/Reference/UDF-Libraries_apache.md b/src/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_apache.md similarity index 100% rename from src/UserGuide/Master/Tree/Reference/UDF-Libraries_apache.md rename to src/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_apache.md diff --git a/src/UserGuide/Master/Tree/Reference/UDF-Libraries_timecho.md b/src/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_timecho.md similarity index 100% rename from src/UserGuide/Master/Tree/Reference/UDF-Libraries_timecho.md rename to src/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_timecho.md diff --git a/src/UserGuide/V1.3.0-2/Preparatory-knowledge/Cluster-Concept.md b/src/UserGuide/V1.3.0-2/Basic-Concept/Cluster-Concept.md similarity index 100% rename from src/UserGuide/V1.3.0-2/Preparatory-knowledge/Cluster-Concept.md rename to src/UserGuide/V1.3.0-2/Basic-Concept/Cluster-Concept.md diff --git a/src/UserGuide/latest/Preparatory-knowledge/Cluster-Concept.md b/src/UserGuide/latest/Background-knowledge/Cluster-Concept.md similarity index 100% rename from src/UserGuide/latest/Preparatory-knowledge/Cluster-Concept.md rename to src/UserGuide/latest/Background-knowledge/Cluster-Concept.md diff --git a/src/UserGuide/latest/Preparatory-knowledge/Data-Type.md b/src/UserGuide/latest/Background-knowledge/Data-Type.md similarity index 100% rename from src/UserGuide/latest/Preparatory-knowledge/Data-Type.md rename to src/UserGuide/latest/Background-knowledge/Data-Type.md diff --git a/src/UserGuide/latest/Reference/Operator-and-Expression.md b/src/UserGuide/latest/SQL-Manual/Operator-and-Expression.md similarity index 100% rename from src/UserGuide/latest/Reference/Operator-and-Expression.md rename to src/UserGuide/latest/SQL-Manual/Operator-and-Expression.md diff --git a/src/UserGuide/latest/Reference/UDF-Libraries_apache.md b/src/UserGuide/latest/SQL-Manual/UDF-Libraries_apache.md similarity index 100% rename from src/UserGuide/latest/Reference/UDF-Libraries_apache.md rename to src/UserGuide/latest/SQL-Manual/UDF-Libraries_apache.md diff --git a/src/UserGuide/latest/Reference/UDF-Libraries_timecho.md b/src/UserGuide/latest/SQL-Manual/UDF-Libraries_timecho.md similarity index 100% rename from src/UserGuide/latest/Reference/UDF-Libraries_timecho.md rename to src/UserGuide/latest/SQL-Manual/UDF-Libraries_timecho.md diff --git a/src/zh/UserGuide/Master/Tree/Preparatory-knowledge/Cluster-Concept.md b/src/zh/UserGuide/Master/Tree/Background-knowledge/Cluster-Concept.md similarity index 100% rename from src/zh/UserGuide/Master/Tree/Preparatory-knowledge/Cluster-Concept.md rename to src/zh/UserGuide/Master/Tree/Background-knowledge/Cluster-Concept.md diff --git a/src/zh/UserGuide/Master/Tree/Preparatory-knowledge/Data-Type.md b/src/zh/UserGuide/Master/Tree/Background-knowledge/Data-Type.md similarity index 100% rename from src/zh/UserGuide/Master/Tree/Preparatory-knowledge/Data-Type.md rename to src/zh/UserGuide/Master/Tree/Background-knowledge/Data-Type.md diff --git a/src/zh/UserGuide/Master/Tree/Reference/Operator-and-Expression.md b/src/zh/UserGuide/Master/Tree/SQL-Manual/Operator-and-Expression.md similarity index 100% rename from src/zh/UserGuide/Master/Tree/Reference/Operator-and-Expression.md rename to src/zh/UserGuide/Master/Tree/SQL-Manual/Operator-and-Expression.md diff --git a/src/zh/UserGuide/Master/Tree/Reference/UDF-Libraries_apache.md b/src/zh/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_apache.md similarity index 100% rename from src/zh/UserGuide/Master/Tree/Reference/UDF-Libraries_apache.md rename to src/zh/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_apache.md diff --git a/src/zh/UserGuide/Master/Tree/Reference/UDF-Libraries_timecho.md b/src/zh/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_timecho.md similarity index 100% rename from src/zh/UserGuide/Master/Tree/Reference/UDF-Libraries_timecho.md rename to src/zh/UserGuide/Master/Tree/SQL-Manual/UDF-Libraries_timecho.md diff --git a/src/zh/UserGuide/V1.3.0-2/Preparatory-knowledge/Cluster-Concept.md b/src/zh/UserGuide/V1.3.0-2/Basic-Concept/Cluster-Concept.md similarity index 100% rename from src/zh/UserGuide/V1.3.0-2/Preparatory-knowledge/Cluster-Concept.md rename to src/zh/UserGuide/V1.3.0-2/Basic-Concept/Cluster-Concept.md diff --git a/src/zh/UserGuide/latest/Preparatory-knowledge/Cluster-Concept.md b/src/zh/UserGuide/latest/Background-knowledge/Cluster-Concept.md similarity index 100% rename from src/zh/UserGuide/latest/Preparatory-knowledge/Cluster-Concept.md rename to src/zh/UserGuide/latest/Background-knowledge/Cluster-Concept.md diff --git a/src/zh/UserGuide/latest/Preparatory-knowledge/Data-Type.md b/src/zh/UserGuide/latest/Background-knowledge/Data-Type.md similarity index 100% rename from src/zh/UserGuide/latest/Preparatory-knowledge/Data-Type.md rename to src/zh/UserGuide/latest/Background-knowledge/Data-Type.md diff --git a/src/zh/UserGuide/latest/Reference/Operator-and-Expression.md b/src/zh/UserGuide/latest/SQL-Manual/Operator-and-Expression.md similarity index 100% rename from src/zh/UserGuide/latest/Reference/Operator-and-Expression.md rename to src/zh/UserGuide/latest/SQL-Manual/Operator-and-Expression.md diff --git a/src/zh/UserGuide/latest/Reference/UDF-Libraries_apache.md b/src/zh/UserGuide/latest/SQL-Manual/UDF-Libraries_apache.md similarity index 100% rename from src/zh/UserGuide/latest/Reference/UDF-Libraries_apache.md rename to src/zh/UserGuide/latest/SQL-Manual/UDF-Libraries_apache.md diff --git a/src/zh/UserGuide/latest/Reference/UDF-Libraries_timecho.md b/src/zh/UserGuide/latest/SQL-Manual/UDF-Libraries_timecho.md similarity index 100% rename from src/zh/UserGuide/latest/Reference/UDF-Libraries_timecho.md rename to src/zh/UserGuide/latest/SQL-Manual/UDF-Libraries_timecho.md From bcac02b9ac0a2ad6200fe7353b6afc83887c4ed7 Mon Sep 17 00:00:00 2001 From: W1y1r <2730956796@qq.com> Date: Tue, 26 Nov 2024 18:50:04 +0800 Subject: [PATCH 2/2] fix legacy issues --- src/.vuepress/sidebar/V1.3.3/en.ts | 5 +- src/.vuepress/sidebar/V1.3.3/zh.ts | 5 +- src/.vuepress/sidebar_timecho/V1.3.3/en.ts | 5 +- src/.vuepress/sidebar_timecho/V1.3.3/zh.ts | 5 +- .../Master/Tree/Basic-Concept/Query-Data.md | 2 +- .../Function-and-Expression.md | 0 .../Master/Tree/SQL-Manual/SQL-Manual.md | 60 ++--- ...ion.md => User-defined-function_apache.md} | 4 +- .../User-defined-function_timecho.md} | 4 +- .../latest/Basic-Concept/Query-Data.md | 2 +- .../Function-and-Expression.md | 0 src/UserGuide/latest/SQL-Manual/SQL-Manual.md | 62 ++--- .../User-defined-function_apache.md | 213 ++++++++++++++++++ .../User-defined-function_timecho.md | 213 ++++++++++++++++++ .../Master/Tree/Basic-Concept/Query-Data.md | 8 +- .../Function-and-Expression.md | 0 .../Master/Tree/SQL-Manual/SQL-Manual.md | 56 ++--- ...ion.md => User-defined-function_apache.md} | 4 +- .../User-defined-function_timecho.md} | 4 +- .../latest/Basic-Concept/Query-Data.md | 2 +- .../Function-and-Expression.md | 0 .../UserGuide/latest/SQL-Manual/SQL-Manual.md | 56 ++--- .../User-defined-function_apache.md | 209 +++++++++++++++++ .../User-defined-function_timecho.md | 209 +++++++++++++++++ 24 files changed, 988 insertions(+), 140 deletions(-) rename src/UserGuide/Master/Tree/{Reference => SQL-Manual}/Function-and-Expression.md (100%) rename src/UserGuide/Master/Tree/User-Manual/{User-defined-function.md => User-defined-function_apache.md} (96%) rename src/UserGuide/{latest/User-Manual/User-defined-function.md => Master/Tree/User-Manual/User-defined-function_timecho.md} (96%) rename src/UserGuide/latest/{Reference => SQL-Manual}/Function-and-Expression.md (100%) create mode 100644 src/UserGuide/latest/User-Manual/User-defined-function_apache.md create mode 100644 src/UserGuide/latest/User-Manual/User-defined-function_timecho.md rename src/zh/UserGuide/Master/Tree/{Reference => SQL-Manual}/Function-and-Expression.md (100%) rename src/zh/UserGuide/Master/Tree/User-Manual/{User-defined-function.md => User-defined-function_apache.md} (96%) rename src/zh/UserGuide/{latest/User-Manual/User-defined-function.md => Master/Tree/User-Manual/User-defined-function_timecho.md} (96%) rename src/zh/UserGuide/latest/{Reference => SQL-Manual}/Function-and-Expression.md (100%) create mode 100644 src/zh/UserGuide/latest/User-Manual/User-defined-function_apache.md create mode 100644 src/zh/UserGuide/latest/User-Manual/User-defined-function_timecho.md diff --git a/src/.vuepress/sidebar/V1.3.3/en.ts b/src/.vuepress/sidebar/V1.3.3/en.ts index 0921e1ff..e6fd9a17 100644 --- a/src/.vuepress/sidebar/V1.3.3/en.ts +++ b/src/.vuepress/sidebar/V1.3.3/en.ts @@ -94,7 +94,7 @@ export const enSidebar = { { text: 'Authority Management', link: 'Authority-Management' }, ], }, - { text: 'UDF', link: 'User-defined-function' }, + { text: 'UDF', link: 'User-defined-function_apache' }, { text: 'Continuous Query', link: 'Database-Programming' }, { text: 'Database Programming', @@ -178,7 +178,8 @@ export const enSidebar = { collapsible: true, children: [ { text: 'UDF Libraries', link: 'UDF-Libraries_timecho' }, - { text: 'Functions and Operators', link: 'Operator-and-Expression' }, + { text: 'Operator and Expression', link: 'Operator-and-Expression' }, + { text: 'Function and Expression', link: 'Function-and-Expression' }, ], }, ], diff --git a/src/.vuepress/sidebar/V1.3.3/zh.ts b/src/.vuepress/sidebar/V1.3.3/zh.ts index 07bb6536..7da59bc3 100644 --- a/src/.vuepress/sidebar/V1.3.3/zh.ts +++ b/src/.vuepress/sidebar/V1.3.3/zh.ts @@ -94,7 +94,7 @@ export const zhSidebar = { { text: '权限管理', link: 'Authority-Management' }, ], }, - { text: '用户自定义函数', link: 'User-defined-function' }, + { text: '用户自定义函数', link: 'User-defined-function_apache' }, { text: '连续查询', link: 'Database-Programming' }, { text: '数据库编程', @@ -178,7 +178,8 @@ export const zhSidebar = { collapsible: true, children: [ { text: 'UDF函数库', link: 'UDF-Libraries_apache' }, - { text: '函数与运算符', link: 'Operator-and-Expression' }, + { text: '函数与运算符', link: 'Operator-and-Expression' }, + { text: '内置函数与表达式', link: 'Function-and-Expression' }, ], }, ], diff --git a/src/.vuepress/sidebar_timecho/V1.3.3/en.ts b/src/.vuepress/sidebar_timecho/V1.3.3/en.ts index 9cf36c4b..7f66d2e6 100644 --- a/src/.vuepress/sidebar_timecho/V1.3.3/en.ts +++ b/src/.vuepress/sidebar_timecho/V1.3.3/en.ts @@ -101,7 +101,7 @@ export const enSidebar = { { text: 'Authority Management', link: 'Authority-Management' }, ], }, - { text: 'UDF', link: 'User-defined-function' }, + { text: 'UDF', link: 'User-defined-function_timecho' }, { text: 'View', link: 'IoTDB-View_timecho' }, { text: 'Tiered Storage', link: 'Tiered-Storage_timecho' }, { text: 'Continuous Query', link: 'Database-Programming' }, @@ -191,7 +191,8 @@ export const enSidebar = { collapsible: true, children: [ { text: 'UDF Libraries', link: 'UDF-Libraries_timecho' }, - { text: 'Functions and Operators', link: 'Operator-and-Expression' }, + { text: 'Operator and Expression', link: 'Operator-and-Expression' }, + { text: 'Function and Expression', link: 'Function-and-Expression' }, ], }, ], diff --git a/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts b/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts index 22faab84..c74923d9 100644 --- a/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts +++ b/src/.vuepress/sidebar_timecho/V1.3.3/zh.ts @@ -101,7 +101,7 @@ export const zhSidebar = { { text: '权限管理', link: 'Authority-Management' }, ], }, - { text: '用户自定义函数', link: 'User-defined-function' }, + { text: '用户自定义函数', link: 'User-defined-function_timecho' }, { text: '视图', link: 'IoTDB-View_timecho' }, { text: '多级存储', link: 'Tiered-Storage_timecho' }, { text: '连续查询', link: 'Database-Programming' }, @@ -191,7 +191,8 @@ export const zhSidebar = { collapsible: true, children: [ { text: 'UDF函数库', link: 'UDF-Libraries_timecho' }, - { text: '函数与运算符', link: 'Operator-and-Expression' }, + { text: '函数与运算符', link: 'Operator-and-Expression' }, + { text: '内置函数与表达式', link: 'Function-and-Expression' }, ], }, ], diff --git a/src/UserGuide/Master/Tree/Basic-Concept/Query-Data.md b/src/UserGuide/Master/Tree/Basic-Concept/Query-Data.md index 42b34904..62fc3c9f 100644 --- a/src/UserGuide/Master/Tree/Basic-Concept/Query-Data.md +++ b/src/UserGuide/Master/Tree/Basic-Concept/Query-Data.md @@ -332,7 +332,7 @@ SessionDataSet executeAggregationQuery( ``` ## `SELECT` CLAUSE -The `SELECT` clause specifies the output of the query, consisting of several `selectExpr`. Each `selectExpr` defines one or more columns in the query result. For select expression details, see document [Operator-and-Expression](./Operator-and-Expression.md). +The `SELECT` clause specifies the output of the query, consisting of several `selectExpr`. Each `selectExpr` defines one or more columns in the query result. For select expression details, see document [Operator-and-Expression](../SQL-Manual/Operator-and-Expression.md). - Example 1: diff --git a/src/UserGuide/Master/Tree/Reference/Function-and-Expression.md b/src/UserGuide/Master/Tree/SQL-Manual/Function-and-Expression.md similarity index 100% rename from src/UserGuide/Master/Tree/Reference/Function-and-Expression.md rename to src/UserGuide/Master/Tree/SQL-Manual/Function-and-Expression.md diff --git a/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md b/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md index ca286e69..9f096743 100644 --- a/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md +++ b/src/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md @@ -911,11 +911,11 @@ explain analyze select s1,s2 from root.sg.d1 order by s1 ``` ## OPERATOR -For more details, see document [Operator-and-Expression](../User-Manual/Operator-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md). ### Arithmetic Operators -For details and examples, see the document [Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#arithmetic-operators-and-functions). +For details and examples, see the document [Arithmetic Operators and Functions](./Operator-and-Expression.md#arithmetic-operators). ```sql select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root.sg.d1 @@ -923,7 +923,7 @@ select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root ### Comparison Operators -For details and examples, see the document [Comparison Operators and Functions](../Reference/Function-and-Expression.md#comparison-operators-and-functions). +For details and examples, see the document [Comparison Operators and Functions](./Operator-and-Expression.md#comparison-operators). ```sql # Basic comparison operators @@ -954,7 +954,7 @@ select a, a in (1, 2) from root.test; ### Logical Operators -For details and examples, see the document [Logical Operators](../Reference/Function-and-Expression.md#logical-operators). +For details and examples, see the document [Logical Operators](./Operator-and-Expression.md#logical-operators). ```sql select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; @@ -962,11 +962,11 @@ select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; ## BUILT-IN FUNCTIONS -For more details, see document [Operator-and-Expression](../Reference/Function-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md#built-in-functions). ### Aggregate Functions -For details and examples, see the document [Aggregate Functions](../Reference/Function-and-Expression.md#aggregate-functions). +For details and examples, see the document [Aggregate Functions](./Operator-and-Expression.md#aggregate-functions). ```sql select count(status) from root.ln.wf01.wt01; @@ -979,7 +979,7 @@ select time_duration(s1) from root.db.d1; ### Arithmetic Functions -For details and examples, see the document [Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#arithmetic-operators-and-functions). +For details and examples, see the document [Arithmetic Operators and Functions](./Operator-and-Expression.md#arithmetic-functions). ```sql select s1, sin(s1), cos(s1), tan(s1) from root.sg1.d1 limit 5 offset 1000; @@ -988,7 +988,7 @@ select s4,round(s4),round(s4,2),round(s4,-1) from root.sg1.d1; ### Comparison Functions -For details and examples, see the document [Comparison Operators and Functions](../Reference/Function-and-Expression.md#comparison-operators-and-functions). +For details and examples, see the document [Comparison Operators and Functions](./Operator-and-Expression.md#comparison-functions). ```sql select ts, on_off(ts, 'threshold'='2') from root.test; @@ -997,7 +997,7 @@ select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test; ### String Processing Functions -For details and examples, see the document [String Processing](../Reference/Function-and-Expression.md#string-processing). +For details and examples, see the document [String Processing](./Operator-and-Expression.md#string-processing-functions). ```sql select s1, string_contains(s1, 's'='warn') from root.sg1.d4; @@ -1025,7 +1025,7 @@ select regexsplit(s1, "regex"=",", "index"="3") from root.test.d1 ### Data Type Conversion Function -For details and examples, see the document [Data Type Conversion Function](../Reference/Function-and-Expression.md#data-type-conversion-function). +For details and examples, see the document [Data Type Conversion Function](./Operator-and-Expression.md#data-type-conversion-function). ```sql SELECT cast(s1 as INT32) from root.sg @@ -1033,7 +1033,7 @@ SELECT cast(s1 as INT32) from root.sg ### Constant Timeseries Generating Functions -For details and examples, see the document [Constant Timeseries Generating Functions](../Reference/Function-and-Expression.md#constant-timeseries-generating-functions). +For details and examples, see the document [Constant Timeseries Generating Functions](./Operator-and-Expression.md#constant-timeseries-generating-functions). ```sql select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; @@ -1041,7 +1041,7 @@ select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from ### Selector Functions -For details and examples, see the document [Selector Functions](../Reference/Function-and-Expression.md#selector-functions). +For details and examples, see the document [Selector Functions](./Operator-and-Expression.md#selector-functions). ```sql select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time > 2020-12-10T20:36:15.530+08:00; @@ -1049,7 +1049,7 @@ select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time ### Continuous Interval Functions -For details and examples, see the document [Continuous Interval Functions](../Reference/Function-and-Expression.md#continuous-interval-functions). +For details and examples, see the document [Continuous Interval Functions](./Operator-and-Expression.md#continuous-interval-functions). ```sql select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_duration(s4) from root.sg.d2; @@ -1057,7 +1057,7 @@ select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_durat ### Variation Trend Calculation Functions -For details and examples, see the document [Variation Trend Calculation Functions](../Reference/Function-and-Expression.md#variation-trend-calculation-functions). +For details and examples, see the document [Variation Trend Calculation Functions](./Operator-and-Expression.md#variation-trend-calculation-functions). ```sql select s1, time_difference(s1), difference(s1), non_negative_difference(s1), derivative(s1), non_negative_derivative(s1) from root.sg1.d1 limit 5 offset 1000; @@ -1068,7 +1068,7 @@ SELECT DIFF(s1, 'ignoreNull'='false'), DIFF(s2, 'ignoreNull'='false') from root. ### Sample Functions -For details and examples, see the document [Sample Functions](../Reference/Function-and-Expression.md#sample-functions). +For details and examples, see the document [Sample Functions](./Operator-and-Expression.md#sample-functions). ```sql select equal_size_bucket_random_sample(temperature,'proportion'='0.1') as random_sample from root.ln.wf01.wt01; @@ -1082,7 +1082,7 @@ select M4(s1,'windowSize'='10') from root.vehicle.d1 ### Change Points Function -For details and examples, see the document [Time-Series](../Reference/Function-and-Expression.md#time-series-processing). +For details and examples, see the document [Time-Series](./Operator-and-Expression.md#change-points-function). ```sql select change_points(s1), change_points(s2), change_points(s3), change_points(s4), change_points(s5), change_points(s6) from root.testChangePoints.d1 @@ -1090,11 +1090,11 @@ select change_points(s1), change_points(s2), change_points(s3), change_points(s4 ## DATA QUALITY FUNCTION LIBRARY -For more details, see document [Operator-and-Expression](../Reference/UDF-Libraries.md#). +For more details, see document [Operator-and-Expression](./UDF-Libraries_timecho.md). ### Data Quality -For details and examples, see the document [Data-Quality](../Reference/UDF-Libraries.md#data-quality). +For details and examples, see the document [Data-Quality](./UDF-Libraries_timecho.md#data-quality). ```sql # Completeness @@ -1119,7 +1119,7 @@ select Accuracy(t1,t2,t3,m1,m2,m3) from root.test ### Data Profiling -For details and examples, see the document [Data-Profiling](../Reference/UDF-Libraries.md#data-profiling). +For details and examples, see the document [Data-Profiling](./UDF-Libraries_timecho.md#data-profiling). ```sql # ACF @@ -1199,7 +1199,7 @@ select zscore(s1) from root.test ### Anomaly Detection -For details and examples, see the document [Anomaly-Detection](../Reference/UDF-Libraries.md#anomaly-detection). +For details and examples, see the document [Anomaly-Detection](./UDF-Libraries_timecho.md#anomaly-detection). ```sql # IQR @@ -1234,7 +1234,7 @@ select MasterDetect(lo,la,m_lo,m_la,model,'output_type'='anomaly','p'='3','k'='3 ### Frequency Domain -For details and examples, see the document [Frequency-Domain](../Reference/UDF-Libraries.md#frequency-domain-analysis). +For details and examples, see the document [Frequency-Domain](./UDF-Libraries_timecho.md#frequency-domain-analysis). ```sql # Conv @@ -1266,7 +1266,7 @@ select envelope(s1) from root.test.d1 ### Data Matching -For details and examples, see the document [Data-Matching](../Reference/UDF-Libraries.md#data-matching). +For details and examples, see the document [Data-Matching](./UDF-Libraries_timecho.md#data-matching). ```sql # Cov @@ -1287,7 +1287,7 @@ select xcorr(s1, s2) from root.test.d1 where time <= 2020-01-01 00:00:05 ### Data Repairing -For details and examples, see the document [Data-Repairing](../Reference/UDF-Libraries.md#data-repairing). +For details and examples, see the document [Data-Repairing](./UDF-Libraries_timecho.md#data-repairing). ```sql # TimestampRepair @@ -1312,7 +1312,7 @@ select seasonalrepair(s1,'method'='improved','period'=3) from root.test.d2 ### Series Discovery -For details and examples, see the document [Series-Discovery](../Reference/UDF-Libraries.md#series-discovery). +For details and examples, see the document [Series-Discovery](./UDF-Libraries_timecho.md#series-discovery). ```sql # ConsecutiveSequences @@ -1325,7 +1325,7 @@ select consecutivewindows(s1,s2,'length'='10m') from root.test.d1 ### Machine Learning -For details and examples, see the document [Machine-Learning](../Reference/UDF-Libraries.md#machine-learning). +For details and examples, see the document [Machine-Learning](./UDF-Libraries_timecho.md#machine-learning). ```sql # AR @@ -1340,7 +1340,7 @@ select rm(s0, s1,"tb"="3","vb"="2") from root.test.d0 ## LAMBDA EXPRESSION -For details and examples, see the document [Lambda](../Reference/Function-and-Expression.md#lambda-expression). +For details and examples, see the document [Lambda](./UDF-Libraries_timecho.md#lambda-expression). ```sql select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'expr'='x -> {x * 3}') as jexl2, jexl(temperature, 'expr'='x -> {x * x}') as jexl3, jexl(temperature, 'expr'='x -> {multiply(x, 100)}') as jexl4, jexl(temperature, st, 'expr'='(x, y) -> {x + y}') as jexl5, jexl(temperature, st, str, 'expr'='(x, y, z) -> {x + y + z}') as jexl6 from root.ln.wf01.wt01;``` @@ -1348,7 +1348,7 @@ select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'exp ## CONDITIONAL EXPRESSION -For details and examples, see the document [Conditional Expressions](../Reference/Function-and-Expression.md#conditional-expressions). +For details and examples, see the document [Conditional Expressions](./UDF-Libraries_timecho.md#conditional-expressions). ```sql select T, P, case @@ -1438,7 +1438,7 @@ SHOW TRIGGERS ## CONTINUOUS QUERY (CQ) -For more details, see document [Operator-and-Expression](../User-Manual/Operator-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md). ```sql CREATE (CONTINUOUS QUERY | CQ) @@ -1548,7 +1548,7 @@ CQs can't be altered once they're created. To change a CQ, you must `DROP` and r ## USER-DEFINED FUNCTION (UDF) -For more details, see document [Operator-and-Expression](../Reference/UDF-Libraries.md). +For more details, see document [Operator-and-Expression](./UDF-Libraries_timecho.md). ### UDF Registration @@ -1586,7 +1586,7 @@ SHOW FUNCTIONS ## ADMINISTRATION MANAGEMENT -For more details, see document [Operator-and-Expression](../User-Manual/Operator-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md). ### SQL Statements diff --git a/src/UserGuide/Master/Tree/User-Manual/User-defined-function.md b/src/UserGuide/Master/Tree/User-Manual/User-defined-function_apache.md similarity index 96% rename from src/UserGuide/Master/Tree/User-Manual/User-defined-function.md rename to src/UserGuide/Master/Tree/User-Manual/User-defined-function_apache.md index 7b48e6bd..2bf1553c 100644 --- a/src/UserGuide/Master/Tree/User-Manual/User-defined-function.md +++ b/src/UserGuide/Master/Tree/User-Manual/User-defined-function_apache.md @@ -78,7 +78,7 @@ SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FRO ## 2. UDF Development -You can refer to UDF development:[Development Guide](../Reference/UDF-development.md) +You can refer to UDF development:[Development Guide](./UDF-development.md) ## 3. UDF management @@ -196,7 +196,7 @@ For more user permissions related content, please refer to [Account Management S Based on the ability of user-defined functions, IoTDB provides a series of functions for temporal data processing, including data quality, data profiling, anomaly detection, frequency domain analysis, data matching, data repairing, sequence discovery, machine learning, etc., which can meet the needs of industrial fields for temporal data processing. -You can refer to the [UDF Libraries](../Reference/UDF-Libraries.md)document to find the installation steps and registration statements for each function, to ensure that all required functions are registered correctly. +You can refer to the [UDF Libraries](../SQL-Manual/UDF-Libraries_apache.md)document to find the installation steps and registration statements for each function, to ensure that all required functions are registered correctly. ## 5. Common problem: diff --git a/src/UserGuide/latest/User-Manual/User-defined-function.md b/src/UserGuide/Master/Tree/User-Manual/User-defined-function_timecho.md similarity index 96% rename from src/UserGuide/latest/User-Manual/User-defined-function.md rename to src/UserGuide/Master/Tree/User-Manual/User-defined-function_timecho.md index 7b48e6bd..fcbae4cc 100644 --- a/src/UserGuide/latest/User-Manual/User-defined-function.md +++ b/src/UserGuide/Master/Tree/User-Manual/User-defined-function_timecho.md @@ -78,7 +78,7 @@ SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FRO ## 2. UDF Development -You can refer to UDF development:[Development Guide](../Reference/UDF-development.md) +You can refer to UDF development:[Development Guide](./UDF-development.md) ## 3. UDF management @@ -196,7 +196,7 @@ For more user permissions related content, please refer to [Account Management S Based on the ability of user-defined functions, IoTDB provides a series of functions for temporal data processing, including data quality, data profiling, anomaly detection, frequency domain analysis, data matching, data repairing, sequence discovery, machine learning, etc., which can meet the needs of industrial fields for temporal data processing. -You can refer to the [UDF Libraries](../Reference/UDF-Libraries.md)document to find the installation steps and registration statements for each function, to ensure that all required functions are registered correctly. +You can refer to the [UDF Libraries](../SQL-Manual/UDF-Libraries_timecho.md)document to find the installation steps and registration statements for each function, to ensure that all required functions are registered correctly. ## 5. Common problem: diff --git a/src/UserGuide/latest/Basic-Concept/Query-Data.md b/src/UserGuide/latest/Basic-Concept/Query-Data.md index 42b34904..62fc3c9f 100644 --- a/src/UserGuide/latest/Basic-Concept/Query-Data.md +++ b/src/UserGuide/latest/Basic-Concept/Query-Data.md @@ -332,7 +332,7 @@ SessionDataSet executeAggregationQuery( ``` ## `SELECT` CLAUSE -The `SELECT` clause specifies the output of the query, consisting of several `selectExpr`. Each `selectExpr` defines one or more columns in the query result. For select expression details, see document [Operator-and-Expression](./Operator-and-Expression.md). +The `SELECT` clause specifies the output of the query, consisting of several `selectExpr`. Each `selectExpr` defines one or more columns in the query result. For select expression details, see document [Operator-and-Expression](../SQL-Manual/Operator-and-Expression.md). - Example 1: diff --git a/src/UserGuide/latest/Reference/Function-and-Expression.md b/src/UserGuide/latest/SQL-Manual/Function-and-Expression.md similarity index 100% rename from src/UserGuide/latest/Reference/Function-and-Expression.md rename to src/UserGuide/latest/SQL-Manual/Function-and-Expression.md diff --git a/src/UserGuide/latest/SQL-Manual/SQL-Manual.md b/src/UserGuide/latest/SQL-Manual/SQL-Manual.md index ca286e69..1905bbb7 100644 --- a/src/UserGuide/latest/SQL-Manual/SQL-Manual.md +++ b/src/UserGuide/latest/SQL-Manual/SQL-Manual.md @@ -602,7 +602,7 @@ IoTDB > select avg(temperature), from root.ln.wf01.wt01; IoTDB > select avg(*), - (avg(*) + 1) * 3 / 2 -1 + (avg(*) + 1) * 3 / 2 -1 from root.sg1 IoTDB > select avg(temperature), @@ -911,11 +911,11 @@ explain analyze select s1,s2 from root.sg.d1 order by s1 ``` ## OPERATOR -For more details, see document [Operator-and-Expression](../User-Manual/Operator-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md). ### Arithmetic Operators -For details and examples, see the document [Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#arithmetic-operators-and-functions). +For details and examples, see the document [Arithmetic Operators and Functions](./Operator-and-Expression.md#arithmetic-operators). ```sql select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root.sg.d1 @@ -923,7 +923,7 @@ select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root ### Comparison Operators -For details and examples, see the document [Comparison Operators and Functions](../Reference/Function-and-Expression.md#comparison-operators-and-functions). +For details and examples, see the document [Comparison Operators and Functions](./Operator-and-Expression.md#comparison-operators). ```sql # Basic comparison operators @@ -954,7 +954,7 @@ select a, a in (1, 2) from root.test; ### Logical Operators -For details and examples, see the document [Logical Operators](../Reference/Function-and-Expression.md#logical-operators). +For details and examples, see the document [Logical Operators](./Operator-and-Expression.md#logical-operators). ```sql select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; @@ -962,11 +962,11 @@ select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; ## BUILT-IN FUNCTIONS -For more details, see document [Operator-and-Expression](../Reference/Function-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md#built-in-functions). ### Aggregate Functions -For details and examples, see the document [Aggregate Functions](../Reference/Function-and-Expression.md#aggregate-functions). +For details and examples, see the document [Aggregate Functions](./Operator-and-Expression.md#aggregate-functions). ```sql select count(status) from root.ln.wf01.wt01; @@ -979,7 +979,7 @@ select time_duration(s1) from root.db.d1; ### Arithmetic Functions -For details and examples, see the document [Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#arithmetic-operators-and-functions). +For details and examples, see the document [Arithmetic Operators and Functions](./Operator-and-Expression.md#arithmetic-functions). ```sql select s1, sin(s1), cos(s1), tan(s1) from root.sg1.d1 limit 5 offset 1000; @@ -988,7 +988,7 @@ select s4,round(s4),round(s4,2),round(s4,-1) from root.sg1.d1; ### Comparison Functions -For details and examples, see the document [Comparison Operators and Functions](../Reference/Function-and-Expression.md#comparison-operators-and-functions). +For details and examples, see the document [Comparison Operators and Functions](./Operator-and-Expression.md#comparison-functions). ```sql select ts, on_off(ts, 'threshold'='2') from root.test; @@ -997,7 +997,7 @@ select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test; ### String Processing Functions -For details and examples, see the document [String Processing](../Reference/Function-and-Expression.md#string-processing). +For details and examples, see the document [String Processing](./Operator-and-Expression.md#string-processing-functions). ```sql select s1, string_contains(s1, 's'='warn') from root.sg1.d4; @@ -1025,7 +1025,7 @@ select regexsplit(s1, "regex"=",", "index"="3") from root.test.d1 ### Data Type Conversion Function -For details and examples, see the document [Data Type Conversion Function](../Reference/Function-and-Expression.md#data-type-conversion-function). +For details and examples, see the document [Data Type Conversion Function](./Operator-and-Expression.md#data-type-conversion-function). ```sql SELECT cast(s1 as INT32) from root.sg @@ -1033,7 +1033,7 @@ SELECT cast(s1 as INT32) from root.sg ### Constant Timeseries Generating Functions -For details and examples, see the document [Constant Timeseries Generating Functions](../Reference/Function-and-Expression.md#constant-timeseries-generating-functions). +For details and examples, see the document [Constant Timeseries Generating Functions](./Operator-and-Expression.md#constant-timeseries-generating-functions). ```sql select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; @@ -1041,7 +1041,7 @@ select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from ### Selector Functions -For details and examples, see the document [Selector Functions](../Reference/Function-and-Expression.md#selector-functions). +For details and examples, see the document [Selector Functions](./Operator-and-Expression.md#selector-functions). ```sql select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time > 2020-12-10T20:36:15.530+08:00; @@ -1049,7 +1049,7 @@ select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time ### Continuous Interval Functions -For details and examples, see the document [Continuous Interval Functions](../Reference/Function-and-Expression.md#continuous-interval-functions). +For details and examples, see the document [Continuous Interval Functions](./Operator-and-Expression.md#continuous-interval-functions). ```sql select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_duration(s4) from root.sg.d2; @@ -1057,7 +1057,7 @@ select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_durat ### Variation Trend Calculation Functions -For details and examples, see the document [Variation Trend Calculation Functions](../Reference/Function-and-Expression.md#variation-trend-calculation-functions). +For details and examples, see the document [Variation Trend Calculation Functions](./Operator-and-Expression.md#variation-trend-calculation-functions). ```sql select s1, time_difference(s1), difference(s1), non_negative_difference(s1), derivative(s1), non_negative_derivative(s1) from root.sg1.d1 limit 5 offset 1000; @@ -1068,7 +1068,7 @@ SELECT DIFF(s1, 'ignoreNull'='false'), DIFF(s2, 'ignoreNull'='false') from root. ### Sample Functions -For details and examples, see the document [Sample Functions](../Reference/Function-and-Expression.md#sample-functions). +For details and examples, see the document [Sample Functions](./Operator-and-Expression.md#sample-functions). ```sql select equal_size_bucket_random_sample(temperature,'proportion'='0.1') as random_sample from root.ln.wf01.wt01; @@ -1082,7 +1082,7 @@ select M4(s1,'windowSize'='10') from root.vehicle.d1 ### Change Points Function -For details and examples, see the document [Time-Series](../Reference/Function-and-Expression.md#time-series-processing). +For details and examples, see the document [Time-Series](./Operator-and-Expression.md#change-points-function). ```sql select change_points(s1), change_points(s2), change_points(s3), change_points(s4), change_points(s5), change_points(s6) from root.testChangePoints.d1 @@ -1090,11 +1090,11 @@ select change_points(s1), change_points(s2), change_points(s3), change_points(s4 ## DATA QUALITY FUNCTION LIBRARY -For more details, see document [Operator-and-Expression](../Reference/UDF-Libraries.md#). +For more details, see document [Operator-and-Expression](./UDF-Libraries_timecho.md). ### Data Quality -For details and examples, see the document [Data-Quality](../Reference/UDF-Libraries.md#data-quality). +For details and examples, see the document [Data-Quality](./UDF-Libraries_timecho.md#data-quality). ```sql # Completeness @@ -1119,7 +1119,7 @@ select Accuracy(t1,t2,t3,m1,m2,m3) from root.test ### Data Profiling -For details and examples, see the document [Data-Profiling](../Reference/UDF-Libraries.md#data-profiling). +For details and examples, see the document [Data-Profiling](./UDF-Libraries_timecho.md#data-profiling). ```sql # ACF @@ -1199,7 +1199,7 @@ select zscore(s1) from root.test ### Anomaly Detection -For details and examples, see the document [Anomaly-Detection](../Reference/UDF-Libraries.md#anomaly-detection). +For details and examples, see the document [Anomaly-Detection](./UDF-Libraries_timecho.md#anomaly-detection). ```sql # IQR @@ -1234,7 +1234,7 @@ select MasterDetect(lo,la,m_lo,m_la,model,'output_type'='anomaly','p'='3','k'='3 ### Frequency Domain -For details and examples, see the document [Frequency-Domain](../Reference/UDF-Libraries.md#frequency-domain-analysis). +For details and examples, see the document [Frequency-Domain](./UDF-Libraries_timecho.md#frequency-domain-analysis). ```sql # Conv @@ -1266,7 +1266,7 @@ select envelope(s1) from root.test.d1 ### Data Matching -For details and examples, see the document [Data-Matching](../Reference/UDF-Libraries.md#data-matching). +For details and examples, see the document [Data-Matching](./UDF-Libraries_timecho.md#data-matching). ```sql # Cov @@ -1287,7 +1287,7 @@ select xcorr(s1, s2) from root.test.d1 where time <= 2020-01-01 00:00:05 ### Data Repairing -For details and examples, see the document [Data-Repairing](../Reference/UDF-Libraries.md#data-repairing). +For details and examples, see the document [Data-Repairing](./UDF-Libraries_timecho.md#data-repairing). ```sql # TimestampRepair @@ -1312,7 +1312,7 @@ select seasonalrepair(s1,'method'='improved','period'=3) from root.test.d2 ### Series Discovery -For details and examples, see the document [Series-Discovery](../Reference/UDF-Libraries.md#series-discovery). +For details and examples, see the document [Series-Discovery](./UDF-Libraries_timecho.md#series-discovery). ```sql # ConsecutiveSequences @@ -1325,7 +1325,7 @@ select consecutivewindows(s1,s2,'length'='10m') from root.test.d1 ### Machine Learning -For details and examples, see the document [Machine-Learning](../Reference/UDF-Libraries.md#machine-learning). +For details and examples, see the document [Machine-Learning](./UDF-Libraries_timecho.md#machine-learning). ```sql # AR @@ -1340,7 +1340,7 @@ select rm(s0, s1,"tb"="3","vb"="2") from root.test.d0 ## LAMBDA EXPRESSION -For details and examples, see the document [Lambda](../Reference/Function-and-Expression.md#lambda-expression). +For details and examples, see the document [Lambda](./UDF-Libraries_timecho.md#lambda-expression). ```sql select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'expr'='x -> {x * 3}') as jexl2, jexl(temperature, 'expr'='x -> {x * x}') as jexl3, jexl(temperature, 'expr'='x -> {multiply(x, 100)}') as jexl4, jexl(temperature, st, 'expr'='(x, y) -> {x + y}') as jexl5, jexl(temperature, st, str, 'expr'='(x, y, z) -> {x + y + z}') as jexl6 from root.ln.wf01.wt01;``` @@ -1348,7 +1348,7 @@ select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'exp ## CONDITIONAL EXPRESSION -For details and examples, see the document [Conditional Expressions](../Reference/Function-and-Expression.md#conditional-expressions). +For details and examples, see the document [Conditional Expressions](./UDF-Libraries_timecho.md#conditional-expressions). ```sql select T, P, case @@ -1438,7 +1438,7 @@ SHOW TRIGGERS ## CONTINUOUS QUERY (CQ) -For more details, see document [Operator-and-Expression](../User-Manual/Operator-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md). ```sql CREATE (CONTINUOUS QUERY | CQ) @@ -1548,7 +1548,7 @@ CQs can't be altered once they're created. To change a CQ, you must `DROP` and r ## USER-DEFINED FUNCTION (UDF) -For more details, see document [Operator-and-Expression](../Reference/UDF-Libraries.md). +For more details, see document [Operator-and-Expression](./UDF-Libraries_timecho.md). ### UDF Registration @@ -1586,7 +1586,7 @@ SHOW FUNCTIONS ## ADMINISTRATION MANAGEMENT -For more details, see document [Operator-and-Expression](../User-Manual/Operator-and-Expression.md). +For more details, see document [Operator-and-Expression](./Operator-and-Expression.md). ### SQL Statements diff --git a/src/UserGuide/latest/User-Manual/User-defined-function_apache.md b/src/UserGuide/latest/User-Manual/User-defined-function_apache.md new file mode 100644 index 00000000..2bf1553c --- /dev/null +++ b/src/UserGuide/latest/User-Manual/User-defined-function_apache.md @@ -0,0 +1,213 @@ +# USER-DEFINED FUNCTION (UDF) + +## 1. UDF Introduction + +UDF (User Defined Function) refers to user-defined functions. IoTDB provides a variety of built-in time series processing functions and also supports extending custom functions to meet more computing needs. + +In IoTDB, you can expand two types of UDF: + + + + + + + + + + + + + + + + + + + + + +
UDF ClassAccessStrategyDescription
UDTFMAPPABLE_ROW_BY_ROWCustom scalar function, input k columns of time series and 1 row of data, output 1 column of time series and 1 row of data, can be used in any clause and expression that appears in the scalar function, such as select clause, where clause, etc.
ROW_BY_ROW
SLIDING_TIME_WINDOW
SLIDING_SIZE_WINDOW
SESSION_TIME_WINDOW
STATE_WINDOW
Custom time series generation function, input k columns of time series m rows of data, output 1 column of time series n rows of data, the number of input rows m can be different from the number of output rows n, and can only be used in SELECT clauses.
UDAF-Custom aggregation function, input k columns of time series m rows of data, output 1 column of time series 1 row of data, can be used in any clause and expression that appears in the aggregation function, such as select clause, having clause, etc.
+ +### 1.1 UDF usage + +The usage of UDF is similar to that of regular built-in functions, and can be directly used in SELECT statements like calling regular functions. + +#### 1.Basic SQL syntax support + +* Support `SLIMIT` / `SOFFSET` +* Support `LIMIT` / `OFFSET` +* Support queries with value filters +* Support queries with time filters + + +#### 2. Queries with * in SELECT Clauses + +Assume that there are 2 time series (`root.sg.d1.s1` and `root.sg.d1.s2`) in the system. + +* **`SELECT example(*) from root.sg.d1`** + +Then the result set will include the results of `example (root.sg.d1.s1)` and `example (root.sg.d1.s2)`. + +* **`SELECT example(s1, *) from root.sg.d1`** + +Then the result set will include the results of `example(root.sg.d1.s1, root.sg.d1.s1)` and `example(root.sg.d1.s1, root.sg.d1.s2)`. + +* **`SELECT example(*, *) from root.sg.d1`** + +Then the result set will include the results of `example(root.sg.d1.s1, root.sg.d1.s1)`, `example(root.sg.d1.s2, root.sg.d1.s1)`, `example(root.sg.d1.s1, root.sg.d1.s2)` and `example(root.sg.d1.s2, root.sg.d1.s2)`. + +#### 3. Queries with Key-value Attributes in UDF Parameters + +You can pass any number of key-value pair parameters to the UDF when constructing a UDF query. The key and value in the key-value pair need to be enclosed in single or double quotes. Note that key-value pair parameters can only be passed in after all time series have been passed in. Here is a set of examples: + + Example: +``` sql +SELECT example(s1, 'key1'='value1', 'key2'='value2'), example(*, 'key3'='value3') FROM root.sg.d1; +SELECT example(s1, s2, 'key1'='value1', 'key2'='value2') FROM root.sg.d1; +``` + +#### 4. Nested Queries + + Example: +``` sql +SELECT s1, s2, example(s1, s2) FROM root.sg.d1; +SELECT *, example(*) FROM root.sg.d1 DISABLE ALIGN; +SELECT s1 * example(* / s1 + s2) FROM root.sg.d1; +SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FROM root.sg.d1; +``` + +## 2. UDF Development + +You can refer to UDF development:[Development Guide](./UDF-development.md) + +## 3. UDF management + +### 3.1 UDF Registration + +The process of registering a UDF in IoTDB is as follows: + +1. Implement a complete UDF class, assuming the full class name of this class is `org.apache.iotdb.udf.ExampleUDTF`. +2. Convert the project into a JAR package. If using Maven to manage the project, you can refer to the [Maven project example](https://github.com/apache/iotdb/tree/master/example/udf) above. +3. Make preparations for registration according to the registration mode. For details, see the following example. +4. You can use following SQL to register UDF. + +```sql +CREATE FUNCTION AS (USING URI URI-STRING) +``` + +#### Example: register UDF named `example`, you can choose either of the following two registration methods + +#### Method 1: Manually place the jar package + +Prepare: +When registering using this method, it is necessary to place the JAR package in advance in the `ext/udf` directory of all nodes in the cluster (which can be configured). + +Registration statement: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' +``` + +#### Method 2: Cluster automatically installs jar packages through URI + +Prepare: +When registering using this method, it is necessary to upload the JAR package to the URI server in advance and ensure that the IoTDB instance executing the registration statement can access the URI server. + +Registration statement: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' USING URI 'http://jar/example.jar' +``` + +IoTDB will download JAR packages and synchronize them to the entire cluster. + +#### Note + +1. Since UDF instances are dynamically loaded through reflection technology, you do not need to restart the server during the UDF registration process. + +2. UDF function names are not case-sensitive. + +3. Please ensure that the function name given to the UDF is different from all built-in function names. A UDF with the same name as a built-in function cannot be registered. + +4. We recommend that you do not use classes that have the same class name but different function logic in different JAR packages. For example, in `UDF(UDAF/UDTF): udf1, udf2`, the JAR package of udf1 is `udf1.jar` and the JAR package of udf2 is `udf2.jar`. Assume that both JAR packages contain the `org.apache.iotdb.udf.ExampleUDTF` class. If you use two UDFs in the same SQL statement at the same time, the system will randomly load either of them and may cause inconsistency in UDF execution behavior. + +### 3.2 UDF Deregistration + +The SQL syntax is as follows: + +```sql +DROP FUNCTION +``` + +Example: Uninstall the UDF from the above example: + +```sql +DROP FUNCTION example +``` + + + +### 3.3 Show All Registered UDFs + +``` sql +SHOW FUNCTIONS +``` + +### 3.4 UDF configuration + +- UDF configuration allows configuring the storage directory of UDF in `iotdb-system.properties` + ``` Properties +# UDF lib dir + +udf_lib_dir=ext/udf +``` + +- -When using custom functions, there is a message indicating insufficient memory. Change the following configuration parameters in `iotdb-system.properties` and restart the service. + + ``` Properties + +# Used to estimate the memory usage of text fields in a UDF query. +# It is recommended to set this value to be slightly larger than the average length of all text +# effectiveMode: restart +# Datatype: int +udf_initial_byte_array_length_for_memory_control=48 + +# How much memory may be used in ONE UDF query (in MB). +# The upper limit is 20% of allocated memory for read. +# effectiveMode: restart +# Datatype: float +udf_memory_budget_in_mb=30.0 + +# UDF memory allocation ratio. +# The parameter form is a:b:c, where a, b, and c are integers. +# effectiveMode: restart +udf_reader_transformer_collector_memory_proportion=1:1:1 +``` + +### 3.5 UDF User Permissions + + +When users use UDF, they will be involved in the `USE_UDF` permission, and only users with this permission are allowed to perform UDF registration, uninstallation, and query operations. + +For more user permissions related content, please refer to [Account Management Statements](./Authority-Management.md). + + +## 4. UDF Libraries + +Based on the ability of user-defined functions, IoTDB provides a series of functions for temporal data processing, including data quality, data profiling, anomaly detection, frequency domain analysis, data matching, data repairing, sequence discovery, machine learning, etc., which can meet the needs of industrial fields for temporal data processing. + +You can refer to the [UDF Libraries](../SQL-Manual/UDF-Libraries_apache.md)document to find the installation steps and registration statements for each function, to ensure that all required functions are registered correctly. + + +## 5. Common problem: + +Q1: How to modify the registered UDF? + +A1: Assume that the name of the UDF is `example` and the full class name is `org.apache.iotdb.udf.ExampleUDTF`, which is introduced by `example.jar`. + +1. Unload the registered function by executing `DROP FUNCTION example`. +2. Delete `example.jar` under `iotdb-server-1.0.0-all-bin/ext/udf`. +3. Modify the logic in `org.apache.iotdb.udf.ExampleUDTF` and repackage it. The name of the JAR package can still be `example.jar`. +4. Upload the new JAR package to `iotdb-server-1.0.0-all-bin/ext/udf`. +5. Load the new UDF by executing `CREATE FUNCTION example AS "org.apache.iotdb.udf.ExampleUDTF"`. + diff --git a/src/UserGuide/latest/User-Manual/User-defined-function_timecho.md b/src/UserGuide/latest/User-Manual/User-defined-function_timecho.md new file mode 100644 index 00000000..fcbae4cc --- /dev/null +++ b/src/UserGuide/latest/User-Manual/User-defined-function_timecho.md @@ -0,0 +1,213 @@ +# USER-DEFINED FUNCTION (UDF) + +## 1. UDF Introduction + +UDF (User Defined Function) refers to user-defined functions. IoTDB provides a variety of built-in time series processing functions and also supports extending custom functions to meet more computing needs. + +In IoTDB, you can expand two types of UDF: + + + + + + + + + + + + + + + + + + + + + +
UDF ClassAccessStrategyDescription
UDTFMAPPABLE_ROW_BY_ROWCustom scalar function, input k columns of time series and 1 row of data, output 1 column of time series and 1 row of data, can be used in any clause and expression that appears in the scalar function, such as select clause, where clause, etc.
ROW_BY_ROW
SLIDING_TIME_WINDOW
SLIDING_SIZE_WINDOW
SESSION_TIME_WINDOW
STATE_WINDOW
Custom time series generation function, input k columns of time series m rows of data, output 1 column of time series n rows of data, the number of input rows m can be different from the number of output rows n, and can only be used in SELECT clauses.
UDAF-Custom aggregation function, input k columns of time series m rows of data, output 1 column of time series 1 row of data, can be used in any clause and expression that appears in the aggregation function, such as select clause, having clause, etc.
+ +### 1.1 UDF usage + +The usage of UDF is similar to that of regular built-in functions, and can be directly used in SELECT statements like calling regular functions. + +#### 1.Basic SQL syntax support + +* Support `SLIMIT` / `SOFFSET` +* Support `LIMIT` / `OFFSET` +* Support queries with value filters +* Support queries with time filters + + +#### 2. Queries with * in SELECT Clauses + +Assume that there are 2 time series (`root.sg.d1.s1` and `root.sg.d1.s2`) in the system. + +* **`SELECT example(*) from root.sg.d1`** + +Then the result set will include the results of `example (root.sg.d1.s1)` and `example (root.sg.d1.s2)`. + +* **`SELECT example(s1, *) from root.sg.d1`** + +Then the result set will include the results of `example(root.sg.d1.s1, root.sg.d1.s1)` and `example(root.sg.d1.s1, root.sg.d1.s2)`. + +* **`SELECT example(*, *) from root.sg.d1`** + +Then the result set will include the results of `example(root.sg.d1.s1, root.sg.d1.s1)`, `example(root.sg.d1.s2, root.sg.d1.s1)`, `example(root.sg.d1.s1, root.sg.d1.s2)` and `example(root.sg.d1.s2, root.sg.d1.s2)`. + +#### 3. Queries with Key-value Attributes in UDF Parameters + +You can pass any number of key-value pair parameters to the UDF when constructing a UDF query. The key and value in the key-value pair need to be enclosed in single or double quotes. Note that key-value pair parameters can only be passed in after all time series have been passed in. Here is a set of examples: + + Example: +``` sql +SELECT example(s1, 'key1'='value1', 'key2'='value2'), example(*, 'key3'='value3') FROM root.sg.d1; +SELECT example(s1, s2, 'key1'='value1', 'key2'='value2') FROM root.sg.d1; +``` + +#### 4. Nested Queries + + Example: +``` sql +SELECT s1, s2, example(s1, s2) FROM root.sg.d1; +SELECT *, example(*) FROM root.sg.d1 DISABLE ALIGN; +SELECT s1 * example(* / s1 + s2) FROM root.sg.d1; +SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FROM root.sg.d1; +``` + +## 2. UDF Development + +You can refer to UDF development:[Development Guide](./UDF-development.md) + +## 3. UDF management + +### 3.1 UDF Registration + +The process of registering a UDF in IoTDB is as follows: + +1. Implement a complete UDF class, assuming the full class name of this class is `org.apache.iotdb.udf.ExampleUDTF`. +2. Convert the project into a JAR package. If using Maven to manage the project, you can refer to the [Maven project example](https://github.com/apache/iotdb/tree/master/example/udf) above. +3. Make preparations for registration according to the registration mode. For details, see the following example. +4. You can use following SQL to register UDF. + +```sql +CREATE FUNCTION AS (USING URI URI-STRING) +``` + +#### Example: register UDF named `example`, you can choose either of the following two registration methods + +#### Method 1: Manually place the jar package + +Prepare: +When registering using this method, it is necessary to place the JAR package in advance in the `ext/udf` directory of all nodes in the cluster (which can be configured). + +Registration statement: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' +``` + +#### Method 2: Cluster automatically installs jar packages through URI + +Prepare: +When registering using this method, it is necessary to upload the JAR package to the URI server in advance and ensure that the IoTDB instance executing the registration statement can access the URI server. + +Registration statement: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' USING URI 'http://jar/example.jar' +``` + +IoTDB will download JAR packages and synchronize them to the entire cluster. + +#### Note + +1. Since UDF instances are dynamically loaded through reflection technology, you do not need to restart the server during the UDF registration process. + +2. UDF function names are not case-sensitive. + +3. Please ensure that the function name given to the UDF is different from all built-in function names. A UDF with the same name as a built-in function cannot be registered. + +4. We recommend that you do not use classes that have the same class name but different function logic in different JAR packages. For example, in `UDF(UDAF/UDTF): udf1, udf2`, the JAR package of udf1 is `udf1.jar` and the JAR package of udf2 is `udf2.jar`. Assume that both JAR packages contain the `org.apache.iotdb.udf.ExampleUDTF` class. If you use two UDFs in the same SQL statement at the same time, the system will randomly load either of them and may cause inconsistency in UDF execution behavior. + +### 3.2 UDF Deregistration + +The SQL syntax is as follows: + +```sql +DROP FUNCTION +``` + +Example: Uninstall the UDF from the above example: + +```sql +DROP FUNCTION example +``` + + + +### 3.3 Show All Registered UDFs + +``` sql +SHOW FUNCTIONS +``` + +### 3.4 UDF configuration + +- UDF configuration allows configuring the storage directory of UDF in `iotdb-system.properties` + ``` Properties +# UDF lib dir + +udf_lib_dir=ext/udf +``` + +- -When using custom functions, there is a message indicating insufficient memory. Change the following configuration parameters in `iotdb-system.properties` and restart the service. + + ``` Properties + +# Used to estimate the memory usage of text fields in a UDF query. +# It is recommended to set this value to be slightly larger than the average length of all text +# effectiveMode: restart +# Datatype: int +udf_initial_byte_array_length_for_memory_control=48 + +# How much memory may be used in ONE UDF query (in MB). +# The upper limit is 20% of allocated memory for read. +# effectiveMode: restart +# Datatype: float +udf_memory_budget_in_mb=30.0 + +# UDF memory allocation ratio. +# The parameter form is a:b:c, where a, b, and c are integers. +# effectiveMode: restart +udf_reader_transformer_collector_memory_proportion=1:1:1 +``` + +### 3.5 UDF User Permissions + + +When users use UDF, they will be involved in the `USE_UDF` permission, and only users with this permission are allowed to perform UDF registration, uninstallation, and query operations. + +For more user permissions related content, please refer to [Account Management Statements](./Authority-Management.md). + + +## 4. UDF Libraries + +Based on the ability of user-defined functions, IoTDB provides a series of functions for temporal data processing, including data quality, data profiling, anomaly detection, frequency domain analysis, data matching, data repairing, sequence discovery, machine learning, etc., which can meet the needs of industrial fields for temporal data processing. + +You can refer to the [UDF Libraries](../SQL-Manual/UDF-Libraries_timecho.md)document to find the installation steps and registration statements for each function, to ensure that all required functions are registered correctly. + + +## 5. Common problem: + +Q1: How to modify the registered UDF? + +A1: Assume that the name of the UDF is `example` and the full class name is `org.apache.iotdb.udf.ExampleUDTF`, which is introduced by `example.jar`. + +1. Unload the registered function by executing `DROP FUNCTION example`. +2. Delete `example.jar` under `iotdb-server-1.0.0-all-bin/ext/udf`. +3. Modify the logic in `org.apache.iotdb.udf.ExampleUDTF` and repackage it. The name of the JAR package can still be `example.jar`. +4. Upload the new JAR package to `iotdb-server-1.0.0-all-bin/ext/udf`. +5. Load the new UDF by executing `CREATE FUNCTION example AS "org.apache.iotdb.udf.ExampleUDTF"`. + diff --git a/src/zh/UserGuide/Master/Tree/Basic-Concept/Query-Data.md b/src/zh/UserGuide/Master/Tree/Basic-Concept/Query-Data.md index fba9d38e..9988c1ee 100644 --- a/src/zh/UserGuide/Master/Tree/Basic-Concept/Query-Data.md +++ b/src/zh/UserGuide/Master/Tree/Basic-Concept/Query-Data.md @@ -368,7 +368,7 @@ select s1 as temperature, s2 as speed from root.ln.wf01.wt01; ### 运算符 -IoTDB 中支持的运算符列表见文档 [运算符和函数](../User-Manual/Operator-and-Expression.md)。 +IoTDB 中支持的运算符列表见文档 [运算符和函数](../SQL-Manual/Operator-and-Expression.md)。 ### 函数 @@ -386,7 +386,7 @@ select sin(s1), count(s1) from root.sg.d1; select s1, count(s1) from root.sg.d1 group by ([10,100),10ms); ``` -IoTDB 支持的聚合函数见文档 [聚合函数](../User-Manual/Operator-and-Expression.md#内置函数)。 +IoTDB 支持的聚合函数见文档 [聚合函数](../SQL-Manual/Operator-and-Expression.md#内置函数)。 #### 时间序列生成函数 @@ -396,7 +396,7 @@ IoTDB 支持的聚合函数见文档 [聚合函数](../User-Manual/Operator-and- ##### 内置时间序列生成函数 -IoTDB 中支持的内置函数列表见文档 [运算符和函数](../User-Manual/Operator-and-Expression.md)。 +IoTDB 中支持的内置函数列表见文档 [运算符和函数](../SQL-Manual/Operator-and-Expression.md)。 ##### 自定义时间序列生成函数 @@ -2708,7 +2708,7 @@ It costs 0.012s ### 设备对齐模式下的排序 在设备对齐模式下,默认按照设备名的字典序升序排列,每个设备内部按照时间戳大小升序排列,可以通过 `ORDER BY` 子句调整设备列和时间列的排序优先级。 -详细说明及示例见文档 [结果集排序](./Operator-and-Expression.md)。 +详细说明及示例见文档 [结果集排序](../SQL-Manual/Operator-and-Expression.md)。 ## 查询写回(INTO 子句) diff --git a/src/zh/UserGuide/Master/Tree/Reference/Function-and-Expression.md b/src/zh/UserGuide/Master/Tree/SQL-Manual/Function-and-Expression.md similarity index 100% rename from src/zh/UserGuide/Master/Tree/Reference/Function-and-Expression.md rename to src/zh/UserGuide/Master/Tree/SQL-Manual/Function-and-Expression.md diff --git a/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md b/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md index 6da4c878..c3591e03 100644 --- a/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md +++ b/src/zh/UserGuide/Master/Tree/SQL-Manual/SQL-Manual.md @@ -1032,11 +1032,11 @@ explain analyze select s1,s2 from root.sg.d1 order by s1 ``` ## 运算符 -更多见文档[Operator-and-Expression](../Reference/Function-and-Expression.md#算数运算符和函数) +更多见文档[Operator-and-Expression](./Operator-and-Expression.md) ### 算数运算符 -更多见文档 [Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#算数运算符和函数) +更多见文档 [Arithmetic Operators and Functions](./Operator-and-Expression.md#算数运算符) ```sql select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root.sg.d1 @@ -1044,7 +1044,7 @@ select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root ### 比较运算符 -更多见文档[Comparison Operators and Functions](../Reference/Function-and-Expression.md#比较运算符和函数) +更多见文档[Comparison Operators and Functions](./Operator-and-Expression.md#比较运算符) ```sql # Basic comparison operators @@ -1075,7 +1075,7 @@ select a, a in (1, 2) from root.test; ### 逻辑运算符 -更多见文档[Logical Operators](../Reference/Function-and-Expression.md#逻辑运算符) +更多见文档[Logical Operators](./Operator-and-Expression.md#逻辑运算符) ```sql select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; @@ -1083,11 +1083,11 @@ select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; ## 内置函数 -更多见文档[Operator-and-Expression](../Reference/Function-and-Expression.md#聚合函数) +更多见文档[Operator-and-Expression](./Operator-and-Expression.md#聚合函数) ### Aggregate Functions -更多见文档[Aggregate Functions](../Reference/Function-and-Expression.md#聚合函数) +更多见文档[Aggregate Functions](./Operator-and-Expression.md#聚合函数) ```sql select count(status) from root.ln.wf01.wt01; @@ -1100,7 +1100,7 @@ select time_duration(s1) from root.db.d1; ### 算数函数 -更多见文档[Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#数学函数) +更多见文档[Arithmetic Operators and Functions](./Operator-and-Expression.md#数学函数) ```sql select s1, sin(s1), cos(s1), tan(s1) from root.sg1.d1 limit 5 offset 1000; @@ -1109,7 +1109,7 @@ select s4,round(s4),round(s4,2),round(s4,-1) from root.sg1.d1; ### 比较函数 -更多见文档[Comparison Operators and Functions](../Reference/Function-and-Expression.md#比较运算符和函数) +更多见文档[Comparison Operators and Functions](./Operator-and-Expression.md#比较函数) ```sql select ts, on_off(ts, 'threshold'='2') from root.test; @@ -1118,7 +1118,7 @@ select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test; ### 字符串处理函数 -更多见文档[String Processing](../Reference/Function-and-Expression.md#字符串处理) +更多见文档[String Processing](./Operator-and-Expression.md#字符串函数) ```sql select s1, string_contains(s1, 's'='warn') from root.sg1.d4; @@ -1146,7 +1146,7 @@ select regexsplit(s1, "regex"=",", "index"="3") from root.test.d1 ### 数据类型转换函数 -更多见文档[Data Type Conversion Function](../Reference/Function-and-Expression.md#数据类型转换) +更多见文档[Data Type Conversion Function](./Operator-and-Expression.md#数据类型转换函数) ```sql SELECT cast(s1 as INT32) from root.sg @@ -1154,7 +1154,7 @@ SELECT cast(s1 as INT32) from root.sg ### 常序列生成函数 -更多见文档[Constant Timeseries Generating Functions](../Reference/Function-and-Expression.md#常序列生成函数) +更多见文档[Constant Timeseries Generating Functions](./Operator-and-Expression.md#常序列生成函数) ```sql select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; @@ -1162,7 +1162,7 @@ select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from ### 选择函数 -更多见文档[Selector Functions](../Reference/Function-and-Expression.md#选择函数) +更多见文档[Selector Functions](./Operator-and-Expression.md#选择函数) ```sql select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time > 2020-12-10T20:36:15.530+08:00; @@ -1170,7 +1170,7 @@ select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time ### 区间查询函数 -更多见文档[Continuous Interval Functions](../Reference/Function-and-Expression.md#区间查询函数) +更多见文档[Continuous Interval Functions](./Operator-and-Expression.md#区间查询函数) ```sql select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_duration(s4) from root.sg.d2; @@ -1178,7 +1178,7 @@ select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_durat ### 趋势计算函数 -更多见文档[Variation Trend Calculation Functions](../Reference/Function-and-Expression.md#趋势计算函数) +更多见文档[Variation Trend Calculation Functions](./Operator-and-Expression.md#趋势计算函数) ```sql select s1, time_difference(s1), difference(s1), non_negative_difference(s1), derivative(s1), non_negative_derivative(s1) from root.sg1.d1 limit 5 offset 1000; @@ -1189,10 +1189,10 @@ SELECT DIFF(s1, 'ignoreNull'='false'), DIFF(s2, 'ignoreNull'='false') from root. ### 采样函数 -更多见文档[Sample Functions](../Reference/Function-and-Expression.md#采样函数)。 +更多见文档[Sample Functions](./Operator-and-Expression.md#采样函数)。 ### 时间序列处理函数 -更多见文档[Sample Functions](../Reference/Function-and-Expression.md#时间序列处理函数)。 +更多见文档[Sample Functions](./Operator-and-Expression.md#时间序列处理函数)。 ```sql select equal_size_bucket_random_sample(temperature,'proportion'='0.1') as random_sample from root.ln.wf01.wt01; @@ -1206,7 +1206,7 @@ select M4(s1,'windowSize'='10') from root.vehicle.d1 ### 时间序列处理函数 -更多见文档[Time-Series](../Reference/Function-and-Expression.md#时间序列处理) +更多见文档[Time-Series](./Operator-and-Expression.md#时间序列处理函数) ```sql select change_points(s1), change_points(s2), change_points(s3), change_points(s4), change_points(s5), change_points(s6) from root.testChangePoints.d1 @@ -1214,11 +1214,11 @@ select change_points(s1), change_points(s2), change_points(s3), change_points(s4 ## 数据质量函数库 -更多见文档[Operator-and-Expression](../Reference/UDF-Libraries.md) +更多见文档[UDF-Libraries](./UDF-Libraries_timecho.md) ### 数据质量 -更多见文档[Data-Quality](../Reference/UDF-Libraries.md#数据质量) +更多见文档[Data-Quality](./UDF-Libraries_timecho.md#数据质量) ```sql # Completeness @@ -1243,7 +1243,7 @@ select Accuracy(t1,t2,t3,m1,m2,m3) from root.test ### 数据画像 -更多见文档[Data-Profiling](../Reference/UDF-Libraries.md#数据画像) +更多见文档[Data-Profiling](./UDF-Libraries_timecho.md#数据画像) ```sql # ACF @@ -1323,7 +1323,7 @@ select zscore(s1) from root.test ### 异常检测 -更多见文档[Anomaly-Detection](../Reference/UDF-Libraries.md#异常检测) +更多见文档[Anomaly-Detection](./UDF-Libraries_timecho.md#异常检测) ```sql # IQR @@ -1358,7 +1358,7 @@ select MasterDetect(lo,la,m_lo,m_la,model,'output_type'='anomaly','p'='3','k'='3 ### 频域分析 -更多见文档[Frequency-Domain](../Reference/UDF-Libraries.md#频域分析) +更多见文档[Frequency-Domain](./UDF-Libraries_timecho.md#频域分析) ```sql # Conv @@ -1390,7 +1390,7 @@ select envelope(s1) from root.test.d1 ### 数据匹配 -更多见文档[Data-Matching](../Reference/UDF-Libraries.md#数据匹配) +更多见文档[Data-Matching](./UDF-Libraries_timecho.md#数据匹配) ```sql # Cov @@ -1411,7 +1411,7 @@ select xcorr(s1, s2) from root.test.d1 where time <= 2020-01-01 00:00:05 ### 数据修复 -更多见文档[Data-Repairing](../Reference/UDF-Libraries.md#数据修复) +更多见文档[Data-Repairing](./UDF-Libraries_timecho.md#数据修复) ```sql # TimestampRepair @@ -1436,7 +1436,7 @@ select seasonalrepair(s1,'method'='improved','period'=3) from root.test.d2 ### 序列发现 -更多见文档[Series-Discovery](../Reference/UDF-Libraries.md#序列发现) +更多见文档[Series-Discovery](./UDF-Libraries_timecho.md#序列发现) ```sql # ConsecutiveSequences @@ -1449,7 +1449,7 @@ select consecutivewindows(s1,s2,'length'='10m') from root.test.d1 ### 机器学习 -更多见文档[Machine-Learning](../Reference/UDF-Libraries.md#机器学习) +更多见文档[Machine-Learning](./UDF-Libraries_timecho.md#机器学习) ```sql # AR @@ -1464,7 +1464,7 @@ select rm(s0, s1,"tb"="3","vb"="2") from root.test.d0 ## Lambda 表达式 -更多见文档[Lambda](../Reference/Function-and-Expression.md#Lambda表达式) +更多见文档[Lambda](./Operator-and-Expression.md#lambda-表达式) ```sql select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'expr'='x -> {x * 3}') as jexl2, jexl(temperature, 'expr'='x -> {x * x}') as jexl3, jexl(temperature, 'expr'='x -> {multiply(x, 100)}') as jexl4, jexl(temperature, st, 'expr'='(x, y) -> {x + y}') as jexl5, jexl(temperature, st, str, 'expr'='(x, y, z) -> {x + y + z}') as jexl6 from root.ln.wf01.wt01;``` @@ -1472,7 +1472,7 @@ select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'exp ## 条件表达式 -更多见文档[Conditional Expressions](../Reference/Function-and-Expression.md#条件表达式) +更多见文档[Conditional Expressions](./Operator-and-Expression.md#条件表达式) ```sql select T, P, case diff --git a/src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function.md b/src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function_apache.md similarity index 96% rename from src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function.md rename to src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function_apache.md index 74b72580..7c085f60 100644 --- a/src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function.md +++ b/src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function_apache.md @@ -79,7 +79,7 @@ SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FRO ## 2. UDF 开发 -可以参考 UDF函数开发:[开发指导](../Reference/UDF-development.md) +可以参考 UDF函数开发:[开发指导](./UDF-development.md) ## 3. UDF 管理 @@ -194,7 +194,7 @@ udf_reader_transformer_collector_memory_proportion=1:1:1 基于用户自定义函数能力,IoTDB 提供了一系列关于时序数据处理的函数,包括数据质量、数据画像、异常检测、 频域分析、数据匹配、数据修复、序列发现、机器学习等,能够满足工业领域对时序数据处理的需求。 -可以参考 [UDF 函数库](../Reference/UDF-Libraries.md)文档,查找安装步骤及每个函数对应的注册语句,以确保正确注册所有需要的函数。 +可以参考 [UDF 函数库](../SQL-Manual/UDF-Libraries_apache.md)文档,查找安装步骤及每个函数对应的注册语句,以确保正确注册所有需要的函数。 ## 5. 常见问题: diff --git a/src/zh/UserGuide/latest/User-Manual/User-defined-function.md b/src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function_timecho.md similarity index 96% rename from src/zh/UserGuide/latest/User-Manual/User-defined-function.md rename to src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function_timecho.md index 74b72580..2125951b 100644 --- a/src/zh/UserGuide/latest/User-Manual/User-defined-function.md +++ b/src/zh/UserGuide/Master/Tree/User-Manual/User-defined-function_timecho.md @@ -79,7 +79,7 @@ SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FRO ## 2. UDF 开发 -可以参考 UDF函数开发:[开发指导](../Reference/UDF-development.md) +可以参考 UDF函数开发:[开发指导](./UDF-development.md) ## 3. UDF 管理 @@ -194,7 +194,7 @@ udf_reader_transformer_collector_memory_proportion=1:1:1 基于用户自定义函数能力,IoTDB 提供了一系列关于时序数据处理的函数,包括数据质量、数据画像、异常检测、 频域分析、数据匹配、数据修复、序列发现、机器学习等,能够满足工业领域对时序数据处理的需求。 -可以参考 [UDF 函数库](../Reference/UDF-Libraries.md)文档,查找安装步骤及每个函数对应的注册语句,以确保正确注册所有需要的函数。 +可以参考 [UDF 函数库](../SQL-Manual/UDF-Libraries_timecho.md)文档,查找安装步骤及每个函数对应的注册语句,以确保正确注册所有需要的函数。 ## 5. 常见问题: diff --git a/src/zh/UserGuide/latest/Basic-Concept/Query-Data.md b/src/zh/UserGuide/latest/Basic-Concept/Query-Data.md index fba9d38e..18b39eda 100644 --- a/src/zh/UserGuide/latest/Basic-Concept/Query-Data.md +++ b/src/zh/UserGuide/latest/Basic-Concept/Query-Data.md @@ -2708,7 +2708,7 @@ It costs 0.012s ### 设备对齐模式下的排序 在设备对齐模式下,默认按照设备名的字典序升序排列,每个设备内部按照时间戳大小升序排列,可以通过 `ORDER BY` 子句调整设备列和时间列的排序优先级。 -详细说明及示例见文档 [结果集排序](./Operator-and-Expression.md)。 +详细说明及示例见文档 [结果集排序](../SQL-Manual/Operator-and-Expression.md)。 ## 查询写回(INTO 子句) diff --git a/src/zh/UserGuide/latest/Reference/Function-and-Expression.md b/src/zh/UserGuide/latest/SQL-Manual/Function-and-Expression.md similarity index 100% rename from src/zh/UserGuide/latest/Reference/Function-and-Expression.md rename to src/zh/UserGuide/latest/SQL-Manual/Function-and-Expression.md diff --git a/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md b/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md index 6da4c878..c3591e03 100644 --- a/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md +++ b/src/zh/UserGuide/latest/SQL-Manual/SQL-Manual.md @@ -1032,11 +1032,11 @@ explain analyze select s1,s2 from root.sg.d1 order by s1 ``` ## 运算符 -更多见文档[Operator-and-Expression](../Reference/Function-and-Expression.md#算数运算符和函数) +更多见文档[Operator-and-Expression](./Operator-and-Expression.md) ### 算数运算符 -更多见文档 [Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#算数运算符和函数) +更多见文档 [Arithmetic Operators and Functions](./Operator-and-Expression.md#算数运算符) ```sql select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root.sg.d1 @@ -1044,7 +1044,7 @@ select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root ### 比较运算符 -更多见文档[Comparison Operators and Functions](../Reference/Function-and-Expression.md#比较运算符和函数) +更多见文档[Comparison Operators and Functions](./Operator-and-Expression.md#比较运算符) ```sql # Basic comparison operators @@ -1075,7 +1075,7 @@ select a, a in (1, 2) from root.test; ### 逻辑运算符 -更多见文档[Logical Operators](../Reference/Function-and-Expression.md#逻辑运算符) +更多见文档[Logical Operators](./Operator-and-Expression.md#逻辑运算符) ```sql select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; @@ -1083,11 +1083,11 @@ select a, b, a > 10, a <= b, !(a <= b), a > 10 && a > b from root.test; ## 内置函数 -更多见文档[Operator-and-Expression](../Reference/Function-and-Expression.md#聚合函数) +更多见文档[Operator-and-Expression](./Operator-and-Expression.md#聚合函数) ### Aggregate Functions -更多见文档[Aggregate Functions](../Reference/Function-and-Expression.md#聚合函数) +更多见文档[Aggregate Functions](./Operator-and-Expression.md#聚合函数) ```sql select count(status) from root.ln.wf01.wt01; @@ -1100,7 +1100,7 @@ select time_duration(s1) from root.db.d1; ### 算数函数 -更多见文档[Arithmetic Operators and Functions](../Reference/Function-and-Expression.md#数学函数) +更多见文档[Arithmetic Operators and Functions](./Operator-and-Expression.md#数学函数) ```sql select s1, sin(s1), cos(s1), tan(s1) from root.sg1.d1 limit 5 offset 1000; @@ -1109,7 +1109,7 @@ select s4,round(s4),round(s4,2),round(s4,-1) from root.sg1.d1; ### 比较函数 -更多见文档[Comparison Operators and Functions](../Reference/Function-and-Expression.md#比较运算符和函数) +更多见文档[Comparison Operators and Functions](./Operator-and-Expression.md#比较函数) ```sql select ts, on_off(ts, 'threshold'='2') from root.test; @@ -1118,7 +1118,7 @@ select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test; ### 字符串处理函数 -更多见文档[String Processing](../Reference/Function-and-Expression.md#字符串处理) +更多见文档[String Processing](./Operator-and-Expression.md#字符串函数) ```sql select s1, string_contains(s1, 's'='warn') from root.sg1.d4; @@ -1146,7 +1146,7 @@ select regexsplit(s1, "regex"=",", "index"="3") from root.test.d1 ### 数据类型转换函数 -更多见文档[Data Type Conversion Function](../Reference/Function-and-Expression.md#数据类型转换) +更多见文档[Data Type Conversion Function](./Operator-and-Expression.md#数据类型转换函数) ```sql SELECT cast(s1 as INT32) from root.sg @@ -1154,7 +1154,7 @@ SELECT cast(s1 as INT32) from root.sg ### 常序列生成函数 -更多见文档[Constant Timeseries Generating Functions](../Reference/Function-and-Expression.md#常序列生成函数) +更多见文档[Constant Timeseries Generating Functions](./Operator-and-Expression.md#常序列生成函数) ```sql select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from root.sg1.d1; @@ -1162,7 +1162,7 @@ select s1, s2, const(s1, 'value'='1024', 'type'='INT64'), pi(s2), e(s1, s2) from ### 选择函数 -更多见文档[Selector Functions](../Reference/Function-and-Expression.md#选择函数) +更多见文档[Selector Functions](./Operator-and-Expression.md#选择函数) ```sql select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time > 2020-12-10T20:36:15.530+08:00; @@ -1170,7 +1170,7 @@ select s1, top_k(s1, 'k'='2'), bottom_k(s1, 'k'='2') from root.sg1.d2 where time ### 区间查询函数 -更多见文档[Continuous Interval Functions](../Reference/Function-and-Expression.md#区间查询函数) +更多见文档[Continuous Interval Functions](./Operator-and-Expression.md#区间查询函数) ```sql select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_duration(s4) from root.sg.d2; @@ -1178,7 +1178,7 @@ select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_durat ### 趋势计算函数 -更多见文档[Variation Trend Calculation Functions](../Reference/Function-and-Expression.md#趋势计算函数) +更多见文档[Variation Trend Calculation Functions](./Operator-and-Expression.md#趋势计算函数) ```sql select s1, time_difference(s1), difference(s1), non_negative_difference(s1), derivative(s1), non_negative_derivative(s1) from root.sg1.d1 limit 5 offset 1000; @@ -1189,10 +1189,10 @@ SELECT DIFF(s1, 'ignoreNull'='false'), DIFF(s2, 'ignoreNull'='false') from root. ### 采样函数 -更多见文档[Sample Functions](../Reference/Function-and-Expression.md#采样函数)。 +更多见文档[Sample Functions](./Operator-and-Expression.md#采样函数)。 ### 时间序列处理函数 -更多见文档[Sample Functions](../Reference/Function-and-Expression.md#时间序列处理函数)。 +更多见文档[Sample Functions](./Operator-and-Expression.md#时间序列处理函数)。 ```sql select equal_size_bucket_random_sample(temperature,'proportion'='0.1') as random_sample from root.ln.wf01.wt01; @@ -1206,7 +1206,7 @@ select M4(s1,'windowSize'='10') from root.vehicle.d1 ### 时间序列处理函数 -更多见文档[Time-Series](../Reference/Function-and-Expression.md#时间序列处理) +更多见文档[Time-Series](./Operator-and-Expression.md#时间序列处理函数) ```sql select change_points(s1), change_points(s2), change_points(s3), change_points(s4), change_points(s5), change_points(s6) from root.testChangePoints.d1 @@ -1214,11 +1214,11 @@ select change_points(s1), change_points(s2), change_points(s3), change_points(s4 ## 数据质量函数库 -更多见文档[Operator-and-Expression](../Reference/UDF-Libraries.md) +更多见文档[UDF-Libraries](./UDF-Libraries_timecho.md) ### 数据质量 -更多见文档[Data-Quality](../Reference/UDF-Libraries.md#数据质量) +更多见文档[Data-Quality](./UDF-Libraries_timecho.md#数据质量) ```sql # Completeness @@ -1243,7 +1243,7 @@ select Accuracy(t1,t2,t3,m1,m2,m3) from root.test ### 数据画像 -更多见文档[Data-Profiling](../Reference/UDF-Libraries.md#数据画像) +更多见文档[Data-Profiling](./UDF-Libraries_timecho.md#数据画像) ```sql # ACF @@ -1323,7 +1323,7 @@ select zscore(s1) from root.test ### 异常检测 -更多见文档[Anomaly-Detection](../Reference/UDF-Libraries.md#异常检测) +更多见文档[Anomaly-Detection](./UDF-Libraries_timecho.md#异常检测) ```sql # IQR @@ -1358,7 +1358,7 @@ select MasterDetect(lo,la,m_lo,m_la,model,'output_type'='anomaly','p'='3','k'='3 ### 频域分析 -更多见文档[Frequency-Domain](../Reference/UDF-Libraries.md#频域分析) +更多见文档[Frequency-Domain](./UDF-Libraries_timecho.md#频域分析) ```sql # Conv @@ -1390,7 +1390,7 @@ select envelope(s1) from root.test.d1 ### 数据匹配 -更多见文档[Data-Matching](../Reference/UDF-Libraries.md#数据匹配) +更多见文档[Data-Matching](./UDF-Libraries_timecho.md#数据匹配) ```sql # Cov @@ -1411,7 +1411,7 @@ select xcorr(s1, s2) from root.test.d1 where time <= 2020-01-01 00:00:05 ### 数据修复 -更多见文档[Data-Repairing](../Reference/UDF-Libraries.md#数据修复) +更多见文档[Data-Repairing](./UDF-Libraries_timecho.md#数据修复) ```sql # TimestampRepair @@ -1436,7 +1436,7 @@ select seasonalrepair(s1,'method'='improved','period'=3) from root.test.d2 ### 序列发现 -更多见文档[Series-Discovery](../Reference/UDF-Libraries.md#序列发现) +更多见文档[Series-Discovery](./UDF-Libraries_timecho.md#序列发现) ```sql # ConsecutiveSequences @@ -1449,7 +1449,7 @@ select consecutivewindows(s1,s2,'length'='10m') from root.test.d1 ### 机器学习 -更多见文档[Machine-Learning](../Reference/UDF-Libraries.md#机器学习) +更多见文档[Machine-Learning](./UDF-Libraries_timecho.md#机器学习) ```sql # AR @@ -1464,7 +1464,7 @@ select rm(s0, s1,"tb"="3","vb"="2") from root.test.d0 ## Lambda 表达式 -更多见文档[Lambda](../Reference/Function-and-Expression.md#Lambda表达式) +更多见文档[Lambda](./Operator-and-Expression.md#lambda-表达式) ```sql select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'expr'='x -> {x * 3}') as jexl2, jexl(temperature, 'expr'='x -> {x * x}') as jexl3, jexl(temperature, 'expr'='x -> {multiply(x, 100)}') as jexl4, jexl(temperature, st, 'expr'='(x, y) -> {x + y}') as jexl5, jexl(temperature, st, str, 'expr'='(x, y, z) -> {x + y + z}') as jexl6 from root.ln.wf01.wt01;``` @@ -1472,7 +1472,7 @@ select jexl(temperature, 'expr'='x -> {x + x}') as jexl1, jexl(temperature, 'exp ## 条件表达式 -更多见文档[Conditional Expressions](../Reference/Function-and-Expression.md#条件表达式) +更多见文档[Conditional Expressions](./Operator-and-Expression.md#条件表达式) ```sql select T, P, case diff --git a/src/zh/UserGuide/latest/User-Manual/User-defined-function_apache.md b/src/zh/UserGuide/latest/User-Manual/User-defined-function_apache.md new file mode 100644 index 00000000..7c085f60 --- /dev/null +++ b/src/zh/UserGuide/latest/User-Manual/User-defined-function_apache.md @@ -0,0 +1,209 @@ +# 用户自定义函数 + +## 1. UDF 介绍 + +UDF(User Defined Function)即用户自定义函数,IoTDB 提供多种内建的面向时序处理的函数,也支持扩展自定义函数来满足更多的计算需求。 + +IoTDB 支持两种类型的 UDF 函数,如下表所示。 + + + + + + + + + + + + + + + + + + + + + +
UDF 分类数据访问策略描述
UDTFMAPPABLE_ROW_BY_ROW自定义标量函数,输入 k 列时间序列 1 行数据,输出 1 列时间序列 1 行数据,可用于标量函数出现的任何子句和表达式中,如select子句、where子句等。
ROW_BY_ROW
SLIDING_TIME_WINDOW
SLIDING_SIZE_WINDOW
SESSION_TIME_WINDOW
STATE_WINDOW
自定义时间序列生成函数,输入 k 列时间序列 m 行数据,输出 1 列时间序列 n 行数据,输入行数 m 可以与输出行数 n 不相同,只能用于SELECT子句中。
UDAF-自定义聚合函数,输入 k 列时间序列 m 行数据,输出 1 列时间序列 1 行数据,可用于聚合函数出现的任何子句和表达式中,如select子句、having子句等。
+ +### 1.1 UDF 使用 + +UDF 的使用方法与普通内建函数类似,可以直接在 SELECT 语句中像调用普通函数一样使用UDF。 + +#### 1.支持的基础 SQL 语法 + +* `SLIMIT` / `SOFFSET` +* `LIMIT` / `OFFSET` +* 支持值过滤 +* 支持时间过滤 + + +#### 2. 带 * 查询 + +假定现在有时间序列 `root.sg.d1.s1`和 `root.sg.d1.s2`。 + +* **执行`SELECT example(*) from root.sg.d1`** + +那么结果集中将包括`example(root.sg.d1.s1)`和`example(root.sg.d1.s2)`的结果。 + +* **执行`SELECT example(s1, *) from root.sg.d1`** + +那么结果集中将包括`example(root.sg.d1.s1, root.sg.d1.s1)`和`example(root.sg.d1.s1, root.sg.d1.s2)`的结果。 + +* **执行`SELECT example(*, *) from root.sg.d1`** + +那么结果集中将包括`example(root.sg.d1.s1, root.sg.d1.s1)`,`example(root.sg.d1.s2, root.sg.d1.s1)`,`example(root.sg.d1.s1, root.sg.d1.s2)` 和 `example(root.sg.d1.s2, root.sg.d1.s2)`的结果。 + +#### 3. 带自定义输入参数的查询 + +可以在进行 UDF 查询的时候,向 UDF 传入任意数量的键值对参数。键值对中的键和值都需要被单引号或者双引号引起来。注意,键值对参数只能在所有时间序列后传入。下面是一组例子: + + 示例: +``` sql +SELECT example(s1, 'key1'='value1', 'key2'='value2'), example(*, 'key3'='value3') FROM root.sg.d1; +SELECT example(s1, s2, 'key1'='value1', 'key2'='value2') FROM root.sg.d1; +``` + +#### 4. 与其他查询的嵌套查询 + + 示例: +``` sql +SELECT s1, s2, example(s1, s2) FROM root.sg.d1; +SELECT *, example(*) FROM root.sg.d1 DISABLE ALIGN; +SELECT s1 * example(* / s1 + s2) FROM root.sg.d1; +SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FROM root.sg.d1; +``` + + +## 2. UDF 开发 + +可以参考 UDF函数开发:[开发指导](./UDF-development.md) + +## 3. UDF 管理 + +### 3.1 UDF 注册 + +注册一个 UDF 可以按如下流程进行: + +1. 实现一个完整的 UDF 类,假定这个类的全类名为`org.apache.iotdb.udf.UDTFExample` +2. 将项目打成 JAR 包,如果使用 Maven 管理项目,可以参考 [Maven 项目示例](https://github.com/apache/iotdb/tree/master/example/udf)的写法 +3. 进行注册前的准备工作,根据注册方式的不同需要做不同的准备,具体可参考以下例子 +4. 使用以下 SQL 语句注册 UDF + +```sql +CREATE FUNCTION AS (USING URI URI-STRING) +``` + +#### 示例:注册名为`example`的 UDF,以下两种注册方式任选其一即可 + +#### 方式一:手动放置jar包 + +准备工作: +使用该种方式注册时,需要提前将 JAR 包放置到集群所有节点的 `ext/udf`目录下(该目录可配置)。 + +注册语句: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' +``` + +#### 方式二:集群通过URI自动安装jar包 + +准备工作: +使用该种方式注册时,需要提前将 JAR 包上传到 URI 服务器上并确保执行注册语句的 IoTDB 实例能够访问该 URI 服务器。 + +注册语句: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' USING URI 'http://jar/example.jar' +``` + +IoTDB 会下载 JAR 包并同步到整个集群。 + +#### 注意 + +1. 由于 IoTDB 的 UDF 是通过反射技术动态装载的,因此在装载过程中无需启停服务器。 + +2. UDF 函数名称是大小写不敏感的。 + +3. 请不要给 UDF 函数注册一个内置函数的名字。使用内置函数的名字给 UDF 注册会失败。 + +4. 不同的 JAR 包中最好不要有全类名相同但实现功能逻辑不一样的类。例如 UDF(UDAF/UDTF):`udf1`、`udf2`分别对应资源`udf1.jar`、`udf2.jar`。如果两个 JAR 包里都包含一个`org.apache.iotdb.udf.UDTFExample`类,当同一个 SQL 中同时使用到这两个 UDF 时,系统会随机加载其中一个类,导致 UDF 执行行为不一致。 + +### 3.2 UDF 卸载 + +SQL 语法如下: + +```sql +DROP FUNCTION +``` + +示例:卸载上述例子的 UDF: + +```sql +DROP FUNCTION example +``` + + +### 3.3 查看所有注册的 UDF + +``` sql +SHOW FUNCTIONS +``` + +### 3.4 UDF 配置 + +- 允许在 `iotdb-system.properties` 中配置 udf 的存储目录.: + ``` Properties +# UDF lib dir + +udf_lib_dir=ext/udf +``` + +- 使用自定义函数时,提示内存不足,更改 `iotdb-system.properties` 中下述配置参数并重启服务。 + ``` Properties + +# Used to estimate the memory usage of text fields in a UDF query. +# It is recommended to set this value to be slightly larger than the average length of all text +# effectiveMode: restart +# Datatype: int +udf_initial_byte_array_length_for_memory_control=48 + +# How much memory may be used in ONE UDF query (in MB). +# The upper limit is 20% of allocated memory for read. +# effectiveMode: restart +# Datatype: float +udf_memory_budget_in_mb=30.0 + +# UDF memory allocation ratio. +# The parameter form is a:b:c, where a, b, and c are integers. +# effectiveMode: restart +udf_reader_transformer_collector_memory_proportion=1:1:1 +``` + +### 3.5 UDF 用户权限 + +用户在使用 UDF 时会涉及到 `USE_UDF` 权限,具备该权限的用户才被允许执行 UDF 注册、卸载和查询操作。 + +更多用户权限相关的内容,请参考 [权限管理语句](./Authority-Management.md##权限管理)。 + + +## 4. UDF 函数库 + +基于用户自定义函数能力,IoTDB 提供了一系列关于时序数据处理的函数,包括数据质量、数据画像、异常检测、 频域分析、数据匹配、数据修复、序列发现、机器学习等,能够满足工业领域对时序数据处理的需求。 + +可以参考 [UDF 函数库](../SQL-Manual/UDF-Libraries_apache.md)文档,查找安装步骤及每个函数对应的注册语句,以确保正确注册所有需要的函数。 + +## 5. 常见问题: + +1. 如何修改已经注册的 UDF? + +答:假设 UDF 的名称为`example`,全类名为`org.apache.iotdb.udf.UDTFExample`,由`example.jar`引入 + +1. 首先卸载已经注册的`example`函数,执行`DROP FUNCTION example` +2. 删除 `iotdb-server-1.0.0-all-bin/ext/udf` 目录下的`example.jar` +3. 修改`org.apache.iotdb.udf.UDTFExample`中的逻辑,重新打包,JAR 包的名字可以仍然为`example.jar` +4. 将新的 JAR 包上传至 `iotdb-server-1.0.0-all-bin/ext/udf` 目录下 +5. 装载新的 UDF,执行`CREATE FUNCTION example AS "org.apache.iotdb.udf.UDTFExample"` \ No newline at end of file diff --git a/src/zh/UserGuide/latest/User-Manual/User-defined-function_timecho.md b/src/zh/UserGuide/latest/User-Manual/User-defined-function_timecho.md new file mode 100644 index 00000000..2125951b --- /dev/null +++ b/src/zh/UserGuide/latest/User-Manual/User-defined-function_timecho.md @@ -0,0 +1,209 @@ +# 用户自定义函数 + +## 1. UDF 介绍 + +UDF(User Defined Function)即用户自定义函数,IoTDB 提供多种内建的面向时序处理的函数,也支持扩展自定义函数来满足更多的计算需求。 + +IoTDB 支持两种类型的 UDF 函数,如下表所示。 + + + + + + + + + + + + + + + + + + + + + +
UDF 分类数据访问策略描述
UDTFMAPPABLE_ROW_BY_ROW自定义标量函数,输入 k 列时间序列 1 行数据,输出 1 列时间序列 1 行数据,可用于标量函数出现的任何子句和表达式中,如select子句、where子句等。
ROW_BY_ROW
SLIDING_TIME_WINDOW
SLIDING_SIZE_WINDOW
SESSION_TIME_WINDOW
STATE_WINDOW
自定义时间序列生成函数,输入 k 列时间序列 m 行数据,输出 1 列时间序列 n 行数据,输入行数 m 可以与输出行数 n 不相同,只能用于SELECT子句中。
UDAF-自定义聚合函数,输入 k 列时间序列 m 行数据,输出 1 列时间序列 1 行数据,可用于聚合函数出现的任何子句和表达式中,如select子句、having子句等。
+ +### 1.1 UDF 使用 + +UDF 的使用方法与普通内建函数类似,可以直接在 SELECT 语句中像调用普通函数一样使用UDF。 + +#### 1.支持的基础 SQL 语法 + +* `SLIMIT` / `SOFFSET` +* `LIMIT` / `OFFSET` +* 支持值过滤 +* 支持时间过滤 + + +#### 2. 带 * 查询 + +假定现在有时间序列 `root.sg.d1.s1`和 `root.sg.d1.s2`。 + +* **执行`SELECT example(*) from root.sg.d1`** + +那么结果集中将包括`example(root.sg.d1.s1)`和`example(root.sg.d1.s2)`的结果。 + +* **执行`SELECT example(s1, *) from root.sg.d1`** + +那么结果集中将包括`example(root.sg.d1.s1, root.sg.d1.s1)`和`example(root.sg.d1.s1, root.sg.d1.s2)`的结果。 + +* **执行`SELECT example(*, *) from root.sg.d1`** + +那么结果集中将包括`example(root.sg.d1.s1, root.sg.d1.s1)`,`example(root.sg.d1.s2, root.sg.d1.s1)`,`example(root.sg.d1.s1, root.sg.d1.s2)` 和 `example(root.sg.d1.s2, root.sg.d1.s2)`的结果。 + +#### 3. 带自定义输入参数的查询 + +可以在进行 UDF 查询的时候,向 UDF 传入任意数量的键值对参数。键值对中的键和值都需要被单引号或者双引号引起来。注意,键值对参数只能在所有时间序列后传入。下面是一组例子: + + 示例: +``` sql +SELECT example(s1, 'key1'='value1', 'key2'='value2'), example(*, 'key3'='value3') FROM root.sg.d1; +SELECT example(s1, s2, 'key1'='value1', 'key2'='value2') FROM root.sg.d1; +``` + +#### 4. 与其他查询的嵌套查询 + + 示例: +``` sql +SELECT s1, s2, example(s1, s2) FROM root.sg.d1; +SELECT *, example(*) FROM root.sg.d1 DISABLE ALIGN; +SELECT s1 * example(* / s1 + s2) FROM root.sg.d1; +SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FROM root.sg.d1; +``` + + +## 2. UDF 开发 + +可以参考 UDF函数开发:[开发指导](./UDF-development.md) + +## 3. UDF 管理 + +### 3.1 UDF 注册 + +注册一个 UDF 可以按如下流程进行: + +1. 实现一个完整的 UDF 类,假定这个类的全类名为`org.apache.iotdb.udf.UDTFExample` +2. 将项目打成 JAR 包,如果使用 Maven 管理项目,可以参考 [Maven 项目示例](https://github.com/apache/iotdb/tree/master/example/udf)的写法 +3. 进行注册前的准备工作,根据注册方式的不同需要做不同的准备,具体可参考以下例子 +4. 使用以下 SQL 语句注册 UDF + +```sql +CREATE FUNCTION AS (USING URI URI-STRING) +``` + +#### 示例:注册名为`example`的 UDF,以下两种注册方式任选其一即可 + +#### 方式一:手动放置jar包 + +准备工作: +使用该种方式注册时,需要提前将 JAR 包放置到集群所有节点的 `ext/udf`目录下(该目录可配置)。 + +注册语句: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' +``` + +#### 方式二:集群通过URI自动安装jar包 + +准备工作: +使用该种方式注册时,需要提前将 JAR 包上传到 URI 服务器上并确保执行注册语句的 IoTDB 实例能够访问该 URI 服务器。 + +注册语句: + +```sql +CREATE FUNCTION example AS 'org.apache.iotdb.udf.UDTFExample' USING URI 'http://jar/example.jar' +``` + +IoTDB 会下载 JAR 包并同步到整个集群。 + +#### 注意 + +1. 由于 IoTDB 的 UDF 是通过反射技术动态装载的,因此在装载过程中无需启停服务器。 + +2. UDF 函数名称是大小写不敏感的。 + +3. 请不要给 UDF 函数注册一个内置函数的名字。使用内置函数的名字给 UDF 注册会失败。 + +4. 不同的 JAR 包中最好不要有全类名相同但实现功能逻辑不一样的类。例如 UDF(UDAF/UDTF):`udf1`、`udf2`分别对应资源`udf1.jar`、`udf2.jar`。如果两个 JAR 包里都包含一个`org.apache.iotdb.udf.UDTFExample`类,当同一个 SQL 中同时使用到这两个 UDF 时,系统会随机加载其中一个类,导致 UDF 执行行为不一致。 + +### 3.2 UDF 卸载 + +SQL 语法如下: + +```sql +DROP FUNCTION +``` + +示例:卸载上述例子的 UDF: + +```sql +DROP FUNCTION example +``` + + +### 3.3 查看所有注册的 UDF + +``` sql +SHOW FUNCTIONS +``` + +### 3.4 UDF 配置 + +- 允许在 `iotdb-system.properties` 中配置 udf 的存储目录.: + ``` Properties +# UDF lib dir + +udf_lib_dir=ext/udf +``` + +- 使用自定义函数时,提示内存不足,更改 `iotdb-system.properties` 中下述配置参数并重启服务。 + ``` Properties + +# Used to estimate the memory usage of text fields in a UDF query. +# It is recommended to set this value to be slightly larger than the average length of all text +# effectiveMode: restart +# Datatype: int +udf_initial_byte_array_length_for_memory_control=48 + +# How much memory may be used in ONE UDF query (in MB). +# The upper limit is 20% of allocated memory for read. +# effectiveMode: restart +# Datatype: float +udf_memory_budget_in_mb=30.0 + +# UDF memory allocation ratio. +# The parameter form is a:b:c, where a, b, and c are integers. +# effectiveMode: restart +udf_reader_transformer_collector_memory_proportion=1:1:1 +``` + +### 3.5 UDF 用户权限 + +用户在使用 UDF 时会涉及到 `USE_UDF` 权限,具备该权限的用户才被允许执行 UDF 注册、卸载和查询操作。 + +更多用户权限相关的内容,请参考 [权限管理语句](./Authority-Management.md##权限管理)。 + + +## 4. UDF 函数库 + +基于用户自定义函数能力,IoTDB 提供了一系列关于时序数据处理的函数,包括数据质量、数据画像、异常检测、 频域分析、数据匹配、数据修复、序列发现、机器学习等,能够满足工业领域对时序数据处理的需求。 + +可以参考 [UDF 函数库](../SQL-Manual/UDF-Libraries_timecho.md)文档,查找安装步骤及每个函数对应的注册语句,以确保正确注册所有需要的函数。 + +## 5. 常见问题: + +1. 如何修改已经注册的 UDF? + +答:假设 UDF 的名称为`example`,全类名为`org.apache.iotdb.udf.UDTFExample`,由`example.jar`引入 + +1. 首先卸载已经注册的`example`函数,执行`DROP FUNCTION example` +2. 删除 `iotdb-server-1.0.0-all-bin/ext/udf` 目录下的`example.jar` +3. 修改`org.apache.iotdb.udf.UDTFExample`中的逻辑,重新打包,JAR 包的名字可以仍然为`example.jar` +4. 将新的 JAR 包上传至 `iotdb-server-1.0.0-all-bin/ext/udf` 目录下 +5. 装载新的 UDF,执行`CREATE FUNCTION example AS "org.apache.iotdb.udf.UDTFExample"` \ No newline at end of file