opti:modify case when type
This commit is contained in:
parent
67f28df97b
commit
a8ac0a2a73
|
@ -1041,19 +1041,18 @@ int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = {
|
|||
/*FLOA*/ 0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 10, 6, 6, 6, 8, 8, -1, 0, 0, 0, 8,
|
||||
/*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 10, 7, 7, 7, 8, 8, -1, 0, 0, 0, 8,
|
||||
/*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, 8, -1, 0, 0, 0, 8,
|
||||
/*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 5, 5, 14, 8, 8, -1, 0, 0, 0, 8,
|
||||
/*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 5, 5, 5, 8, 8, -1, 0, 0, 0, 8,
|
||||
/*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, -1, 0, 0, 0, 10,
|
||||
/*UTIN*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, 8, -1, 0, 0, 0, 8,
|
||||
/*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 8, -1, 0, 0, 0, 8,
|
||||
/*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 8, -1, 0, 0, 0, 8,
|
||||
/*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 8, -1, 0, 0, 0, 8,
|
||||
/*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, -1, 0, 0, 0, -1,
|
||||
/*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
|
||||
/*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, -1, 0, 0, 0, 8,
|
||||
/*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, -1,
|
||||
/*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
|
||||
/*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20
|
||||
};
|
||||
/*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20};
|
||||
|
||||
int32_t vectorGetConvertType(int32_t type1, int32_t type2) {
|
||||
if (type1 == type2) {
|
||||
|
|
|
@ -1064,8 +1064,8 @@ sql_error select case when sum(f1) then sum(f1)-abs(f1) end from tba1;
|
|||
sql drop database if exists test_db;
|
||||
sql create database test_db vgroups 5;
|
||||
sql use test_db;
|
||||
sql create stable test_stable (ts TIMESTAMP,c_int INT,c_uint INT UNSIGNED, c_bigint BIGINT, c_ubigint BIGINT UNSIGNED, c_float FLOAT, c_double DOUBLE, c_binary BINARY(20), c_smallint SMALLINT, c_usmallint SMALLINT UNSIGNED, c_tinyint TINYINT,c_utinyint TINYINT UNSIGNED,c_bool BOOL,c_nchar NCHAR(20), c_varchar VARCHAR(20), c_varbinary VARBINARY(20), c_geometry GEOMETRY(50)) tags(tag_id INT);
|
||||
sql create table t_test using test_stable tags(1);
|
||||
sql create stable test_stable (ts TIMESTAMP,c_int INT,c_uint INT UNSIGNED, c_bigint BIGINT, c_ubigint BIGINT UNSIGNED, c_float FLOAT, c_double DOUBLE, c_binary BINARY(20), c_smallint SMALLINT, c_usmallint SMALLINT UNSIGNED, c_tinyint TINYINT,c_utinyint TINYINT UNSIGNED,c_bool BOOL,c_nchar NCHAR(20), c_varchar VARCHAR(20), c_varbinary VARBINARY(20), c_geometry GEOMETRY(50)) tags(tag_id JSON);
|
||||
sql create table t_test using test_stable tags('{\"tag1\":5}');
|
||||
sql insert into t_test values ('2022-09-30 15:15:01',123,456,1234567890,9876543210,123.45,678.90,'binary_val',32767,65535,127,255,true,'涛思数据','varchar_val', '1101', 'point(10 10)');
|
||||
|
||||
sql select case when c_int > 100 then c_float else c_int end as result from t_test;
|
||||
|
@ -1141,6 +1141,21 @@ if $data00 != true then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select case when 0 then tag_id else c_geometry end as result from t_test;
|
||||
if $data00 != 16842773 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select case when 0 then tag_id else c_int end as result from t_test;
|
||||
if $data00 != 123 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select case when 0 then tag_id else c_float end as result from t_test;
|
||||
if $data00 != 123.449997 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error select case when c_double > 100 then c_varbinary else c_geometry end as result from t_test;
|
||||
sql_error select case when c_bool then c_double else c_varbinary end as result from t_test;
|
||||
sql_error select case when c_bool then c_varbinary else c_varchar end as result from t_test;
|
||||
|
|
Loading…
Reference in New Issue