opti:modify type display between numbers and string
This commit is contained in:
parent
fae8f5bfa5
commit
9bbfff8bf8
|
@ -3186,7 +3186,7 @@ static int32_t rewriteIsTrue(SNode* pSrc, SNode** pIsTrue) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX];
|
extern int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX];
|
||||||
static bool selectCommonType(SDataType* commonType, const SDataType* newType) {
|
static bool selectCommonType(SDataType* commonType, const SDataType* newType) {
|
||||||
if (commonType->type < TSDB_DATA_TYPE_NULL || commonType->type >= TSDB_DATA_TYPE_MAX ||
|
if (commonType->type < TSDB_DATA_TYPE_NULL || commonType->type >= TSDB_DATA_TYPE_MAX ||
|
||||||
newType->type < TSDB_DATA_TYPE_NULL || newType->type >= TSDB_DATA_TYPE_MAX) {
|
newType->type < TSDB_DATA_TYPE_NULL || newType->type >= TSDB_DATA_TYPE_MAX) {
|
||||||
|
@ -3209,9 +3209,9 @@ static bool selectCommonType(SDataType* commonType, const SDataType* newType) {
|
||||||
int8_t type2 = newType->type;
|
int8_t type2 = newType->type;
|
||||||
int8_t resultType;
|
int8_t resultType;
|
||||||
if (type1 < type2) {
|
if (type1 < type2) {
|
||||||
resultType = gConvertTypes[type1][type2];
|
resultType = gDisplyTypes[type1][type2];
|
||||||
} else {
|
} else {
|
||||||
resultType = gConvertTypes[type2][type1];
|
resultType = gDisplyTypes[type2][type1];
|
||||||
}
|
}
|
||||||
if (resultType == -1) {
|
if (resultType == -1) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1030,6 +1030,30 @@ int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = {
|
||||||
/*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1,
|
/*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1,
|
||||||
/*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0};
|
/*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = {
|
||||||
|
/*NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/
|
||||||
|
/*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
/*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, -1, 0, 0, 0, -1,
|
||||||
|
/*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 7, 0, -1, 0, 0, 0, -1,
|
||||||
|
/*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 7, 0, -1, 0, 0, 0, -1,
|
||||||
|
/*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 8, 9, 10, 4, 4, 5, 7, 0, -1, 0, 0, 0, -1,
|
||||||
|
/*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 5, 5, 5, 7, 0, -1, 0, 0, 0, -1,
|
||||||
|
/*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 8, 6, 10, 6, 6, 6, 6, 0, -1, 0, 0, 0, -1,
|
||||||
|
/*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 7, 10, 7, 7, 7, 7,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, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0};
|
||||||
|
|
||||||
int32_t vectorGetConvertType(int32_t type1, int32_t type2) {
|
int32_t vectorGetConvertType(int32_t type1, int32_t type2) {
|
||||||
if (type1 == type2) {
|
if (type1 == type2) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -296,16 +296,16 @@ sql select case when '2' then 'b' when null then 0 end from tba1;
|
||||||
if $rows != 4 then
|
if $rows != 4 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data00 != 0 then
|
if $data00 != b then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data10 != 0 then
|
if $data10 != b then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data20 != 0 then
|
if $data20 != b then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data30 != 0 then
|
if $data30 != b then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -1122,7 +1122,12 @@ if $data00 != @70-01-01 08:00:00.001@ then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select case when c_double > 100 then c_nchar else c_double end as result from t_test;
|
sql select case when c_double > 100 then c_nchar else c_double end as result from t_test;
|
||||||
if $data00 != 0.000000000 then
|
if $data00 != 涛思数据 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select case when c_double > 100 then c_varchar else c_double end as result from t_test;
|
||||||
|
if $data00 != varchar_val then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,6 @@ class TDTestCase:
|
||||||
|
|
||||||
for i in range(30):
|
for i in range(30):
|
||||||
cs = self.state_window_list().split(',')[i]
|
cs = self.state_window_list().split(',')[i]
|
||||||
print(cs)
|
|
||||||
sql1 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1 where tbname = 'stable_1_1' state_window(%s);" % (database,cs)
|
sql1 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1 where tbname = 'stable_1_1' state_window(%s);" % (database,cs)
|
||||||
sql2 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1_1 state_window(%s) ;" % (database,cs)
|
sql2 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1_1 state_window(%s) ;" % (database,cs)
|
||||||
self.constant_check(database,sql1,sql2,0)
|
self.constant_check(database,sql1,sql2,0)
|
||||||
|
|
Loading…
Reference in New Issue