Merge pull request #11220 from taosdata/feature/3.0_liaohj

[td-14393] fix bug, update sim script.
This commit is contained in:
Haojun Liao 2022-04-02 18:58:49 +08:00 committed by GitHub
commit 4149070c88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 79 deletions

View File

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

View File

@ -264,8 +264,17 @@ int *taos_fetch_lengths(TAOS_RES *res) {
}
TAOS_ROW *taos_result_block(TAOS_RES *res) {
// TODO
SRequestObj* pRequest = (SRequestObj*) res;
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
@ -313,7 +322,9 @@ int taos_affected_rows(TAOS_RES *res) {
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) {
STscObj *pObj = (STscObj *)taos;

View File

@ -79,7 +79,7 @@ loop_test_pos:
# 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 ====> $data00 $data01 $data02 $data03 $data04 $data05
print ====> $data10 $data11 $data12 $data13 $data14 $data15
@ -100,7 +100,7 @@ endi
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
return -1
endi
@ -109,7 +109,7 @@ if $data01 != 2 then
endi
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
return -1
endi
@ -118,7 +118,7 @@ if $data01 != 5 then
endi
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
return -1
endi
@ -127,7 +127,7 @@ if $data01 != 5 then
endi
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
return -1
endi
@ -136,7 +136,7 @@ if $data01 != 5 then
endi
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
return -1
endi
@ -145,7 +145,7 @@ if $data01 != 5 then
endi
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
return -1
endi
@ -154,7 +154,7 @@ if $data01 != 8 then
endi
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
return -1
endi
@ -163,7 +163,7 @@ if $data01 != 8 then
endi
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
return -1
endi
@ -172,7 +172,7 @@ if $data01 != 11 then
endi
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
return -1
endi
@ -181,7 +181,7 @@ if $data01 != 11 then
endi
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
return -1
endi
@ -190,7 +190,7 @@ if $data01 != 13 then
endi
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
return -1
endi
@ -199,7 +199,7 @@ if $data01 != 13 then
endi
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
return -1
endi
@ -208,7 +208,7 @@ if $data01 != 15 then
endi
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
return -1
endi
@ -216,71 +216,73 @@ if $data01 != 15 then
return -1
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)
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
return -1
endi
if $data01 != 13 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 13 then
return -1
endi
if $data04 != 7 then
return -1
endi
if $data05 != 91 then
return -1
endi
if $data06 != 1 then
return -1
endi
if $data07 != 13 then
return -1
endi
if $data08 != @{slop:1.000000, intercept:0.000000}@ then
return -1
endi
if $data09 != 12 then
return -1
endi
#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
# return -1
#endi
#if $data01 != 13 then
# return -1
#endi
#if $data02 != 1 then
# return -1
#endi
#if $data03 != 13 then
# return -1
#endi
#if $data04 != 7 then
# return -1
#endi
#if $data05 != 91 then
# return -1
#endi
#if $data06 != 1 then
# return -1
#endi
#if $data07 != 13 then
# return -1
#endi
#if $data08 != @{slop:1.000000, intercept:0.000000}@ then
# return -1
#endi
#if $data09 != 12 then
# return -1
#endi
# $data0-10 != 3.741657387
# $data0-11 != 1
# $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)
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
return -1
endi
if $data01 != 13 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 13 then
return -1
endi
if $data04 != 7 then
return -1
endi
if $data05 != 91 then
return -1
endi
if $data06 != 1 then
return -1
endi
if $data07 != 13 then
return -1
endi
if $data08 != @{slop:1.000000, intercept:0.000000}@ then
return -1
endi
#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
# return -1
#endi
#if $data01 != 13 then
# return -1
#endi
#if $data02 != 1 then
# return -1
#endi
#if $data03 != 13 then
# return -1
#endi
#if $data04 != 7 then
# return -1
#endi
#if $data05 != 91 then
# return -1
#endi
#if $data06 != 1 then
# return -1
#endi
#if $data07 != 13 then
# return -1
#endi
#if $data08 != @{slop:1.000000, intercept:0.000000}@ then
# return -1
#endi
sql_error select * from dev_001 session(ts,1w)
sql_error select count(*) from st session(ts,1w)