Merge pull request #29748 from taosdata/fix/TS-5972/castDouble3.0

Fix/ts 5972/cast double3.0
This commit is contained in:
Pan Wei 2025-02-12 09:17:14 +08:00 committed by GitHub
commit 15efd7abb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 948 additions and 921 deletions

View File

@ -216,55 +216,43 @@ typedef struct {
} \
} while (0)
#define NUM_TO_STRING(_inputType, _input, _outputBytes, _output) \
do { \
switch (_inputType) { \
case TSDB_DATA_TYPE_TINYINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int8_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_UTINYINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint8_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_SMALLINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int16_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_USMALLINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint16_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_TIMESTAMP: \
case TSDB_DATA_TYPE_BIGINT: \
snprintf(_output, (int32_t)(_outputBytes), "%" PRId64, *(int64_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_UBIGINT: \
snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_FLOAT: { \
int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \
if (n >= (_outputBytes)) { \
n = snprintf(_output, (int32_t)(_outputBytes), "%.7e", *(float *)(_input)); \
if (n >= (_outputBytes)) { \
snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \
} \
} \
break; \
} \
case TSDB_DATA_TYPE_DOUBLE: { \
int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \
if (n >= (_outputBytes)) { \
snprintf(_output, (int32_t)(_outputBytes), "%.15e", *(double *)(_input)); \
if (n >= (_outputBytes)) { \
snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \
} \
} \
break; \
} \
case TSDB_DATA_TYPE_UINT: \
snprintf(_output, (int32_t)(_outputBytes), "%u", *(uint32_t *)(_input)); \
break; \
default: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int32_t *)(_input)); \
break; \
} \
#define NUM_TO_STRING(_inputType, _input, _outputBytes, _output) \
do { \
switch (_inputType) { \
case TSDB_DATA_TYPE_TINYINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int8_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_UTINYINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint8_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_SMALLINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int16_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_USMALLINT: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint16_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_TIMESTAMP: \
case TSDB_DATA_TYPE_BIGINT: \
snprintf(_output, (int32_t)(_outputBytes), "%" PRId64, *(int64_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_UBIGINT: \
snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input)); \
break; \
case TSDB_DATA_TYPE_FLOAT: { \
snprintf(_output, (int32_t)(_outputBytes), "%.*g", FLT_DIG, *(float *)(_input)); \
break; \
} \
case TSDB_DATA_TYPE_DOUBLE: { \
snprintf(_output, (int32_t)(_outputBytes), "%.*g", DBL_DIG, *(double *)(_input)); \
break; \
} \
case TSDB_DATA_TYPE_UINT: \
snprintf(_output, (int32_t)(_outputBytes), "%u", *(uint32_t *)(_input)); \
break; \
default: \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int32_t *)(_input)); \
break; \
} \
} while (0)
// TODO: use varchar(0) to represent NULL type

View File

