Merge branch 'develop' of github.com:taosdata/TDengine into dev/chr

This commit is contained in:
tomchon 2021-06-10 15:57:30 +08:00
commit 7e7a70b74c
59 changed files with 5633 additions and 4409 deletions

View File

@ -2331,8 +2331,10 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
if (info.precision == TSDB_TIME_PRECISION_MILLI) {
tickPerSec /= 1000000;
} else if (info.precision == TSDB_TIME_PRECISION_MICRO) {
tickPerSec /= 1000;
}
}
if (tickPerSec <= 0 || tickPerSec < TSDB_TICK_PER_SECOND(info.precision)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10);
@ -5937,48 +5939,40 @@ int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlN
}
static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* pCreateDb) {
const char* msg = "invalid number of options";
const char* msg1 = "invalid number of keep options";
const char* msg2 = "invalid keep value";
const char* msg3 = "invalid keep value, should be keep0 <= keep1 <= keep2";
pMsg->daysToKeep = htonl(-1);
pMsg->daysToKeep0 = htonl(-1);
pMsg->daysToKeep1 = htonl(-1);
pMsg->daysToKeep2 = htonl(-1);
SArray* pKeep = pCreateDb->keep;
if (pKeep != NULL) {
size_t s = taosArrayGetSize(pKeep);
tVariantListItem* p0 = taosArrayGet(pKeep, 0);
switch (s) {
case 1: {
if ((int32_t)p0->pVar.i64 <= 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg);
}
pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64);
}
break;
case 2: {
tVariantListItem* p1 = taosArrayGet(pKeep, 1);
if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg);
}
pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64);
pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64);
break;
}
case 3: {
tVariantListItem* p1 = taosArrayGet(pKeep, 1);
tVariantListItem* p2 = taosArrayGet(pKeep, 2);
if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg);
}
pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64);
pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64);
pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64);
break;
}
default: { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); }
#ifdef _STORAGE
if (s >= 4 ||s <= 0) {
#else
if (s != 1) {
#endif
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
tVariantListItem* p0 = taosArrayGet(pKeep, 0);
tVariantListItem* p1 = (s > 1) ? taosArrayGet(pKeep, 1) : p0;
tVariantListItem* p2 = (s > 2) ? taosArrayGet(pKeep, 2) : p1;
if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
if (!(((int32_t)p0->pVar.i64 <= (int32_t)p1->pVar.i64) && ((int32_t)p1->pVar.i64 <= (int32_t)p2->pVar.i64))) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
pMsg->daysToKeep0 = htonl((int32_t)p0->pVar.i64);
pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64);
pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64);
}
return TSDB_CODE_SUCCESS;

View File

@ -265,7 +265,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
SSqlCmd* pCmd = &pSql->cmd;
pSub->lastSyncTime = taosGetTimestampMs();
TSDB_QUERY_CLEAR_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0);
if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) {
@ -276,6 +276,8 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
taosArrayClear(pSub->progress);
taosArrayPush(pSub->progress, &target);
}
pSub->lastSyncTime = taosGetTimestampMs();
return 1;
}
@ -305,7 +307,11 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
}
taosArrayDestroy(tables);
TSDB_QUERY_SET_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
if (pTableMetaInfo->pVgroupTables && taosArrayGetSize(pTableMetaInfo->pVgroupTables) > 0) {
TSDB_QUERY_SET_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
}
pSub->lastSyncTime = taosGetTimestampMs();
return 1;
}

View File

