[td-14393] fix bug, update sim script.

This commit is contained in:
Haojun Liao 2022-04-02 18:25:57 +08:00
parent 6f77eeccce
commit 1cbdec1aba
3 changed files with 92 additions and 79 deletions

View File

@ -53,12 +53,12 @@ typedef struct {
typedef struct SColumnDataAgg { typedef struct SColumnDataAgg {
int16_t colId; int16_t colId;
int64_t sum;
int64_t max;
int64_t min;
int16_t maxIndex; int16_t maxIndex;
int16_t minIndex; int16_t minIndex;
int16_t numOfNull; int16_t numOfNull;
int64_t sum;
int64_t max;
int64_t min;
} SColumnDataAgg; } SColumnDataAgg;
typedef struct SDataBlockInfo { typedef struct SDataBlockInfo {

View File

@ -264,8 +264,17 @@ int *taos_fetch_lengths(TAOS_RES *res) {
} }
TAOS_ROW *taos_result_block(TAOS_RES *res) { TAOS_ROW *taos_result_block(TAOS_RES *res) {
// TODO SRequestObj* pRequest = (SRequestObj*) res;
return NULL; if (pRequest == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return NULL;
}
if (taos_is_update_query(res)) {
return NULL;
}
return &pRequest->body.resInfo.row;
} }
// todo intergrate with tDataTypes // todo intergrate with tDataTypes
@ -313,7 +322,9 @@ int taos_affected_rows(TAOS_RES *res) {
return pResInfo->numOfRows; return pResInfo->numOfRows;
} }
int taos_result_precision(TAOS_RES *res) { return TSDB_TIME_PRECISION_MILLI; } int taos_result_precision(TAOS_RES *res) {
return TSDB_TIME_PRECISION_MILLI;
}
int taos_select_db(TAOS *taos, const char *db) { int taos_select_db(TAOS *taos, const char *db) {
STscObj *pObj = (STscObj *)taos; STscObj *pObj = (STscObj *)taos;

View File

@ -79,7 +79,7 @@ loop_test_pos:
# session(ts,5a) # session(ts,5a)
print ====> select count(*) from dev_001 session(ts,5a) print ====> select count(*) from dev_001 session(ts,5a)
sql select count(*) from dev_001 session(ts,5a) sql select _wstartts, count(*) from dev_001 session(ts,5a)
print ====> rows: $rows print ====> rows: $rows
print ====> $data00 $data01 $data02 $data03 $data04 $data05 print ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15 print ====> $data10 $data11 $data12 $data13 $data14 $data15
@ -100,7 +100,7 @@ endi
print ====> select count(*) from (select * from dev_001) session(ts,5a) print ====> select count(*) from (select * from dev_001) session(ts,5a)
sql select count(*) from (select * from dev_001) session(ts,5a) sql select _wstartts, count(*) from (select * from dev_001) session(ts,5a)
if $rows != 15 then if $rows != 15 then
return -1 return -1
endi endi
@ -109,7 +109,7 @@ if $data01 != 2 then
endi endi
print ====> select count(*) from dev_001 session(ts,1s) print ====> select count(*) from dev_001 session(ts,1s)
sql select count(*) from dev_001 session(ts,1s) sql select _wstartts, count(*) from dev_001 session(ts,1s)
if $rows != 12 then if $rows != 12 then
return -1 return -1
endi endi
@ -118,7 +118,7 @@ if $data01 != 5 then
endi endi
print ====> select count(*) from (select * from dev_001) session(ts,1s) print ====> select count(*) from (select * from dev_001) session(ts,1s)
sql select count(*) from (select * from dev_001) session(ts,1s) sql select _wstartts, count(*) from (select * from dev_001) session(ts,1s)
if $rows != 12 then if $rows != 12 then
return -1 return -1
endi endi
@ -127,7 +127,7 @@ if $data01 != 5 then
endi endi
print ====> select count(*) from dev_001 session(ts,1000a) print ====> select count(*) from dev_001 session(ts,1000a)
sql select count(*) from dev_001 session(ts,1000a) sql select _wstartts, count(*) from dev_001 session(ts,1000a)
if $rows != 12 then if $rows != 12 then
return -1 return -1
endi endi
@ -136,7 +136,7 @@ if $data01 != 5 then
endi endi
print ====> select count(*) from (select * from dev_001) session(ts,1000a) print ====> select count(*) from (select * from dev_001) session(ts,1000a)
sql select count(*) from (select * from dev_001) session(ts,1000a) sql select _wstartts, count(*) from (select * from dev_001) session(ts,1000a)
if $rows != 12 then if $rows != 12 then
return -1 return -1
endi endi
@ -145,7 +145,7 @@ if $data01 != 5 then
endi endi
print ====> select count(*) from dev_001 session(ts,1m) print ====> select count(*) from dev_001 session(ts,1m)
sql select count(*) from dev_001 session(ts,1m) sql select _wstartts, count(*) from dev_001 session(ts,1m)
if $rows != 9 then if $rows != 9 then
return -1 return -1
endi endi
@ -154,7 +154,7 @@ if $data01 != 8 then
endi endi
print ====> select count(*) from (select * from dev_001) session(ts,1m) print ====> select count(*) from (select * from dev_001) session(ts,1m)
sql select count(*) from (select * from dev_001) session(ts,1m) sql select _wstartts, count(*) from (select * from dev_001) session(ts,1m)
if $rows != 9 then if $rows != 9 then
return -1 return -1
endi endi
@ -163,7 +163,7 @@ if $data01 != 8 then
endi endi
print ====> select count(*) from dev_001 session(ts,1h) print ====> select count(*) from dev_001 session(ts,1h)
sql select count(*) from dev_001 session(ts,1h) sql select _wstartts, count(*) from dev_001 session(ts,1h)
if $rows != 6 then if $rows != 6 then
return -1 return -1
endi endi
@ -172,7 +172,7 @@ if $data01 != 11 then
endi endi
print ====> select count(*) from (select * from dev_001) session(ts,1h) print ====> select count(*) from (select * from dev_001) session(ts,1h)
sql select count(*) from (select * from dev_001) session(ts,1h) sql select _wstartts, count(*) from (select * from dev_001) session(ts,1h)
if $rows != 6 then if $rows != 6 then
return -1 return -1
endi endi
@ -181,7 +181,7 @@ if $data01 != 11 then
endi endi
print ====> select count(*) from dev_001 session(ts,1d) print ====> select count(*) from dev_001 session(ts,1d)
sql select count(*) from dev_001 session(ts,1d) sql select _wstartts, count(*) from dev_001 session(ts,1d)
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
@ -190,7 +190,7 @@ if $data01 != 13 then
endi endi
print ====> select count(*) from (select * from dev_001) session(ts,1d) print ====> select count(*) from (select * from dev_001) session(ts,1d)
sql select count(*) from (select * from dev_001) session(ts,1d) sql select _wstartts, count(*) from (select * from dev_001) session(ts,1d)
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
@ -199,7 +199,7 @@ if $data01 != 13 then
endi endi
print ====> select count(*) from dev_001 session(ts,1w) print ====> select count(*) from dev_001 session(ts,1w)
sql select count(*) from dev_001 session(ts,1w) sql select _wstartts, count(*) from dev_001 session(ts,1w)
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
@ -208,7 +208,7 @@ if $data01 != 15 then
endi endi
print ====> select count(*) from (select * from dev_001) session(ts,1w) print ====> select count(*) from (select * from dev_001) session(ts,1w)
sql select count(*) from (select * from dev_001) session(ts,1w) sql select _wstartts, count(*) from (select * from dev_001) session(ts,1w)
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
@ -216,71 +216,73 @@ if $data01 != 15 then
return -1 return -1
endi endi
print ====> leastsquares not supported yet.
print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d) print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)
sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d) #sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)
if $rows != 2 then #if $rows != 2 then
return -1 # return -1
endi #endi
if $data01 != 13 then #if $data01 != 13 then
return -1 # return -1
endi #endi
if $data02 != 1 then #if $data02 != 1 then
return -1 # return -1
endi #endi
if $data03 != 13 then #if $data03 != 13 then
return -1 # return -1
endi #endi
if $data04 != 7 then #if $data04 != 7 then
return -1 # return -1
endi #endi
if $data05 != 91 then #if $data05 != 91 then
return -1 # return -1
endi #endi
if $data06 != 1 then #if $data06 != 1 then
return -1 # return -1
endi #endi
if $data07 != 13 then #if $data07 != 13 then
return -1 # return -1
endi #endi
if $data08 != @{slop:1.000000, intercept:0.000000}@ then #if $data08 != @{slop:1.000000, intercept:0.000000}@ then
return -1 # return -1
endi #endi
if $data09 != 12 then #if $data09 != 12 then
return -1 # return -1
endi #endi
# $data0-10 != 3.741657387 # $data0-10 != 3.741657387
# $data0-11 != 1 # $data0-11 != 1
# $data1-11 != 14 # $data1-11 != 14
print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)
sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) #sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)
if $rows != 2 then #if $rows != 2 then
return -1 # return -1
endi #endi
if $data01 != 13 then #if $data01 != 13 then
return -1 # return -1
endi #endi
if $data02 != 1 then #if $data02 != 1 then
return -1 # return -1
endi #endi
if $data03 != 13 then #if $data03 != 13 then
return -1 # return -1
endi #endi
if $data04 != 7 then #if $data04 != 7 then
return -1 # return -1
endi #endi
if $data05 != 91 then #if $data05 != 91 then
return -1 # return -1
endi #endi
if $data06 != 1 then #if $data06 != 1 then
return -1 # return -1
endi #endi
if $data07 != 13 then #if $data07 != 13 then
return -1 # return -1
endi #endi
if $data08 != @{slop:1.000000, intercept:0.000000}@ then #if $data08 != @{slop:1.000000, intercept:0.000000}@ then
return -1 # return -1
endi #endi
sql_error select * from dev_001 session(ts,1w) sql_error select * from dev_001 session(ts,1w)
sql_error select count(*) from st session(ts,1w) sql_error select count(*) from st session(ts,1w)