Merge pull request #29190 from taosdata/docs/TD-33244

docs:[TD-33244] Add version support description to function documenta…
This commit is contained in:
Shengliang Guan 2024-12-17 18:17:18 +08:00 committed by GitHub
commit f2f6ff0a1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 106 additions and 4 deletions

View File

@ -190,6 +190,7 @@ ROUND(expr[, digits])
- `digits` less than zero means discarding the decimal places and rounding the number to the left of the decimal point by `digits` places. If the number of places to the left of the decimal point is less than `digits`, returns 0.
- Since the DECIMAL type is not yet supported, this function will use DOUBLE and FLOAT to represent results containing decimals, but DOUBLE and FLOAT have precision limits, and using this function may be meaningless when there are too many digits.
- Can only be used with regular columns, selection (Selection), projection (Projection) functions, and cannot be used with aggregation (Aggregation) functions.
- `digits` is supported from version 3.3.3.0.
**Example**:
@ -249,6 +250,8 @@ TAN(expr)
**Function Description**: Obtains the tangent result of the specified field.
**Version**: ver-3.3.3.0
**Return Result Type**: DOUBLE.
**Applicable Data Types**: Numeric types.
@ -297,6 +300,8 @@ TRUNCATE(expr, digits)
**Function Description**: Gets the truncated value of the specified field to the specified number of digits.
**Version**: ver-3.3.3.0
**Return Type**: Consistent with the original data type of the `expr` field.
**Applicable Data Types**:
@ -340,6 +345,8 @@ EXP(expr)
**Function Description**: Returns the value of e (the base of natural logarithms) raised to the specified power.
**Version**: ver-3.3.3.0
**Return Type**: DOUBLE.
**Applicable Data Types**: Numeric type.
@ -370,6 +377,8 @@ LN(expr)
**Function Description**: Returns the natural logarithm of the specified parameter.
**Version**: ver-3.3.3.0
**Return Type**: DOUBLE.
**Applicable Data Types**: Numeric type.
@ -401,6 +410,8 @@ MOD(expr1, expr2)
**Function Description**: Calculates the result of expr1 % expr2.
**Version**: ver-3.3.3.0
**Return Type**: DOUBLE.
**Applicable Data Types**: Numeric type.
@ -437,6 +448,8 @@ RAND([seed])
**Function Description**: Returns a uniformly distributed random number from 0 to 1.
**Version**: ver-3.3.3.0
**Return Result Type**: DOUBLE.
**Applicable Data Types**:
@ -484,6 +497,8 @@ SIGN(expr)
**Function Description**: Returns the sign of the specified parameter.
**Version**: ver-3.3.3.0
**Return Result Type**: Consistent with the original data type of the specified field.
**Applicable Data Types**: Numeric types.
@ -527,6 +542,8 @@ DEGREES(expr)
**Function Description**: Calculates the value of the specified parameter converted from radians to degrees.
**Version**: ver-3.3.3.0
**Return Result Type**: DOUBLE.
**Applicable Data Types**: Numeric types.
@ -558,6 +575,8 @@ RADIANS(expr)
**Function Description**: Calculates the value of the specified parameter converted from degrees to radians.
**Version**: ver-3.3.3.0
**Return Type**: DOUBLE.
**Applicable Data Types**: Numeric types.
@ -729,6 +748,8 @@ TRIM([remstr FROM] expr)
**Function Description**: Returns the string expr with all prefixes or suffixes of remstr removed.
**Version**: ver-3.3.3.0
**Return Result Type**: Same as the original type of the input field expr.
**Applicable Data Types**:
@ -807,6 +828,8 @@ SUBSTRING/SUBSTR(expr FROM pos [FOR len])
- If `len` is less than 1, returns an empty string.
- `pos` is 1-based; if `pos` is 0, returns an empty string.
- If `pos` + `len` exceeds `len(expr)`, returns the substring from `pos` to the end of the string, equivalent to executing `substring(expr, pos)`.
- Function `SUBSTRING` is equal to `SUBSTR`, supported from ver-3.3.3.0.
- Syntax `SUBSTRING/SUBSTR(expr FROM pos [FOR len])` is supported from ver-3.3.3.0.
**Examples**:
@ -845,6 +868,8 @@ SUBSTRING_INDEX(expr, delim, count)
**Function Description**: Returns a substring of `expr` cut at the position where the delimiter appears the specified number of times.
**Version**: ver-3.3.3.0
**Return Result Type**: Same as the original type of the input field `expr`.
**Applicable Data Types**:
@ -902,6 +927,8 @@ CHAR(expr1 [, expr2] [, expr3] ...)
**Function Description**: Treats the input parameters as integers and returns the characters corresponding to these integers in ASCII encoding.
**Version**: ver-3.3.3.0
**Return Result Type**: VARCHAR.
**Applicable Data Types**: Integer types, VARCHAR, NCHAR.
@ -949,6 +976,8 @@ ASCII(expr)
**Function Description**: Returns the ASCII code of the first character of the string.
**Version**: ver-3.3.3.0
**Return Result Data Type**: BIGINT.
**Applicable Data Types**: VARCHAR, NCHAR.
@ -979,6 +1008,8 @@ POSITION(expr1 IN expr2)
**Function Description**: Calculates the position of string `expr1` in string `expr2`.
**Version**: ver-3.3.3.0
**Return Result Type**: BIGINT.
**Applicable Data Types**:
@ -1026,6 +1057,8 @@ REPLACE(expr, from_str, to_str)
**Function Description**: Replaces all occurrences of `from_str` in the string with `to_str`.
**Version**: ver-3.3.3.0
**Return Type**: Same as the original type of the input field `expr`.
**Applicable Data Types**:
@ -1061,6 +1094,8 @@ REPEAT(expr, count)
**Function Description**: Returns a string that repeats the string `expr` a specified number of times.
**Version**: ver-3.3.3.0
**Return Type**: Same as the original type of the input field `expr`.
**Applicable Data Types**:
@ -1319,6 +1354,7 @@ TIMEDIFF(expr1, expr2 [, time_unit])
- `expr1`: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 standard date-time format.
- `expr2`: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 standard date-time format.
- `time_unit`: See usage instructions.
- `timediff` return the absolute value of the difference between timestamp `expr1` and `expr2` before ver-3.3.3.0.
**Nested Subquery Support**: Applicable to both inner and outer queries.
@ -1423,6 +1459,8 @@ WEEK(expr [, mode])
**Function Description**: Returns the week number of the input date.
**Version**: ver-3.3.3.0
**Return Result Type**: BIGINT.
**Applicable Data Types**:
@ -1490,6 +1528,8 @@ WEEKOFYEAR(expr)
**Function Description**: Returns the week number of the input date.
**Version**: ver-3.3.3.0
**Return Type**: BIGINT.
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
@ -1521,6 +1561,8 @@ WEEKDAY(expr)
**Function Description**: Returns the weekday of the input date.
**Version**: ver-3.3.3.0
**Return Type**: BIGINT.
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
@ -1552,6 +1594,8 @@ DAYOFWEEK(expr)
**Function Description**: Returns the weekday of the input date.
**Version**: ver-3.3.3.0
**Return Type**: BIGINT.
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
@ -1707,6 +1751,9 @@ STDDEV/STDDEV_POP(expr)
**Applicable to**: Tables and supertables.
**Description**:
- Function `STDDEV_POP` equals `STDDEV` and is supported from ver-3.3.3.0.
**Example**:
```sql
@ -1733,6 +1780,8 @@ VAR_POP(expr)
**Function Description**: Calculates the population variance of a column in a table.
**Version**: ver-3.3.3.0
**Return Data Type**: DOUBLE.
**Applicable Data Types**: Numeric types.
@ -1975,7 +2024,8 @@ MAX(expr)
**Applicable to**: Tables and supertables.
**Usage Instructions**: The max function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value.
**Usage Instructions**:
- The max function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value(supported from ver-3.3.3.0, function `max` only accept numeric parameter before ver-3.3.3.0).
### MIN
@ -1991,7 +2041,8 @@ MIN(expr)
**Applicable to**: Tables and supertables.
**Usage Instructions**: The min function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value.
**Usage Instructions**:
- The min function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value(supported from ver-3.3.3.0, function `min` only accept numeric parameter before ver-3.3.3.0).
### MODE

View File

@ -193,6 +193,7 @@ ROUND(expr[, digits])
- `digits` 小于零表示丢掉小数位,并将数字四舍五入到小数点左侧 `digits` 位。若小数点左侧的位数小于 `digits`位,返回 0。
- 由于暂未支持 DECIMAL 类型,所以该函数会用 DOUBLE 和 FLOAT 来表示包含小数的结果,但是 DOUBLE 和 FLOAT 是有精度上限的,当位数太多时使用该函数可能没有意义。
- 只能与普通列选择Selection、投影Projection函数一起使用不能与聚合Aggregation函数一起使用。
- `digits` 从 ver-3.3.3.0 开始支持。
**举例**
```sql
@ -268,6 +269,8 @@ PI()
**功能说明**:返回圆周率 π 的值。
**版本**: ver-3.3.3.0
**返回结果类型**DOUBLE。
**适用数据类型**:无。
@ -295,6 +298,8 @@ TRUNCATE(expr, digits)
**功能说明**:获得指定字段按照指定位数截断的值。
**版本**: ver-3.3.3.0
**返回结果类型**:与 `expr` 字段的原始数据类型一致。
**适用数据类型**
@ -333,6 +338,8 @@ EXP(expr)
```
**功能说明**:返回 e自然对数的底的指定乘方后的值。
**版本**: ver-3.3.3.0
**返回结果类型**DOUBLE。
**适用数据类型**:数值类型。
@ -360,6 +367,8 @@ LN(expr)
**功能说明**:返回指定参数的自然对数。
**版本**: ver-3.3.3.0
**返回结果类型**DOUBLE。
**适用数据类型**:数值类型。
@ -388,6 +397,8 @@ MOD(expr1, expr2)
**功能说明**:计算 expr1 % expr2 的结果。
**版本**: ver-3.3.3.0
**返回结果类型**DOUBLE。
**适用数据类型**:数值类型。
@ -421,6 +432,8 @@ RAND([seed])
**功能说明**返回一个从0到1均匀分布的随机数。
**版本**: ver-3.3.3.0
**返回结果类型**DOUBLE。
**适用数据类型**
@ -464,6 +477,8 @@ SIGN(expr)
**功能说明**:返回指定参数的符号。
**版本**: ver-3.3.3.0
**返回结果类型**:与指定字段的原始数据类型一致。
**适用数据类型**:数值类型。
@ -504,6 +519,8 @@ DEGREES(expr)
**功能说明**:计算指定参数由弧度值转为角度后的值。
**版本**: ver-3.3.3.0
**返回结果类型**DOUBLE。
**适用数据类型**:数值类型。
@ -532,6 +549,8 @@ RADIANS(expr)
**功能说明**:计算指定参数由角度值转为弧度后的值。
**版本**: ver-3.3.3.0
**返回结果类型**DOUBLE。
**适用数据类型**:数值类型。
@ -702,6 +721,8 @@ TRIM([remstr FROM] expr)
**功能说明**:返回去掉了所有 remstr 前缀或后缀的字符串 epxr 。
**版本**: ver-3.3.3.0
**返回结果类型**:与输入字段 epxr 的原始类型相同。
**适用数据类型**
@ -773,6 +794,8 @@ SUBSTRING/SUBSTR(expr FROM pos [FOR len])
- 若 `len` 小于 1返回空串。
- `pos` 是 1-base 的,若 `pos` 为 0返回空串。
- 若 `pos` + `len` 大于 `len(expr)`,返回从 `pos` 开始到字符串结尾的子串,等同于执行 `substring(expr, pos)`
- `SUBSTRING` 函数等价于 `SUBSTR`, 从 ver-3.3.3.0 开始支持。
- `SUBSTRING/SUBSTR(expr FROM pos [FOR len])` 语法从 ver-3.3.3.0 开始支持。
**举例**
```sql
@ -809,6 +832,8 @@ SUBSTRING_INDEX(expr, delim, count)
**功能说明**:返回字符串 `expr` 在出现指定次数分隔符的位置截取的子串。
**版本**: ver-3.3.3.0
**返回结果类型**:与输入字段 `expr` 的原始类型相同。
**适用数据类型**
@ -862,6 +887,8 @@ CHAR(expr1 [, expr2] [, epxr3] ...)
**功能说明**:将输入参数当作整数,并返回这些整数在 ASCII 编码中对应的字符。
**版本**: ver-3.3.3.0
**返回结果类型**VARCHAR。
**适用数据类型**:整数类型,VARCHAR,NCHAR。
@ -906,6 +933,8 @@ ASCII(expr)
**功能说明**:返回字符串第一个字符的 ASCII 码。
**版本**: ver-3.3.3.0
**返回结果数据类型**BIGINT。
**适用数据类型**VARCHAR, NCHAR。
@ -933,6 +962,8 @@ POSITION(expr1 IN expr2)
**功能说明**:计算字符串 `expr1` 在字符串 `expr2` 中的位置。
**版本**: ver-3.3.3.0
**返回结果类型**BIGINT。
**适用数据类型**
@ -975,6 +1006,8 @@ REPLACE(expr, from_str, to_str)
```
**功能说明**:将字符串中的 `from_str` 全部替换为 `to_str`
**版本**: ver-3.3.3.0
**返回结果类型**:与输入字段 `expr` 的原始类型相同。
**适用数据类型**
@ -1005,6 +1038,8 @@ REPEAT(expr, count)
```
**功能说明**:返回将字符串重复指定次数得到的字符串。
**版本**: ver-3.3.3.0
**返回结果类型**:与输入字段 `expr` 的原始类型相同。
**适用数据类型**
@ -1260,6 +1295,7 @@ TIMEDIFF(expr1, expr2 [, time_unit])
- `expr1`:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
- `expr2`:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
- `time_unit`:见使用说明。
- ver-3.3.3.0 之前该函数结果为时间戳 `expr1``expr2` 的差值的绝对值,结果为正数。
**嵌套子查询支持**:适用于内层查询和外层查询。
@ -1361,6 +1397,8 @@ WEEK(expr [, mode])
```
**功能说明**:返回输入日期的周数。
**版本**: ver-3.3.3.0
**返回结果类型**BIGINT。
**适用数据类型**
@ -1422,6 +1460,8 @@ WEEKOFYEAR(expr)
```
**功能说明**:返回输入日期的周数。
**版本**: ver-3.3.3.0
**返回结果类型**BIGINT。
**适用数据类型**:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
@ -1449,6 +1489,8 @@ WEEKDAY(expr)
```
**功能说明**:返回输入日期是周几。
**版本**: ver-3.3.3.0
**返回结果类型**BIGINT。
**适用数据类型**:表示 表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
@ -1476,6 +1518,8 @@ DAYOFWEEK(expr)
```
**功能说明**:返回输入日期是周几。
**版本**: ver-3.3.3.0
**返回结果类型**BIGINT。
**适用数据类型**:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
@ -1633,6 +1677,9 @@ STDDEV/STDDEV_POP(expr)
**适用于**:表和超级表。
**说明**
- `STDDEV_POP` 函数等价于 `STDDEV` 函数,从 ver-3.3.3.0 开始支持。
**举例**
```sql
taos> select id from test_stddev;
@ -1656,6 +1703,8 @@ VAR_POP(expr)
**功能说明**:统计表中某列的总体方差。
**版本**: ver-3.3.3.0
**返回数据类型**DOUBLE。
**适用数据类型**:数值类型。
@ -1898,7 +1947,8 @@ MAX(expr)
**适用于**:表和超级表。
**使用说明**max 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值。
**使用说明**
- max 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值,从 ver-3.3.3.0 开始支持,之前的版本不支持字符串参数。
### MIN
@ -1914,7 +1964,8 @@ MIN(expr)
**适用于**:表和超级表。
**使用说明**min 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值。
**使用说明**
- min 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值,从 ver-3.3.3.0 开始支持,之前的版本不支持字符串参数。
### MODE