@ -548,7 +548,7 @@ typedef struct {
int32_t totalBlocks;
int32_t maxTables;
int32_t daysPerFile;
int32_t daysToKeep;
int32_t daysToKeep0;
int32_t daysToKeep1;
int32_t daysToKeep2;
int32_t minRowsPerFileBlock;

View File

@ -104,28 +104,28 @@
#define TK_QTIME 85
#define TK_CONNS 86
#define TK_STATE 87
#define TK_KEEP 88
#define TK_CACHE 89
#define TK_REPLICA 90
#define TK_QUORUM 91
#define TK_DAYS 92
#define TK_MINROWS 93
#define TK_MAXROWS 94
#define TK_BLOCKS 95
#define TK_CTIME 96
#define TK_WAL 97
#define TK_FSYNC 98
#define TK_COMP 99
#define TK_PRECISION 100
#define TK_UPDATE 101
#define TK_CACHELAST 102
#define TK_PARTITIONS 103
#define TK_LP 104
#define TK_RP 105
#define TK_UNSIGNED 106
#define TK_TAGS 107
#define TK_USING 108
#define TK_COMMA 109
#define TK_COMMA 88
#define TK_KEEP 89
#define TK_CACHE 90
#define TK_REPLICA 91
#define TK_QUORUM 92
#define TK_DAYS 93
#define TK_MINROWS 94
#define TK_MAXROWS 95
#define TK_BLOCKS 96
#define TK_CTIME 97
#define TK_WAL 98
#define TK_FSYNC 99
#define TK_COMP 100
#define TK_PRECISION 101
#define TK_UPDATE 102
#define TK_CACHELAST 103
#define TK_PARTITIONS 104
#define TK_LP 105
#define TK_RP 106
#define TK_UNSIGNED 107
#define TK_TAGS 108
#define TK_USING 109
#define TK_AS 110
#define TK_NULL 111
#define TK_SELECT 112
@ -212,7 +212,6 @@
#define TK_SPACE 300
#define TK_COMMENT 301
#define TK_ILLEGAL 302

View File

@ -161,7 +161,7 @@ typedef struct {
int32_t totalBlocks;
int32_t maxTables;
int32_t daysPerFile;
int32_t daysToKeep;
int32_t daysToKeep0;
int32_t daysToKeep1;
int32_t daysToKeep2;
int32_t minRowsPerFileBlock;

View File

@ -261,26 +261,27 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) {
return TSDB_CODE_MND_INVALID_DB_OPTION_DAYS;
}
if (pCfg->daysToKeep < TSDB_MIN_KEEP || pCfg->daysToKeep > TSDB_MAX_KEEP) {
mError("invalid db option daysToKeep:%d valid range: [%d, %d]", pCfg->daysToKeep, TSDB_MIN_KEEP, TSDB_MAX_KEEP);
if (pCfg->daysToKeep0 < TSDB_MIN_KEEP || pCfg->daysToKeep0 > TSDB_MAX_KEEP) {
mError("invalid db option daysToKeep:%d valid range: [%d, %d]", pCfg->daysToKeep0, TSDB_MIN_KEEP, TSDB_MAX_KEEP);
return TSDB_CODE_MND_INVALID_DB_OPTION_KEEP;
}
if (pCfg->daysToKeep < pCfg->daysPerFile) {
mError("invalid db option daysToKeep:%d should larger than daysPerFile:%d", pCfg->daysToKeep, pCfg->daysPerFile);
if (pCfg->daysToKeep0 < pCfg->daysPerFile) {
mError("invalid db option daysToKeep:%d should larger than daysPerFile:%d", pCfg->daysToKeep0, pCfg->daysPerFile);
return TSDB_CODE_MND_INVALID_DB_OPTION_KEEP;
}
if (pCfg->daysToKeep2 < TSDB_MIN_KEEP || pCfg->daysToKeep2 > pCfg->daysToKeep) {
mError("invalid db option daysToKeep2:%d valid range: [%d, %d]", pCfg->daysToKeep2, TSDB_MIN_KEEP, pCfg->daysToKeep);
if (pCfg->daysToKeep1 < pCfg->daysToKeep0 || pCfg->daysToKeep1 > TSDB_MAX_KEEP) {
mError("invalid db option daysToKeep1:%d valid range: [%d, %d]", pCfg->daysToKeep1, pCfg->daysToKeep0, TSDB_MAX_KEEP);
return TSDB_CODE_MND_INVALID_DB_OPTION_KEEP;
}
if (pCfg->daysToKeep1 < TSDB_MIN_KEEP || pCfg->daysToKeep1 > pCfg->daysToKeep2) {
mError("invalid db option daysToKeep1:%d valid range: [%d, %d]", pCfg->daysToKeep1, TSDB_MIN_KEEP, pCfg->daysToKeep2);
if (pCfg->daysToKeep2 < pCfg->daysToKeep1 || pCfg->daysToKeep2 > TSDB_MAX_KEEP) {
mError("invalid db option daysToKeep2:%d valid range: [%d, %d]", pCfg->daysToKeep2, pCfg->daysToKeep1, TSDB_MAX_KEEP);
return TSDB_CODE_MND_INVALID_DB_OPTION_KEEP;
}
if (pCfg->maxRowsPerFileBlock < TSDB_MIN_MAX_ROW_FBLOCK || pCfg->maxRowsPerFileBlock > TSDB_MAX_MAX_ROW_FBLOCK) {
mError("invalid db option maxRowsPerFileBlock:%d valid range: [%d, %d]", pCfg->maxRowsPerFileBlock,
TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK);
@ -378,9 +379,9 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) {
if (pCfg->totalBlocks < 0) pCfg->totalBlocks = tsBlocksPerVnode;
if (pCfg->maxTables < 0) pCfg->maxTables = tsMaxTablePerVnode;
if (pCfg->daysPerFile < 0) pCfg->daysPerFile = tsDaysPerFile;
if (pCfg->daysToKeep < 0) pCfg->daysToKeep = tsDaysToKeep;
if (pCfg->daysToKeep1 < 0) pCfg->daysToKeep1 = pCfg->daysToKeep;
if (pCfg->daysToKeep2 < 0) pCfg->daysToKeep2 = pCfg->daysToKeep;
if (pCfg->daysToKeep2 < 0) pCfg->daysToKeep2 = tsDaysToKeep;
if (pCfg->daysToKeep1 < 0) pCfg->daysToKeep1 = pCfg->daysToKeep2;
if (pCfg->daysToKeep0 < 0) pCfg->daysToKeep0 = pCfg->daysToKeep1;
if (pCfg->minRowsPerFileBlock < 0) pCfg->minRowsPerFileBlock = tsMinRowsInFileBlock;
if (pCfg->maxRowsPerFileBlock < 0) pCfg->maxRowsPerFileBlock = tsMaxRowsInFileBlock;
if (pCfg->fsyncPeriod <0) pCfg->fsyncPeriod = tsFsyncPeriod;
@ -435,7 +436,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate, SMnodeMsg *
.totalBlocks = pCreate->totalBlocks,
.maxTables = pCreate->maxTables,
.daysPerFile = pCreate->daysPerFile,
.daysToKeep = pCreate->daysToKeep,
.daysToKeep0 = pCreate->daysToKeep0,
.daysToKeep1 = pCreate->daysToKeep1,
.daysToKeep2 = pCreate->daysToKeep2,
.minRowsPerFileBlock = pCreate->minRowsPerFileBlock,
@ -611,7 +612,12 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
pShow->bytes[cols] = 24 + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "keep0,keep1,keep(D)");
#ifdef _STORAGE
strcpy(pSchema[cols].name, "keep0,keep1,keep2");
#else
strcpy(pSchema[cols].name, "keep");
#endif
pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++;
@ -777,7 +783,15 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
char tmp[128] = {0};
sprintf(tmp, "%d,%d,%d", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2, pDb->cfg.daysToKeep);
#ifdef _STORAGE
if (pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep1 || pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep2) {
sprintf(tmp, "%d,%d,%d", pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2, pDb->cfg.daysToKeep0);
} else {
sprintf(tmp, "%d,%d,%d", pDb->cfg.daysToKeep0, pDb->cfg.daysToKeep1, pDb->cfg.daysToKeep2);
}
#else
sprintf(tmp, "%d", pDb->cfg.daysToKeep2);
#endif
STR_WITH_SIZE_TO_VARSTR(pWrite, tmp, strlen(tmp));
cols++;
@ -895,7 +909,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
pCreate->cacheBlockSize = htonl(pCreate->cacheBlockSize);
pCreate->totalBlocks = htonl(pCreate->totalBlocks);
pCreate->daysPerFile = htonl(pCreate->daysPerFile);
pCreate->daysToKeep = htonl(pCreate->daysToKeep);
pCreate->daysToKeep0 = htonl(pCreate->daysToKeep0);
pCreate->daysToKeep1 = htonl(pCreate->daysToKeep1);
pCreate->daysToKeep2 = htonl(pCreate->daysToKeep2);
pCreate->commitTime = htonl(pCreate->commitTime);
@ -922,7 +936,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
int32_t cacheBlockSize = htonl(pAlter->cacheBlockSize);
int32_t totalBlocks = htonl(pAlter->totalBlocks);
int32_t daysPerFile = htonl(pAlter->daysPerFile);
int32_t daysToKeep = htonl(pAlter->daysToKeep);
int32_t daysToKeep0 = htonl(pAlter->daysToKeep0);
int32_t daysToKeep1 = htonl(pAlter->daysToKeep1);
int32_t daysToKeep2 = htonl(pAlter->daysToKeep2);
int32_t minRows = htonl(pAlter->minRowsPerFileBlock);
@ -941,6 +955,14 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
terrno = TSDB_CODE_SUCCESS;
//UPGRATE FROM LOW VERSION, reorder it
if (pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep1 || pDb->cfg.daysToKeep0 > pDb->cfg.daysToKeep2) {
int32_t t = pDb->cfg.daysToKeep0;
newCfg.daysToKeep0 = pDb->cfg.daysToKeep1;
newCfg.daysToKeep1 = pDb->cfg.daysToKeep2;
newCfg.daysToKeep2 = t;
}
if (cacheBlockSize > 0 && cacheBlockSize != pDb->cfg.cacheBlockSize) {
mError("db:%s, can't alter cache option", pDb->name);
terrno = TSDB_CODE_MND_INVALID_DB_OPTION;
@ -965,17 +987,17 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
terrno = TSDB_CODE_MND_INVALID_DB_OPTION;
}
if (daysToKeep > 0 && daysToKeep != pDb->cfg.daysToKeep) {
mDebug("db:%s, daysToKeep:%d change to %d", pDb->name, pDb->cfg.daysToKeep, daysToKeep);
newCfg.daysToKeep = daysToKeep;
if (daysToKeep0 > 0 && (daysToKeep0 != pDb->cfg.daysToKeep0 || newCfg.daysToKeep0 != pDb->cfg.daysToKeep0)) {
mDebug("db:%s, daysToKeep:%d change to %d", pDb->name, pDb->cfg.daysToKeep0, daysToKeep0);
newCfg.daysToKeep0 = daysToKeep0;
}
if (daysToKeep1 > 0 && daysToKeep1 != pDb->cfg.daysToKeep1) {
if (daysToKeep1 > 0 && (daysToKeep1 != pDb->cfg.daysToKeep1 || newCfg.daysToKeep1 != pDb->cfg.daysToKeep1)) {
mDebug("db:%s, daysToKeep1:%d change to %d", pDb->name, pDb->cfg.daysToKeep1, daysToKeep1);
newCfg.daysToKeep1 = daysToKeep1;
}
if (daysToKeep2 > 0 && daysToKeep2 != pDb->cfg.daysToKeep2) {
if (daysToKeep2 > 0 && (daysToKeep2 != pDb->cfg.daysToKeep2 || newCfg.daysToKeep2 != pDb->cfg.daysToKeep2)) {
mDebug("db:%s, daysToKeep2:%d change to %d", pDb->name, pDb->cfg.daysToKeep2, daysToKeep2);
newCfg.daysToKeep2 = daysToKeep2;
}
@ -1068,8 +1090,8 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
// community version can only change daysToKeep
// but enterprise version can change all daysToKeep options
#ifndef _STORAGE
newCfg.daysToKeep1 = newCfg.daysToKeep;
newCfg.daysToKeep2 = newCfg.daysToKeep;
newCfg.daysToKeep1 = newCfg.daysToKeep0;
newCfg.daysToKeep2 = newCfg.daysToKeep0;
#endif
return newCfg;
@ -1309,4 +1331,4 @@ int32_t mnodeCompactDbs() {
mInfo("end to compact dbs table...");
return 0;
}
}

View File

@ -894,9 +894,9 @@ static SCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
pCfg->totalBlocks = htonl(pDb->cfg.totalBlocks);
pCfg->maxTables = htonl(maxTables + 1);
pCfg->daysPerFile = htonl(pDb->cfg.daysPerFile);
pCfg->daysToKeep = htonl(pDb->cfg.daysToKeep);
pCfg->daysToKeep1 = htonl(pDb->cfg.daysToKeep1);
pCfg->daysToKeep2 = htonl(pDb->cfg.daysToKeep2);
pCfg->daysToKeep = htonl(pDb->cfg.daysToKeep2); //FROM DB TO VNODE MAP:
pCfg->daysToKeep1 = htonl(pDb->cfg.daysToKeep0); //keep0,keep1,keep2 in SQL is mapped to keep1,keep2,keep in vnode
pCfg->daysToKeep2 = htonl(pDb->cfg.daysToKeep1); //user,client,mnode use keep0,keep1,keep2; vnode use keep1,keep2,keep
pCfg->minRowsPerFileBlock = htonl(pDb->cfg.minRowsPerFileBlock);
pCfg->maxRowsPerFileBlock = htonl(pDb->cfg.maxRowsPerFileBlock);
pCfg->fsyncPeriod = htonl(pDb->cfg.fsyncPeriod);

View File

@ -184,11 +184,17 @@ static void *monThreadFunc(void *param) {
static void monBuildMonitorSql(char *sql, int32_t cmd) {
memset(sql, 0, SQL_LENGTH);
#ifdef _STORAGE
char *keepValue = "30,30,30";
#else
char *keepValue = "30";
#endif
if (cmd == MON_CMD_CREATE_DB) {
snprintf(sql, SQL_LENGTH,
"create database if not exists %s replica 1 days 10 keep 30 cache %d "
"create database if not exists %s replica 1 days 10 keep %s cache %d "
"blocks %d precision 'us'",
tsMonitorDbName, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MIN_TOTAL_BLOCKS);
tsMonitorDbName, keepValue, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MIN_TOTAL_BLOCKS);
} else if (cmd == MON_CMD_CREATE_MT_DN) {
snprintf(sql, SQL_LENGTH,
"create table if not exists %s.dn(ts timestamp"

View File

@ -238,9 +238,18 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K
Y.stat = M;
}
%type intitemlist {SArray*}
%destructor intitemlist {taosArrayDestroy($$);}
%type intitem {tVariant}
intitemlist(A) ::= intitemlist(X) COMMA intitem(Y). { A = tVariantListAppend(X, &Y, -1); }
intitemlist(A) ::= intitem(X). { A = tVariantListAppend(NULL, &X, -1); }
intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
%type keep {SArray*}
%destructor keep {taosArrayDestroy($$);}
keep(Y) ::= KEEP tagitemlist(X). { Y = X; }
keep(Y) ::= KEEP intitemlist(X). { Y = X; }
cache(Y) ::= CACHE INTEGER(X). { Y = X; }
replica(Y) ::= REPLICA INTEGER(X). { Y = X; }

File diff suppressed because it is too large Load Diff

View File

@ -3572,6 +3572,9 @@ int32_t tsdbGetTableGroupFromIdList(STsdbRepo* tsdb, SArray* pTableIdList, STabl
if (pTable->type == TSDB_SUPER_TABLE) {
tsdbError("direct query on super tale is not allowed, table uid:%"PRIu64", tid:%d", id->uid, id->tid);
terrno = TSDB_CODE_QRY_INVALID_MSG;
tsdbUnlockRepoMeta(tsdb);
taosArrayDestroy(group);
return terrno;
}
tsdbRefTable(pTable);

View File

@ -193,7 +193,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_IN_DROPPING, "Database not availabl
TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_READY, "Database unsynced")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_OPTION_DAYS, "Invalid database option: days out of range")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_OPTION_KEEP, "Invalid database option: keep >= keep1 >= keep0 >= days")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_OPTION_KEEP, "Invalid database option: keep2 >= keep1 >= keep0 >= days")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TOPIC, "Invalid topic name")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TOPIC_OPTION, "Invalid topic option")

View File

@ -265,6 +265,10 @@ static int32_t tKeywordCode(const char* z, int n) {
}
}
if (keywordHashTable == NULL) {
return TK_ILLEGAL;
}
SKeyword** pKey = (SKeyword**)taosHashGet(keywordHashTable, key, n);
return (pKey != NULL)? (*pKey)->type:TK_ID;
}

View File

@ -23,84 +23,93 @@ class TDTestCase:
tdSql.init(conn.cursor(), logSql)
def alterKeepCommunity(self):
## community accepts both 1 paramater, 2 parmaters and 3 paramaters
## but paramaters other than paramater 1 will be ignored
## only paramater 1 will be used
tdLog.notice('running Keep Test, Community Version')
#testing keep parameter during create
tdSql.query('show databases')
tdSql.checkData(0,7,'3650')
tdSql.execute('drop database db')
tdSql.execute('create database db keep 100')
tdSql.query('show databases')
tdSql.checkData(0,7,'100')
tdSql.execute('drop database db')
tdSql.error('create database db keep ')
tdSql.error('create database db keep 0')
tdSql.error('create database db keep 10,20')
tdSql.error('create database db keep 10,20,30')
tdSql.error('create database db keep 20,30,40,50')
#testing keep parameter during alter
tdSql.execute('create database db')
tdSql.execute('alter database db keep 100')
tdSql.query('show databases')
tdSql.checkData(0,7,'100')
tdSql.error('alter database db keep ')
tdSql.error('alter database db keep 0')
tdSql.error('alter database db keep 10,20')
tdSql.error('alter database db keep 10,20,30')
tdSql.error('alter database db keep 20,30,40,50')
tdSql.query('show databases')
tdSql.checkData(0,7,'100')
def alterKeepEnterprise(self):
tdLog.notice('running Keep Test, Enterprise Version')
#testing keep parameter during create
tdSql.query('show databases')
tdSql.checkData(0,7,'3650,3650,3650')
tdSql.execute('drop database db')
tdSql.execute('create database db keep 100')
tdSql.query('show databases')
tdSql.checkData(0,7,'100,100,100')
tdSql.execute('drop database db')
tdSql.execute('create database db keep 20, 30')
tdSql.query('show databases')
tdSql.checkData(0,7,'20,30,30')
tdSql.execute('drop database db')
tdSql.execute('create database db keep 30,40,50')
tdSql.query('show databases')
tdSql.checkData(0,7,'30,40,50')
tdSql.execute('drop database db')
tdSql.error('create database db keep ')
tdSql.error('create database db keep 20,30,40,50')
tdSql.error('create database db keep 0')
tdSql.error('create database db keep 100,50')
tdSql.error('create database db keep 100,40,50')
tdSql.error('create database db keep 20,100,50')
tdSql.error('create database db keep 50,60,20')
#testing keep parameter during alter
tdSql.execute('create database db')
tdSql.execute('alter database db keep 10')
tdSql.query('show databases')
tdSql.checkData(0,7,'10,10,10')
tdSql.execute('alter database db keep 50')
tdSql.execute('alter database db keep 20,30')
tdSql.query('show databases')
tdSql.checkData(0,7,'50,50,50')
tdSql.checkData(0,7,'20,30,30')
tdSql.execute('alter database db keep 20')
tdSql.execute('alter database db keep 100,200,300')
tdSql.query('show databases')
tdSql.checkData(0,7,'20,20,20')
tdSql.checkData(0,7,'100,200,300')
tdSql.execute('alter database db keep 100, 98 ,99')
tdSql.error('alter database db keep ')
tdSql.error('alter database db keep 20,30,40,50')
tdSql.error('alter database db keep 0')
tdSql.error('alter database db keep 100,50')
tdSql.error('alter database db keep 100,40,50')
tdSql.error('alter database db keep 20,100,50')
tdSql.error('alter database db keep 50,60,20')
tdSql.query('show databases')
tdSql.checkData(0,7,'100,100,100')
tdSql.checkData(0,7,'100,200,300')
tdSql.execute('alter database db keep 99, 100 ,101')
tdSql.query('show databases')
tdSql.checkData(0,7,'99,99,99')
tdSql.execute('alter database db keep 200, 199 ,198')
tdSql.query('show databases')
tdSql.checkData(0,7,'200,200,200')
tdSql.execute('alter database db keep 4000,4001')
tdSql.query('show databases')
tdSql.checkData(0,7,'4000,4000,4000')
tdSql.execute('alter database db keep 5000,50')
tdSql.query('show databases')
tdSql.checkData(0,7,'5000,5000,5000')
tdSql.execute('alter database db keep 50,5000')
tdSql.query('show databases')
tdSql.checkData(0,7,'50,50,50')
def alterKeepEnterprise(self):
## enterprise only accept three inputs
## does not accept 1 paramaters nor 3 paramaters
tdSql.query('show databases')
tdSql.checkData(0,7,'3650,3650,3650')
tdSql.error('alter database db keep 10')
tdSql.query('show databases')
tdSql.checkData(0,7,'3650,3650,3650')
## the order for altering keep is keep(D), keep0, keep1.
## if the order is changed, please modify the following test
## to make sure the the test is accurate
tdSql.execute('alter database db keep 10, 10 ,10')
tdSql.query('show databases')
tdSql.checkData(0,7,'10,10,10')
tdSql.execute('alter database db keep 100, 98 ,99')
tdSql.query('show databases')
tdSql.checkData(0,7,'98,99,100')
tdSql.execute('alter database db keep 200, 200 ,200')
tdSql.query('show databases')
tdSql.checkData(0,7,'200,200,200')
tdSql.error('alter database db keep 198, 199 ,200')
tdSql.query('show databases')
tdSql.checkData(0,7,'200,200,200')
# tdSql.execute('alter database db keep 3650,3650,3650')
# tdSql.error('alter database db keep 4000,3640')
# tdSql.error('alter database db keep 10,10')
# tdSql.query('show databases')
# tdSql.checkData(0,7,'3650,3650,3650')
def run(self):
tdSql.prepare()
@ -112,7 +121,8 @@ class TDTestCase:
else:
tdLog.debug('running community test')
self.alterKeepCommunity()
tdSql.prepare()
##TODO: need to wait for TD-4445 to implement the following
## tests

View File

@ -0,0 +1,72 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.pathFinding import *
from util.dnodes import tdDnodes
from datetime import datetime
import subprocess
##TODO: this is now automatic, but not sure if this will run through jenkins
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
tdFindPath.init(__file__)
def run(self):
tdSql.prepare()
binPath = tdFindPath.getTaosdemoPath()
TDenginePath = tdFindPath.getTDenginePath()
## change system time to 2020/10/20
os.system('sudo timedatectl set-ntp off')
os.system('sudo timedatectl set-time 2020-10-20')
#run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20
#11 data files should be generated
#vnode at TDinternal/community/sim/dnode1/data/vnode
os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json")
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
print(result.count('data'))
if result.count('data') != 11:
tdLog.exit('wrong number of files')
else:
tdLog.debug("data file number correct")
#move 5 days ahead to 2020/10/25. 4 oldest files should be removed during the new write
#leaving 7 data files.
os.system ('timedatectl set-time 2020-10-25')
os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json")
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
print(result.count('data'))
if result.count('data') != 7:
tdLog.exit('wrong number of files')
else:
tdLog.debug("data file number correct")
tdSql.query('select first(ts) from stb_0')
tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database
def stop(self):
os.system('sudo timedatectl set-ntp on')
tdSql.close()
tdLog.success("alter block manual check finish")
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -0,0 +1,82 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import tdDnodes
from util.pathFinding import *
from datetime import datetime
import subprocess
##TODO: this is now automatic, but not sure if this will run through jenkins
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
tdFindPath.init(__file__)
def run(self):
tdSql.prepare()
binPath = tdFindPath.getTaosdemoPath()
TDenginePath = tdFindPath.getTDenginePath()
## change system time to 2020/10/20
os.system ('timedatectl set-ntp off')
os.system ('timedatectl set-time 2020-10-20')
#run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20
#11 data files should be generated
#vnode at TDinternal/community/sim/dnode1/data/vnode
os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json")
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
print(result.count('data'))
if result.count('data') != 11:
tdLog.exit('wrong number of files')
else:
tdLog.debug("data file number correct")
tdSql.query('select first(ts) from stb_0') #check the last data in the database
tdSql.checkData(0,0,datetime(2020,10,11,0,0,0,0))
os.system ('timedatectl set-time 2020-10-25')
#moves 5 days ahead to 2020/10/25 and restart taosd
#4 oldest data file should be removed from tsdb/data
#7 data file should be found
#vnode at TDinternal/community/sim/dnode1/data/vnode
os.system ('timedatectl set-time 2020-10-25')
tdDnodes.stop(1)
tdDnodes.start(1)
tdSql.query('select first(ts) from stb_0')
tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
print(result.count('data'))
if result.count('data') != 7:
tdLog.exit('wrong number of files')
else:
tdLog.debug("data file number correct")
def stop(self):
os.system('sudo timedatectl set-ntp on')
tdSql.close()
tdLog.success("alter block manual check finish")
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -256,6 +256,8 @@ python3 ./test.py -f client/client.py
python3 ./test.py -f client/version.py
python3 ./test.py -f client/alterDatabase.py
python3 ./test.py -f client/noConnectionErrorTest.py
python3 test.py -f client/change_time_1_1.py
python3 test.py -f client/change_time_1_2.py
# Misc
python3 testCompress.py
@ -315,7 +317,6 @@ python3 ./test.py -f query/last_row_cache.py
python3 ./test.py -f account/account_create.py
python3 ./test.py -f alter/alter_table.py
python3 ./test.py -f query/queryGroupbySort.py
python3 ./test.py -f functions/function_session.py
python3 ./test.py -f functions/function_stateWindow.py
python3 ./test.py -f insert/unsignedInt.py
@ -342,4 +343,5 @@ python3 test.py -f insert/insert_before_use_db.py
python3 test.py -f alter/alter_keep.py
python3 test.py -f alter/alter_cacheLastRow.py
python3 test.py -f alter/alter_keep_exception.py
python3 ./test.py -f query/querySession.py
#======================p4-end===============

View File

@ -26,7 +26,20 @@ class TDTestCase:
self.rowNum = 10
self.ts = 1537146000000
self.perfix = 'dev'
self.tables = 10
def insertData(self):
print("==============step1")
tdSql.execute(
"create table if not exists st (ts timestamp, col int) tags(dev nchar(50))")
for i in range(self.tables):
tdSql.execute("create table %s%d using st tags(%d)" % (self.perfix, i, i))
rows = 15 + i
for j in range(rows):
tdSql.execute("insert into %s%d values(%d, %d)" %(self.perfix, i, self.ts + i * 20 * 10000 + j * 10000, j))
def run(self):
tdSql.prepare()
@ -99,6 +112,15 @@ class TDTestCase:
tdSql.query("select diff(col6) from test1")
tdSql.checkRows(10)
self.insertData()
tdSql.query("select diff(col) from st group by tbname")
tdSql.checkRows(185)
tdSql.error("select diff(col) from st group by dev")
tdSql.error("select diff(col) from st group by col")
def stop(self):
tdSql.close()

View File

@ -97,6 +97,12 @@ class TDTestCase:
tdSql.query("select diff(col6) from test1")
tdSql.checkRows(10)
tdSql.query("select diff(col) from st group by tbname")
tdSql.checkRows(185)
tdSql.error("select diff(col) from st group by dev")
tdSql.error("select diff(col) from st group by col")
def stop(self):
tdSql.close()

View File

@ -1,86 +0,0 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import *
from util.cases import *
from util.sql import *
#import numpy as np
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.rowNum = 10
self.ts = 1537146000000
def run(self):
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# operation not allowed on super table
tdSql.error("select count(*) from test session(ts, 1s)")
# operation not allowde on col pro
tdSql.error("select * from test1 session(ts, 1s)")
# operation not allowed on col except primary ts
tdSql.error("select * from test1 session(col1, 1s)")
tdSql.query("select count(*) from test1 session(ts, 1s)")
tdSql.checkRows(1)
tdSql.checkData(0, 1, 10)
# append more data
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + 2000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.query("select count(*) from test1 session(ts, 1s)")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 10)
tdSql.checkData(1, 1, 1)
tdSql.query("select count(*) from test1 session(ts, 1m)")
tdSql.checkRows(1)
tdSql.checkData(0, 1, 11)
tdSql.query("select first(col1) from test1 session(ts, 1s)")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 1)
tdSql.query("select first(col1), last(col2) from test1 session(ts, 1s)")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, 10)
tdSql.checkData(1, 1, 1)
tdSql.checkData(1, 1, 1)
# add more function
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -0,0 +1,97 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from fabric import Connection
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import tdDnodes
from datetime import datetime
import subprocess
import time
import taos
##TODO: this is now automatic, but not sure if this will run through jenkins
#the initial time used for this test is 2020/10/20
#setting local machine's time for later connecting to the server
os.system('sudo timedatectl set-ntp off')
os.system('sudo timedatectl set-time 2020-10-25')
#connect to VM lyq-1, and initalize the environment at lyq-1
conn1 = Connection("{}@{}".format('ubuntu', "192.168.1.125"), connect_kwargs={"password": "{}".format('tbase125!')})
conn1.run("sudo systemctl stop taosd")
conn1.run('ls -l')
conn1.run('sudo timedatectl set-ntp off')
conn1.run('sudo timedatectl set-time 2020-10-20')
with conn1.cd('/data/taos/log'):
conn1.run('sudo rm -rf *')
with conn1.cd('/data/taos/data'):
conn1.run('sudo rm -rf *')
#lanuch taosd and start taosdemo
conn1.run("sudo systemctl start taosd")
time.sleep(5)
with conn1.cd('~/bschang_test'):
conn1.run('taosdemo -f manual_change_time_1_1_A.json')
#force everything onto disk
conn1.run("sudo systemctl restart taosd")
time.sleep(10)
#change lyq-1 to 2020/10/25 for testing if the server
#will send data that is out of time range
conn1.run('sudo timedatectl set-time 2020-10-25')
#connect to VM lyq-2, initalize the environment at lyq-2, and run taosd
#on that
conn2 = Connection("{}@{}".format('ubuntu', "192.168.1.126"), connect_kwargs={"password": "{}".format('tbase125!')})
conn2.run('sudo timedatectl set-ntp off')
conn2.run('sudo timedatectl set-time 2020-10-20')
conn2.run("sudo systemctl stop taosd")
with conn2.cd('/data/taos/log'):
conn2.run('sudo rm -rf *')
with conn2.cd('/data/taos/data'):
conn2.run('sudo rm -rf *')
conn2.run("sudo systemctl start taosd")
#set replica to 2
connTaos = taos.connect(host = '192.168.1.125', user = 'root', password = 'taosdata', cnfig = '/etc/taos')
c1 = connTaos.cursor()
c1.execute('create dnode \'lyq-2:6030\'')
c1.execute('alter database db replica 2')
c1.close()
connTaos.close()
time.sleep(5)
#force everything onto the disk for lyq-2
#stopping taosd on lyq-1 for future testing
conn2.run("sudo systemctl stop taosd")
conn1.run("sudo systemctl stop taosd")
#reset the time
conn1.run('sudo timedatectl set-ntp on')
conn2.run('sudo timedatectl set-ntp on')
os.system('sudo timedatectl set-ntp on')
#check if the number of file received is 7
#the 4 oldest data files should be dropped
#4 files because of moving 5 days ahead
with conn2.cd('/data/taos/data/vnode/vnode3/tsdb/data'):
result = conn2.run('ls -l |grep \'data\' |wc -l')
if result.stdout.strip() != '7':
tdLog.exit('the file number is wrong')
else:
tdLog.success('the file number is the same. test pass')

