fix: print folat when title name is too long
This commit is contained in:
parent
36183aa36b
commit
b3ef8b2f44
|
@ -51,7 +51,7 @@ taos> select ASCII('hello') + 1 from ts_4893.meters limit 1
|
|||
taos> select ASCII('hello') + ASCII('hello') from ts_4893.meters limit 1
|
||||
ascii('hello') + ascii('hello') |
|
||||
==================================
|
||||
2.080000000000000e+02 |
|
||||
208 |
|
||||
|
||||
taos> select ASCII(nch1) from ts_4893.meters order by ts limit 5
|
||||
ascii(nch1) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 17.
|
|
@ -51,7 +51,7 @@ taos> select CHAR_LENGTH('hello') + 1 from ts_4893.meters limit 1
|
|||
taos> select CHAR_LENGTH('hello') + CHAR_LENGTH('hello') from ts_4893.meters limit 1
|
||||
char_length('hello') + char_length('hello') |
|
||||
==============================================
|
||||
1.000000000000000e+01 |
|
||||
10 |
|
||||
|
||||
taos> select CHAR_LENGTH(nch1) from ts_4893.meters order by ts limit 5
|
||||
char_length(nch1) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 17.
|
|
@ -576,7 +576,7 @@ taos> select max(total_voltage) from (select sum(voltage) as total_voltage from
|
|||
taos> select round(max(current), 2) from ts_4893.meters
|
||||
round(max(current), 2) |
|
||||
=========================
|
||||
1.2000000e+01 |
|
||||
12 |
|
||||
|
||||
taos> select pow(max(current), 2) from ts_4893.meters
|
||||
pow(max(current), 2) |
|
||||
|
@ -651,7 +651,7 @@ taos> select max(cast(10000000000 as bigint unsigned))
|
|||
taos> select max(cast(1.1 as float))
|
||||
max(cast(1.1 as float)) |
|
||||
==========================
|
||||
1.1000000e+00 |
|
||||
1.1 |
|
||||
|
||||
taos> select max(cast(1.1 as double))
|
||||
max(cast(1.1 as double)) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 576.
|
|
@ -576,7 +576,7 @@ taos> select min(total_voltage) from (select sum(voltage) as total_voltage from
|
|||
taos> select round(min(current), 2) from ts_4893.meters
|
||||
round(min(current), 2) |
|
||||
=========================
|
||||
8.0000000e+00 |
|
||||
8 |
|
||||
|
||||
taos> select pow(min(current), 2) from ts_4893.meters
|
||||
pow(min(current), 2) |
|
||||
|
@ -651,7 +651,7 @@ taos> select min(cast(10000000000 as bigint unsigned))
|
|||
taos> select min(cast(1.1 as float))
|
||||
min(cast(1.1 as float)) |
|
||||
==========================
|
||||
1.1000000e+00 |
|
||||
1.1 |
|
||||
|
||||
taos> select min(cast(1.1 as double))
|
||||
min(cast(1.1 as double)) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 576.
|
|
@ -42,26 +42,26 @@ taos> select MOD(10.55, 1) + 1
|
|||
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 |
|
||||
===================================================================
|
||||
1.234567890000022e-01 |
|
||||
0.12345678900000 |
|
||||
|
||||
taos> select MOD(MOD(MOD(MOD(MOD(MOD(MOD(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
|
||||
mod(mod(mod(mod(mod(mod(mod(123456789.123456789, -1), -2), -3), |
|
||||
===================================================================
|
||||
1.234567910432816e-01 |
|
||||
0.12345679104328 |
|
||||
|
||||
taos> select MOD(87654321.123456789, id + 1) from ts_4893.meters order by ts limit 10
|
||||
mod(87654321.123456789, id + 1) |
|
||||
==================================
|
||||
1.234567910432816e-01 |
|
||||
1.123456791043282e+00 |
|
||||
1.234567910432816e-01 |
|
||||
1.123456791043282e+00 |
|
||||
1.123456791043282e+00 |
|
||||
3.123456791043282e+00 |
|
||||
6.123456791043282e+00 |
|
||||
1.123456791043282e+00 |
|
||||
1.234567910432816e-01 |
|
||||
1.123456791043282e+00 |
|
||||
0.123456791043282 |
|
||||
1.12345679104328 |
|
||||
0.123456791043282 |
|
||||
1.12345679104328 |
|
||||
1.12345679104328 |
|
||||
3.12345679104328 |
|
||||
6.12345679104328 |
|
||||
1.12345679104328 |
|
||||
0.123456791043282 |
|
||||
1.12345679104328 |
|
||||
|
||||
taos> select MOD(current, id + 1) from ts_4893.meters order by ts limit 10
|
||||
mod(current, id + 1) |
|
||||
|
@ -94,16 +94,16 @@ taos> select MOD(current, 1) from ts_4893.meters order by ts limit 10
|
|||
taos> select MOD(sqrt(current), abs(id + 1)) from ts_4893.meters order by ts limit 10
|
||||
mod(sqrt(current), abs(id + 1)) |
|
||||
==================================
|
||||
2.634337159700784e-01 |
|
||||
9.281394021770111e-01 |
|
||||
1.296964830944782e-01 |
|
||||
3.351566768190027e+00 |
|
||||
3.272002495118848e+00 |
|
||||
2.916847677517688e+00 |
|
||||
3.097741066924800e+00 |
|
||||
3.310891102586806e+00 |
|
||||
3.350522322288470e+00 |
|
||||
3.215120509901375e+00 |
|
||||
0.263433715970078 |
|
||||
0.928139402177011 |
|
||||
0.129696483094478 |
|
||||
3.35156676819003 |
|
||||
3.27200249511885 |
|
||||
2.91684767751769 |
|
||||
3.0977410669248 |
|
||||
3.31089110258681 |
|
||||
3.35052232228847 |
|
||||
3.21512050990137 |
|
||||
|
||||
taos> select mod(10, -3)
|
||||
mod(10, -3) |
|
||||
|
|
|
|
@ -190,5 +190,5 @@ taos> select voltage / pi() from ts_4893.meters limit 1
|
|||
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 |
|
||||
====================================================================
|
||||
0 | 3.141592653589793e+00 |
|
||||
0 | 3.14159265358979 |
|
||||
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 90.
|
|
@ -201,7 +201,7 @@ taos> select ABS(POSITION('aaa' IN 'aaaaaaaaa'))
|
|||
taos> select POW(POSITION('aaa' IN 'aaaaaaaaa'), 2)
|
||||
pow(position('aaa' in 'aaaaaaaaa'), 2) |
|
||||
=========================================
|
||||
1.000000000000000e+00 |
|
||||
1 |
|
||||
|
||||
taos> select position('t' in 'taos')
|
||||
position('t' in 'taos') |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 22.
|
|
@ -50,12 +50,12 @@ taos> select rand(-1)
|
|||
taos> select rand(12345678901234567890)
|
||||
rand(12345678901234567890) |
|
||||
=============================
|
||||
2.008294813338805e-01 |
|
||||
0.20082948133388 |
|
||||
|
||||
taos> select rand(-12345678901234567890)
|
||||
rand(-12345678901234567890) |
|
||||
==============================
|
||||
8.401877171547095e-01 |
|
||||
0.84018771715471 |
|
||||
|
||||
taos> select rand(12345), rand(12345)
|
||||
rand(12345) | rand(12345) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 60.
|
|
@ -67,12 +67,12 @@ taos> select ROUND(10.55, 1) + 1
|
|||
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), |
|
||||
===================================================================
|
||||
1.230000000000000e+02 |
|
||||
12 |
|
||||
|
||||
taos> select ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(ROUND(123456789.123456789, -1), -2), -3), -4), -5), -6))
|
||||
round(round(round(round(round(round(round(123456789.123456789, - |
|
||||
===================================================================
|
||||
1.230000000000000e+08 |
|
||||
12300000 |
|
||||
|
||||
taos> select ROUND(current) from ts_4893.meters order by ts limit 20
|
||||
round(current) |
|
||||
|
@ -101,16 +101,16 @@ taos> select ROUND(current) from ts_4893.meters order by ts limit 20
|
|||
taos> select ROUND(87654321.123456789, id) from ts_4893.meters order by ts limit 10
|
||||
round(87654321.123456789, id) |
|
||||
================================
|
||||
8.765432100000000e+07 |
|
||||
8.765432109999999e+07 |
|
||||
8.765432112000000e+07 |
|
||||
8.765432112300000e+07 |
|
||||
8.765432112350000e+07 |
|
||||
8.765432112345999e+07 |
|
||||
8.765432112345700e+07 |
|
||||
8.765432112345681e+07 |
|
||||
8.765432112345679e+07 |
|
||||
8.765432112345679e+07 |
|
||||
87654321 |
|
||||
87654321.1 |
|
||||
87654321.12 |
|
||||
87654321.123 |
|
||||
87654321.1235 |
|
||||
87654321.12346 |
|
||||
87654321.123457 |
|
||||
87654321.1234568 |
|
||||
87654321.1234568 |
|
||||
87654321.1234568 |
|
||||
|
||||
taos> select ROUND(current, id) from ts_4893.meters order by ts limit 10
|
||||
round(current, id) |
|
||||
|
@ -286,7 +286,7 @@ taos> select round(voltage, -1) from ts_4893.meters limit 1
|
|||
taos> select round(current * voltage, 2) from ts_4893.meters limit 1
|
||||
round(current * voltage, 2) |
|
||||
==============================
|
||||
2.353650000000000e+03 |
|
||||
2353.65 |
|
||||
|
||||
taos> select round(abs(voltage), 2) from ts_4893.meters limit 1
|
||||
round(abs(voltage), 2) |
|
||||
|
|
|
|
@ -164,7 +164,7 @@ taos> select sign(cast(1 as bigint unsigned))
|
|||
taos> select sign(cast(1 as float))
|
||||
sign(cast(1 as float)) |
|
||||
=========================
|
||||
1.0000000e+00 |
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(1 as double))
|
||||
sign(cast(1 as double)) |
|
||||
|
@ -316,30 +316,30 @@ taos> select sign(current) from ts_4893.meters order by ts limit 10
|
|||
taos> select sign(cast(current as float)) from ts_4893.d0 order by ts limit 10
|
||||
sign(cast(current as float)) |
|
||||
===============================
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
|
||||
taos> select sign(cast(current as float)) from ts_4893.meters order by ts limit 10
|
||||
sign(cast(current as float)) |
|
||||
===============================
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1.0000000e+00 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
1 |
|
||||
|
||||
taos> select sign(null)
|
||||
sign(null) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 239.
|
|
@ -109,17 +109,17 @@ taos> select stddev_pop(total_voltage) from (select sum(voltage) as total_voltag
|
|||
taos> select round(stddev_pop(current), 2) from ts_4893.meters
|
||||
round(stddev_pop(current), 2) |
|
||||
================================
|
||||
1.150000000000000e+00 |
|
||||
1.15 |
|
||||
|
||||
taos> select pow(stddev_pop(current), 2) from ts_4893.meters
|
||||
pow(stddev_pop(current), 2) |
|
||||
==============================
|
||||
1.332500071133751e+00 |
|
||||
1.33250007113375 |
|
||||
|
||||
taos> select log(stddev_pop(voltage) + 1) from ts_4893.meters
|
||||
log(stddev_pop(voltage) + 1) |
|
||||
===============================
|
||||
1.354922290183882e+00 |
|
||||
1.35492229018388 |
|
||||
|
||||
taos> select groupid, stddev_pop(voltage) from ts_4893.meters group by groupid order by groupid
|
||||
groupid | stddev_pop(voltage) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 109.
|
|
@ -47,40 +47,40 @@ taos> select TRUNCATE(10.55, 1) + 1
|
|||
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 |
|
||||
===================================================================
|
||||
1.231230000000000e+02 |
|
||||
123.12 |
|
||||
|
||||
taos> select TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(TRUNCATE(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
|
||||
truncate(truncate(truncate(truncate(truncate(truncate(truncate(1 |
|
||||
===================================================================
|
||||
1.200000000000000e+08 |
|
||||
12000000 |
|
||||
|
||||
taos> select TRUNCATE(87654321.123456789, id) from ts_4893.meters order by ts limit 10
|
||||
truncate(87654321.123456789, id) |
|
||||
===================================
|
||||
8.765432100000000e+07 |
|
||||
8.765432109999999e+07 |
|
||||
8.765432112000000e+07 |
|
||||
8.765432112300000e+07 |
|
||||
8.765432112340000e+07 |
|
||||
8.765432112345000e+07 |
|
||||
8.765432112345600e+07 |
|
||||
8.765432112345670e+07 |
|
||||
8.765432112345679e+07 |
|
||||
8.765432112345679e+07 |
|
||||
87654321 |
|
||||
87654321.1 |
|
||||
87654321.12 |
|
||||
87654321.123 |
|
||||
87654321.1234 |
|
||||
87654321.12345 |
|
||||
87654321.123456 |
|
||||
87654321.1234567 |
|
||||
87654321.1234568 |
|
||||
87654321.1234568 |
|
||||
|
||||
taos> select TRUNCATE(current, id) from ts_4893.meters order by ts limit 10
|
||||
truncate(current, id) |
|
||||
========================
|
||||
1.0000000e+01 |
|
||||
8.5000000e+00 |
|
||||
9.7900000e+00 |
|
||||
1.1233000e+01 |
|
||||
1.0706000e+01 |
|
||||
8.5080004e+00 |
|
||||
9.5959997e+00 |
|
||||
1.0962000e+01 |
|
||||
1.1226000e+01 |
|
||||
1.0337000e+01 |
|
||||
10 |
|
||||
8.5 |
|
||||
9.79 |
|
||||
11.233 |
|
||||
10.706 |
|
||||
8.508 |
|
||||
9.596 |
|
||||
10.962 |
|
||||
11.226 |
|
||||
10.337 |
|
||||
|
||||
taos> select TRUNCATE(current, 1) from ts_4893.meters order by ts limit 10
|
||||
truncate(current, 1) |
|
||||
|
@ -144,26 +144,26 @@ taos> select TRUNC(10.55, 1) + 1
|
|||
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), |
|
||||
===================================================================
|
||||
1.231230000000000e+02 |
|
||||
123.12 |
|
||||
|
||||
taos> select TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(TRUNC(123456789.123456789, -1), -2), -3), -4), -5), -6), -7)
|
||||
trunc(trunc(trunc(trunc(trunc(trunc(trunc(123456789.123456789, - |
|
||||
===================================================================
|
||||
1.200000000000000e+08 |
|
||||
12000000 |
|
||||
|
||||
taos> select TRUNC(87654321.123456789, id) from ts_4893.meters order by ts limit 10
|
||||
trunc(87654321.123456789, id) |
|
||||
================================
|
||||
8.765432100000000e+07 |
|
||||
8.765432109999999e+07 |
|
||||
8.765432112000000e+07 |
|
||||
8.765432112300000e+07 |
|
||||
8.765432112340000e+07 |
|
||||
8.765432112345000e+07 |
|
||||
8.765432112345600e+07 |
|
||||
8.765432112345670e+07 |
|
||||
8.765432112345679e+07 |
|
||||
8.765432112345679e+07 |
|
||||
87654321 |
|
||||
87654321.1 |
|
||||
87654321.12 |
|
||||
87654321.123 |
|
||||
87654321.1234 |
|
||||
87654321.12345 |
|
||||
87654321.123456 |
|
||||
87654321.1234567 |
|
||||
87654321.1234568 |
|
||||
87654321.1234568 |
|
||||
|
||||
taos> select TRUNC(current, id) from ts_4893.meters order by ts limit 10
|
||||
trunc(current, id) |
|
||||
|
@ -289,7 +289,7 @@ taos> select truncate(100.9876, 2)
|
|||
taos> select truncate(99999999999999.9999, 2)
|
||||
truncate(99999999999999.9999, 2) |
|
||||
===================================
|
||||
1.000000000000000e+14 |
|
||||
100000000000000 |
|
||||
|
||||
taos> select truncate(-5.678, 2)
|
||||
truncate(-5.678, 2) |
|
||||
|
@ -314,7 +314,7 @@ taos> select truncate(phase, 3) from ts_4893.meters limit 1
|
|||
taos> select truncate(voltage + current, 2) from ts_4893.meters limit 1
|
||||
truncate(voltage + current, 2) |
|
||||
=================================
|
||||
2.316400000000000e+02 |
|
||||
231.64 |
|
||||
|
||||
taos> select truncate(voltage, -1) from ts_4893.meters limit 1
|
||||
truncate(voltage, -1) |
|
||||
|
@ -329,7 +329,7 @@ taos> select round(truncate(voltage, 1), 2) from ts_4893.meters limit 1
|
|||
taos> select truncate(abs(current), 1) from ts_4893.meters limit 1
|
||||
truncate(abs(current), 1) |
|
||||
============================
|
||||
1.0600000e+01 |
|
||||
10.6 |
|
||||
|
||||
taos> select truncate(exp(phase), 2) from ts_4893.meters limit 1
|
||||
truncate(exp(phase), 2) |
|
||||
|
|
|
|
@ -99,7 +99,7 @@ taos> select var_pop(total_voltage) from (select sum(voltage) as total_voltage f
|
|||
taos> select round(var_pop(current), 2) from ts_4893.meters
|
||||
round(var_pop(current), 2) |
|
||||
=============================
|
||||
1.330000000000000e+00 |
|
||||
1.33 |
|
||||
|
||||
taos> select pow(var_pop(current), 2) from ts_4893.meters
|
||||
pow(var_pop(current), 2) |
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 99.
|
|
@ -671,12 +671,8 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
|
|||
if (tsEnableScience) {
|
||||
printf("%*.7e", width, GET_FLOAT_VAL(val));
|
||||
} else {
|
||||
n = snprintf(buf, LENGTH, "%*.*g", width, FLT_DIG, GET_FLOAT_VAL(val));
|
||||
if (n > width) {
|
||||
printf("%*.7e", width, GET_FLOAT_VAL(val));
|
||||
} else {
|
||||
printf("%s", buf);
|
||||
}
|
||||
snprintf(buf, LENGTH, "%*.*g", width, FLT_DIG, GET_FLOAT_VAL(val));
|
||||
printf("%s", buf);
|
||||
}
|
||||
break;
|
||||
case TSDB_DATA_TYPE_DOUBLE:
|
||||
|
@ -684,12 +680,8 @@ 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 = snprintf(buf, LENGTH, "%*.*g", width, DBL_DIG, GET_DOUBLE_VAL(val));
|
||||
if (n > SHELL_DOUBLE_WIDTH) {
|
||||
printf("%*.15e", width, GET_DOUBLE_VAL(val));
|
||||
} else {
|
||||
printf("%*s", width, buf);
|
||||
}
|
||||
snprintf(buf, LENGTH, "%*.*g", width, DBL_DIG, GET_DOUBLE_VAL(val));
|
||||
printf("%*s", width, buf);
|
||||
}
|
||||
break;
|
||||
case TSDB_DATA_TYPE_VARBINARY: {
|
||||
|
|
Loading…
Reference in New Issue