@ -699,13 +699,13 @@ int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD
case TSDB_DATA_TYPE_FLOAT: {
float fv = 0;
fv = GET_FLOAT_VAL(row[i]);
len += tsnprintf(str + len, size - len, "%f", fv);
len += snprintf(str + len, size - len, "%.*g", FLT_DIG, fv);
} break;
case TSDB_DATA_TYPE_DOUBLE: {
double dv = 0;
dv = GET_DOUBLE_VAL(row[i]);
len += tsnprintf(str + len, size - len, "%lf", dv);
len += snprintf(str + len, size - len, "%.*g", DBL_DIG, dv);
} break;
case TSDB_DATA_TYPE_VARBINARY: {

View File

@ -27,12 +27,12 @@ taos> select ASCII('北京涛思数据科技有限公司')
taos> select ASCII('hello') + 1
ascii('hello') + 1 |
============================
105.000000000000000 |
105 |
taos> select ASCII('hello') - 1
ascii('hello') - 1 |
============================
103.000000000000000 |
103 |
taos> select ASCII('hello') from ts_4893.meters limit 5
ascii('hello') |
@ -46,7 +46,7 @@ taos> select ASCII('hello') from ts_4893.meters limit 5
taos> select ASCII('hello') + 1 from ts_4893.meters limit 1
ascii('hello') + 1 |
============================
105.000000000000000 |
105 |
taos> select ASCII('hello') + ASCII('hello') from ts_4893.meters limit 1
ascii('hello') + ascii('hello') |
@ -92,20 +92,20 @@ taos> select ASCII(cast(nch1 as varchar)) from ts_4893.meters order by ts limit
taos> select pow(ASCII(nch1), 2) from ts_4893.meters order by ts limit 5
pow(ascii(nch1), 2) |
============================
12100.000000000000000 |
51984.000000000000000 |
13689.000000000000000 |
12544.000000000000000 |
12100.000000000000000 |
12100 |
51984 |
13689 |
12544 |
12100 |
taos> select sqrt(ASCII(nch1)) from ts_4893.meters order by ts limit 5
sqrt(ascii(nch1)) |
============================
10.488088481701515 |
15.099668870541500 |
10.816653826391969 |
10.583005244258363 |
10.488088481701515 |
10.4880884817015 |
15.0996688705415 |
10.816653826392 |
10.5830052442584 |
10.4880884817015 |
taos> select cast(ASCII(nch1) as int) from ts_4893.meters order by ts limit 5
cast(ascii(nch1) as int) |

Can't render this file because it has a wrong number of fields in line 17.

View File

@ -27,12 +27,12 @@ taos> select CHAR_LENGTH('北京涛思数据科技有限公司')
taos> select CHAR_LENGTH('hello') + 1
char_length('hello') + 1 |
============================
6.000000000000000 |
6 |
taos> select CHAR_LENGTH('hello') - 1
char_length('hello') - 1 |
============================
4.000000000000000 |
4 |
taos> select CHAR_LENGTH('hello') from ts_4893.meters limit 5
char_length('hello') |
@ -46,7 +46,7 @@ taos> select CHAR_LENGTH('hello') from ts_4893.meters limit 5
taos> select CHAR_LENGTH('hello') + 1 from ts_4893.meters limit 1
char_length('hello') + 1 |
============================
6.000000000000000 |
6 |
taos> select CHAR_LENGTH('hello') + CHAR_LENGTH('hello') from ts_4893.meters limit 1
char_length('hello') + char_length('hello') |
@ -92,20 +92,20 @@ taos> select CHAR_LENGTH(cast(nch1 as varchar)) from ts_4893.meters order by ts
taos> select pow(CHAR_LENGTH(nch1), 2) from ts_4893.meters order by ts limit 5
pow(char_length(nch1), 2) |
============================
25.000000000000000 |
100.000000000000000 |
36.000000000000000 |
49.000000000000000 |
25.000000000000000 |
25 |
100 |
36 |
49 |
25 |
taos> select sqrt(CHAR_LENGTH(nch1)) from ts_4893.meters order by ts limit 5
sqrt(char_length(nch1)) |
============================
2.236067977499790 |
3.162277660168380 |
2.449489742783178 |
2.645751311064591 |
2.236067977499790 |
2.23606797749979 |
3.16227766016838 |
2.44948974278318 |
2.64575131106459 |
2.23606797749979 |
taos> select cast(CHAR_LENGTH(nch1) as int) from ts_4893.meters order by ts limit 5
cast(char_length(nch1) as int) |
@ -255,5 +255,5 @@ taos> select groupid, max(char_length(name)) from ts_4893.meters group by groupi
taos> select location, avg(char_length(name)) from ts_4893.meters group by location order by location
location | avg(char_length(name)) |
=================================================
beijing | 3.244600000000000 |
beijing | 3.2446 |

Can't render this file because it has a wrong number of fields in line 17.

View File

@ -2,149 +2,149 @@
taos> select DEGREES(0)
degrees(0) |
============================
0.000000000000000 |
0 |
taos> select DEGREES(1)
degrees(1) |
============================
57.295779513082323 |
57.2957795130823 |
taos> select DEGREES(1.5)
degrees(1.5) |
============================
85.943669269623484 |
85.9436692696235 |
taos> select DEGREES(100)
degrees(100) |
============================
5729.577951308232514 |
5729.57795130823 |
taos> select DEGREES(-1)
degrees(-1) |
============================
-57.295779513082323 |
-57.2957795130823 |
taos> select DEGREES(-1.5)
degrees(-1.5) |
============================
-85.943669269623484 |
-85.9436692696235 |
taos> select DEGREES(-100)
degrees(-100) |
============================
-5729.577951308232514 |
-5729.57795130823 |
taos> select DEGREES(1) + 1
degrees(1) + 1 |
============================
58.295779513082323 |
58.2957795130823 |
taos> select DEGREES(1) - 1
degrees(1) - 1 |
============================
56.295779513082323 |
56.2957795130823 |
taos> select DEGREES(1) * 1
degrees(1) * 1 |
============================
57.295779513082323 |
57.2957795130823 |
taos> select DEGREES(1) / 1
degrees(1) / 1 |
============================
57.295779513082323 |
57.2957795130823 |
taos> select DEGREES(1) from ts_4893.meters limit 5
degrees(1) |
============================
57.295779513082323 |
57.295779513082323 |
57.295779513082323 |
57.295779513082323 |
57.295779513082323 |
57.2957795130823 |
57.2957795130823 |
57.2957795130823 |
57.2957795130823 |
57.2957795130823 |
taos> select DEGREES(1) + 1 from ts_4893.meters limit 1
degrees(1) + 1 |
============================
58.295779513082323 |
58.2957795130823 |
taos> select DEGREES(1) - 1 from ts_4893.meters limit 1
degrees(1) - 1 |
============================
56.295779513082323 |
56.2957795130823 |
taos> select DEGREES(1) * 2 from ts_4893.meters limit 1
degrees(1) * 2 |
============================
114.591559026164646 |
114.591559026165 |
taos> select DEGREES(1) / 2 from ts_4893.meters limit 1
degrees(1) / 2 |
============================
28.647889756541161 |
28.6478897565412 |
taos> select DEGREES(2) + DEGREES(1) from ts_4893.meters limit 1
degrees(2) + degrees(1) |
============================
171.887338539246969 |
171.887338539247 |
taos> select DEGREES(2) - DEGREES(1) from ts_4893.meters limit 1
degrees(2) - degrees(1) |
============================
57.295779513082323 |
57.2957795130823 |
taos> select DEGREES(2) * DEGREES(1) from ts_4893.meters limit 1
degrees(2) * degrees(1) |
============================
6565.612700023488287 |
6565.61270002349 |
taos> select DEGREES(2) / DEGREES(1) from ts_4893.meters limit 1
degrees(2) / degrees(1) |
============================
2.000000000000000 |
2 |
taos> select DEGREES(1) + id from ts_4893.meters order by ts limit 5
degrees(1) + id |
============================
57.295779513082323 |
58.295779513082323 |
59.295779513082323 |
60.295779513082323 |
61.295779513082323 |
57.2957795130823 |
58.2957795130823 |
59.2957795130823 |
60.2957795130823 |
61.2957795130823 |
taos> select DEGREES(id) + id from ts_4893.meters order by ts limit 5
degrees(id) + id |
============================
0.000000000000000 |
58.295779513082323 |
116.591559026164646 |
174.887338539246969 |
233.183118052329291 |
0 |
58.2957795130823 |
116.591559026165 |
174.887338539247 |
233.183118052329 |
taos> select DEGREES(abs(10))
degrees(abs(10)) |
============================
572.957795130823229 |
572.957795130823 |
taos> select DEGREES(PI())
degrees(pi()) |
============================
180.000000000000000 |
180 |
taos> select abs(DEGREES(10))
abs(degrees(10)) |
============================
572.957795130823229 |
572.957795130823 |
taos> select pow(DEGREES(10), 2)
pow(degrees(10), 2) |
============================
328280.635001174407080 |
328280.635001174 |
taos> select sqrt(DEGREES(10))
sqrt(degrees(10)) |
============================
23.936536824085962 |
23.936536824086 |
taos> select cast(DEGREES(10) as int)
cast(degrees(10) as int) |
@ -154,44 +154,44 @@ taos> select cast(DEGREES(10) as int)
taos> select DEGREES(sqrt(id)) from ts_4893.meters order by ts limit 5
degrees(sqrt(id)) |
============================
0.000000000000000 |
57.295779513082323 |
81.028468454139556 |
99.239201175922574 |
114.591559026164646 |
0 |
57.2957795130823 |
81.0284684541396 |
99.2392011759226 |
114.591559026165 |
taos> select degrees(pi())
degrees(pi()) |
============================
180.000000000000000 |
180 |
taos> select degrees(current) from ts_4893.d0 order by ts limit 10
degrees(current) |
============================
610.200029957721426 |
491.254034090376820 |
561.212164701962479 |
643.603479905018958 |
613.408634263739941 |
487.472513516777667 |
549.810284033650078 |
628.076328902558998 |
643.202411196955836 |
592.266466706882511 |
610.200029957721 |
491.254034090377 |
561.212164701962 |
643.603479905019 |
613.40863426374 |
487.472513516778 |
549.81028403365 |
628.076328902559 |
643.202411196956 |
592.266466706883 |
taos> select degrees(current) from ts_4893.meters order by ts limit 10
degrees(current) |
============================
610.200029957721426 |
491.254034090376820 |
561.212164701962479 |
643.603479905018958 |
613.408634263739941 |
487.472513516777667 |
549.810284033650078 |
628.076328902558998 |
643.202411196955836 |
592.266466706882511 |
610.200029957721 |
491.254034090377 |
561.212164701962 |
643.603479905019 |
613.40863426374 |
487.472513516778 |
549.81028403365 |
628.076328902559 |
643.202411196956 |
592.266466706883 |
taos> select degrees(null)
degrees(null) |
@ -201,70 +201,70 @@ taos> select degrees(null)
taos> select degrees(-5)
degrees(-5) |
============================
-286.478897565411614 |
-286.478897565412 |
taos> select degrees(3.14)
degrees(3.14) |
============================
179.908747671078515 |
179.908747671079 |
taos> select degrees(2*pi())
degrees(2*pi()) |
============================
360.000000000000000 |
360 |
taos> select degrees(pi()/2)
degrees(pi()/2) |
============================
90.000000000000000 |
90 |
taos> select degrees(-pi()/2)
degrees(-pi()/2) |
============================
-90.000000000000000 |
-90 |
taos> select degrees(1000000)
degrees(1000000) |
============================
57295779.513082325458527 |
57295779.5130823 |
taos> select degrees(sin(1))
degrees(sin(1)) |
============================
48.212736012209490 |
48.2127360122095 |
taos> select degrees(cos(1))
degrees(cos(1)) |
============================
30.957041787430903 |
30.9570417874309 |
taos> select degrees(tan(1))
degrees(tan(1)) |
============================
89.232889603798512 |
89.2328896037985 |
taos> select degrees(radians(90))
degrees(radians(90)) |
============================
90.000000000000000 |
90 |
taos> select degrees(atan(1))
degrees(atan(1)) |
============================
45.000000000000000 |
45 |
taos> select degrees(phase) from ts_4893.meters limit 1
degrees(phase) |
============================
29.157708736569255 |
29.1577087365693 |
taos> select degrees(current) from ts_4893.meters limit 1
degrees(current) |
============================
610.200029957721426 |
610.200029957721 |
taos> select degrees(voltage) from ts_4893.meters limit 1
degrees(voltage) |
============================
12662.367272391193183 |
12662.3672723912 |

Can't render this file because it has a wrong number of fields in line 139.

View File

@ -2,22 +2,22 @@
taos> select EXP(0)
exp(0) |
============================
1.000000000000000 |
1 |
taos> select EXP(1)
exp(1) |
============================
2.718281828459045 |
2.71828182845905 |
taos> select EXP(1.5)
exp(1.5) |
============================
4.481689070338065 |
4.48168907033806 |
taos> select EXP(100)
exp(100) |
============================
2.688117141816136e+43 |
2.68811714181614e+43 |
taos> select EXP(-1)
exp(-1) |
@ -27,114 +27,114 @@ taos> select EXP(-1)
taos> select EXP(-1.5)
exp(-1.5) |
============================
0.223130160148430 |
0.22313016014843 |
taos> select EXP(-100)
exp(-100) |
============================
0.000000000000000 |
3.72007597602084e-44 |
taos> select EXP(1) + 1
exp(1) + 1 |
============================
3.718281828459045 |
3.71828182845905 |
taos> select EXP(1) - 1
exp(1) - 1 |
============================
1.718281828459045 |
1.71828182845905 |
taos> select EXP(1) * 1
exp(1) * 1 |
============================
2.718281828459045 |
2.71828182845905 |
taos> select EXP(1) / 1
exp(1) / 1 |
============================
2.718281828459045 |
2.71828182845905 |
taos> select exp(1) from ts_4893.meters limit 5
exp(1) |
============================
2.718281828459045 |
2.718281828459045 |
2.718281828459045 |
2.718281828459045 |
2.718281828459045 |
2.71828182845905 |
2.71828182845905 |
2.71828182845905 |
2.71828182845905 |
2.71828182845905 |
taos> select exp(1) + 1 from ts_4893.meters limit 1
exp(1) + 1 |
============================
3.718281828459045 |
3.71828182845905 |
taos> select exp(1) - 1 from ts_4893.meters limit 1
exp(1) - 1 |
============================
1.718281828459045 |
1.71828182845905 |
taos> select exp(1) * 2 from ts_4893.meters limit 1
exp(1) * 2 |
============================
5.436563656918090 |
5.43656365691809 |
taos> select exp(1) / 2 from ts_4893.meters limit 1
exp(1) / 2 |
============================
1.359140914229523 |
1.35914091422952 |
taos> select exp(2) + exp(1) from ts_4893.meters limit 1
exp(2) + exp(1) |
============================
10.107337927389695 |
10.1073379273897 |
taos> select exp(2) - exp(1) from ts_4893.meters limit 1
exp(2) - exp(1) |
============================
4.670774270471606 |
4.67077427047161 |
taos> select exp(2) * exp(1) from ts_4893.meters limit 1
exp(2) * exp(1) |
============================
20.085536923187668 |
20.0855369231877 |
taos> select exp(2) / exp(1) from ts_4893.meters limit 1
exp(2) / exp(1) |
============================
2.718281828459046 |
2.71828182845905 |
taos> select exp(1) + id from ts_4893.meters order by ts limit 5
exp(1) + id |
============================
2.718281828459045 |
3.718281828459045 |
4.718281828459045 |
5.718281828459045 |
6.718281828459045 |
2.71828182845905 |
3.71828182845905 |
4.71828182845904 |
5.71828182845904 |
6.71828182845904 |
taos> select exp(id) + id from ts_4893.meters order by ts limit 5
exp(id) + id |
============================
1.000000000000000 |
3.718281828459045 |
9.389056098930650 |
23.085536923187668 |
58.598150033144236 |
1 |
3.71828182845905 |
9.38905609893065 |
23.0855369231877 |
58.5981500331442 |
taos> select abs(EXP(10))
abs(exp(10)) |
============================
22026.465794806717895 |
22026.4657948067 |
taos> select pow(EXP(10), 2)
pow(exp(10), 2) |
============================
485165195.409790337085724 |
485165195.40979 |
taos> select sqrt(EXP(10))
sqrt(exp(10)) |
============================
148.413159102576600 |
148.413159102577 |
taos> select cast(EXP(10) as int)
cast(exp(10) as int) |
@ -144,54 +144,54 @@ taos> select cast(EXP(10) as int)
taos> select EXP(sqrt(id)) from ts_4893.meters order by ts limit 5
exp(sqrt(id)) |
============================
1.000000000000000 |
2.718281828459045 |
4.113250378782928 |
5.652233674034091 |
7.389056098930650 |
1 |
2.71828182845905 |
4.11325037878293 |
5.65223367403409 |
7.38905609893065 |
taos> select EXP(EXP(EXP(EXP(0))))
exp(exp(exp(exp(0)))) |
============================
3814279.104760214220732 |
3814279.10476021 |
taos> select exp(2)
exp(2) |
============================
7.389056098930650 |
7.38905609893065 |
taos> select exp(0.5)
exp(0.5) |
============================
1.648721270700128 |
1.64872127070013 |
taos> select exp(current) from ts_4893.d0 order by ts limit 10
exp(current) |
============================
42192.578453635847836 |
5292.258432380726845 |
17943.802618770550907 |
75583.992598717435612 |
44622.804904812772293 |
4954.246535954979663 |
14705.836248958077704 |
57641.604897186582093 |
75056.754435561466380 |
30853.327779395312973 |
42192.5784536358 |
5292.25843238073 |
17943.8026187706 |
75583.9925987174 |
44622.8049048128 |
4954.24653595498 |
14705.8362489581 |
57641.6048971866 |
75056.7544355615 |
30853.3277793953 |
taos> select exp(current) from ts_4893.meters order by ts limit 10
exp(current) |
============================
42192.578453635847836 |
5292.258432380726845 |
17943.802618770550907 |
75583.992598717435612 |
44622.804904812772293 |
4954.246535954979663 |
14705.836248958077704 |
57641.604897186582093 |
75056.754435561466380 |
30853.327779395312973 |
42192.5784536358 |
5292.25843238073 |
17943.8026187706 |
75583.9925987174 |
44622.8049048128 |
4954.24653595498 |
14705.8362489581 |
57641.6048971866 |
75056.7544355615 |
30853.3277793953 |
taos> select exp(null)
exp(null) |
@ -206,55 +206,55 @@ taos> select exp(100000)
taos> select exp(-1000)
exp(-1000) |
============================
0.000000000000000 |
0 |
taos> select exp(-9999999999)
exp(-9999999999) |
============================
0.000000000000000 |
0 |
taos> select exp(0.0001)
exp(0.0001) |
============================
1.000100005000167 |
1.00010000500017 |
taos> select exp(pi())
exp(pi()) |
============================
23.140692632779267 |
23.1406926327793 |
taos> select exp(voltage) from ts_4893.meters limit 1
exp(voltage) |
============================
9.529727902367202e+95 |
9.5297279023672e+95 |
taos> select exp(current) from ts_4893.meters limit 1
exp(current) |
============================
42192.578453635847836 |
42192.5784536358 |
taos> select exp(phase) from ts_4893.meters limit 1
exp(phase) |
============================
1.663457087766762 |
1.66345708776676 |
taos> select exp(voltage + current) from ts_4893.meters limit 1
exp(voltage + current) |
============================
4.020837921624308e+100 |
4.02083792162431e+100 |
taos> select exp(abs(current)) from ts_4893.meters limit 1
exp(abs(current)) |
============================
42192.578453635847836 |
42192.5784536358 |
taos> select exp(log(voltage)) from ts_4893.meters limit 1
exp(log(voltage)) |
============================
220.999999999999915 |
221 |
taos> select round(exp(voltage), 2) from ts_4893.meters limit 1
round(exp(voltage), 2) |
============================
9.529727902367202e+95 |
9.5297279023672e+95 |

Can't render this file because it has a wrong number of fields in line 129.

View File

@ -2,7 +2,7 @@
taos> select LN(100)
ln(100) |
============================
4.605170185988092 |
4.60517018598809 |
taos> select LN(1.5)
ln(1.5) |
@ -12,71 +12,71 @@ taos> select LN(1.5)
taos> select LN(100)
ln(100) |
============================
4.605170185988092 |
4.60517018598809 |
taos> select LN(100) + 1
ln(100) + 1 |
============================
5.605170185988092 |
5.60517018598809 |
taos> select LN(100) - 1
ln(100) - 1 |
============================
3.605170185988092 |
3.60517018598809 |
taos> select LN(100) * 1
ln(100) * 1 |
============================
4.605170185988092 |
4.60517018598809 |
taos> select LN(100) / 1
ln(100) / 1 |
============================
4.605170185988092 |
4.60517018598809 |
taos> select LN(100) from ts_4893.meters limit 5
ln(100) |
============================
4.605170185988092 |
4.605170185988092 |
4.605170185988092 |
4.605170185988092 |
4.605170185988092 |
4.60517018598809 |
4.60517018598809 |
4.60517018598809 |
4.60517018598809 |
4.60517018598809 |
taos> select LN(100) + 1 from ts_4893.meters limit 1
ln(100) + 1 |
============================
5.605170185988092 |
5.60517018598809 |
taos> select LN(100) - 1 from ts_4893.meters limit 1
ln(100) - 1 |
============================
3.605170185988092 |
3.60517018598809 |
taos> select LN(100) * 2 from ts_4893.meters limit 1
ln(100) * 2 |
============================
9.210340371976184 |
9.21034037197618 |
taos> select LN(100) / 2 from ts_4893.meters limit 1
ln(100) / 2 |
============================
2.302585092994046 |
2.30258509299405 |
taos> select LN(2) + LN(100) from ts_4893.meters limit 1
ln(2) + ln(100) |
============================
5.298317366548037 |
5.29831736654804 |
taos> select LN(2) - LN(100) from ts_4893.meters limit 1
ln(2) - ln(100) |
============================
-3.912023005428146 |
-3.91202300542815 |
taos> select LN(2) * LN(100) from ts_4893.meters limit 1
ln(2) * ln(100) |
============================
3.192060730416365 |
3.19206073041636 |
taos> select LN(2) / LN(100) from ts_4893.meters limit 1
ln(2) / ln(100) |
@ -86,20 +86,20 @@ taos> select LN(2) / LN(100) from ts_4893.meters limit 1
taos> select LN(100) + id from ts_4893.meters order by ts limit 5
ln(100) + id |
============================
4.605170185988092 |
5.605170185988092 |
6.605170185988092 |
7.605170185988092 |
8.605170185988092 |
4.60517018598809 |
5.60517018598809 |
6.60517018598809 |
7.60517018598809 |
8.60517018598809 |
taos> select LN(id + 1) + id from ts_4893.meters order by ts limit 5
ln(id + 1) + id |
============================
0.000000000000000 |
1.693147180559945 |
3.098612288668110 |
4.386294361119891 |
5.609437912434101 |
0 |
1.69314718055995 |
3.09861228866811 |
4.38629436111989 |
5.6094379124341 |
taos> select ln(null)
ln(null) |
@ -119,17 +119,17 @@ taos> select ln(-5)
taos> select abs(LN(10))
abs(ln(10)) |
============================
2.302585092994046 |
2.30258509299405 |
taos> select pow(LN(10), 2)
pow(ln(10), 2) |
============================
5.301898110478399 |
5.3018981104784 |
taos> select sqrt(LN(10))
sqrt(ln(10)) |
============================
1.517427129385146 |
1.51742712938515 |
taos> select cast(LN(10) as int)
cast(ln(10) as int) |
@ -139,11 +139,11 @@ taos> select cast(LN(10) as int)
taos> select LN(sqrt(id) + 1) from ts_4893.meters order by ts limit 5
ln(sqrt(id) + 1) |
============================
0.000000000000000 |
0 |
0.693147180559945 |
0.881373587019543 |
1.005052538742381 |
1.098612288668110 |
1.00505253874238 |
1.09861228866811 |
taos> select LN(LN(LN(LN(10000))))
ln(ln(ln(ln(10000)))) |
@ -153,70 +153,70 @@ taos> select LN(LN(LN(LN(10000))))
taos> select LN(EXP(2))
ln(exp(2)) |
============================
2.000000000000000 |
2 |
taos> select ln(10)
ln(10) |
============================
2.302585092994046 |
2.30258509299405 |
taos> select ln(pi())
ln(pi()) |
============================
1.144729885849400 |
1.1447298858494 |
taos> select ln(current) from ts_4893.d0 order by ts limit 10
ln(current) |
============================
2.365559856336680 |
2.148734409997751 |
2.281872059185575 |
2.418855857000369 |
2.370804362614190 |
2.141006941277850 |
2.261346315560232 |
2.394434736880126 |
2.418232501568406 |
2.335729681253415 |
2.36555985633668 |
2.14873440999775 |
2.28187205918557 |
2.41885585700037 |
2.37080436261419 |
2.14100694127785 |
2.26134631556023 |
2.39443473688013 |
2.41823250156841 |
2.33572968125342 |
taos> select ln(current) from ts_4893.meters order by ts limit 10
ln(current) |
============================
2.365559856336680 |
2.148734409997751 |
2.281872059185575 |
2.418855857000369 |
2.370804362614190 |
2.141006941277850 |
2.261346315560232 |
2.394434736880126 |
2.418232501568406 |
2.335729681253415 |
2.36555985633668 |
2.14873440999775 |
2.28187205918557 |
2.41885585700037 |
2.37080436261419 |
2.14100694127785 |
2.26134631556023 |
2.39443473688013 |
2.41823250156841 |
2.33572968125342 |
taos> select ln(1)
ln(1) |
============================
0.000000000000000 |
0 |
taos> select ln(20)
ln(20) |
============================
2.995732273553991 |
2.99573227355399 |
taos> select ln(100)
ln(100) |
============================
4.605170185988092 |
4.60517018598809 |
taos> select ln(99999999999999)
ln(99999999999999) |
============================
32.236191301916627 |
32.2361913019166 |
taos> select ln(0.1)
ln(0.1) |
============================
-2.302585092994045 |
-2.30258509299405 |
taos> select ln(2.718)
ln(2.718) |
@ -226,17 +226,17 @@ taos> select ln(2.718)
taos> select ln(exp(1))
ln(exp(1)) |
============================
1.000000000000000 |
1 |
taos> select ln(voltage) from ts_4893.meters where voltage > 0 limit 1
ln(voltage) |
============================
5.398162701517752 |
5.39816270151775 |
taos> select ln(current) from ts_4893.meters where current > 0 limit 1
ln(current) |
============================
2.365559856336680 |
2.36555985633668 |
taos> select ln(phase) from ts_4893.meters where phase > 0 limit 1
ln(phase) |
@ -246,12 +246,12 @@ taos> select ln(phase) from ts_4893.meters where phase > 0 limit 1
taos> select ln(exp(voltage)) from ts_4893.meters where voltage > 0 limit 1
ln(exp(voltage)) |
============================
221.000000000000000 |
221 |
taos> select ln(abs(current)) from ts_4893.meters where current != 0 limit 1
ln(abs(current)) |
============================
2.365559856336680 |
2.36555985633668 |
taos> select ln(sqrt(phase)) from ts_4893.meters where phase >= 0 limit 1
ln(sqrt(phase)) |

Can't render this file because it has a wrong number of fields in line 124.

View File

@ -2,7 +2,7 @@
taos> select MAX(current) from ts_4893.meters
max(current) |
=======================
11.9989996 |
11.999 |
taos> select MAX(voltage) from ts_4893.meters
max(voltage) |
@ -100,65 +100,65 @@ taos> select MAX(id) from ts_4893.meters interval(60d)
taos> select MAX(current) from ts_4893.meters interval(60d)
max(current) |
=======================
11.9989996 |
11.9969997 |
11.9969997 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9980001 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9980001 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9980001 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9980001 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9980001 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9980001 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9969997 |
11.9989996 |
11.9989996 |
11.9989996 |
11.9860001 |
11.999 |
11.997 |
11.997 |
11.999 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.998 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.998 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.998 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.998 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.998 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.998 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.999 |
11.999 |
11.999 |
11.999 |
11.997 |
11.999 |
11.999 |
11.999 |
11.986 |
taos> select MAX(voltage) from ts_4893.meters interval(60d)
max(voltage) |
@ -561,7 +561,7 @@ taos> select max(id) from ts_4893.meters where id <= 0
taos> select max(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
max(phase) |
=======================
0.9999660 |
0.999966 |
taos> select max(voltage) from ts_4893.meters where voltage is not null
max(voltage) |
@ -581,12 +581,12 @@ taos> select round(max(current), 2) from ts_4893.meters
taos> select pow(max(current), 2) from ts_4893.meters
pow(max(current), 2) |
============================
143.975991296219036 |
143.975991296219 |
taos> select log(max(voltage) + 1) from ts_4893.meters
log(max(voltage) + 1) |
============================
5.416100402204420 |
5.41610040220442 |
taos> select groupid, max(voltage) from ts_4893.meters group by groupid order by groupid
groupid | max(voltage) |
@ -601,7 +601,7 @@ taos> select location, max(id) from ts_4893.meters group by location order by lo
taos> select location, max(current) from ts_4893.meters group by location order by location
location | max(current) |
============================================
beijing | 11.9989996 |
beijing | 11.999 |
taos> select max(1)
max(1) |
@ -656,5 +656,5 @@ taos> select max(cast(1.1 as float))
taos> select max(cast(1.1 as double))
max(cast(1.1 as double)) |
============================
1.100000000000000 |
1.1 |

Can't render this file because it has a wrong number of fields in line 576.

View File

@ -7,7 +7,7 @@ taos> select MIN(id) from ts_4893.meters
taos> select MIN(current) from ts_4893.meters
min(current) |
=======================
8.0000000 |
8 |
taos> select MIN(voltage) from ts_4893.meters
min(voltage) |
@ -105,65 +105,65 @@ taos> select MIN(id) from ts_4893.meters interval(60d)
taos> select MIN(current) from ts_4893.meters interval(60d)
min(current) |
=======================
8.0000000 |
8.0000000 |
8.0000000 |
8.0010004 |
8.0010004 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0030003 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0030003 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0010004 |
8.0089998 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0030003 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0019999 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0000000 |
8.0019999 |
8.0010004 |
8.0000000 |
8.0050001 |
8 |
8 |
8 |
8.001 |
8.001 |
8 |
8 |
8 |
8.002 |
8.001 |
8 |
8.003 |
8 |
8 |
8.002 |
8.001 |
8 |
8.003 |
8 |
8 |
8.002 |
8.001 |
8 |
8 |
8 |
8 |
8.002 |
8.001 |
8 |
8 |
8 |
8 |
8.001 |
8.009 |
8 |
8 |
8 |
8.002 |
8.001 |
8 |
8.003 |
8 |
8 |
8.002 |
8.001 |
8 |
8.002 |
8 |
8 |
8.002 |
8.001 |
8 |
8 |
8 |
8 |
8.002 |
8.001 |
8 |
8.005 |
taos> select MIN(voltage) from ts_4893.meters interval(60d)
min(voltage) |
@ -561,7 +561,7 @@ taos> select min(id) from ts_4893.meters where id <= 0
taos> select min(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
min(phase) |
=======================
0.0001700 |
0.00017 |
taos> select min(voltage) from ts_4893.meters where voltage is not null
min(voltage) |
@ -581,12 +581,12 @@ taos> select round(min(current), 2) from ts_4893.meters
taos> select pow(min(current), 2) from ts_4893.meters
pow(min(current), 2) |
============================
64.000000000000000 |
64 |
taos> select log(min(voltage) + 1) from ts_4893.meters
log(min(voltage) + 1) |
============================
5.375278407684165 |
5.37527840768417 |
taos> select groupid, min(voltage) from ts_4893.meters group by groupid order by groupid
groupid | min(voltage) |
@ -596,7 +596,7 @@ taos> select groupid, min(voltage) from ts_4893.meters group by groupid order by
taos> select location, min(current) from ts_4893.meters group by location order by location
location | min(current) |
============================================
beijing | 8.0000000 |
beijing | 8 |
taos> select location, min(id) from ts_4893.meters group by location order by location
location | min(id) |
@ -656,5 +656,5 @@ taos> select min(cast(1.1 as float))
taos> select min(cast(1.1 as double))
min(cast(1.1 as double)) |
============================
1.100000000000000 |
1.1 |

Can't render this file because it has a wrong number of fields in line 576.

View File

@ -2,7 +2,7 @@
taos> select MOD(10.55, 3)
mod(10.55, 3) |
============================
1.550000000000001 |
1.55 |
taos> select MOD(10.55, 2)
mod(10.55, 2) |
@ -32,12 +32,12 @@ taos> select MOD(-10.55, 1)
taos> select MOD(99, 1)
mod(99, 1) |
============================
0.000000000000000 |
0 |
taos> select MOD(10.55, 1) + 1
mod(10.55, 1) + 1 |
============================
1.550000000000001 |
1.55 |
taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123.123456789, 9), 8), 7), 6), 5), 4), 3)
mod(mod(mod(mod(mod(mod(mod(123.123456789, 9), 8), 7), 6), 5), 4 |
@ -69,12 +69,12 @@ taos> select MOD(current, id + 1) from ts_4893.meters order by ts limit 10
0.649999618530273 |
0.574000358581543 |
0.795000076293945 |
3.232999801635742 |
3.23299980163574 |
0.706000328063965 |
2.508000373840332 |
2.595999717712402 |
2.961999893188477 |
2.225999832153320 |
2.50800037384033 |
2.5959997177124 |
2.96199989318848 |
2.22599983215332 |
0.336999893188477 |
taos> select MOD(current, 1) from ts_4893.meters order by ts limit 10
@ -88,7 +88,7 @@ taos> select MOD(current, 1) from ts_4893.meters order by ts limit 10
0.508000373840332 |
0.595999717712402 |
0.961999893188477 |
0.225999832153320 |
0.22599983215332 |
0.336999893188477 |
taos> select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10
@ -108,40 +108,40 @@ taos> select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts lim
taos> select mod(10, -3)
mod(10, -3) |
============================
1.000000000000000 |
1 |
taos> select mod(10, 3)
mod(10, 3) |
============================
1.000000000000000 |
1 |
taos> select mod(id, 3) from ts_4893.d0 order by ts limit 10
mod(id, 3) |
============================
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
0 |
1 |
2 |
0 |
1 |
2 |
0 |
1 |
2 |
0 |
taos> select mod(id, 3) from ts_4893.meters order by ts limit 10
mod(id, 3) |
============================
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
1.000000000000000 |
2.000000000000000 |
0.000000000000000 |
0 |
1 |
2 |
0 |
1 |
2 |
0 |
1 |
2 |
0 |
taos> select mod(null, 2)
mod(null, 2) |
@ -171,37 +171,37 @@ taos> select mod(5, 0)
taos> select mod(0, 1)
mod(0, 1) |
============================
0.000000000000000 |
0 |
taos> select mod(1, 1)
mod(1, 1) |
============================
0.000000000000000 |
0 |
taos> select mod(5, 2)
mod(5, 2) |
============================
1.000000000000000 |
1 |
taos> select mod(5, -3)
mod(5, -3) |
============================
2.000000000000000 |
2 |
taos> select mod(15, 4)
mod(15, 4) |
============================
3.000000000000000 |
3 |
taos> select mod(-5, 3)
mod(-5, 3) |
============================
-2.000000000000000 |
-2 |
taos> select mod(voltage, 2) from ts_4893.meters limit 1
mod(voltage, 2) |
============================
1.000000000000000 |
1 |
taos> select mod(current, 10) from ts_4893.meters limit 1
mod(current, 10) |
@ -211,7 +211,7 @@ taos> select mod(current, 10) from ts_4893.meters limit 1
taos> select mod(current, log(100)) from ts_4893.meters limit 1
mod(current, log(100)) |
============================
1.439659246554090 |
1.43965924655409 |
taos> select mod(phase, 4) from ts_4893.meters limit 1
mod(phase, 4) |
@ -221,7 +221,7 @@ taos> select mod(phase, 4) from ts_4893.meters limit 1
taos> select mod(abs(voltage), 3) from ts_4893.meters limit 1
mod(abs(voltage), 3) |
============================
2.000000000000000 |
2 |
taos> select mod(phase, sqrt(16)) from ts_4893.meters limit 1
mod(phase, sqrt(16)) |
@ -231,5 +231,5 @@ taos> select mod(phase, sqrt(16)) from ts_4893.meters limit 1
taos> select mod(round(voltage), 5) from ts_4893.meters limit 1
mod(round(voltage), 5) |
============================
1.000000000000000 |
1 |

1 taos> select MOD(10.55, 3)
2 mod(10.55, 3) |
3 ============================
4 1.550000000000001 | 1.55 |
5 taos> select MOD(10.55, 2)
6 mod(10.55, 2) |
7 ============================
8 0.550000000000001 |
32 1.550000000000001 | 1.55 |
33 taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123.123456789, 9), 8), 7), 6), 5), 4), 3)
34 mod(mod(mod(mod(mod(mod(mod(123.123456789, 9), 8), 7), 6), 5), 4 |
35 ===================================================================
36 1.234567890000022e-01 |
37 taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
38 mod(mod(mod(mod(mod(mod(mod(123456789.123456789, -1), -2), -3), |
39 ===================================================================
40 1.234567910432816e-01 |
41 taos> select MOD(87654321.123456789, id + 1) from ts_4893.meters order by ts limit 10
42 mod(87654321.123456789, id + 1) |
43 ==================================
69 ============================
70 0.649999618530273 |
71 0.574000358581543 |
72 0.795000076293945 |
73 0.232999801635742 |
74 0.706000328063965 |
75 0.508000373840332 |
76 0.595999717712402 |
77 0.961999893188477 |
78 0.225999832153320 | 0.22599983215332 |
79 0.336999893188477 |
80 taos> select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10
88 2.916847677517688e+00 |
89 3.097741066924800e+00 |
90 3.310891102586806e+00 |
91 3.350522322288470e+00 |
92 3.215120509901375e+00 |
93 taos> select mod(10, -3)
94 mod(10, -3) |
108 1.000000000000000 | 1 |
109 2.000000000000000 | 2 |
110 0.000000000000000 | 0 |
111 1.000000000000000 | 1 |
112 2.000000000000000 | 2 |
113 0.000000000000000 | 0 |
114 taos> select mod(id, 3) from ts_4893.meters order by ts limit 10
115 mod(id, 3) |
116 ============================
117 0.000000000000000 | 0 |
118 1.000000000000000 | 1 |
119 2.000000000000000 | 2 |
120 0.000000000000000 | 0 |
121 1.000000000000000 | 1 |
122 2.000000000000000 | 2 |
123 0.000000000000000 | 0 |
124 1.000000000000000 | 1 |
125 2.000000000000000 | 2 |
126 0.000000000000000 | 0 |
127 taos> select mod(null, 2)
128 mod(null, 2) |
129 ============================
130 NULL |
131 taos> select mod(10, null)
132 mod(10, null) |
133 ============================
134 NULL |
135 taos> select mod(10, 0)
136 mod(10, 0) |
137 ============================
138 NULL |
139 taos> select mod(-10, 0)
140 mod(-10, 0) |
141 ============================
142 NULL |
143 taos> select mod(5, 0)
144 mod(5, 0) |
145 ============================
146 NULL |
147 taos> select mod(0, 1)
171 taos> select mod(voltage, 2) from ts_4893.meters limit 1
172 mod(voltage, 2) |
173 ============================
174 1.000000000000000 | 1 |
175 taos> select mod(current, 10) from ts_4893.meters limit 1
176 mod(current, 10) |
177 ============================
178 0.649999618530273 |
179 taos> select mod(current, log(100)) from ts_4893.meters limit 1
180 mod(current, log(100)) |
181 ============================
182 1.439659246554090 | 1.43965924655409 |
183 taos> select mod(phase, 4) from ts_4893.meters limit 1
184 mod(phase, 4) |
185 ============================
186 0.508898019790649 |
187 taos> select mod(abs(voltage), 3) from ts_4893.meters limit 1
188 mod(abs(voltage), 3) |
189 ============================
190 2.000000000000000 | 2 |
191 taos> select mod(phase, sqrt(16)) from ts_4893.meters limit 1
192 mod(phase, sqrt(16)) |
193 ============================
194 0.508898019790649 |
195 taos> select mod(round(voltage), 5) from ts_4893.meters limit 1
196 mod(round(voltage), 5) |
197 ============================
198 1.000000000000000 | 1 |
199
200
201
202
203
204
205
206
207
211
212
213
214
215
216
217
221
222
223
224
225
226
227
231
232
233
234
235

View File

@ -2,100 +2,100 @@
taos> select pi()
pi() |
============================
3.141592653589793 |
3.14159265358979 |
taos> select pi() + 1
pi() + 1 |
============================
4.141592653589793 |
4.14159265358979 |
taos> select pi() - 1
pi() - 1 |
============================
2.141592653589793 |
2.14159265358979 |
taos> select pi() * 2
pi() * 2 |
============================
6.283185307179586 |
6.28318530717959 |
taos> select pi() / 2
pi() / 2 |
============================
1.570796326794897 |
1.5707963267949 |
taos> select pi() from ts_4893.meters limit 5
pi() |
============================
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
3.141592653589793 |
3.14159265358979 |
3.14159265358979 |
3.14159265358979 |
3.14159265358979 |
3.14159265358979 |
taos> select pi() + 1 from ts_4893.meters limit 1
pi() + 1 |
============================
4.141592653589793 |
4.14159265358979 |
taos> select pi() - 1 from ts_4893.meters limit 1
pi() - 1 |
============================
2.141592653589793 |
2.14159265358979 |
taos> select pi() * 2 from ts_4893.meters limit 1
pi() * 2 |
============================
6.283185307179586 |
6.28318530717959 |
taos> select pi() / 2 from ts_4893.meters limit 1
pi() / 2 |
============================
1.570796326794897 |
1.5707963267949 |
taos> select pi() + pi() from ts_4893.meters limit 1
pi() + pi() |
============================
6.283185307179586 |
6.28318530717959 |
taos> select pi() - pi() from ts_4893.meters limit 1
pi() - pi() |
============================
0.000000000000000 |
0 |
taos> select pi() * pi() from ts_4893.meters limit 1
pi() * pi() |
============================
9.869604401089358 |
9.86960440108936 |
taos> select pi() / pi() from ts_4893.meters limit 1
pi() / pi() |
============================
1.000000000000000 |
1 |
taos> select pi() + id from ts_4893.meters order by ts limit 5
pi() + id |
============================
3.141592653589793 |
4.141592653589793 |
5.141592653589793 |
6.141592653589793 |
7.141592653589793 |
3.14159265358979 |
4.14159265358979 |
5.14159265358979 |
6.14159265358979 |
7.14159265358979 |
taos> select abs(pi())
abs(pi()) |
============================
3.141592653589793 |
3.14159265358979 |
taos> select pow(pi(), 2)
pow(pi(), 2) |
============================
9.869604401089358 |
9.86960440108936 |
taos> select sqrt(pi())
sqrt(pi()) |
============================
1.772453850905516 |
1.77245385090552 |
taos> select cast(pi() as int)
cast(pi() as int) |
@ -105,7 +105,7 @@ taos> select cast(pi() as int)
taos> select pi()
pi() |
============================
3.141592653589793 |
3.14159265358979 |
taos> select substring_index(null, '.', 2)
substring_index(null, '.', 2) |
@ -120,7 +120,7 @@ taos> select pi() + null
taos> select pi() * 0
pi() * 0 |
============================
0.000000000000000 |
0 |
taos> select pi() / 0
pi() / 0 |
@ -130,62 +130,62 @@ taos> select pi() / 0
taos> select pi() * 0.5
pi() * 0.5 |
============================
1.570796326794897 |
1.5707963267949 |
taos> select pi() * -1
pi() * -1 |
============================
-3.141592653589793 |
-3.14159265358979 |
taos> select pi() * name from ts_4893.meters limit 1
pi() * name |
============================
0.000000000000000 |
0 |
taos> select pi() * voltage from ts_4893.meters limit 1
pi() * voltage |
============================
694.291976443344311 |
694.291976443344 |
taos> select pi() * phase * 2 from ts_4893.meters limit 1
pi() * phase * 2 |
============================
3.197500560801395 |
3.19750056080139 |
taos> select round(pi(), 6)
round(pi(), 6) |
============================
3.141593000000000 |
3.141593 |
taos> select round(pi() * phase, 2) from ts_4893.meters limit 1
round(pi() * phase, 2) |
============================
1.600000000000000 |
1.6 |
taos> select sqrt(pi() * voltage) from ts_4893.meters limit 1
sqrt(pi() * voltage) |
============================
26.349420799010826 |
26.3494207990108 |
taos> select sqrt(current / pi()) from ts_4893.meters limit 1
sqrt(current / pi()) |
============================
1.841195309148865 |
1.84119530914887 |
taos> select abs(pi() * phase) from ts_4893.meters limit 1
abs(pi() * phase) |
============================
1.598750280400697 |
1.5987502804007 |
taos> select log(pi() * voltage) from ts_4893.meters limit 1
log(pi() * voltage) |
============================
6.542892587367153 |
6.54289258736715 |
taos> select voltage / pi() from ts_4893.meters limit 1
voltage / pi() |
============================
70.346484846617741 |
70.3464848466177 |
taos> select id, case when voltage > 100 then pi() else pi() / 2 end from ts_4893.meters limit 1
id | case when voltage > 100 then pi() else pi() / 2 end |

Can't render this file because it has a wrong number of fields in line 90.

View File

@ -2,42 +2,42 @@
taos> select RADIANS(0)
radians(0) |
============================
0.000000000000000 |
0 |
taos> select RADIANS(1)
radians(1) |
============================
0.017453292519943 |
0.0174532925199433 |
taos> select RADIANS(1.5)
radians(1.5) |
============================
0.026179938779915 |
0.0261799387799149 |
taos> select RADIANS(100)
radians(100) |
============================
1.745329251994330 |
1.74532925199433 |
taos> select RADIANS(-1)
radians(-1) |
============================
-0.017453292519943 |
-0.0174532925199433 |
taos> select RADIANS(-1.5)
radians(-1.5) |
============================
-0.026179938779915 |
-0.0261799387799149 |
taos> select RADIANS(-100)
radians(-100) |
============================
-1.745329251994330 |
-1.74532925199433 |
taos> select RADIANS(1) + 1
radians(1) + 1 |
============================
1.017453292519943 |
1.01745329251994 |
taos> select RADIANS(1) - 1
radians(1) - 1 |
@ -47,26 +47,26 @@ taos> select RADIANS(1) - 1
taos> select RADIANS(1) * 1
radians(1) * 1 |
============================
0.017453292519943 |
0.0174532925199433 |
taos> select RADIANS(1) / 1
radians(1) / 1 |
============================
0.017453292519943 |
0.0174532925199433 |
taos> select RADIANS(1) from ts_4893.meters limit 5
radians(1) |
============================
0.017453292519943 |
0.017453292519943 |
0.017453292519943 |
0.017453292519943 |
0.017453292519943 |
0.0174532925199433 |
0.0174532925199433 |
0.0174532925199433 |
0.0174532925199433 |
0.0174532925199433 |
taos> select RADIANS(1) + 1 from ts_4893.meters limit 1
radians(1) + 1 |
============================
1.017453292519943 |
1.01745329251994 |
taos> select RADIANS(1) - 1 from ts_4893.meters limit 1
radians(1) - 1 |
@ -76,50 +76,50 @@ taos> select RADIANS(1) - 1 from ts_4893.meters limit 1
taos> select RADIANS(1) * 2 from ts_4893.meters limit 1
radians(1) * 2 |
============================
0.034906585039887 |
0.0349065850398866 |
taos> select RADIANS(1) / 2 from ts_4893.meters limit 1
radians(1) / 2 |
============================
0.008726646259972 |
0.00872664625997165 |
taos> select RADIANS(2) + RADIANS(1) from ts_4893.meters limit 1
radians(2) + radians(1) |
============================
0.052359877559830 |
0.0523598775598299 |
taos> select RADIANS(2) - RADIANS(1) from ts_4893.meters limit 1
radians(2) - radians(1) |
============================
0.017453292519943 |
0.0174532925199433 |
taos> select RADIANS(2) * RADIANS(1) from ts_4893.meters limit 1
radians(2) * radians(1) |
============================
0.000609234839573 |
0.000609234839573417 |
taos> select RADIANS(2) / RADIANS(1) from ts_4893.meters limit 1
radians(2) / radians(1) |
============================
2.000000000000000 |
2 |
taos> select RADIANS(1) + id from ts_4893.meters order by ts limit 5
radians(1) + id |
============================
0.017453292519943 |
1.017453292519943 |
2.017453292519943 |
3.017453292519943 |
4.017453292519943 |
0.0174532925199433 |
1.01745329251994 |
2.01745329251994 |
3.01745329251994 |
4.01745329251994 |
taos> select RADIANS(id) + id from ts_4893.meters order by ts limit 5
radians(id) + id |
============================
0.000000000000000 |
1.017453292519943 |
2.034906585039887 |
3.052359877559830 |
4.069813170079773 |
0 |
1.01745329251994 |
2.03490658503989 |
3.05235987755983 |
4.06981317007977 |
taos> select RADIANS(abs(10))
radians(abs(10)) |
@ -129,7 +129,7 @@ taos> select RADIANS(abs(10))
taos> select RADIANS(DEGREES(PI()))
radians(degrees(pi())) |
============================
3.141592653589793 |
3.14159265358979 |
taos> select abs(RADIANS(10))
abs(radians(10)) |
@ -139,7 +139,7 @@ taos> select abs(RADIANS(10))
taos> select pow(RADIANS(10), 2)
pow(radians(10), 2) |
============================
0.030461741978671 |
0.0304617419786709 |
taos> select sqrt(RADIANS(10))
sqrt(radians(10)) |
@ -154,16 +154,16 @@ taos> select cast(RADIANS(10) as int)
taos> select RADIANS(sqrt(id)) from ts_4893.meters order by ts limit 5
radians(sqrt(id)) |
============================
0.000000000000000 |
0.017453292519943 |
0.024682682989769 |
0.030229989403904 |
0.034906585039887 |
0 |
0.0174532925199433 |
0.0246826829897687 |
0.0302299894039036 |
0.0349065850398866 |
taos> select radians(180)
radians(180) |
============================
3.141592653589793 |
3.14159265358979 |
taos> select radians(current) from ts_4893.d0 order by ts limit 10
radians(current) |
@ -201,7 +201,7 @@ taos> select radians(null)
taos> select radians(0)
radians(0) |
============================
0.000000000000000 |
0 |
taos> select radians(45)
radians(45) |
@ -216,22 +216,22 @@ taos> select radians(-45)
taos> select radians(90)
radians(90) |
============================
1.570796326794897 |
1.5707963267949 |
taos> select radians(-90)
radians(-90) |
============================
-1.570796326794897 |
-1.5707963267949 |
taos> select radians(360)
radians(360) |
============================
6.283185307179586 |
6.28318530717959 |
taos> select radians(1000000)
radians(1000000) |
============================
17453.292519943293883 |
17453.2925199433 |
taos> select radians(sin(1))
radians(sin(1)) |
@ -241,22 +241,22 @@ taos> select radians(sin(1))
taos> select radians(cos(1))
radians(cos(1)) |
============================
0.009430054193517 |
0.00943005419351652 |
taos> select radians(tan(1))
radians(tan(1)) |
============================
0.027181892591221 |
0.0271818925912213 |
taos> select radians(degrees(90))
radians(degrees(90)) |
============================
89.999999999999986 |
90 |
taos> select radians(atan(1))
radians(atan(1)) |
============================
0.013707783890402 |
0.0137077838904019 |
taos> select radians(current) from ts_4893.meters limit 1
radians(current) |
@ -266,10 +266,10 @@ taos> select radians(current) from ts_4893.meters limit 1
taos> select radians(voltage) from ts_4893.meters limit 1
radians(voltage) |
============================
3.857177646907469 |
3.85717764690747 |
taos> select radians(phase) from ts_4893.meters limit 1
radians(phase) |
============================
0.008881946002226 |
0.0088819460022261 |

Can't render this file because it has a wrong number of fields in line 139.

View File

@ -7,8 +7,8 @@ taos> select RAND(1245)
taos> select RAND(id) from ts_4893.d0 limit 10
rand(id) |
============================
0.840187717154710 |
0.840187717154710 |
0.84018771715471 |
0.84018771715471 |
0.700976369297587 |
0.561380175203728 |
0.916457875592847 |
@ -35,12 +35,12 @@ taos> select RAND(id) from ts_4893.d0 order by id desc limit 10
taos> select rand(0)
rand(0) |
============================
0.840187717154710 |
0.84018771715471 |
taos> select rand(1)
rand(1) |
============================
0.840187717154710 |
0.84018771715471 |
taos> select rand(-1)
rand(-1) |
@ -65,13 +65,13 @@ taos> select rand(12345), rand(12345)
taos> select rand(9999999999) where rand(9999999999) >= 0 and rand(9999999999) < 1
rand(9999999999) |
============================
0.321409397442550 |
0.32140939744255 |
taos> select rand(id) from ts_4893.meters limit 100
rand(id) |
============================
0.840187717154710 |
0.840187717154710 |
0.84018771715471 |
0.84018771715471 |
0.700976369297587 |
0.561380175203728 |
0.916457875592847 |
@ -89,22 +89,22 @@ taos> select rand(id) from ts_4893.meters limit 100
0.215437470104283 |
0.571794000254848 |
0.929072778173291 |
0.290233385418650 |
0.148812267532950 |
0.29023338541865 |
0.14881226753295 |
0.505899571117898 |
0.865026922367991 |
0.727581746283724 |
0.087714229285584 |
0.0877142292855839 |
0.939356191986872 |
0.795545781867367 |
0.659832971943465 |
0.517155105023251 |
0.875989373715589 |
0.229967075041480 |
0.22996707504148 |
0.592119012303706 |
0.449675684072858 |
0.307948935454688 |
0.168970021497910 |
0.16897002149791 |
0.524489704763745 |
0.381259786142623 |
0.239412393066758 |
@ -112,29 +112,29 @@ taos> select rand(id) from ts_4893.meters limit 100
0.957148446215851 |
0.819422913165494 |
0.670246056127477 |
0.033469948001890 |
0.0334699480018904 |
0.392149003405193 |
0.749737140606035 |
0.608923980318440 |
0.60892398031844 |
0.469695958061933 |
0.825680229266025 |
0.683865774275673 |
0.041811583583155 |
0.0418115835831555 |
0.894321223206036 |
0.760580372885140 |
0.76058037288514 |
0.615916447069457 |
0.977703406930763 |
0.329537633959920 |
0.193522962831670 |
0.052021294390793 |
0.32953763395992 |
0.19352296283167 |
0.0520212943907926 |
0.911150676622591 |
0.766549994129012 |
0.126697651635249 |
0.985316422761100 |
0.843173408342140 |
0.9853164227611 |
0.84317340834214 |
0.699550600116863 |
0.557263156192965 |
0.419794161068180 |
0.41979416106818 |
0.278590486048996 |
0.133239280028846 |
0.488706417143674 |
@ -147,25 +147,25 @@ taos> select rand(id) from ts_4893.meters limit 100
0.998458440880505 |
0.356983164025928 |
0.218767986269094 |
0.076468908263589 |
0.0764689082635888 |
0.431104593179703 |
0.293163777931204 |
0.650123746902740 |
0.65012374690274 |
0.510736836358317 |
0.864335399057872 |
0.725284450559544 |
0.085677149279824 |
0.0856771492798241 |
0.942077809917777 |
0.798407114482674 |
0.163865051774245 |
0.017995767769402 |
0.0179957677694018 |
0.879516513030751 |
0.736922031145972 |
0.589669372695344 |
0.954449085497507 |
0.811225361568493 |
0.172090128609953 |
0.525153056031630 |
0.52515305603163 |
0.386470556904781 |
0.744990266275122 |
0.100015020510189 |

Can't render this file because it has a wrong number of fields in line 60.

View File

@ -2,42 +2,42 @@
taos> select ROUND(10.55, 3)
round(10.55, 3) |
============================
10.550000000000001 |
10.55 |
taos> select ROUND(10.55, 2)
round(10.55, 2) |
============================
10.550000000000001 |
10.55 |
taos> select ROUND(10.55, 1)
round(10.55, 1) |
============================
10.600000000000000 |
10.6 |
taos> select ROUND(10.55, 0)
round(10.55, 0) |
============================
11.000000000000000 |
11 |
taos> select ROUND(10.55)
round(10.55) |
============================
11.000000000000000 |
11 |
taos> select ROUND(10.55, -1)
round(10.55, -1) |
============================
10.000000000000000 |
10 |
taos> select ROUND(10.55, -10)
round(10.55, -10) |
============================
0.000000000000000 |
0 |
taos> select ROUND(-10.55, 1)
round(-10.55, 1) |
============================
-10.600000000000000 |
-10.6 |
taos> select ROUND(99, 1)
round(99, 1) |
@ -47,22 +47,22 @@ taos> select ROUND(99, 1)
taos> select ROUND(111.1111)
round(111.1111) |
============================
111.000000000000000 |
111 |
taos> select ROUND(111.5111)
round(111.5111) |
============================
112.000000000000000 |
112 |
taos> select ROUND(10.55) + 1
round(10.55) + 1 |
============================
12.000000000000000 |
12 |
taos> select ROUND(10.55, 1) + 1
round(10.55, 1) + 1 |
============================
11.600000000000000 |
11.6 |
taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123.123456789, 9), 8), 7), 6), 5), 4))
round(round(round(round(round(round(round(123.123456789, 9), 8), |
@ -77,26 +77,26 @@ taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1),
taos> select ROUND(current) from ts_4893.meters order by ts limit 20
round(current) |
=======================
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
10.0000000 |
11.0000000 |
9.0000000 |
11.0000000 |
8.0000000 |
12.0000000 |
9.0000000 |
10.0000000 |
10.0000000 |
10.0000000 |
10.0000000 |
11 |
9 |
10 |
11 |
11 |
9 |
10 |
11 |
11 |
10 |
11 |
9 |
11 |
8 |
12 |
9 |
10 |
10 |
10 |
10 |
taos> select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10
round(87654321.123456789, id) |
@ -115,70 +115,70 @@ taos> select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit
taos> select ROUND(current, id) from ts_4893.meters order by ts limit 10
round(current, id) |
=======================
11.0000000 |
8.6000004 |
9.8000002 |
11.2329998 |
10.7060003 |
8.5080004 |
9.5959997 |
10.9619999 |
11.2259998 |
10.3369999 |
11 |
8.6 |
9.8 |
11.233 |
10.706 |
8.508 |
9.596 |
10.962 |
11.226 |
10.337 |
taos> select ROUND(current, 1) from ts_4893.meters order by ts limit 10
round(current, 1) |
=======================
10.6999998 |
8.6000004 |
9.8000002 |
11.1999998 |
10.6999998 |
8.5000000 |
9.6000004 |
11.0000000 |
11.1999998 |
10.3000002 |
10.7 |
8.6 |
9.8 |
11.2 |
10.7 |
8.5 |
9.6 |
11 |
11.2 |
10.3 |
taos> select round(10.55, 3)
round(10.55, 3) |
============================
10.550000000000001 |
10.55 |
taos> select round(10.55, 2)
round(10.55, 2) |
============================
10.550000000000001 |
10.55 |
taos> select round(10.55, 1)
round(10.55, 1) |
============================
10.600000000000000 |
10.6 |
taos> select round(10.55, 0)
round(10.55, 0) |
============================
11.000000000000000 |
11 |
taos> select round(10.55)
round(10.55) |
============================
11.000000000000000 |
11 |
taos> select round(10.55, -1)
round(10.55, -1) |
============================
10.000000000000000 |
10 |
taos> select round(10.55, -10)
round(10.55, -10) |
============================
0.000000000000000 |
0 |
taos> select round(-10.55, 1)
round(-10.55, 1) |
============================
-10.600000000000000 |
-10.6 |
taos> select round(99, 1)
round(99, 1) |
@ -188,30 +188,30 @@ taos> select round(99, 1)
taos> select round(current) from ts_4893.d0 order by ts limit 10
round(current) |
=======================
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
10.0000000 |
11 |
9 |
10 |
11 |
11 |
9 |
10 |
11 |
11 |
10 |
taos> select round(current) from ts_4893.meters order by ts limit 10
round(current) |
=======================
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
9.0000000 |
10.0000000 |
11.0000000 |
11.0000000 |
10.0000000 |
11 |
9 |
10 |
11 |
11 |
9 |
10 |
11 |
11 |
10 |
taos> select round(10, null)
round(10, null) |
@ -236,32 +236,32 @@ taos> select round(100)
taos> select round(0.00123, -2)
round(0.00123, -2) |
============================
0.000000000000000 |
0 |
taos> select round(123.456, 0)
round(123.456, 0) |
============================
123.000000000000000 |
123 |
taos> select round(123.456, -5)
round(123.456, -5) |
============================
0.000000000000000 |
0 |
taos> select round(12345.6789, -2)
round(12345.6789, -2) |
============================
12300.000000000000000 |
12300 |
taos> select round(-123.456, 2)
round(-123.456, 2) |
============================
-123.459999999999994 |
-123.46 |
taos> select round(-1234.5678, 2)
round(-1234.5678, 2) |
============================
-1234.569999999999936 |
-1234.57 |
taos> select round(voltage, 0) from ts_4893.meters limit 1
round(voltage, 0) |
@ -271,12 +271,12 @@ taos> select round(voltage, 0) from ts_4893.meters limit 1
taos> select round(current, 1) from ts_4893.meters limit 1
round(current, 1) |
=======================
10.6999998 |
10.7 |
taos> select round(phase, 3) from ts_4893.meters limit 1
round(phase, 3) |
=======================
0.5090000 |
0.509 |
taos> select round(voltage, -1) from ts_4893.meters limit 1
round(voltage, -1) |
@ -296,17 +296,17 @@ taos> select round(abs(voltage), 2) from ts_4893.meters limit 1
taos> select round(pi() * phase, 3) from ts_4893.meters limit 1
round(pi() * phase, 3) |
============================
1.599000000000000 |
1.599 |
taos> select round(sqrt(voltage), 2) from ts_4893.meters limit 1
round(sqrt(voltage), 2) |
============================
14.869999999999999 |
14.87 |
taos> select round(log(current), 2) from ts_4893.meters limit 1
round(log(current), 2) |
============================
2.370000000000000 |
2.37 |
taos> select round(cast(1.0e+400 as float), 0);
round(cast(1.0e+400 as float), 0) |

1 taos> select ROUND(10.55, 3)
2 round(10.55, 3) |
3 ============================
4 10.550000000000001 | 10.55 |
5 taos> select ROUND(10.55, 2)
6 round(10.55, 2) |
7 ============================
8 10.550000000000001 | 10.55 |
9 taos> select ROUND(10.55, 1)
10 round(10.55, 1) |
11 ============================
12 10.600000000000000 | 10.6 |
13 taos> select ROUND(10.55, 0)
14 round(10.55, 0) |
15 ============================
16 11.000000000000000 | 11 |
17 taos> select ROUND(10.55)
18 round(10.55) |
19 ============================
20 11.000000000000000 | 11 |
21 taos> select ROUND(10.55, -1)
22 round(10.55, -1) |
23 ============================
24 10.000000000000000 | 10 |
25 taos> select ROUND(10.55, -10)
26 round(10.55, -10) |
27 ============================
28 0.000000000000000 | 0 |
29 taos> select ROUND(-10.55, 1)
30 round(-10.55, 1) |
31 ============================
32 -10.600000000000000 | -10.6 |
33 taos> select ROUND(99, 1)
34 round(99, 1) |
35 ========================
36 99 |
37 taos> select ROUND(111.1111)
38 round(111.1111) |
39 ============================
40 111.000000000000000 | 111 |
41 taos> select ROUND(111.5111)
42 round(111.5111) |
43 ============================
47 ============================
48 12.000000000000000 | 12 |
49 taos> select ROUND(10.55, 1) + 1
50 round(10.55, 1) + 1 |
51 ============================
52 11.600000000000000 | 11.6 |
53 taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123.123456789, 9), 8), 7), 6), 5), 4))
54 round(round(round(round(round(round(round(123.123456789, 9), 8), |
55 ===================================================================
56 1.230000000000000e+02 |
57 taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1), -2), -3), -4), -5), -6))
58 round(round(round(round(round(round(round(123456789.123456789, - |
59 ===================================================================
60 1.230000000000000e+08 |
61 taos> select ROUND(current) from ts_4893.meters order by ts limit 20
62 round(current) |
63 =======================
64 11.0000000 | 11 |
65 9.0000000 | 9 |
66 10.0000000 | 10 |
67 11.0000000 | 11 |
68 11.0000000 | 11 |
77 8.0000000 | 8 |
78 12.0000000 | 12 |
79 9.0000000 | 9 |
80 10.0000000 | 10 |
81 10.0000000 | 10 |
82 10.0000000 | 10 |
83 10.0000000 | 10 |
84 taos> select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10
85 round(87654321.123456789, id) |
86 ================================
87 8.765432100000000e+07 |
88 8.765432109999999e+07 |
89 8.765432112000000e+07 |
90 8.765432112300000e+07 |
91 8.765432112350000e+07 |
92 8.765432112345999e+07 |
93 8.765432112345700e+07 |
94 8.765432112345681e+07 |
95 8.765432112345679e+07 |
96 8.765432112345679e+07 |
97 taos> select ROUND(current, id) from ts_4893.meters order by ts limit 10
98 round(current, id) |
99 =======================
100 11.0000000 | 11 |
101 8.6000004 | 8.6 |
102 9.8000002 | 9.8 |
115 9.8000002 | 9.8 |
116 11.1999998 | 11.2 |
117 10.6999998 | 10.7 |
118 8.5000000 | 8.5 |
119 9.6000004 | 9.6 |
120 11.0000000 | 11 |
121 11.1999998 | 11.2 |
122 10.3000002 | 10.3 |
123 taos> select round(10.55, 3)
124 round(10.55, 3) |
125 ============================
126 10.550000000000001 | 10.55 |
127 taos> select round(10.55, 2)
128 round(10.55, 2) |
129 ============================
130 10.550000000000001 | 10.55 |
131 taos> select round(10.55, 1)
132 round(10.55, 1) |
133 ============================
134 10.600000000000000 | 10.6 |
135 taos> select round(10.55, 0)
136 round(10.55, 0) |
137 ============================
138 11.000000000000000 | 11 |
139 taos> select round(10.55)
140 round(10.55) |
141 ============================
142 11.000000000000000 | 11 |
143 taos> select round(10.55, -1)
144 round(10.55, -1) |
145 ============================
146 10.000000000000000 | 10 |
147 taos> select round(10.55, -10)
148 round(10.55, -10) |
149 ============================
150 0.000000000000000 | 0 |
151 taos> select round(-10.55, 1)
152 round(-10.55, 1) |
153 ============================
154 -10.600000000000000 | -10.6 |
155 taos> select round(99, 1)
156 round(99, 1) |
157 ========================
158 99 |
159 taos> select round(current) from ts_4893.d0 order by ts limit 10
160 round(current) |
161 =======================
162 11.0000000 | 11 |
163 9.0000000 | 9 |
164 10.0000000 | 10 |
165 11.0000000 | 11 |
166 11.0000000 | 11 |
167 9.0000000 | 9 |
168 10.0000000 | 10 |
169 11.0000000 | 11 |
170 11.0000000 | 11 |
171 10.0000000 | 10 |
172 taos> select round(current) from ts_4893.meters order by ts limit 10
173 round(current) |
174 =======================
175 11.0000000 | 11 |
176 9.0000000 | 9 |
177 10.0000000 | 10 |
178 11.0000000 | 11 |
179 11.0000000 | 11 |
180 9.0000000 | 9 |
181 10.0000000 | 10 |
182 11.0000000 | 11 |
183 11.0000000 | 11 |
184 10.0000000 | 10 |
188 NULL |
189 taos> select round(null, 2)
190 round(null, 2) |
191 ========================
192 NULL |
193 taos> select round(123.456, null)
194 round(123.456, null) |
195 ============================
196 NULL |
197 taos> select round(100)
198 round(100) |
199 ========================
200 100 |
201 taos> select round(0.00123, -2)
202 round(0.00123, -2) |
203 ============================
204 0.000000000000000 | 0 |
205 taos> select round(123.456, 0)
206 round(123.456, 0) |
207 ============================
208 123.000000000000000 | 123 |
209 taos> select round(123.456, -5)
210 round(123.456, -5) |
211 ============================
212 0.000000000000000 | 0 |
213 taos> select round(12345.6789, -2)
214 round(12345.6789, -2) |
215 ============================
216 12300.000000000000000 | 12300 |
217 taos> select round(-123.456, 2)
236 0.5090000 | 0.509 |
237 taos> select round(voltage, -1) from ts_4893.meters limit 1
238 round(voltage, -1) |
239 =====================
240 220 |
241 taos> select round(current * voltage, 2) from ts_4893.meters limit 1
242 round(current * voltage, 2) |
243 ==============================
244 2.353650000000000e+03 |
245 taos> select round(abs(voltage), 2) from ts_4893.meters limit 1
246 round(abs(voltage), 2) |
247 =========================
248 221 |
249 taos> select round(pi() * phase, 3) from ts_4893.meters limit 1
250 round(pi() * phase, 3) |
251 ============================
252 1.599000000000000 | 1.599 |
253 taos> select round(sqrt(voltage), 2) from ts_4893.meters limit 1
254 round(sqrt(voltage), 2) |
255 ============================
256 14.869999999999999 | 14.87 |
257 taos> select round(log(current), 2) from ts_4893.meters limit 1
258 round(log(current), 2) |
259 ============================
260 2.370000000000000 | 2.37 |
261 taos> select round(cast(1.0e+400 as float), 0);
262 round(cast(1.0e+400 as float), 0) |
263 ====================================
264 NULL |
265 taos> select round(cast(1.0e+400 as double), 0);
266 round(cast(1.0e+400 as double), 0) |
267 =====================================
271 ===============================
272 5 |
273 taos> select round(cast(50 as smallint), 1);
274 round(cast(50 as smallint), 1) |
275 =================================
276 50 |
277 taos> select round(cast(500 as int), 1);
278 round(cast(500 as int), 1) |
279 =============================
280 500 |
281 taos> select round(cast(50000 as bigint), 1);
282 round(cast(50000 as bigint), 1) |
296 500 |
297 taos> select round(cast(50000 as bigint unsigned), 1)
298 round(cast(50000 as bigint unsigned), 1) |
299 ===========================================
300 50000 |
301
302
303
304
305
306
307
308
309
310
311
312

View File

@ -12,7 +12,7 @@ taos> select SIGN(1)
taos> select SIGN(1.5)
sign(1.5) |
============================
1.000000000000000 |
1 |
taos> select SIGN(100)
sign(100) |
@ -27,7 +27,7 @@ taos> select SIGN(-1)
taos> select SIGN(-1.5)
sign(-1.5) |
============================
-1.000000000000000 |
-1 |
taos> select SIGN(-100)
sign(-100) |
@ -37,22 +37,22 @@ taos> select SIGN(-100)
taos> select SIGN(1) + 1
sign(1) + 1 |
============================
2.000000000000000 |
2 |
taos> select SIGN(1) - 1
sign(1) - 1 |
============================
0.000000000000000 |
0 |
taos> select SIGN(1) * 1
sign(1) * 1 |
============================
1.000000000000000 |
1 |
taos> select SIGN(1) / 1
sign(1) / 1 |
============================
1.000000000000000 |
1 |
taos> select SIGN(1) from ts_4893.meters limit 5
sign(1) |
@ -66,60 +66,60 @@ taos> select SIGN(1) from ts_4893.meters limit 5
taos> select SIGN(1) + 1 from ts_4893.meters limit 1
sign(1) + 1 |
============================
2.000000000000000 |
2 |
taos> select SIGN(1) - 1 from ts_4893.meters limit 1
sign(1) - 1 |
============================
0.000000000000000 |
0 |
taos> select SIGN(1) * 2 from ts_4893.meters limit 1
sign(1) * 2 |
============================
2.000000000000000 |
2 |
taos> select SIGN(1) / 2 from ts_4893.meters limit 1
sign(1) / 2 |
============================
0.500000000000000 |
0.5 |
taos> select SIGN(2) + SIGN(1) from ts_4893.meters limit 1
sign(2) + sign(1) |
============================
2.000000000000000 |
2 |
taos> select SIGN(2) - SIGN(1) from ts_4893.meters limit 1
sign(2) - sign(1) |
============================
0.000000000000000 |
0 |
taos> select SIGN(2) * SIGN(1) from ts_4893.meters limit 1
sign(2) * sign(1) |
============================
1.000000000000000 |
1 |
taos> select SIGN(2) / SIGN(1) from ts_4893.meters limit 1
sign(2) / sign(1) |
============================
1.000000000000000 |
1 |
taos> select SIGN(1) + id from ts_4893.meters order by ts limit 5
sign(1) + id |
============================
1.000000000000000 |
2.000000000000000 |
3.000000000000000 |
4.000000000000000 |
5.000000000000000 |
1 |
2 |
3 |
4 |
5 |
taos> select SIGN(id) + id from ts_4893.meters order by ts limit 5
sign(id) + id |
============================
0.000000000000000 |
2.000000000000000 |
3.000000000000000 |
4.000000000000000 |
5.000000000000000 |
0 |
2 |
3 |
4 |
5 |
taos> select sign(cast(1 as tinyint))
sign(cast(1 as tinyint)) |
@ -169,7 +169,7 @@ taos> select sign(cast(1 as float))
taos> select sign(cast(1 as double))
sign(cast(1 as double)) |
============================
1.000000000000000 |
1 |
taos> select sign(cast(NULL as tinyint))
sign(cast(null as tinyint)) |
@ -239,12 +239,12 @@ taos> select abs(SIGN(10))
taos> select pow(SIGN(10), 2)
pow(sign(10), 2) |
============================
1.000000000000000 |
1 |
taos> select sqrt(SIGN(10))
sqrt(sign(10)) |
============================
1.000000000000000 |
1 |
taos> select cast(SIGN(10) as int)
cast(sign(10) as int) |
@ -254,11 +254,11 @@ taos> select cast(SIGN(10) as int)
taos> select SIGN(sqrt(id)) from ts_4893.meters order by ts limit 5
sign(sqrt(id)) |
============================
0.000000000000000 |
1.000000000000000 |
1.000000000000000 |
1.000000000000000 |
1.000000000000000 |
0 |
1 |
1 |
1 |
1 |
taos> select SIGN(SIGN(SIGN(SIGN(0))))
sign(sign(sign(sign(0)))) |
@ -288,30 +288,30 @@ taos> select sign(-10)
taos> select sign(current) from ts_4893.d0 order by ts limit 10
sign(current) |
=======================
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
taos> select sign(current) from ts_4893.meters order by ts limit 10
sign(current) |
=======================
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1.0000000 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
taos> select sign(cast(current as float)) from ts_4893.d0 order by ts limit 10
sign(cast(current as float)) |
@ -359,17 +359,17 @@ taos> select sign(-10)
taos> select sign(0.1)
sign(0.1) |
============================
1.000000000000000 |
1 |
taos> select sign(-0.1)
sign(-0.1) |
============================
-1.000000000000000 |
-1 |
taos> select sign(current) from ts_4893.meters limit 1
sign(current) |
=======================
1.0000000 |
1 |
taos> select sign(voltage) from ts_4893.meters limit 1
sign(voltage) |
@ -379,7 +379,7 @@ taos> select sign(voltage) from ts_4893.meters limit 1
taos> select sign(phase) from ts_4893.meters limit 1
sign(phase) |
=======================
1.0000000 |
1 |
taos> select sign(abs(voltage)) from ts_4893.meters limit 1
sign(abs(voltage)) |
@ -389,15 +389,15 @@ taos> select sign(abs(voltage)) from ts_4893.meters limit 1
taos> select sign(round(current)) from ts_4893.meters limit 1
sign(round(current)) |
=======================
1.0000000 |
1 |
taos> select sign(sqrt(voltage)) from ts_4893.meters limit 1
sign(sqrt(voltage)) |
============================
1.000000000000000 |
1 |
taos> select sign(log(current + 1)) from ts_4893.meters limit 1
sign(log(current + 1)) |
============================
1.000000000000000 |
1 |

Can't render this file because it has a wrong number of fields in line 239.

View File

@ -2,7 +2,7 @@
taos> select STDDEV(current) from ts_4893.meters
stddev(current) |
============================
1.154339668872967 |
1.15433966887297 |
taos> select STDDEV(current) from ts_4893.meters interval(1d) order by 1 limit 10
stddev(current) |
@ -21,40 +21,40 @@ taos> select STDDEV(current) from ts_4893.meters interval(1d) order by 1 limit 1
taos> select STDDEV(id) from ts_4893.meters
stddev(id) |
============================
2886.751331514371941 |
2886.75133151437 |
taos> select STDDEV(id) from ts_4893.meters interval(1d) limit 10
stddev(id) |
============================
4.609772228646444 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
8.077747210701755 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
8.366600265340756 |
4.60977222864644 |
8.36660026534076 |
8.36660026534076 |
8.36660026534076 |
8.36660026534076 |
8.07774721070176 |
8.36660026534076 |
8.36660026534076 |
8.36660026534076 |
8.36660026534076 |
taos> select STDDEV(id) from ts_4893.meters where id > 100
stddev(id) |
============================
2857.595142773027419 |
2857.59514277303 |
taos> select STDDEV(id) from ts_4893.meters interval(1d) order by 1 limit 10
stddev(id) |
============================
4.609772228646444 |
5.477225575051661 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
8.077747210701755 |
4.60977222864644 |
5.47722557505166 |
8.07774721070176 |
8.07774721070176 |
8.07774721070176 |
8.07774721070176 |
8.07774721070176 |
8.07774721070176 |
8.07774721070176 |
8.07774721070176 |
taos> select stddev_pop(null) from ts_4893.meters
stddev_pop(null) |
@ -64,32 +64,32 @@ taos> select stddev_pop(null) from ts_4893.meters
taos> select stddev_pop(id) from ts_4893.d0
stddev_pop(id) |
============================
2886.751331514371941 |
2886.75133151437 |
taos> select stddev_pop(id) from ts_4893.meters
stddev_pop(id) |
============================
2886.751331514371941 |
2886.75133151437 |
taos> select stddev_pop(current) from ts_4893.d0
stddev_pop(current) |
============================
1.154339668872967 |
1.15433966887297 |
taos> select stddev_pop(current) from ts_4893.meters
stddev_pop(current) |
============================
1.154339668872967 |
1.15433966887297 |
taos> select stddev_pop(voltage) from ts_4893.meters
stddev_pop(voltage) |
============================
2.876459705957324 |
2.87645970595732 |
taos> select stddev_pop(voltage) from ts_4893.meters where voltage is not null
stddev_pop(voltage) |
============================
2.876459705957324 |
2.87645970595732 |
taos> select stddev_pop(phase) from ts_4893.meters
stddev_pop(phase) |
@ -104,7 +104,7 @@ taos> select stddev_pop(phase) from ts_4893.meters where ts between '2023-01-01
taos> select stddev_pop(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
stddev_pop(total_voltage) |
============================
0.000000000000000 |
0 |
taos> select round(stddev_pop(current), 2) from ts_4893.meters
round(stddev_pop(current), 2) |
@ -124,15 +124,15 @@ taos> select log(stddev_pop(voltage) + 1) from ts_4893.meters
taos> select groupid, stddev_pop(voltage) from ts_4893.meters group by groupid order by groupid
groupid | stddev_pop(voltage) |
======================================
1 | 2.876459705957324 |
1 | 2.87645970595732 |
taos> select location, stddev_pop(current) from ts_4893.meters group by location order by location
location | stddev_pop(current) |
=================================================
beijing | 1.154339668872967 |
beijing | 1.15433966887297 |
taos> select location, stddev_pop(voltage) from ts_4893.meters group by location order by location
location | stddev_pop(voltage) |
=================================================
beijing | 2.876459705957324 |
beijing | 2.87645970595732 |

Can't render this file because it has a wrong number of fields in line 109.

View File

@ -47,10 +47,10 @@ taos> select sum(cast(10000000000 as bigint unsigned))
taos> select sum(cast(1.1 as float))
sum(cast(1.1 as float)) |
============================
1.100000023841858 |
1.10000002384186 |
taos> select sum(cast(1.1 as double))
sum(cast(1.1 as double)) |
============================
1.100000000000000 |
1.1 |

1 taos> select sum(1)
47
48
49
50
51
52
53
54
55
56

View File

@ -2,37 +2,37 @@
taos> select TRUNCATE(10.55, 3)
truncate(10.55, 3) |
============================
10.550000000000001 |
10.55 |
taos> select TRUNCATE(10.55, 2)
truncate(10.55, 2) |
============================
10.550000000000001 |
10.55 |
taos> select TRUNCATE(10.55, 1)
truncate(10.55, 1) |
============================
10.500000000000000 |
10.5 |
taos> select TRUNCATE(10.55, 0)
truncate(10.55, 0) |
============================
10.000000000000000 |
10 |
taos> select TRUNCATE(10.55, -1)
truncate(10.55, -1) |
============================
10.000000000000000 |
10 |
taos> select TRUNCATE(10.55, -10)
truncate(10.55, -10) |
============================
0.000000000000000 |
0 |
taos> select TRUNCATE(-10.55, 1)
truncate(-10.55, 1) |
============================
-10.500000000000000 |
-10.5 |
taos> select TRUNCATE(99, 1)
truncate(99, 1) |
@ -42,7 +42,7 @@ taos> select TRUNCATE(99, 1)
taos> select TRUNCATE(10.55, 1) + 1
truncate(10.55, 1) + 1 |
============================
11.500000000000000 |
11.5 |
taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123.123456789, 9), 8), 7), 6), 5), 4), 3)
truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
@ -85,51 +85,51 @@ taos> select TRUNCATE(current, id) from ts_4893.meters order by ts limit 10
taos> select TRUNCATE(current, 1) from ts_4893.meters order by ts limit 10
truncate(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
10.6 |
8.5 |
9.7 |
11.2 |
10.7 |
8.5 |
9.5 |
10.9 |
11.2 |
10.3 |
taos> select TRUNC(10.55, 3)
trunc(10.55, 3) |
============================
10.550000000000001 |
10.55 |
taos> select TRUNC(10.55, 2)
trunc(10.55, 2) |
============================
10.550000000000001 |
10.55 |
taos> select TRUNC(10.55, 1)
trunc(10.55, 1) |
============================
10.500000000000000 |
10.5 |
taos> select TRUNC(10.55, 0)
trunc(10.55, 0) |
============================
10.000000000000000 |
10 |
taos> select TRUNC(10.55, -1)
trunc(10.55, -1) |
============================
10.000000000000000 |
10 |
taos> select TRUNC(10.55, -10)
trunc(10.55, -10) |
============================
0.000000000000000 |
0 |
taos> select TRUNC(-10.55, 1)
trunc(-10.55, 1) |
============================
-10.500000000000000 |
-10.5 |
taos> select TRUNC(99, 1)
trunc(99, 1) |
@ -139,7 +139,7 @@ taos> select TRUNC(99, 1)
taos> select TRUNC(10.55, 1) + 1
trunc(10.55, 1) + 1 |
============================
11.500000000000000 |
11.5 |
taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123.123456789, 9), 8), 7), 6), 5), 4), 3)
trunc(trunc(trunc(trunc(trunc(trunc(trunc(123.123456789, 9), 8), |
@ -168,60 +168,60 @@ taos> select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit
taos> select TRUNC(current, id) from ts_4893.meters order by ts limit 10
trunc(current, id) |
=======================
10.0000000 |
8.5000000 |
9.7900000 |
11.2329998 |
10.7060003 |
8.5080004 |
9.5959997 |
10.9619999 |
11.2259998 |
10.3369999 |
10 |
8.5 |
9.79 |
11.233 |
10.706 |
8.508 |
9.596 |
10.962 |
11.226 |
10.337 |
taos> select TRUNC(current, 1) from ts_4893.meters order by ts limit 10
trunc(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
10.6 |
8.5 |
9.7 |
11.2 |
10.7 |
8.5 |
9.5 |
10.9 |
11.2 |
10.3 |
taos> select truncate(99.99, 3)
truncate(99.99, 3) |
============================
99.989999999999995 |
99.99 |
taos> select truncate(99.99, 2)
truncate(99.99, 2) |
============================
99.989999999999995 |
99.99 |
taos> select truncate(99.99, 1)
truncate(99.99, 1) |
============================
99.900000000000006 |
99.9 |
taos> select truncate(99.99, 0)
truncate(99.99, 0) |
============================
99.000000000000000 |
99 |
taos> select truncate(99.99, -1)
truncate(99.99, -1) |
============================
90.000000000000000 |
90 |
taos> select truncate(99.99, -10)
truncate(99.99, -10) |
============================
0.000000000000000 |
0 |
taos> select truncate(99, 1)
truncate(99, 1) |
@ -231,30 +231,30 @@ taos> select truncate(99, 1)
taos> select truncate(current, 1) from ts_4893.d0 order by ts limit 10
truncate(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
10.6 |
8.5 |
9.7 |
11.2 |
10.7 |
8.5 |
9.5 |
10.9 |
11.2 |
10.3 |
taos> select truncate(current, 1) from ts_4893.meters order by ts limit 10
truncate(current, 1) |
=======================
10.6000004 |
8.5000000 |
9.6999998 |
11.1999998 |
10.6999998 |
8.5000000 |
9.5000000 |
10.8999996 |
11.1999998 |
10.3000002 |
10.6 |
8.5 |
9.7 |
11.2 |
10.7 |
8.5 |
9.5 |
10.9 |
11.2 |
10.3 |
taos> select truncate(99.99, null)
truncate(99.99, null) |
@ -269,22 +269,22 @@ taos> select truncate(null, 3)
taos> select truncate(1.0001, 3)
truncate(1.0001, 3) |
============================
1.000000000000000 |
1 |
taos> select truncate(2.71828, 4)
truncate(2.71828, 4) |
============================
2.718200000000000 |
2.7182 |
taos> select truncate(3.14159, 2)
truncate(3.14159, 2) |
============================
3.140000000000000 |
3.14 |
taos> select truncate(100.9876, 2)
truncate(100.9876, 2) |
============================
100.980000000000004 |
100.98 |
taos> select truncate(99999999999999.9999, 2)
truncate(99999999999999.9999, 2) |
@ -294,7 +294,7 @@ taos> select truncate(99999999999999.9999, 2)
taos> select truncate(-5.678, 2)
truncate(-5.678, 2) |
============================
-5.670000000000000 |
-5.67 |
taos> select truncate(voltage, 2) from ts_4893.meters limit 1
truncate(voltage, 2) |
@ -304,12 +304,12 @@ taos> select truncate(voltage, 2) from ts_4893.meters limit 1
taos> select truncate(current, 1) from ts_4893.meters limit 1
truncate(current, 1) |
=======================
10.6000004 |
10.6 |
taos> select truncate(phase, 3) from ts_4893.meters limit 1
truncate(phase, 3) |
=======================
0.5080000 |
0.508 |
taos> select truncate(voltage + current, 2) from ts_4893.meters limit 1
truncate(voltage + current, 2) |
@ -334,10 +334,10 @@ taos> select truncate(abs(current), 1) from ts_4893.meters limit 1
taos> select truncate(exp(phase), 2) from ts_4893.meters limit 1
truncate(exp(phase), 2) |
============================
1.660000000000000 |
1.66 |
taos> select truncate(log(current), 1) from ts_4893.meters limit 1
truncate(log(current), 1) |
============================
2.300000000000000 |
2.3 |

1 taos> select TRUNCATE(10.55, 3)
2 truncate(10.55, 3) |
3 ============================
4 10.550000000000001 | 10.55 |
5 taos> select TRUNCATE(10.55, 2)
6 truncate(10.55, 2) |
7 ============================
8 10.550000000000001 | 10.55 |
9 taos> select TRUNCATE(10.55, 1)
10 truncate(10.55, 1) |
11 ============================
12 10.500000000000000 | 10.5 |
13 taos> select TRUNCATE(10.55, 0)
14 truncate(10.55, 0) |
15 ============================
16 10.000000000000000 | 10 |
17 taos> select TRUNCATE(10.55, -1)
18 truncate(10.55, -1) |
19 ============================
20 10.000000000000000 | 10 |
21 taos> select TRUNCATE(10.55, -10)
22 truncate(10.55, -10) |
23 ============================
24 0.000000000000000 | 0 |
25 taos> select TRUNCATE(-10.55, 1)
26 truncate(-10.55, 1) |
27 ============================
28 -10.500000000000000 | -10.5 |
29 taos> select TRUNCATE(99, 1)
30 truncate(99, 1) |
31 ========================
32 99 |
33 taos> select TRUNCATE(10.55, 1) + 1
34 truncate(10.55, 1) + 1 |
35 ============================
36 11.500000000000000 | 11.5 |
37 taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123.123456789, 9), 8), 7), 6), 5), 4), 3)
38 truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
42 truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
43 ===================================================================
44 1.200000000000000e+08 |
45 taos> select TRUNCATE(87654321.123456789, id) from ts_4893.meters order by ts limit 10
46 truncate(87654321.123456789, id) |
47 ===================================
48 8.765432100000000e+07 |
85 trunc(10.55, 3) |
86 ============================
87 10.550000000000001 | 10.55 |
88 taos> select TRUNC(10.55, 2)
89 trunc(10.55, 2) |
90 ============================
91 10.550000000000001 | 10.55 |
92 taos> select TRUNC(10.55, 1)
93 trunc(10.55, 1) |
94 ============================
95 10.500000000000000 | 10.5 |
96 taos> select TRUNC(10.55, 0)
97 trunc(10.55, 0) |
98 ============================
99 10.000000000000000 | 10 |
100 taos> select TRUNC(10.55, -1)
101 trunc(10.55, -1) |
102 ============================
103 10.000000000000000 | 10 |
104 taos> select TRUNC(10.55, -10)
105 trunc(10.55, -10) |
106 ============================
107 0.000000000000000 | 0 |
108 taos> select TRUNC(-10.55, 1)
109 trunc(-10.55, 1) |
110 ============================
111 -10.500000000000000 | -10.5 |
112 taos> select TRUNC(99, 1)
113 trunc(99, 1) |
114 ========================
115 99 |
116 taos> select TRUNC(10.55, 1) + 1
117 trunc(10.55, 1) + 1 |
118 ============================
119 11.500000000000000 | 11.5 |
120 taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123.123456789, 9), 8), 7), 6), 5), 4), 3)
121 trunc(trunc(trunc(trunc(trunc(trunc(trunc(123.123456789, 9), 8), |
122 ===================================================================
123 1.231230000000000e+02 |
124 taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
125 trunc(trunc(trunc(trunc(trunc(trunc(trunc(123456789.123456789, - |
126 ===================================================================
127 1.200000000000000e+08 |
128 taos> select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10
129 trunc(87654321.123456789, id) |
130 ================================
131 8.765432100000000e+07 |
132 8.765432109999999e+07 |
133 8.765432112000000e+07 |
134 8.765432112300000e+07 |
135 8.765432112340000e+07 |
139 8.765432112345679e+07 |
140 8.765432112345679e+07 |
141 taos> select TRUNC(current, id) from ts_4893.meters order by ts limit 10
142 trunc(current, id) |
143 =======================
144 10.0000000 | 10 |
145 8.5000000 | 8.5 |
168 truncate(99.99, 3) |
169 ============================
170 99.989999999999995 | 99.99 |
171 taos> select truncate(99.99, 2)
172 truncate(99.99, 2) |
173 ============================
174 99.989999999999995 | 99.99 |
175 taos> select truncate(99.99, 1)
176 truncate(99.99, 1) |
177 ============================
178 99.900000000000006 | 99.9 |
179 taos> select truncate(99.99, 0)
180 truncate(99.99, 0) |
181 ============================
182 99.000000000000000 | 99 |
183 taos> select truncate(99.99, -1)
184 truncate(99.99, -1) |
185 ============================
186 90.000000000000000 | 90 |
187 taos> select truncate(99.99, -10)
188 truncate(99.99, -10) |
189 ============================
190 0.000000000000000 | 0 |
191 taos> select truncate(99, 1)
192 truncate(99, 1) |
193 ========================
194 99 |
195 taos> select truncate(current, 1) from ts_4893.d0 order by ts limit 10
196 truncate(current, 1) |
197 =======================
198 10.6000004 | 10.6 |
199 8.5000000 | 8.5 |
200 9.6999998 | 9.7 |
201 11.1999998 | 11.2 |
202 10.6999998 | 10.7 |
203 8.5000000 | 8.5 |
204 9.5000000 | 9.5 |
205 10.8999996 | 10.9 |
206 11.1999998 | 11.2 |
207 10.3000002 | 10.3 |
208 taos> select truncate(current, 1) from ts_4893.meters order by ts limit 10
209 truncate(current, 1) |
210 =======================
211 10.6000004 | 10.6 |
212 8.5000000 | 8.5 |
213 9.6999998 | 9.7 |
214 11.1999998 | 11.2 |
215 10.6999998 | 10.7 |
216 8.5000000 | 8.5 |
217 9.5000000 | 9.5 |
218 10.8999996 | 10.9 |
219 11.1999998 | 11.2 |
220 10.3000002 | 10.3 |
221 taos> select truncate(99.99, null)
222 truncate(99.99, null) |
223 ============================
224 NULL |
225 taos> select truncate(null, 3)
226 truncate(null, 3) |
227 ====================
231 ============================
232 1.000000000000000 | 1 |
233 taos> select truncate(2.71828, 4)
234 truncate(2.71828, 4) |
235 ============================
236 2.718200000000000 | 2.7182 |
237 taos> select truncate(3.14159, 2)
238 truncate(3.14159, 2) |
239 ============================
240 3.140000000000000 | 3.14 |
241 taos> select truncate(100.9876, 2)
242 truncate(100.9876, 2) |
243 ============================
244 100.980000000000004 | 100.98 |
245 taos> select truncate(99999999999999.9999, 2)
246 truncate(99999999999999.9999, 2) |
247 ===================================
248 1.000000000000000e+14 |
249 taos> select truncate(-5.678, 2)
250 truncate(-5.678, 2) |
251 ============================
252 -5.670000000000000 | -5.67 |
253 taos> select truncate(voltage, 2) from ts_4893.meters limit 1
254 truncate(voltage, 2) |
255 =======================
256 221 |
257 taos> select truncate(current, 1) from ts_4893.meters limit 1
258 truncate(current, 1) |
259 =======================
260 10.6000004 | 10.6 |
269 taos> select truncate(voltage, -1) from ts_4893.meters limit 1
270 truncate(voltage, -1) |
271 ========================
272 220 |
273 taos> select round(truncate(voltage, 1), 2) from ts_4893.meters limit 1
274 round(truncate(voltage, 1), 2) |
275 =================================
276 221 |
277 taos> select truncate(abs(current), 1) from ts_4893.meters limit 1
278 truncate(abs(current), 1) |
279 ============================
280 1.0600000e+01 |
281 taos> select truncate(exp(phase), 2) from ts_4893.meters limit 1
282 truncate(exp(phase), 2) |
283 ============================
284 1.660000000000000 | 1.66 |
285 taos> select truncate(log(current), 1) from ts_4893.meters limit 1
286 truncate(log(current), 1) |
287 ============================
288 2.300000000000000 | 2.3 |
289
290
294
295
296
297
298
299
300
304
305
306
307
308
309
310
311
312
313
314
315
334
335
336
337
338
339
340
341
342
343

View File

@ -2,7 +2,7 @@
taos> select VAR_POP(current) from ts_4893.meters
var_pop(current) |
============================
1.332500071133751 |
1.33250007113375 |
taos> select VAR_POP(current) from ts_4893.meters interval(1d) order by 1 limit 10
var_pop(current) |
@ -14,47 +14,47 @@ taos> select VAR_POP(current) from ts_4893.meters interval(1d) order by 1 limit
0.706550935286586 |
0.713306900568867 |
0.716868311383919 |
0.717430738826280 |
0.71743073882628 |
0.717718552465783 |
0.719483293517456 |
taos> select VAR_POP(id) from ts_4893.meters
var_pop(id) |
============================
8333333.250000000000000 |
8333333.25 |
taos> select VAR_POP(id) from ts_4893.meters interval(1d) limit 10
var_pop(id) |
============================
21.250000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
65.250000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
70.000000000000000 |
21.25 |
70 |
70 |
70 |
70 |
65.25 |
70 |
70 |
70 |
70 |
taos> select VAR_POP(id) from ts_4893.meters where id > 100
var_pop(id) |
============================
8165850.000000000000000 |
8165850 |
taos> select VAR_POP(id) from ts_4893.meters interval(1d) order by 1 limit 10
var_pop(id) |
============================
21.250000000000000 |
30.000000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
65.250000000000000 |
21.25 |
30 |
65.25 |
65.25 |
65.25 |
65.25 |
65.25 |
65.25 |
65.25 |
65.25 |
taos> select var_pop(null) from ts_4893.meters
var_pop(null) |
@ -64,37 +64,37 @@ taos> select var_pop(null) from ts_4893.meters
taos> select var_pop(id) from ts_4893.d0
var_pop(id) |
============================
8333333.250000000000000 |
8333333.25 |
taos> select var_pop(current) from ts_4893.d0
var_pop(current) |
============================
1.332500071133751 |
1.33250007113375 |
taos> select var_pop(voltage) from ts_4893.meters
var_pop(voltage) |
============================
8.274020439996093 |
8.27402043999609 |
taos> select var_pop(voltage) from ts_4893.meters where voltage is not null
var_pop(voltage) |
============================
8.274020439996093 |
8.27402043999609 |
taos> select var_pop(phase) from ts_4893.meters
var_pop(phase) |
============================
0.083287338468169 |
0.0832873384681693 |
taos> select var_pop(phase) from ts_4893.meters where ts between '2023-01-01 00:00:00' and '2023-12-31 23:59:59'
var_pop(phase) |
============================
0.082987411872200 |
0.0829874118722003 |
taos> select var_pop(total_voltage) from (select sum(voltage) as total_voltage from ts_4893.meters group by location)
var_pop(total_voltage) |
============================
0.000000000000000 |
0 |
taos> select round(var_pop(current), 2) from ts_4893.meters
round(var_pop(current), 2) |
@ -104,25 +104,25 @@ taos> select round(var_pop(current), 2) from ts_4893.meters
taos> select pow(var_pop(current), 2) from ts_4893.meters
pow(var_pop(current), 2) |
============================
1.775556439571451 |
1.77555643957145 |
taos> select log(var_pop(voltage) + 1) from ts_4893.meters
log(var_pop(voltage) + 1) |
============================
2.227216989977633 |
2.22721698997763 |
taos> select groupid, var_pop(voltage) from ts_4893.meters group by groupid order by groupid
groupid | var_pop(voltage) |
======================================
1 | 8.274020439996093 |
1 | 8.27402043999609 |
taos> select location, var_pop(current) from ts_4893.meters group by location order by location
location | var_pop(current) |
=================================================
beijing | 1.332500071133751 |
beijing | 1.33250007113375 |
taos> select location, var_pop(voltage) from ts_4893.meters group by location order by location
location | var_pop(voltage) |
=================================================
beijing | 8.274020439996093 |
beijing | 8.27402043999609 |

Can't render this file because it has a wrong number of fields in line 99.

View File

@ -265,8 +265,9 @@ class TDTestCase(TBase):
tdSql.checkData(0, 0, 3.141)
sql = f"select cast({float_1001} as binary(10)) as re;"
tdLog.debug(sql)
tdSql.query(sql)
tdSql.checkData(0, 0, 3.141593)
tdSql.checkData(0, 0, 3.14159265)
tdSql.query(f"select cast({float_1001} as nchar(5));")
tdSql.checkData(0, 0, 3.141)
@ -540,6 +541,18 @@ class TDTestCase(TBase):
tdSql.query(f"select cast({add1}+{test_str} as nchar(2)) re;")
tdSql.checkData(0, 0, "12")
def ts5972(self):
tdSql.execute("CREATE DATABASE IF NOT EXISTS ts5972;")
tdSql.execute("DROP TABLE IF EXISTS ts5972.t1;")
tdSql.execute("DROP TABLE IF EXISTS ts5972.t1;")
tdSql.execute("CREATE TABLE ts5972.t1(time TIMESTAMP, c0 DOUBLE);")
tdSql.execute("INSERT INTO ts5972.t1(time, c0) VALUES (1641024000000, 0.018518518518519), (1641024005000, 0.015151515151515), (1641024010000, 0.1234567891012345);")
tdSql.query("SELECT c0, CAST(c0 AS BINARY(50)) FROM ts5972.t1 WHERE CAST(c0 AS BINARY(50)) != c0;")
tdSql.checkRows(0)
tdSql.query("SELECT c0, CAST(c0 AS BINARY(50)) FROM ts5972.t1 WHERE CAST(c0 AS BINARY(50)) == c0;")
tdSql.checkRows(3)
def cast_without_from(self):
self.cast_from_int_to_other()
@ -556,6 +569,7 @@ class TDTestCase(TBase):
def run(self):
# 'from table' case see system-test/2-query/cast.py
self.cast_without_from()
self.ts5972()
tdLog.success(f"{__file__} successfully executed")

View File

@ -142,13 +142,14 @@ class TDTestCase(TBase):
assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res]))
tdSql.query("select case when c_float is not null then c_float else c_null end from st1;")
assert(tdSql.checkRows(10) and tdSql.res == [('2.200000',), ('3.300000',), ('4.400000',), ('5.500000',), ('6.600000',), ('7.700000',), ('8.800000',), ('9.900000',), ('10.100000',), (None,)])
assert(tdSql.checkRows(10) and tdSql.res == [('2.2',), ('3.3',), ('4.4',), ('5.5',), ('6.6',), ('7.7',), ('8.8',), ('9.9',), ('10.1',), (None,)])
tdSql.query("select case when c_double is null then c_double else c_null end from st1;")
assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res]))
tdSql.query("select case when c_double is not null then c_double else c_null end from st1;")
assert(tdSql.checkRows(10) and tdSql.res == [('2.220000',), ('3.330000',), ('4.440000',), ('5.550000',), ('6.660000',), ('7.770000',), ('8.880000',), ('9.990000',), ('10.101000',), (None,)])
assert(tdSql.checkRows(10) and tdSql.res == [('2.22',), ('3.33',), ('4.44',), ('5.55',), ('6.66',), ('7.77',), ('8.88',), ('9.99',), ('10.101',), (None,)])
tdSql.query("select case when c_varchar is null then c_varchar else c_null end from st1;")
assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res]))
@ -344,7 +345,8 @@ class TDTestCase(TBase):
assert(tdSql.checkRows(10) and tdSql.res == [('-2147483648',), ('three',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',)])
tdSql.query("select case c_float when 2.2 then 9.2233720e+18 when 3.3 then -9.2233720e+18 else 'aa' end from st1;")
assert(tdSql.checkRows(10) and tdSql.res == [('9223372000000000000.000000',), ('-9223372000000000000.000000',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',)])
print(tdSql.res)
assert(tdSql.checkRows(10) and tdSql.res == [('9.223372e+18',), ('-9.223372e+18',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',)])
tdSql.query("select case t1.c_int when 2 then 'run' when t1.c_int is null then 'other' else t2.c_varchar end from st1 t1, st2 t2 where t1.ts=t2.ts;")
print(tdSql.res)

View File

@ -414,6 +414,29 @@ class TDSql:
self.checkRowCol(row, col)
return self.cursor.istype(col, dataType)
def checkFloatString(self, row, col, data, show = False):
if row >= self.queryRows:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, row+1, self.queryRows)
tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args)
if col >= self.queryCols:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, col+1, self.queryCols)
tdLog.exit("%s(%d) failed: sql:%s, col:%d is larger than queryCols:%d" % args)
self.checkRowCol(row, col)
val = float(self.queryResult[row][col])
if abs(data) >= 1 and abs((val - data) / data) <= 0.000001:
if(show):
tdLog.info("check successfully")
elif abs(data) < 1 and abs(val - data) <= 0.000001:
if(show):
tdLog.info("check successfully")
else:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, row, col, self.queryResult[row][col], data)
tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args)
def checkData(self, row, col, data, show = False):
if row >= self.queryRows:

View File

@ -397,7 +397,7 @@ sql select case when f1 then f1 when f1 + 1 then f1 + 1 else f1 is null end from
if $rows != 4 then
return -1
endi
if $data00 != 1.000000 then
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
@ -659,10 +659,10 @@ endi
if $data00 != 0 then
return -1
endi
if $data10 != 10.000000 then
if $data10 != 10 then
return -1
endi
if $data20 != 50.000000 then
if $data20 != 50 then
return -1
endi
if $data30 != -1 then
@ -889,19 +889,19 @@ endi
if $data10 != 0 then
return -1
endi
if $data11 != -99.000000 then
if $data11 != -99 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data21 != 100.000000 then
if $data21 != 100 then
return -1
endi
if $data30 != 5 then
return -1
endi
if $data31 != -94.000000 then
if $data31 != -94 then
return -1
endi
@ -1028,7 +1028,7 @@ endi
if $data00 != NULL then
return -1
endi
if $data10 != -99.000000 then
if $data10 != -99 then
return -1
endi
if $data20 != 1 then
@ -1051,10 +1051,10 @@ endi
if $data21 != NULL then
return -1
endi
if $data31 != 101.000000 then
if $data31 != 101 then
return -1
endi
if $data41 != 103.000000 then
if $data41 != 103 then
return -1
endi
@ -1071,7 +1071,7 @@ sql select case when c_int > 100 then c_float else c_int end as result from t_te
if $rows != 1 then
return -1
endi
if $data00 != 123.449997 then
if $data00 != 123.45 then
return -1
endi
@ -1079,7 +1079,7 @@ sql select case when c_bigint > 100000 then c_double else c_bigint end as result
if $rows != 1 then
return -1
endi
if $data00 != 678.900000 then
if $data00 != 678.9 then
return -1
endi

View File

@ -435,7 +435,7 @@ if $data01 != @t12@ then
return -1
endi
if $data03 != @100000.000@ then
if $data03 != @100000@ then
return -1
endi

View File

@ -305,30 +305,30 @@ class TDTestCase:
tdLog.printNoPrefix("==========step21: cast float to binary, expect changes to str(int) ")
tdSql.query(f"select cast(c5 as binary(32)) as b from {self.dbname}.ct4")
for i in range(len(data_ct4_c5)):
tdSql.checkData( i, 0, str(data_ct4_c5[i]) ) if data_ct4_c5[i] is None else tdSql.checkData( i, 0, f'{data_ct4_c5[i]:.6f}' )
tdSql.checkData( i, 0, str(data_ct4_c5[i]) ) if data_ct4_c5[i] is None else tdSql.checkFloatString( i, 0, data_ct4_c5[i])
tdSql.query(f"select cast(c5 as binary(32)) as b from {self.dbname}.t1")
for i in range(len(data_t1_c5)):
tdSql.checkData( i, 0, str(data_t1_c5[i]) ) if data_t1_c5[i] is None else tdSql.checkData( i, 0, f'{data_t1_c5[i]:.6f}' )
tdSql.checkData( i, 0, str(data_t1_c5[i]) ) if data_t1_c5[i] is None else tdSql.checkFloatString( i, 0, data_t1_c5[i])
tdSql.query(f"select cast(c5 as binary) as b from {self.dbname}.ct4")
for i in range(len(data_ct4_c5)):
tdSql.checkData( i, 0, str(data_ct4_c5[i]) ) if data_ct4_c5[i] is None else tdSql.checkData( i, 0, f'{data_ct4_c5[i]:.6f}' )
tdSql.checkData( i, 0, str(data_ct4_c5[i]) ) if data_ct4_c5[i] is None else tdSql.checkFloatString( i, 0, data_ct4_c5[i])
tdSql.query(f"select cast(c5 as binary) as b from {self.dbname}.t1")
for i in range(len(data_t1_c5)):
tdSql.checkData( i, 0, str(data_t1_c5[i]) ) if data_t1_c5[i] is None else tdSql.checkData( i, 0, f'{data_t1_c5[i]:.6f}' )
tdSql.checkData( i, 0, str(data_t1_c5[i]) ) if data_t1_c5[i] is None else tdSql.checkFloatString( i, 0, data_t1_c5[i])
tdLog.printNoPrefix("==========step22: cast float to nchar, expect changes to str(int) ")
tdSql.query(f"select cast(c5 as nchar(32)) as b from {self.dbname}.ct4")
for i in range(len(data_ct4_c5)):
tdSql.checkData( i, 0, None ) if data_ct4_c5[i] is None else tdSql.checkData( i, 0, f'{data_ct4_c5[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_ct4_c5[i] is None else tdSql.checkFloatString( i, 0, data_ct4_c5[i])
tdSql.query(f"select cast(c5 as nchar(32)) as b from {self.dbname}.t1")
for i in range(len(data_t1_c5)):
tdSql.checkData( i, 0, None ) if data_t1_c5[i] is None else tdSql.checkData( i, 0, f'{data_t1_c5[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_t1_c5[i] is None else tdSql.checkFloatString( i, 0, data_t1_c5[i])
tdSql.query(f"select cast(c5 as nchar) as b from {self.dbname}.t1")
for i in range(len(data_t1_c5)):
tdSql.checkData( i, 0, None ) if data_t1_c5[i] is None else tdSql.checkData( i, 0, f'{data_t1_c5[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_t1_c5[i] is None else tdSql.checkFloatString( i, 0, data_t1_c5[i])
tdSql.query(f"select cast(c5 as varchar) as b from {self.dbname}.t1")
for i in range(len(data_t1_c5)):
tdSql.checkData( i, 0, None ) if data_t1_c5[i] is None else tdSql.checkData( i, 0, f'{data_t1_c5[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_t1_c5[i] is None else tdSql.checkFloatString( i, 0, data_t1_c5[i])
tdLog.printNoPrefix("==========step23: cast float to timestamp, expect changes to timestamp ")
tdSql.query(f"select cast(c5 as timestamp) as b from {self.dbname}.ct4")
@ -367,18 +367,18 @@ class TDTestCase:
tdLog.printNoPrefix("==========step25: cast double to binary, expect changes to str(int) ")
tdSql.query(f"select cast(c6 as binary(32)) as b from {self.dbname}.ct4")
for i in range(len(data_ct4_c6)):
tdSql.checkData( i, 0, None ) if data_ct4_c6[i] is None else tdSql.checkData( i, 0, f'{data_ct4_c6[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_ct4_c6[i] is None else tdSql.checkFloatString( i, 0, data_ct4_c6[i])
tdSql.query(f"select cast(c6 as binary(32)) as b from {self.dbname}.t1")
for i in range(len(data_t1_c6)):
tdSql.checkData( i, 0, None ) if data_t1_c6[i] is None else tdSql.checkData( i, 0, f'{data_t1_c6[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_t1_c6[i] is None else tdSql.checkFloatString( i, 0, data_t1_c6[i])
tdLog.printNoPrefix("==========step26: cast double to nchar, expect changes to str(int) ")
tdSql.query(f"select cast(c6 as nchar(32)) as b from {self.dbname}.ct4")
for i in range(len(data_ct4_c6)):
tdSql.checkData( i, 0, None ) if data_ct4_c6[i] is None else tdSql.checkData( i, 0, f'{data_ct4_c6[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_ct4_c6[i] is None else tdSql.checkFloatString( i, 0, data_ct4_c6[i])
tdSql.query(f"select cast(c6 as nchar(32)) as b from {self.dbname}.t1")
for i in range(len(data_t1_c6)):
tdSql.checkData( i, 0, None ) if data_t1_c6[i] is None else tdSql.checkData( i, 0, f'{data_t1_c6[i]:.6f}' )
tdSql.checkData( i, 0, None ) if data_t1_c6[i] is None else tdSql.checkFloatString( i, 0, data_t1_c6[i])
tdLog.printNoPrefix("==========step27: cast double to timestamp, expect changes to timestamp ")
tdSql.query(f"select cast(c6 as timestamp) as b from {self.dbname}.ct4")

View File

@ -672,7 +672,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
if (tsEnableScience) {
printf("%*.7e", width, GET_FLOAT_VAL(val));
} else {
n = tsnprintf(buf, LENGTH, "%*.7f", width, GET_FLOAT_VAL(val));
n = snprintf(buf, LENGTH, "%*.*g", width, FLT_DIG, GET_FLOAT_VAL(val));
if (n > SHELL_FLOAT_WIDTH) {
printf("%*.7e", width, GET_FLOAT_VAL(val));
} else {
@ -685,7 +685,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
snprintf(buf, LENGTH, "%*.15e", width, GET_DOUBLE_VAL(val));
printf("%s", buf);
} else {
n = tsnprintf(buf, LENGTH, "%*.15f", width, GET_DOUBLE_VAL(val));
n = snprintf(buf, LENGTH, "%*.*g", width, DBL_DIG, GET_DOUBLE_VAL(val));
if (n > SHELL_DOUBLE_WIDTH) {
printf("%*.15e", width, GET_DOUBLE_VAL(val));
} else {