View File

@ -0,0 +1,97 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from fabric import Connection
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import tdDnodes
from datetime import datetime
import subprocess
import time
import taos
##TODO: this is now automatic, but not sure if this will run through jenkins
#the initial time used for this test is 2020/10/20
#setting local machine's time for later connecting to the server
os.system('sudo timedatectl set-ntp off')
os.system('sudo timedatectl set-time 2020-10-20')
#connect to VM lyq-1, and initalize the environment at lyq-1
conn1 = Connection("{}@{}".format('ubuntu', "192.168.1.125"), connect_kwargs={"password": "{}".format('tbase125!')})
conn1.run("sudo systemctl stop taosd")
conn1.run('sudo timedatectl set-ntp off')
conn1.run('sudo timedatectl set-time 2020-10-20')
with conn1.cd('/data/taos/log'):
conn1.run('sudo rm -rf *')
with conn1.cd('/data/taos/data'):
conn1.run('sudo rm -rf *')
#lanuch taosd and start taosdemo
conn1.run("sudo systemctl start taosd")
time.sleep(5)
with conn1.cd('~/bschang_test'):
conn1.run('taosdemo -f manual_change_time_1_1_A.json') #the json file is placed in lyq-1 already
#force everything onto disk
conn1.run("sudo systemctl restart taosd")
time.sleep(10)
#connect to VM lyq-2, and initalize the environment at lyq-2
conn2 = Connection("{}@{}".format('ubuntu', "192.168.1.126"), connect_kwargs={"password": "{}".format('tbase125!')})
conn2.run('sudo timedatectl set-ntp off')
conn2.run('sudo timedatectl set-time 2020-10-20')
conn2.run("sudo systemctl stop taosd")
with conn2.cd('/data/taos/log'):
conn2.run('sudo rm -rf *')
with conn2.cd('/data/taos/data'):
conn2.run('sudo rm -rf *')
#the date of lyq-2 is going to be set to 2020/10/25
#for testing if other pnode will accpet file out of local time range
conn2.run("sudo systemctl start taosd")
conn2.run('sudo timedatectl set-time 2020-10-25')
#set the replica to 2
connTaos = taos.connect(host = '192.168.1.125', user = 'root', password = 'taosdata', cnfig = '/etc/taos')
c1 = connTaos.cursor()
c1.execute('create dnode \'lyq-2:6030\'')
c1.execute('alter database db replica 2')
time.sleep(5)
#force everything onto the disk for lyq-2
#stopping taosd on lyq-1 for future testing
conn2.run("sudo systemctl stop taosd")
conn1.run("sudo systemctl stop taosd")
#reset the time
conn1.run('sudo timedatectl set-ntp on')
conn2.run('sudo timedatectl set-ntp on')
os.system('sudo timedatectl set-ntp on')
#check if the number of file received is 7
#the 4 oldest data files should be dropped
#4 files because of moving 5 days ahead
with conn2.cd('/data/taos/data/vnode/vnode3/tsdb/data'):
result = conn2.run('ls -l |grep \'data\' |wc -l')
if result.stdout.strip() != '7':
tdLog.exit('the file number is wrong')
else:
tdLog.success('the file number is the same. test pass')
c1.close()
connTaos.close()

View File

@ -82,7 +82,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 15)
# session with where
tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)")
tdSql.query("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)")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 13)
tdSql.checkData(0, 2, 1)
@ -93,6 +93,9 @@ class TDTestCase:
tdSql.checkData(0, 7, 13)
tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}')
tdSql.checkData(0, 9, 12)
tdSql.checkData(0, 10, 3.741657387)
tdSql.checkData(0, 11, 1)
tdSql.checkData(1, 11, 14)
# tdsql err
tdSql.error("select * from dev_001 session(ts,1w)")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,98 +331,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> '0'
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '0' and
# ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '0' and
# ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -471,12 +469,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -526,13 +524,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -74,14 +74,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -102,14 +101,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -128,36 +126,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -269,98 +267,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> '0'
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '0' and
# ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '0' and
# ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -370,98 +368,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> '0'
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and
# ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and
# ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -471,104 +469,104 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' and
# tgcol = '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' and
# tgcol <> '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' and
# tgcol = '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' and
# tgcol <> '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' and
# tgcol = '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0'
# and tgcol <> '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> '0' and tgcol <> '0'
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and
# ts < now + 5m and ts < now + 5m and tgcol <> '0'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and
# ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> '0'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> "0"' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -648,12 +646,12 @@ class TDTestCase:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -738,13 +736,13 @@ class TDTestCase:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -71,14 +71,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -97,14 +96,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -123,81 +121,81 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -216,36 +214,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -324,98 +322,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = true
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = false
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> false
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false
# and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> false
# and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -462,12 +460,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -517,13 +515,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -71,14 +71,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -96,14 +95,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -122,36 +120,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -263,98 +261,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = true
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = false
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> false
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false
# and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> false
# and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -364,98 +362,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> '0'
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and
# ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and
# ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -465,104 +463,104 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' and
# tgcol = true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' and
# tgcol <> true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' and
# tgcol = false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' and
# tgcol <> false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' and
# tgcol = false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0'
# and tgcol <> false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> '0' and tgcol <> false
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> false' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and
# ts < now + 5m and ts < now + 5m and tgcol <> false
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and
# ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -642,12 +640,12 @@ class TDTestCase:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -732,13 +730,13 @@ class TDTestCase:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -71,14 +71,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -96,14 +95,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -122,36 +120,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -295,98 +293,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = true
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = false
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> false
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false
# and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> false
# and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -396,98 +394,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and
# ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and
# ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -497,104 +495,104 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 and
# tgcol = true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 and
# tgcol <> true
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> true' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> true' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> true' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 and
# tgcol = false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 and
# tgcol <> false
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> false' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 and
# tgcol = false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and
# tgcol <> false
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> false' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> 0 and tgcol <> false
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> false' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and
# ts < now + 5m and ts < now + 5m and tgcol <> false
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and
# ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> false' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -674,12 +672,12 @@ class TDTestCase:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -764,13 +762,13 @@ class TDTestCase:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -71,14 +71,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -97,14 +96,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -123,56 +121,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -189,25 +187,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -226,36 +224,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -332,94 +330,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -466,12 +464,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -521,13 +519,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,36 +122,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -265,94 +263,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -362,98 +360,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1'
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1'
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "1"' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0'
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> "0"' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0'
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> "0"' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> '0'
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and
# ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and
# ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -463,104 +461,104 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' and
# tgcol = 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' and
# tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' and
# tgcol = 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' and
# tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' and
# tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0'
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0'
# and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> '0' and tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and
# ts < now + 5m and ts < now + 5m and tgcol <> 0
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and
# ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -640,12 +638,12 @@ class TDTestCase:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -730,13 +728,13 @@ class TDTestCase:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,36 +122,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -301,94 +299,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -398,98 +396,98 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step6
tdLog.info('=============== step6')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and
# ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and
# ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -499,104 +497,104 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step7
tdLog.info('=============== step7')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 and
# tgcol = 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 and
# tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 and
# tgcol = 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 and
# tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol2 <> 0 and tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and
# ts < now + 5m and ts < now + 5m and tgcol <> 0
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and
# ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -676,12 +674,12 @@ class TDTestCase:
# TSIM: print =============== step10
tdLog.info('=============== step10')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -766,13 +764,13 @@ class TDTestCase:
# TSIM: print =============== step13
tdLog.info('=============== step13')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')

View File

@ -0,0 +1,60 @@
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 4,
"thread_count_create_tbl": 4,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 100,
"num_of_records_per_req": 32766,
"databases": [{
"dbinfo": {
"name": "db",
"drop": "yes",
"replica": 1,
"days": 1,
"cache": 4,
"blocks": 3,
"precision": "ms",
"keep": 10,
"minRows": 1000,
"maxRows": 4096,
"comp":2,
"walLevel":1,
"cachelast":0,
"quorum":1,
"fsync":3000,
"update": 0
},
"super_tables": [{
"name": "stb",
"child_table_exists":"no",
"childtable_count": 1,
"childtable_prefix": "stb_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 864000,
"childtable_limit": 1,
"childtable_offset":0,
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1000,
"start_timestamp": "2020-10-11 00:00:00.000",
"sample_format": "csv",
"sample_file": "./tools/taosdemoAllTest/sample.csv",
"tags_file": "",
"columns": [{"type": "BINARY", "len": 5120, "count":1}],
"tags": [{"type": "TINYINT", "count":2}]
}]
}]
}

View File

@ -0,0 +1,60 @@
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 4,
"thread_count_create_tbl": 4,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 100,
"num_of_records_per_req": 32766,
"databases": [{
"dbinfo": {
"name": "db",
"drop": "no",
"replica": 1,
"days": 1,
"cache": 4,
"blocks": 3,
"precision": "ms",
"keep": 10,
"minRows": 1000,
"maxRows": 4096,
"comp":2,
"walLevel":1,
"cachelast":0,
"quorum":1,
"fsync":3000,
"update": 0
},
"super_tables": [{
"name": "stb",
"child_table_exists":"yes",
"childtable_count": 1,
"childtable_prefix": "stb_",
"auto_create_table": "yes",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 432000,
"childtable_limit": 1,
"childtable_offset":0,
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1000,
"start_timestamp": "2020-10-16 00:00:00.500",
"sample_format": "csv",
"sample_file": "./tools/taosdemoAllTest/sample.csv",
"tags_file": "",
"columns": [{"type": "BINARY", "len": 5120, "count":1}],
"tags": [{"type": "TINYINT", "count":1}]
}]
}]
}

View File

@ -0,0 +1,83 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import os
from util.log import *
class TDFindPath:
"""This class is for finding path within TDengine
"""
def __init__(self):
self.file = ""
def init(self, file):
"""[summary]
Args:
file (str): the file location you want to start the query. Generally using __file__
"""
self.file = file
def getTaosdemoPath(self):
"""for finding the path of directory containing taosdemo
Returns:
str: the path to directory containing taosdemo
"""
selfPath = os.path.dirname(os.path.realpath(self.file))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
break
if (buildPath == ""):
tdLog.exit("taosd not found!")
else:
tdLog.info(f"taosd found in {buildPath}")
return buildPath + "/build/bin/"
def getTDenginePath(self):
"""for finding the root path of TDengine
Returns:
str: the root path of TDengine
"""
selfPath = os.path.dirname(os.path.realpath(self.file))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
print(projPath)
for root, dirs, files in os.walk(projPath):
if ("sim" in dirs):
print(root)
rootRealPath = os.path.realpath(root)
if (rootRealPath == ""):
tdLog.exit("TDengine not found!")
else:
tdLog.info(f"TDengine found in {rootRealPath}")
return rootRealPath
tdFindPath = TDFindPath()

View File

@ -112,21 +112,21 @@ endi
sql alter database db keep 30
sql show databases
print keep $data7_db
if $data7_db != 20,20,30 then
if $data7_db != 30,30,30 then
return -1
endi
sql alter database db keep 40
sql show databases
print keep $data7_db
if $data7_db != 20,20,40 then
if $data7_db != 40,40,40 then
return -1
endi
sql alter database db keep 40
sql alter database db keep 30
sql alter database db keep 40,50
sql alter database db keep 30,31
sql alter database db keep 20
sql_error alter database db keep 10
sql_error alter database db keep 10.0
sql_error alter database db keep 9
sql_error alter database db keep 1
sql_error alter database db keep 0

View File

@ -367,7 +367,7 @@ sql_error topic db keep 30
sql alter database db keep 30
sql show databases
print keep $data7_db
if $data7_db != 20,20,30 then
if $data7_db != 30,30,30 then
return -1
endi
@ -375,14 +375,14 @@ sql_error alter topic db keep 40
sql alter database db keep 40
sql show databases
print keep $data7_db
if $data7_db != 20,20,40 then
if $data7_db != 40,40,40 then
return -1
endi
sql alter database db keep 40
sql alter database db keep 30
sql alter database db keep 20
sql_error alter database db keep 10
sql_error alter database db keep 10.0
sql_error alter database db keep 9
sql_error alter database db keep 1
sql_error alter database db keep 0

View File

@ -88,7 +88,7 @@ print =============== step2 - no db
#11
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:7111/rest/sql
print 11-> $system_content
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[],"rows":0}@ then
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep2","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep2",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[],"rows":0}@ then
return -1
endi

View File

@ -20,8 +20,82 @@ $db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database if exists $db
sql create database $db
sql create database $db days 10 keep 20,20,20
sql use $db
sql_error alter database $db keep "20"
sql_error alter database $db keep "20","20","20"
sql_error alter database $db keep 20,19
sql_error alter database $db keep 20.0
sql_error alter database $db keep 20.0,20.0,20.0
sql_error alter database $db keep 0,0,0
sql_error alter database $db keep -1,-1,-1
sql_error alter database $db keep 9,20
sql_error alter database $db keep 9,9,9
sql_error alter database $db keep 20,20,19
sql_error alter database $db keep 20,19,20
sql_error alter database $db keep 20,19,19
sql_error alter database $db keep 20,19,18
sql_error alter database $db keep 20,20,20,20
sql_error alter database $db keep 365001,365001,365001
sql alter database $db keep 21
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 21,21,21 then
return -1
endi
sql alter database $db keep 11,12
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11,12,12 then
return -1
endi
sql alter database $db keep 20,20,20
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 20,20,20 then
return -1
endi
sql alter database $db keep 10,10,10
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 10,10,10 then
return -1
endi
sql alter database $db keep 10,10,11
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 10,10,11 then
return -1
endi
sql alter database $db keep 11,12,13
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11,12,13 then
return -1
endi
sql alter database $db keep 365000,365000,365000
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 365000,365000,365000 then
return -1
endi
##### alter table test, simeplest case
sql create table tb (ts timestamp, c1 int, c2 int, c3 int)
sql insert into tb values (now, 1, 1, 1)

View File

@ -0,0 +1,316 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 100
sql connect
$dbPrefix = m_alt_db
$tbPrefix = m_alt_tb
$mtPrefix = m_alt_mt
$tbNum = 10
$rowNum = 5
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== alter.sim
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database if exists $db
sql create database $db days 10 keep 20
sql use $db
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 20 then
return -1
endi
sql_error alter database $db keep "20"
sql_error alter database $db keep "20","20","20"
sql_error alter database $db keep 0
sql_error alter database $db keep 20.0
sql_error alter database $db keep 20.0,20.0,20.0
sql_error alter database $db keep 0,0,0
sql_error alter database $db keep 3
sql_error alter database $db keep -1,-1,-1
sql_error alter database $db keep 20,20
sql_error alter database $db keep 9,9,9
sql_error alter database $db keep 20,20,19
sql_error alter database $db keep 20,19,20
sql_error alter database $db keep 20,19,19
sql_error alter database $db keep 20,19,18
sql_error alter database $db keep 20,20,20,20
sql_error alter database $db keep 365001,365001,365001
sql_error alter database $db keep 365001
sql alter database $db keep 20
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 20 then
return -1
endi
sql alter database $db keep 10
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 10 then
return -1
endi
sql alter database $db keep 11
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11 then
return -1
endi
sql alter database $db keep 13
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 13 then
return -1
endi
sql alter database $db keep 365000
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 365000 then
return -1
endi
##### alter table test, simeplest case
sql create table tb (ts timestamp, c1 int, c2 int, c3 int)
sql insert into tb values (now, 1, 1, 1)
sql select * from tb order by ts desc
if $rows != 1 then
return -1
endi
sql alter table tb drop column c3
sql select * from tb order by ts desc
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != null then
return -1
endi
sql alter table tb add column c3 nchar(4)
sql select * from tb order by ts desc
if $rows != 1 then
return -1
endi
if $data03 != NULL then
return -1
endi
sql insert into tb values (now, 2, 2, 'taos')
sql select * from tb order by ts desc
if $rows != 2 then
return -1
endi
print data03 = $data03
if $data03 != taos then
print expect taos, actual: $data03
return -1
endi
sql drop table tb
##### alter metric test, simplest case
sql create table mt (ts timestamp, c1 int, c2 int, c3 int) tags (t1 int)
sql create table tb using mt tags(1)
sql insert into tb values (now, 1, 1, 1)
sql alter table mt drop column c3
sql select * from tb order by ts desc
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != null then
return -1
endi
sql alter table mt add column c3 nchar(4)
sql select * from tb order by ts desc
if $data03 != NULL then
return -1
endi
sql insert into tb values (now, 2, 2, 'taos')
sql select * from tb order by ts desc
if $rows != 2 then
return -1
endi
if $data03 != taos then
return -1
endi
if $data13 != NULL then
return -1
endi
sql drop table tb
sql drop table mt
## [TBASE272]
sql create table tb (ts timestamp, c1 int, c2 int, c3 int)
sql insert into tb values (now, 1, 1, 1)
sql alter table tb drop column c3
sql alter table tb add column c3 nchar(5)
sql insert into tb values(now, 2, 2, 'taos')
sql drop table tb
sql create table mt (ts timestamp, c1 int, c2 int, c3 int) tags (t1 int)
sql create table tb using mt tags(1)
sql insert into tb values (now, 1, 1, 1)
sql alter table mt drop column c3
sql select * from tb order by ts desc
if $rows != 1 then
return -1
endi
sql drop table tb
sql drop table mt
sleep 100
### ALTER TABLE WHILE STREAMING [TBASE271]
#sql create table tb1 (ts timestamp, c1 int, c2 nchar(5), c3 int)
#sql create table strm as select count(*), avg(c1), first(c2), sum(c3) from tb1 interval(2s)
#sql select * from strm
#if $rows != 0 then
# return -1
#endi
##sleep 12000
#sql insert into tb1 values (now, 1, 'taos', 1)
#sleep 20000
#sql select * from strm
#print rows = $rows
#if $rows != 1 then
# return -1
#endi
#if $data04 != 1 then
# return -1
#endi
#sql alter table tb1 drop column c3
#sleep 500
#sql insert into tb1 values (now, 2, 'taos')
#sleep 30000
#sql select * from strm
#if $rows != 2 then
# return -1
#endi
#if $data04 != 1 then
# return -1
#endi
#sql alter table tb1 add column c3 int
#sleep 500
#sql insert into tb1 values (now, 3, 'taos', 3);
#sleep 100
#sql select * from strm
#if $rows != 3 then
# return -1
#endi
#if $data04 != 1 then
# return -1
#endi
## ALTER TABLE AND INSERT BY COLUMNS
sql create table mt (ts timestamp, c1 int, c2 int) tags(t1 int)
sql create table tb using mt tags(0)
sql insert into tb values (now-1m, 1, 1)
sql alter table mt drop column c2
sql_error insert into tb (ts, c1, c2) values (now, 2, 2)
sql insert into tb (ts, c1) values (now, 2)
sql select * from tb order by ts desc
if $rows != 2 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data02 != null then
return -1
endi
sql alter table mt add column c2 int
sql insert into tb (ts, c2) values (now, 3)
sql select * from tb order by ts desc
if $data02 != 3 then
return -1
endi
## ALTER TABLE AND IMPORT
sql drop database $db
sql create database $db
sql use $db
sql create table mt (ts timestamp, c1 int, c2 nchar(7), c3 int) tags (t1 int)
sql create table tb using mt tags(1)
sleep 100
sql insert into tb values ('2018-11-01 16:30:00.000', 1, 'insert', 1)
sql alter table mt drop column c3
sql insert into tb values ('2018-11-01 16:29:59.000', 1, 'insert')
sql import into tb values ('2018-11-01 16:29:59.000', 1, 'import')
sql select * from tb order by ts desc
if $data01 != 1 then
return -1
endi
if $data02 != insert then
return -1
endi
sql alter table mt add column c3 nchar(4)
sql select * from tb order by ts desc
if $data03 != NULL then
return -1
endi
print ============================>TD-3366 TD-3486
sql insert into td_3366(ts, c3, c1) using mt(t1) tags(911) values('2018-1-1 11:11:11', 'new1', 12);
sql insert into td_3486(ts, c3, c1) using mt(t1) tags(-12) values('2018-1-1 11:11:11', 'new1', 12);
sql insert into ttxu(ts, c3, c1) using mt(t1) tags('-121') values('2018-1-1 11:11:11', 'new1', 12);
sql insert into tb(ts, c1, c3) using mt(t1) tags(123) values('2018-11-01 16:29:58.000', 2, 'port')
sql insert into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3)
sql import into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3)
sql import into tb values ('2018-11-01 16:39:58.000', 2, 'import', 3)
sql select * from tb order by ts desc
if $rows != 4 then
return -1
endi
if $data03 != 3 then
return -1
endi
##### ILLEGAL OPERATIONS
# try dropping columns that are defined in metric
sql_error alter table tb drop column c1;
# try dropping primary key
sql_error alter table mt drop column ts;
# try modifying two columns in a single statement
sql_error alter table mt add column c5 nchar(3) c6 nchar(4)
# duplicate columns
sql_error alter table mt add column c1 int
# drop non-existing columns
sql_error alter table mt drop column c9
#sql drop database $db
#sql show databases
#if $rows != 0 then
# return -1
#endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -102,7 +102,7 @@ print create_db.sim case5: db_meta_data test
# cfg params
$replica = 1 # max=3
$days = 10
$keep = 365
$keep = 365,365,365
$rows_db = 1000
$cache = 16 # 16MB
$ablocks = 100
@ -150,6 +150,73 @@ sql_error create database $db day 3651
# keep [1, infinity]
sql_error create database $db keep 0
sql_error create database $db keep 0,0,0
sql_error create database $db keep 3,3,3
sql_error create database $db keep 11.0
sql_error create database $db keep 11.0,11.0,11.0
sql_error create database $db keep "11","11","11"
sql_error create database $db keep "11"
sql_error create database $db keep 13,12,11
sql_error create database $db keep 11,12,11
sql_error create database $db keep 12,11,12
sql_error create database $db keep 8
sql_error create database $db keep 12,11
sql_error create database $db keep 365001,365001,365001
sql create database dbk0 keep 19
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 19,19,19 then
return -1
endi
sql drop database dbk0
sql create database dbka keep 19,20
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 19,20,20 then
return -1
endi
sql drop database dbka
sql create database dbk1 keep 11,11,11
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11,11,11 then
return -1
endi
sql drop database dbk1
sql create database dbk2 keep 11,12,13
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11,12,13 then
return -1
endi
sql drop database dbk2
sql create database dbk3 keep 11,11,13
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11,11,13 then
return -1
endi
sql drop database dbk3
sql create database dbk4 keep 11,13,13
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11,13,13 then
return -1
endi
sql drop database dbk4
#sql_error create database $db keep 3651
# rows [200, 10000]

View File

@ -0,0 +1,238 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 100
sql connect
print ======================== dnode1 start
$dbPrefix = fi_in_db
$tbPrefix = fi_in_tb
$mtPrefix = fi_in_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print excuting test script create_db.sim
print =============== set up
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql_error createdatabase $db
sql create database $db
sql use $db
sql show databases
if $rows != 1 then
return -1
endi
if $data00 != $db then
return -1
endi
sql drop database $db
# case1: case_insensitivity test
print =========== create_db.sim case1: case insensitivity test
sql_error CREATEDATABASE $db
sql CREATE DATABASE $db
sql use $db
sql show databases
if $rows != 1 then
return -1
endi
if $data00 != $db then
return -1
endi
sql drop database $db
print case_insensitivity test passed
# case2: illegal_db_name test
print =========== create_db.sim case2: illegal_db_name test
$illegal_db1 = 1db
$illegal_db2 = d@b
sql_error create database $illegal_db1
sql_error create database $illegal_db2
print illegal_db_name test passed
# case3: chinese_char_in_db_name test
print ========== create_db.sim case3: chinese_char_in_db_name test
$CN_db1 = 数据库
$CN_db2 = 数据库1
$CN_db3 = db数据库1
sql_error create database $CN_db1
sql_error create database $CN_db2
sql_error create database $CN_db3
#sql show databases
#if $rows != 3 then
# return -1
#endi
#if $data00 != $CN_db1 then
# return -1
#endi
#if $data10 != $CN_db2 then
# return -1
#endi
#if $data20 != $CN_db3 then
# return -1
#endi
#sql drop database $CN_db1
#sql drop database $CN_db2
#sql drop database $CN_db3
print case_chinese_char_in_db_name test passed
# case4: db_already_exists
print create_db.sim case4: db_already_exists
sql create database db0
sql create database db0
sql show databases
if $rows != 1 then
return -1
endi
sql drop database db0
print db_already_exists test passed
# case5: db_meta_data
print create_db.sim case5: db_meta_data test
# cfg params
$replica = 1 # max=3
$days = 10
$keep = 365
$rows_db = 1000
$cache = 16 # 16MB
$ablocks = 100
$tblocks = 32 # max=512, automatically trimmed when exceeding
$ctime = 36000 # 10 hours
$wal = 1 # valid value is 1, 2
$comp = 1 # max=32, automatically trimmed when exceeding
sql create database $db replica $replica days $days keep $keep maxrows $rows_db cache $cache blocks 4 ctime $ctime wal $wal comp $comp
sql show databases
if $rows != 1 then
return -1
endi
if $data00 != $db then
return -1
endi
if $data04 != $replica then
return -1
endi
if $data06 != $days then
return -1
endi
if $data07 != 365 then
return -1
endi
print data08 = $data07
if $data08 != $cache then
print expect $cache, actual:$data08
return -1
endi
if $data09 != 4 then
return -1
endi
sql drop database $db
## param range tests
# replica [1,3]
#sql_error create database $db replica 0
sql_error create database $db replica 4
# day [1, 3650]
sql_error create database $db day 0
sql_error create database $db day 3651
# keep [1, infinity]
sql_error create database $db keep 0
sql_error create database $db keep 0,0,0
sql_error create database $db keep 3,3,3
sql_error create database $db keep 3
sql_error create database $db keep 11.0
sql_error create database $db keep 11.0,11.0,11.0
sql_error create database $db keep "11","11","11"
sql_error create database $db keep "11"
sql_error create database $db keep 13,12,11
sql_error create database $db keep 11,12,11
sql_error create database $db keep 12,11,12
sql_error create database $db keep 11,12,13
sql_error create database $db keep 11,12,13,14
sql_error create database $db keep 11,11
sql_error create database $db keep 365001,365001,365001
sql_error create database $db keep 365001
sql create database dbk1 keep 11
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11 then
return -1
endi
sql drop database dbk1
sql create database dbk2 keep 12
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 12 then
return -1
endi
sql drop database dbk2
sql create database dbk3 keep 11
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 11 then
return -1
endi
sql drop database dbk3
sql create database dbk4 keep 13
sql show databases
if $rows != 1 then
return -1
endi
if $data07 != 13 then
return -1
endi
sql drop database dbk4
#sql_error create database $db keep 3651
# rows [200, 10000]
sql_error create database $db maxrows 199
#sql_error create database $db maxrows 10001
# cache [100, 10485760]
sql_error create database $db cache 0
#sql_error create database $db cache 10485761
# blocks [32, 4096 overwriten by 4096 if exceeds, Note added:2018-10-24]
#sql_error create database $db tblocks 31
#sql_error create database $db tblocks 4097
# ctime [30, 40960]
sql_error create database $db ctime 29
sql_error create database $db ctime 40961
# wal {0, 2}
#sql_error create database $db wal 0
sql_error create database $db wal -1
sql_error create database $db wal 3
# comp {0, 1, 2}
sql_error create database $db comp -1
sql_error create database $db comp 3
sql_error drop database $db
sql show databases
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -124,4 +124,4 @@ if $rows != 10000 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -367,4 +367,4 @@ if $data35 != 5 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -902,4 +902,4 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group
#sql select count(c1) from select_tags_mt0 where c1=99 group by tbname;
#sql select count(*),tbname from select_tags_mt0 group by tbname
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -175,7 +175,7 @@ if $data21 != 2.10000 then
endi
print =====================td-1302 case
sql create database t1 keep 36500;
sql create database t1 keep 36500
sql use t1;
sql create table test(ts timestamp, k int);
sql insert into test values(29999, 1)(70000, 2)(80000, 3)
@ -194,7 +194,7 @@ if $rows != 3 then
endi
print ==============>td-1308
sql create database db keep 36500;
sql create database db keep 36500
sql use db;
sql create table stb (ts timestamp, c1 int, c2 binary(10)) tags(t1 binary(10));
@ -377,4 +377,4 @@ sql_error select * from ttm2 where k<>null
sql_error select * from ttm2 where k like null
sql_error select * from ttm2 where k<null
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -424,6 +424,10 @@ cd ../../../debug; make
./test.sh -f general/parser/stableOp.sim
./test.sh -f general/parser/timestamp.sim
./test.sh -f general/parser/sliding.sim
./test.sh -f general/parser/having.sim
./test.sh -f general/parser/having_child.sim
./test.sh -f general/parser/between_and.sim
./test.sh -f general/parser/last_cache.sim
./test.sh -f unique/big/balance.sim
#======================b7-end===============