diff --git a/.travis.yml b/.travis.yml index 9bc576dcf9..9fefa61f8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ matrix: - python3-pip - python3-setuptools - valgrind + - psmisc before_script: - cd ${TRAVIS_BUILD_DIR} @@ -142,6 +143,7 @@ matrix: - python3-pip - python3-setuptools - lcov + - psmisc before_script: - cd ${TRAVIS_BUILD_DIR} diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 36b1ab5993..56f0b5099d 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -779,6 +779,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { STagData *pTag = (STagData *)pCmd->payload; memset(pTag, 0, sizeof(STagData)); + pCmd->payloadLen = sizeof(STagData); /* * the source super table is moved to the secondary position of the pTableMetaInfo list diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index a5ea6583c1..f9ce16471a 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4823,7 +4823,7 @@ static int32_t setTimePrecision(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBIn static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { pMsg->maxTables = htonl(pCreateDb->maxTablesPerVnode); pMsg->cacheBlockSize = htonl(pCreateDb->cacheBlockSize); - pMsg->numOfBlocks = htonl(pCreateDb->numOfBlocks); + pMsg->totalBlocks = htonl(pCreateDb->numOfBlocks); pMsg->daysPerFile = htonl(pCreateDb->daysPerFile); pMsg->commitTime = htonl(pCreateDb->commitTime); pMsg->minRowsPerFileBlock = htonl(pCreateDb->minRowsPerBlock); diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 324edb422b..ac7bc31c3d 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -141,6 +141,7 @@ int32_t rpcDebugFlag = 135; int32_t uDebugFlag = 131; int32_t debugFlag = 131; int32_t sDebugFlag = 135; +int32_t tsdbDebugFlag = 135; // the maximum number of results for projection query on super table that are returned from // one virtual node, to order according to timestamp @@ -216,7 +217,8 @@ void taosSetAllDebugFlag() { rpcDebugFlag = debugFlag; uDebugFlag = debugFlag; sDebugFlag = debugFlag; - //qDebugFlag = debugFlag; + tsdbDebugFlag = debugFlag; + qDebugFlag = debugFlag; } uPrint("all debug flag are set to %d", debugFlag); } @@ -1131,6 +1133,16 @@ static void doInitGlobalConfig() { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "tsdbDebugFlag"; + cfg.ptr = &tsdbDebugFlag; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT; + cfg.minValue = 0; + cfg.maxValue = 255; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "tscEnableRecordSql"; cfg.ptr = &tsTscEnableRecordSql; cfg.valType = TAOS_CFG_VTYPE_INT32; diff --git a/src/connector/python/linux/python2/taos/cursor.py b/src/connector/python/linux/python2/taos/cursor.py index f18920c553..3d738ab22d 100644 --- a/src/connector/python/linux/python2/taos/cursor.py +++ b/src/connector/python/linux/python2/taos/cursor.py @@ -1,5 +1,7 @@ from .cinterface import CTaosInterface from .error import * +from .constants import FieldType + class TDengineCursor(object): """Database cursor which is used to manage the context of a fetch operation. @@ -19,7 +21,7 @@ class TDengineCursor(object): if the cursor has not had an operation invoked via the .execute*() method yet. .rowcount:This read-only attribute specifies the number of rows that the last - .execute*() produced (for DQL statements like SELECT) or affected + .execute*() produced (for DQL statements like SELECT) or affected """ def __init__(self, connection=None): @@ -44,13 +46,14 @@ class TDengineCursor(object): raise OperationalError("Invalid use of fetch iterator") if self._block_rows <= self._block_iter: - block, self._block_rows = CTaosInterface.fetchBlock(self._result, self._fields) + block, self._block_rows = CTaosInterface.fetchBlock( + self._result, self._fields) if self._block_rows == 0: raise StopIteration self._block = list(map(tuple, zip(*block))) self._block_iter = 0 - data = self._block[self._block_iter] + data = self._block[self._block_iter] self._block_iter += 1 return data @@ -85,7 +88,7 @@ class TDengineCursor(object): """ if self._connection is None: return False - + self._connection.clear_result_set() self._reset_result() self._connection = None @@ -101,24 +104,28 @@ class TDengineCursor(object): if not self._connection: # TODO : change the exception raised here raise ProgrammingError("Cursor is not connected") - + self._connection.clear_result_set() self._reset_result() stmt = operation if params is not None: pass - + res = CTaosInterface.query(self._connection._conn, stmt) if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: - self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) + self._affected_rows += CTaosInterface.affectedRows( + self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn) else: - self._result, self._fields = CTaosInterface.useResult(self._connection._conn) + self._result, self._fields = CTaosInterface.useResult( + self._connection._conn) return self._handle_result() else: - raise ProgrammingError(CTaosInterface.errStr(self._connection._conn)) + raise ProgrammingError( + CTaosInterface.errStr( + self._connection._conn)) def executemany(self, operation, seq_of_parameters): """Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. @@ -130,6 +137,37 @@ class TDengineCursor(object): """ pass + def istype(self, col, dataType): + if (dataType.upper() == "BOOL"): + if (self._description[col][1] == FieldType.C_BOOL): + return True + if (dataType.upper() == "TINYINT"): + if (self._description[col][1] == FieldType.C_TINYINT): + return True + if (dataType.upper() == "INT"): + if (self._description[col][1] == FieldType.C_INT): + return True + if (dataType.upper() == "BIGINT"): + if (self._description[col][1] == FieldType.C_INT): + return True + if (dataType.upper() == "FLOAT"): + if (self._description[col][1] == FieldType.C_FLOAT): + return True + if (dataType.upper() == "DOUBLE"): + if (self._description[col][1] == FieldType.C_DOUBLE): + return True + if (dataType.upper() == "BINARY"): + if (self._description[col][1] == FieldType.C_BINARY): + return True + if (dataType.upper() == "TIMESTAMP"): + if (self._description[col][1] == FieldType.C_TIMESTAMP): + return True + if (dataType.upper() == "NCHAR"): + if (self._description[col][1] == FieldType.C_NCHAR): + return True + + return False + def fetchmany(self): pass @@ -138,22 +176,22 @@ class TDengineCursor(object): """ if self._result is None or self._fields is None: raise OperationalError("Invalid use of fetchall") - + buffer = [[] for i in range(len(self._fields))] self._rowcount = 0 while True: - block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) - if num_of_fields == 0: break + block, num_of_fields = CTaosInterface.fetchBlock( + self._result, self._fields) + if num_of_fields == 0: + break self._rowcount += num_of_fields for i in range(len(self._fields)): buffer[i].extend(block[i]) self._connection.clear_result_set() - + return list(map(tuple, zip(*buffer))) - - def nextset(self): """ """ @@ -176,12 +214,13 @@ class TDengineCursor(object): self._block_rows = -1 self._block_iter = 0 self._affected_rows = 0 - + def _handle_result(self): """Handle the return result from query. """ self._description = [] for ele in self._fields: - self._description.append((ele['name'], ele['type'], None, None, None, None, False)) - + self._description.append( + (ele['name'], ele['type'], None, None, None, None, False)) + return self._result diff --git a/src/connector/python/linux/python3/taos/cursor.py b/src/connector/python/linux/python3/taos/cursor.py index dfbb0f2064..ea7e9e5404 100644 --- a/src/connector/python/linux/python3/taos/cursor.py +++ b/src/connector/python/linux/python3/taos/cursor.py @@ -1,8 +1,10 @@ from .cinterface import CTaosInterface from .error import * +from .constants import FieldType # querySeqNum = 0 + class TDengineCursor(object): """Database cursor which is used to manage the context of a fetch operation. @@ -21,7 +23,7 @@ class TDengineCursor(object): if the cursor has not had an operation invoked via the .execute*() method yet. .rowcount:This read-only attribute specifies the number of rows that the last - .execute*() produced (for DQL statements like SELECT) or affected + .execute*() produced (for DQL statements like SELECT) or affected """ def __init__(self, connection=None): @@ -46,13 +48,14 @@ class TDengineCursor(object): raise OperationalError("Invalid use of fetch iterator") if self._block_rows <= self._block_iter: - block, self._block_rows = CTaosInterface.fetchBlock(self._result, self._fields) + block, self._block_rows = CTaosInterface.fetchBlock( + self._result, self._fields) if self._block_rows == 0: raise StopIteration self._block = list(map(tuple, zip(*block))) self._block_iter = 0 - data = self._block[self._block_iter] + data = self._block[self._block_iter] self._block_iter += 1 return data @@ -87,7 +90,7 @@ class TDengineCursor(object): """ if self._connection is None: return False - + self._connection.clear_result_set() self._reset_result() self._connection = None @@ -103,14 +106,13 @@ class TDengineCursor(object): if not self._connection: # TODO : change the exception raised here raise ProgrammingError("Cursor is not connected") - + self._connection.clear_result_set() self._reset_result() stmt = operation if params is not None: pass - # global querySeqNum # querySeqNum += 1 @@ -121,13 +123,17 @@ class TDengineCursor(object): if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: - self._affected_rows += CTaosInterface.affectedRows(self._connection._conn) + self._affected_rows += CTaosInterface.affectedRows( + self._connection._conn) return CTaosInterface.affectedRows(self._connection._conn) else: - self._result, self._fields = CTaosInterface.useResult(self._connection._conn) + self._result, self._fields = CTaosInterface.useResult( + self._connection._conn) return self._handle_result() else: - raise ProgrammingError(CTaosInterface.errStr(self._connection._conn)) + raise ProgrammingError( + CTaosInterface.errStr( + self._connection._conn)) def executemany(self, operation, seq_of_parameters): """Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. @@ -142,27 +148,58 @@ class TDengineCursor(object): def fetchmany(self): pass + def istype(self, col, dataType): + if (dataType.upper() == "BOOL"): + if (self._description[col][1] == FieldType.C_BOOL): + return True + if (dataType.upper() == "TINYINT"): + if (self._description[col][1] == FieldType.C_TINYINT): + return True + if (dataType.upper() == "INT"): + if (self._description[col][1] == FieldType.C_INT): + return True + if (dataType.upper() == "BIGINT"): + if (self._description[col][1] == FieldType.C_INT): + return True + if (dataType.upper() == "FLOAT"): + if (self._description[col][1] == FieldType.C_FLOAT): + return True + if (dataType.upper() == "DOUBLE"): + if (self._description[col][1] == FieldType.C_DOUBLE): + return True + if (dataType.upper() == "BINARY"): + if (self._description[col][1] == FieldType.C_BINARY): + return True + if (dataType.upper() == "TIMESTAMP"): + if (self._description[col][1] == FieldType.C_TIMESTAMP): + return True + if (dataType.upper() == "NCHAR"): + if (self._description[col][1] == FieldType.C_NCHAR): + return True + + return False + def fetchall(self): """Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation. """ if self._result is None or self._fields is None: raise OperationalError("Invalid use of fetchall") - + buffer = [[] for i in range(len(self._fields))] self._rowcount = 0 while True: - block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) - if num_of_fields == 0: break + block, num_of_fields = CTaosInterface.fetchBlock( + self._result, self._fields) + if num_of_fields == 0: + break self._rowcount += num_of_fields for i in range(len(self._fields)): buffer[i].extend(block[i]) self._connection.clear_result_set() - + return list(map(tuple, zip(*buffer))) - - def nextset(self): """ """ @@ -185,12 +222,13 @@ class TDengineCursor(object): self._block_rows = -1 self._block_iter = 0 self._affected_rows = 0 - + def _handle_result(self): """Handle the return result from query. """ self._description = [] for ele in self._fields: - self._description.append((ele['name'], ele['type'], None, None, None, None, False)) - + self._description.append( + (ele['name'], ele['type'], None, None, None, None, False)) + return self._result diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 7fea8bdc75..aeccd92d9a 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -252,12 +252,12 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_MULTI_METERMETA_MAX_NUM 100000 // maximum batch size allowed to load metermeta #define TSDB_MIN_CACHE_BLOCK_SIZE 1 -#define TSDB_MAX_CACHE_BLOCK_SIZE 10240 // 10GB for each vnode +#define TSDB_MAX_CACHE_BLOCK_SIZE 128 // 128MB for each vnode #define TSDB_DEFAULT_CACHE_BLOCK_SIZE 16 #define TSDB_MIN_TOTAL_BLOCKS 2 #define TSDB_MAX_TOTAL_BLOCKS 10000 -#define TSDB_DEFAULT_TOTAL_BLOCKS 2 +#define TSDB_DEFAULT_TOTAL_BLOCKS 4 #define TSDB_MIN_TABLES 4 #define TSDB_MAX_TABLES 200000 diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 85046bbd29..e09e0cef78 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -485,20 +485,20 @@ typedef struct { typedef struct { char acct[TSDB_USER_LEN + 1]; char db[TSDB_DB_NAME_LEN + 1]; - int32_t maxTables; int32_t cacheBlockSize; //MB - int32_t numOfBlocks; + int32_t totalBlocks; + int32_t maxTables; int32_t daysPerFile; + int32_t daysToKeep; int32_t daysToKeep1; int32_t daysToKeep2; - int32_t daysToKeep; - int32_t commitTime; int32_t minRowsPerFileBlock; int32_t maxRowsPerFileBlock; + int32_t commitTime; + uint8_t precision; // time resolution int8_t compression; int8_t walLevel; int8_t replications; - uint8_t precision; // time resolution int8_t ignoreExist; } SCMCreateDbMsg, SCMAlterDbMsg; @@ -563,9 +563,9 @@ typedef struct { typedef struct { uint32_t vgId; int32_t cfgVersion; + int32_t maxTables; int32_t cacheBlockSize; int32_t totalBlocks; - int32_t maxTables; int32_t daysPerFile; int32_t daysToKeep; int32_t daysToKeep1; diff --git a/src/inc/tsync.h b/src/inc/tsync.h index 137b97e287..05d1d93cf6 100644 --- a/src/inc/tsync.h +++ b/src/inc/tsync.h @@ -95,7 +95,7 @@ typedef void* tsync_h; tsync_h syncStart(const SSyncInfo *); void syncStop(tsync_h shandle); int syncReconfig(tsync_h shandle, const SSyncCfg *); -int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle); +int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype); void syncConfirmForward(tsync_h shandle, uint64_t version, int32_t code); void syncRecover(tsync_h shandle); // recover from other nodes: int syncGetNodesRole(tsync_h shandle, SNodesRole *); diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 3f43d4bf89..3ea2e3aa87 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -187,11 +187,13 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { if (pCfg->cacheBlockSize < TSDB_MIN_CACHE_BLOCK_SIZE || pCfg->cacheBlockSize > TSDB_MAX_CACHE_BLOCK_SIZE) { mError("invalid db option cacheBlockSize:%d valid range: [%d, %d]", pCfg->cacheBlockSize, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE); + return TSDB_CODE_INVALID_OPTION; } if (pCfg->totalBlocks < TSDB_MIN_TOTAL_BLOCKS || pCfg->totalBlocks > TSDB_MAX_TOTAL_BLOCKS) { mError("invalid db option totalBlocks:%d valid range: [%d, %d]", pCfg->totalBlocks, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); + return TSDB_CODE_INVALID_OPTION; } if (pCfg->maxTables < TSDB_MIN_TABLES || pCfg->maxTables > TSDB_MAX_TABLES) { @@ -206,18 +208,22 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { } if (pCfg->daysToKeep < TSDB_MIN_KEEP || pCfg->daysToKeep > TSDB_MAX_KEEP) { - mError("invalid db option daysToKeep:%d", pCfg->daysToKeep); + mError("invalid db option daysToKeep:%d valid range: [%d, %d]", pCfg->daysToKeep, TSDB_MIN_KEEP, TSDB_MAX_KEEP); return TSDB_CODE_INVALID_OPTION; } if (pCfg->daysToKeep < pCfg->daysPerFile) { - mError("invalid db option daysToKeep:%d daysPerFile:%d", pCfg->daysToKeep, pCfg->daysPerFile); + mError("invalid db option daysToKeep:%d should larger than daysPerFile:%d", pCfg->daysToKeep, pCfg->daysPerFile); return TSDB_CODE_INVALID_OPTION; } - if (pCfg->minRowsPerFileBlock < TSDB_MIN_MIN_ROW_FBLOCK || pCfg->minRowsPerFileBlock > TSDB_MAX_MIN_ROW_FBLOCK) { - mError("invalid db option minRowsPerFileBlock:%d valid range: [%d, %d]", pCfg->minRowsPerFileBlock, - TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); + if (pCfg->daysToKeep2 < TSDB_MIN_KEEP || pCfg->daysToKeep2 > pCfg->daysToKeep) { + mError("invalid db option daysToKeep2:%d valid range: [%d, %d]", pCfg->daysToKeep, TSDB_MIN_KEEP, pCfg->daysToKeep); + return TSDB_CODE_INVALID_OPTION; + } + + 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); return TSDB_CODE_INVALID_OPTION; } @@ -227,9 +233,15 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { return TSDB_CODE_INVALID_OPTION; } + if (pCfg->minRowsPerFileBlock < TSDB_MIN_MIN_ROW_FBLOCK || pCfg->minRowsPerFileBlock > TSDB_MAX_MIN_ROW_FBLOCK) { + mError("invalid db option minRowsPerFileBlock:%d valid range: [%d, %d]", pCfg->minRowsPerFileBlock, + TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); + return TSDB_CODE_INVALID_OPTION; + } + if (pCfg->minRowsPerFileBlock > pCfg->maxRowsPerFileBlock) { - mError("invalid db option minRowsPerFileBlock:%d maxRowsPerFileBlock:%d", pCfg->minRowsPerFileBlock, - pCfg->maxRowsPerFileBlock); + mError("invalid db option minRowsPerFileBlock:%d should smaller than maxRowsPerFileBlock:%d", + pCfg->minRowsPerFileBlock, pCfg->maxRowsPerFileBlock); return TSDB_CODE_INVALID_OPTION; } @@ -252,7 +264,7 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { } if (pCfg->walLevel < TSDB_MIN_WAL_LEVEL || pCfg->walLevel > TSDB_MAX_WAL_LEVEL) { - mError("invalid db option walLevel:%d, only 0-2 allowed", pCfg->walLevel); + mError("invalid db option walLevel:%d, valid range: [%d, %d]", pCfg->walLevel, TSDB_MIN_WAL_LEVEL, TSDB_MAX_WAL_LEVEL); return TSDB_CODE_INVALID_OPTION; } @@ -262,6 +274,11 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { return TSDB_CODE_INVALID_OPTION; } + if (pCfg->replications > 1 && pCfg->walLevel <= TSDB_MIN_WAL_LEVEL) { + mError("invalid db option walLevel:%d must > 0, while replica:%d > 1", pCfg->walLevel, pCfg->replications); + return TSDB_CODE_INVALID_OPTION; + } + #ifndef _SYNC if (pCfg->replications != 1) { mError("invalid db option replications:%d can only be 1 in this version", pCfg->replications); @@ -314,13 +331,13 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) { pDb->createdTime = taosGetTimestampMs(); pDb->cfg = (SDbCfg) { .cacheBlockSize = pCreate->cacheBlockSize, - .totalBlocks = pCreate->numOfBlocks, + .totalBlocks = pCreate->totalBlocks, .maxTables = pCreate->maxTables, .daysPerFile = pCreate->daysPerFile, .daysToKeep = pCreate->daysToKeep, .daysToKeep1 = pCreate->daysToKeep1, .daysToKeep2 = pCreate->daysToKeep2, - .minRowsPerFileBlock = pCreate->maxRowsPerFileBlock, + .minRowsPerFileBlock = pCreate->minRowsPerFileBlock, .maxRowsPerFileBlock = pCreate->maxRowsPerFileBlock, .commitTime = pCreate->commitTime, .precision = pCreate->precision, @@ -735,7 +752,7 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) { pCreate->maxTables = htonl(pCreate->maxTables); pCreate->cacheBlockSize = htonl(pCreate->cacheBlockSize); - pCreate->numOfBlocks = htonl(pCreate->numOfBlocks); + pCreate->totalBlocks = htonl(pCreate->totalBlocks); pCreate->daysPerFile = htonl(pCreate->daysPerFile); pCreate->daysToKeep = htonl(pCreate->daysToKeep); pCreate->daysToKeep1 = htonl(pCreate->daysToKeep1); @@ -763,37 +780,47 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) { static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { SDbCfg newCfg = pDb->cfg; - int32_t cacheBlockSize = htonl(pAlter->daysToKeep); - int32_t totalBlocks = htonl(pAlter->numOfBlocks); - int32_t maxTables = htonl(pAlter->maxTables); - int32_t daysToKeep = htonl(pAlter->daysToKeep); - int32_t daysToKeep1 = htonl(pAlter->daysToKeep1); - int32_t daysToKeep2 = htonl(pAlter->daysToKeep2); - int8_t compression = pAlter->compression; - int8_t replications = pAlter->replications; - int8_t walLevel = pAlter->walLevel; + int32_t maxTables = htonl(pAlter->maxTables); + 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 daysToKeep1 = htonl(pAlter->daysToKeep1); + int32_t daysToKeep2 = htonl(pAlter->daysToKeep2); + int32_t minRows = htonl(pAlter->minRowsPerFileBlock); + int32_t maxRows = htonl(pAlter->maxRowsPerFileBlock); + int32_t commitTime = htonl(pAlter->commitTime); + int8_t compression = pAlter->compression; + int8_t walLevel = pAlter->walLevel; + int8_t replications = pAlter->replications; + int8_t precision = pAlter->precision; terrno = TSDB_CODE_SUCCESS; if (cacheBlockSize > 0 && cacheBlockSize != pDb->cfg.cacheBlockSize) { - mTrace("db:%s, cache:%d change to %d", pDb->name, pDb->cfg.cacheBlockSize, cacheBlockSize); - newCfg.cacheBlockSize = cacheBlockSize; + mError("db:%s, can't alter cache option", pDb->name); + terrno = TSDB_CODE_INVALID_OPTION; } if (totalBlocks > 0 && totalBlocks != pDb->cfg.totalBlocks) { - mTrace("db:%s, blocks:%d change to %d", pDb->name, pDb->cfg.totalBlocks, totalBlocks); + mPrint("db:%s, blocks:%d change to %d", pDb->name, pDb->cfg.totalBlocks, totalBlocks); newCfg.totalBlocks = totalBlocks; } - if (maxTables > 0 && maxTables != pDb->cfg.maxTables) { - mTrace("db:%s, tables:%d change to %d", pDb->name, pDb->cfg.maxTables, maxTables); + if (maxTables > 0) { + mPrint("db:%s, maxTables:%d change to %d", pDb->name, pDb->cfg.maxTables, maxTables); newCfg.maxTables = maxTables; if (newCfg.maxTables < pDb->cfg.maxTables) { - mTrace("db:%s, tables:%d should larger than origin:%d", pDb->name, newCfg.maxTables, pDb->cfg.maxTables); + mError("db:%s, tables:%d should larger than origin:%d", pDb->name, newCfg.maxTables, pDb->cfg.maxTables); terrno = TSDB_CODE_INVALID_OPTION; } } + if (daysPerFile > 0 && daysPerFile != pDb->cfg.daysPerFile) { + mError("db:%s, can't alter days option", pDb->name); + terrno = TSDB_CODE_INVALID_OPTION; + } + if (daysToKeep > 0 && daysToKeep != pDb->cfg.daysToKeep) { mTrace("db:%s, daysToKeep:%d change to %d", pDb->name, pDb->cfg.daysToKeep, daysToKeep); newCfg.daysToKeep = daysToKeep; @@ -809,15 +836,45 @@ static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { newCfg.daysToKeep2 = daysToKeep2; } + if (minRows > 0 && minRows != pDb->cfg.minRowsPerFileBlock) { + mError("db:%s, can't alter minRows option", pDb->name); + terrno = TSDB_CODE_INVALID_OPTION; + } + + if (maxRows > 0 && maxRows != pDb->cfg.maxRowsPerFileBlock) { + mError("db:%s, can't alter maxRows option", pDb->name); + terrno = TSDB_CODE_INVALID_OPTION; + } + + if (commitTime > 0 && commitTime != pDb->cfg.commitTime) { + mError("db:%s, can't alter commitTime option", pDb->name); + terrno = TSDB_CODE_INVALID_OPTION; + } + + if (precision > 0 && precision != pDb->cfg.precision) { + mError("db:%s, can't alter precision option", pDb->name); + terrno = TSDB_CODE_INVALID_OPTION; + } + if (compression >= 0 && compression != pDb->cfg.compression) { mTrace("db:%s, compression:%d change to %d", pDb->name, pDb->cfg.compression, compression); newCfg.compression = compression; } + if (walLevel > 0 && walLevel != pDb->cfg.walLevel) { + mError("db:%s, can't alter walLevel option", pDb->name); + terrno = TSDB_CODE_INVALID_OPTION; + } + if (replications > 0 && replications != pDb->cfg.replications) { mTrace("db:%s, replications:%d change to %d", pDb->name, pDb->cfg.replications, replications); newCfg.replications = replications; + if (replications > 1 && pDb->cfg.walLevel <= TSDB_MIN_WAL_LEVEL) { + mError("db:%s, walLevel:%d must > 0, while replica:%d > 1", pDb->name, pDb->cfg.walLevel, replications); + terrno = TSDB_CODE_INVALID_OPTION; + } + if (replications > mgmtGetDnodesNum()) { mError("db:%s, no enough dnode to change replica:%d", pDb->name, replications); terrno = TSDB_CODE_NO_ENOUGH_DNODES; @@ -829,11 +886,6 @@ static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { } } - if (walLevel >= 0 && (walLevel < TSDB_MIN_WAL_LEVEL || walLevel > TSDB_MAX_WAL_LEVEL)) { - mError("db:%s, wal level %d should be between 0-2, origin:%d", pDb->name, walLevel, pDb->cfg.walLevel); - terrno = TSDB_CODE_INVALID_OPTION; - } - return newCfg; } diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index 087c84effd..47fb71680a 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -227,7 +227,7 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) { static int32_t sdbForwardToPeer(SWalHead *pHead) { if (tsSdbObj.sync == NULL) return TSDB_CODE_SUCCESS; - int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version); + int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version, TAOS_QTYPE_RPC); if (code > 0) { sdbTrace("forward request is sent, version:%" PRIu64 ", code:%d", pHead->version, code); sem_wait(&tsSdbObj.sem); diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 3043306978..7b010a536a 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -269,7 +269,6 @@ static int32_t mgmtChildTableActionRestored() { SChildTableObj *pTable = NULL; while (1) { - mgmtDecTableRef(pTable); pIter = mgmtGetNextChildTable(pIter, &pTable); if (pTable == NULL) break; @@ -278,6 +277,7 @@ static int32_t mgmtChildTableActionRestored() { mError("ctable:%s, failed to get db, discard it", pTable->info.tableId); SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); + mgmtDecTableRef(pTable); continue; } mgmtDecDbRef(pDb); @@ -288,6 +288,7 @@ static int32_t mgmtChildTableActionRestored() { pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); + mgmtDecTableRef(pTable); continue; } mgmtDecVgroupRef(pVgroup); @@ -298,6 +299,7 @@ static int32_t mgmtChildTableActionRestored() { pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); + mgmtDecTableRef(pTable); continue; } @@ -306,6 +308,7 @@ static int32_t mgmtChildTableActionRestored() { pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); + mgmtDecTableRef(pTable); continue; } @@ -316,10 +319,13 @@ static int32_t mgmtChildTableActionRestored() { pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); + mgmtDecTableRef(pTable); continue; } mgmtDecTableRef(pSuperTable); } + + mgmtDecTableRef(pTable); } sdbFreeIter(pIter); @@ -1136,19 +1142,20 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v char stableName[TSDB_TABLE_NAME_LEN] = {0}; while (numOfRows < rows) { - mgmtDecTableRef(pTable); pShow->pIter = mgmtGetNextSuperTable(pShow->pIter, &pTable); if (pTable == NULL) break; if (strncmp(pTable->info.tableId, prefix, prefixLen)) { + mgmtDecTableRef(pTable); continue; } memset(stableName, 0, tListLen(stableName)); mgmtExtractTableName(pTable->info.tableId, stableName); - if (pShow->payloadLen > 0 && - patternMatch(pShow->payload, stableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) + if (pShow->payloadLen > 0 && patternMatch(pShow->payload, stableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) { + mgmtDecTableRef(pTable); continue; + } cols = 0; @@ -1178,6 +1185,7 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v cols++; numOfRows++; + mgmtDecTableRef(pTable); } pShow->numOfReads += numOfRows; @@ -1252,7 +1260,7 @@ static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) { pMeta->contLen = htons(pMeta->contLen); rpcSendResponse(&rpcRsp); - mTrace("stable:%%s, uid:%" PRIu64 " table meta is retrieved", pTable->info.tableId, pTable->uid); + mTrace("stable:%s, uid:%" PRIu64 " table meta is retrieved", pTable->info.tableId, pTable->uid); } static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { @@ -1475,7 +1483,7 @@ static SChildTableObj* mgmtDoCreateChildTable(SCMCreateTableMsg *pCreate, SVgObj return NULL; } - mTrace("table:%s, create table in vgroup, id:%d, uid:%" PRIu64 , pTable->info.tableId, pTable->sid, pTable->uid); + mTrace("table:%s, create table in vgroup:%d, id:%d, uid:%" PRIu64 , pTable->info.tableId, pVgroup->vgId, pTable->sid, pTable->uid); return pTable; } @@ -1759,7 +1767,7 @@ static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) { newMsg->msgType = TSDB_MSG_TYPE_CM_CREATE_TABLE; newMsg->pCont = pCreateMsg; - mTrace("table:%s, start to create on demand", pInfo->tableId); + mTrace("table:%s, start to create on demand, stable:%s", pInfo->tableId, pInfo->tags); mgmtAddToShellQueue(newMsg); } @@ -2106,12 +2114,12 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, int32_t prefixLen = strlen(prefix); while (numOfRows < rows) { - mgmtDecTableRef(pTable); pShow->pIter = mgmtGetNextChildTable(pShow->pIter, &pTable); if (pTable == NULL) break; // not belong to current db if (strncmp(pTable->info.tableId, prefix, prefixLen)) { + mgmtDecTableRef(pTable); continue; } @@ -2120,8 +2128,8 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, // pattern compare for table name mgmtExtractTableName(pTable->info.tableId, tableName); - if (pShow->payloadLen > 0 && - patternMatch(pShow->payload, tableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) { + if (pShow->payloadLen > 0 && patternMatch(pShow->payload, tableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) { + mgmtDecTableRef(pTable); continue; } @@ -2156,6 +2164,7 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, cols++; numOfRows++; + mgmtDecTableRef(pTable); } pShow->numOfReads += numOfRows; diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 445e542387..dcbfbcf9ac 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -989,6 +989,7 @@ static void rpcSendQuickRsp(SRpcConn *pConn, int32_t code) { pHead->sourceId = pConn->ownId; pHead->destId = pConn->peerId; pHead->linkUid = pConn->linkUid; + pHead->ahandle = (uint64_t)pConn->ahandle; memcpy(pHead->user, pConn->user, tListLen(pHead->user)); pHead->code = htonl(code); @@ -1011,6 +1012,7 @@ static void rpcSendReqHead(SRpcConn *pConn) { pHead->sourceId = pConn->ownId; pHead->destId = pConn->peerId; pHead->linkUid = pConn->linkUid; + pHead->ahandle = (uint64_t)pConn->ahandle; memcpy(pHead->user, pConn->user, tListLen(pHead->user)); pHead->code = 1; diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 36cb937d33..cac5279b76 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -9,8 +9,6 @@ #include "ttime.h" #include -int tsdbDebugFlag = 135; - #define TSDB_DEFAULT_PRECISION TSDB_PRECISION_MILLI // default precision #define IS_VALID_PRECISION(precision) (((precision) >= TSDB_PRECISION_MILLI) && ((precision) <= TSDB_PRECISION_NANO)) #define TSDB_DEFAULT_COMPRESSION TWO_STAGE_COMP diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index 52f70bdf5e..989273e051 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -416,12 +416,12 @@ void getTmpfilePath(const char *fileNamePrefix, char *dstPath) { #else char *tmpDir = "/tmp/"; #endif - + int64_t ts = taosGetTimestampUs(); strcpy(tmpPath, tmpDir); strcat(tmpPath, tdengineTmpFileNamePrefix); strcat(tmpPath, fileNamePrefix); - strcat(tmpPath, "-%llu-%u"); - snprintf(dstPath, PATH_MAX, tmpPath, taosGetPthreadId(), atomic_add_fetch_32(&tmpFileSerialNum, 1)); + strcat(tmpPath, "-%d-%"PRIu64"-%u-%"PRIu64); + snprintf(dstPath, PATH_MAX, tmpPath, getpid(), taosGetPthreadId(), atomic_add_fetch_32(&tmpFileSerialNum, 1), ts); } int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) { diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 6dabc98ae8..4514d80a54 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -46,7 +46,7 @@ static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT; #ifndef _SYNC tsync_h syncStart(const SSyncInfo *info) { return NULL; } -int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle) { return 0; } +int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype) { return 0; } void syncStop(tsync_h shandle) {} int syncReconfig(tsync_h shandle, const SSyncCfg * cfg) { return 0; } int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; } diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 635c466978..9c415d6af7 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -72,10 +72,9 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { code = walWrite(pVnode->wal, pHead); if (code < 0) return code; - // forward to peers if data is from RPC or CQ + // forward to peers, even it is WAL/FWD, it shall be called to update version in sync int32_t syncCode = 0; - if (qtype == TAOS_QTYPE_RPC || qtype == TAOS_QTYPE_CQ) - syncCode = syncForwardToPeer(pVnode->sync, pHead, item); + syncCode = syncForwardToPeer(pVnode->sync, pHead, item, qtype); if (syncCode < 0) return syncCode; // write data locally diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index efd9f7ce52..ab5db30051 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -22,6 +22,32 @@ python3 ./test.py $1 -f table/tablename-boundary.py # tag python3 ./test.py $1 -f tag_lite/filter.py python3 ./test.py $1 -f tag_lite/create-tags-boundary.py +python3 ./test.py $1 -f tag_lite/3.py +python3 ./test.py $1 -f tag_lite/4.py +python3 ./test.py $1 -f tag_lite/5.py +python3 ./test.py $1 -f tag_lite/6.py +python3 ./test.py $1 -f tag_lite/add.py +python3 ./test.py $1 -f tag_lite/bigint.py +python3 ./test.py $1 -f tag_lite/binary_binary.py +python3 ./test.py $1 -f tag_lite/binary.py +python3 ./test.py $1 -f tag_lite/bool_binary.py +python3 ./test.py $1 -f tag_lite/bool_int.py +python3 ./test.py $1 -f tag_lite/bool.py +python3 ./test.py $1 -f tag_lite/change.py +python3 ./test.py $1 -f tag_lite/column.py +python3 ./test.py $1 -f tag_lite/commit.py +python3 ./test.py $1 -f tag_lite/create.py +python3 ./test.py $1 -f tag_lite/datatype.py +python3 ./test.py $1 -f tag_lite/datatype-without-alter.py +python3 ./test.py $1 -f tag_lite/delete.py +python3 ./test.py $1 -f tag_lite/double.py +python3 ./test.py $1 -f tag_lite/float.py +python3 ./test.py $1 -f tag_lite/int_binary.py +python3 ./test.py $1 -f tag_lite/int_float.py +python3 ./test.py $1 -f tag_lite/int.py +python3 ./test.py $1 -f tag_lite/set.py +python3 ./test.py $1 -f tag_lite/smallint.py +python3 ./test.py $1 -f tag_lite/tinyint.py python3 ./test.py $1 -f dbmgmt/database-name-boundary.py diff --git a/tests/pytest/import_merge/importBlock1H.py b/tests/pytest/import_merge/importBlock1H.py index a1ba905b17..aef29444d6 100644 --- a/tests/pytest/import_merge/importBlock1H.py +++ b/tests/pytest/import_merge/importBlock1H.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock1HO.py b/tests/pytest/import_merge/importBlock1HO.py index 73aec07a90..ad4bcf1288 100644 --- a/tests/pytest/import_merge/importBlock1HO.py +++ b/tests/pytest/import_merge/importBlock1HO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock1HPO.py b/tests/pytest/import_merge/importBlock1HPO.py index ad224e5c65..6aabc035ec 100644 --- a/tests/pytest/import_merge/importBlock1HPO.py +++ b/tests/pytest/import_merge/importBlock1HPO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock1S.py b/tests/pytest/import_merge/importBlock1S.py index 37c2ad6631..4b2adfb961 100644 --- a/tests/pytest/import_merge/importBlock1S.py +++ b/tests/pytest/import_merge/importBlock1S.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock1Sub.py b/tests/pytest/import_merge/importBlock1Sub.py index 5228563651..343b87c757 100644 --- a/tests/pytest/import_merge/importBlock1Sub.py +++ b/tests/pytest/import_merge/importBlock1Sub.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock1T.py b/tests/pytest/import_merge/importBlock1T.py index 75f41b98cf..40f4bbfdec 100644 --- a/tests/pytest/import_merge/importBlock1T.py +++ b/tests/pytest/import_merge/importBlock1T.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock1TO.py b/tests/pytest/import_merge/importBlock1TO.py index b43428da27..db8b036d6f 100644 --- a/tests/pytest/import_merge/importBlock1TO.py +++ b/tests/pytest/import_merge/importBlock1TO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock1TPO.py b/tests/pytest/import_merge/importBlock1TPO.py index 913ca1cc02..f2361712e7 100644 --- a/tests/pytest/import_merge/importBlock1TPO.py +++ b/tests/pytest/import_merge/importBlock1TPO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2H.py b/tests/pytest/import_merge/importBlock2H.py index bacd88cbe7..62552980bd 100644 --- a/tests/pytest/import_merge/importBlock2H.py +++ b/tests/pytest/import_merge/importBlock2H.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2HO.py b/tests/pytest/import_merge/importBlock2HO.py index 01c0f622b6..0f53210f4a 100644 --- a/tests/pytest/import_merge/importBlock2HO.py +++ b/tests/pytest/import_merge/importBlock2HO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2HPO.py b/tests/pytest/import_merge/importBlock2HPO.py index ee8d580dfe..3b7ffbbe44 100644 --- a/tests/pytest/import_merge/importBlock2HPO.py +++ b/tests/pytest/import_merge/importBlock2HPO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2S.py b/tests/pytest/import_merge/importBlock2S.py index d85074bfeb..69b0291839 100644 --- a/tests/pytest/import_merge/importBlock2S.py +++ b/tests/pytest/import_merge/importBlock2S.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2Sub.py b/tests/pytest/import_merge/importBlock2Sub.py index deb1dc8337..5b93750584 100644 --- a/tests/pytest/import_merge/importBlock2Sub.py +++ b/tests/pytest/import_merge/importBlock2Sub.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2T.py b/tests/pytest/import_merge/importBlock2T.py index ded698d28c..0d9b70299d 100644 --- a/tests/pytest/import_merge/importBlock2T.py +++ b/tests/pytest/import_merge/importBlock2T.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2TO.py b/tests/pytest/import_merge/importBlock2TO.py index ffc88c2c99..fe57308c42 100644 --- a/tests/pytest/import_merge/importBlock2TO.py +++ b/tests/pytest/import_merge/importBlock2TO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlock2TPO.py b/tests/pytest/import_merge/importBlock2TPO.py index 8b6c70c32b..4da52bd3f4 100644 --- a/tests/pytest/import_merge/importBlock2TPO.py +++ b/tests/pytest/import_merge/importBlock2TPO.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importBlockbetween.py b/tests/pytest/import_merge/importBlockbetween.py index c3482b3776..eea7f7ea7c 100644 --- a/tests/pytest/import_merge/importBlockbetween.py +++ b/tests/pytest/import_merge/importBlockbetween.py @@ -34,7 +34,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') + tdSql.execute('create database db cache 128') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importToCommit.py b/tests/pytest/import_merge/importToCommit.py index 3684dde049..b1a0065d47 100644 --- a/tests/pytest/import_merge/importToCommit.py +++ b/tests/pytest/import_merge/importToCommit.py @@ -33,7 +33,7 @@ class TDTestCase: tdDnodes.start(1) tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512 maxtables 10') + tdSql.execute('create database db cache 128 maxtables 10') tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/tag_lite/3.py b/tests/pytest/tag_lite/3.py new file mode 100644 index 0000000000..e5b5ba05e0 --- /dev/null +++ b/tests/pytest/tag_lite/3.py @@ -0,0 +1,1332 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + dbPrefix = "ta_3_db" + tbPrefix = "ta_3_tb" + mtPrefix = "ta_3_mt" + tbNum = 10 + rowNum = 20 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + i = 0 + db = "%s%d" % (dbPrefix, i) + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, + # tgcol2 int, tgcol3 float) + tdLog.info( + "create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 float)" % + mt) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 float)' % + mt) + # TSIM: + i = 0 + while (i < 5): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using %s tags( 0, 0, 0 ) + tdLog.info("create table %s using %s tags( 0, 0, 0 )" % (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 0, 0, 0 )' % + (tb, mt)) + + x = 0 + while (x < rowNum): + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + tdSql.execute( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + x = x + 1 + #TSIM: endw + i = i + 1 + #TSIM: endw + while (i < 10): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using %s tags( 1, 1, 1 ) + tdLog.info("create table %s using %s tags( 1, 1, 1 )" % (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 1, 1 )' % + (tb, mt)) + x = 0 + while (x < rowNum): + ms = "%dm" % x + tdLog.info( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + tdSql.execute( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + x = x + 1 + #TSIM: endw + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from %s + tdLog.info('select * from %s' % mt) + tdSql.query('select * from %s' % mt) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow(%d)' % totalNum) + tdSql.checkRows(totalNum) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from %s 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: if $rows != 50 then + tdLog.info('tdSql.checkRow(50)') + tdSql.checkRows(50) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s 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: if $rows != 150 then + tdLog.info('tdSql.checkRow(150)') + tdSql.checkRows(150) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s 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: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + mt) + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from %s where tgcol1 = 0 + tdLog.info('select * from %s where tgcol1 = 0' % mt) + tdSql.query('select * from %s where tgcol1 = 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> 0 + tdLog.info('select * from %s where tgcol1 <> 0' % mt) + tdSql.query('select * from %s where tgcol1 <> 0' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % mt) + tdSql.query('select * from %s where tgcol1 = 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> 1 + tdLog.info('select * from %s where tgcol1 <> 1' % mt) + tdSql.query('select * from %s where tgcol1 <> 1' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 = true + tdLog.info('select * from %s where tgcol1 = true' % mt) + tdSql.query('select * from %s where tgcol1 = true' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> true + tdLog.info('select * from %s where tgcol1 <> true' % mt) + tdSql.query('select * from %s where tgcol1 <> true' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 = false + tdLog.info('select * from %s where tgcol1 = false' % mt) + tdSql.query('select * from %s where tgcol1 = false' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> false + tdLog.info('select * from %s where tgcol1 <> false' % mt) + tdSql.query('select * from %s where tgcol1 <> false' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from %s where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % mt) + tdSql.query('select * from %s where tgcol2 = 0' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol2 <> 0 + tdLog.info('select * from %s where tgcol2 <> 0' % mt) + tdSql.query('select * from %s where tgcol2 <> 0' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol2 = 1 + tdLog.info('select * from %s where tgcol2 = 1' % mt) + tdSql.query('select * from %s where tgcol2 = 1' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol2 <> 1 + tdLog.info('select * from %s where tgcol2 <> 1' % mt) + tdSql.query('select * from %s where tgcol2 <> 1' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from %s where tgcol3 = 0 + tdLog.info('select * from %s where tgcol3 = 0' % mt) + tdSql.query('select * from %s where tgcol3 = 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol3 <> 0 + tdLog.info('select * from %s where tgcol3 <> 0' % mt) + tdSql.query('select * from %s where tgcol3 <> 0' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol3 = 1 + tdLog.info('select * from %s where tgcol3 = 1' % mt) + tdSql.query('select * from %s where tgcol3 = 1' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol3 <> 1 + tdLog.info('select * from %s where tgcol3 <> 1' % mt) + tdSql.query('select * from %s where tgcol3 <> 1' % mt) + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 = true' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 = true' % + mt) + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> true' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> true' % + mt) + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 = false' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 = false' % + mt) + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> false' % + mt) + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 = false' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = false' % + mt) + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> false' % + mt) + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol1 <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> false' % + mt) + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> false + # and ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> false and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> false and ts < now + 5m' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol2 = 1' % mt) + tdSql.query('select * from %s where ts > now + 4m 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 %s where ts > now + 4m and tgcol2 <> 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol2 <> 1' % mt) + tdSql.query( + 'select * from %s where ts > now + 4m 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 %s where ts < now + 4m and tgcol2 = 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) + tdSql.query('select * from %s where ts < now + 4m 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 %s where ts < now + 4m and tgcol2 <> 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol2 <> 0' % mt) + tdSql.query( + 'select * from %s where ts < now + 4m 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 %s where ts <= now + 4m and tgcol2 = 0 + tdLog.info('select * from %s where ts <= now + 4m and tgcol2 = 0' % mt) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 %s where ts <= now + 4m and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 %s where ts > now + 4m and ts < now + 5m and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 %s where ts > now + 4m and tgcol2 <> 0 and ts + # < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) + tdSql.query('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol3 <> 1' % mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) + tdSql.query('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol3 <> 0' % mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 + tdLog.info('select * from %s where ts <= now + 4m and tgcol3 = 0' % mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts + # < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 and + # tgcol1 = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = true' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = true' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 and + # tgcol1 <> true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> true' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> true' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 and + # tgcol1 = false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = false' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 and + # tgcol1 <> false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 and + # tgcol1 = false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = false' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 and + # tgcol1 <> false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol2 <> 0 and tgcol1 <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> false' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol1 <> false + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # tgcol1 = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = true' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = true' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # tgcol1 <> true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> true' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> true' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # tgcol1 = false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = false' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # tgcol1 <> false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # tgcol1 = false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = false' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # tgcol1 <> false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol3 <> 0 and tgcol1 <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> false' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol1 <> false + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 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 %s where ts > now + 4m and tgcol3 <> 1 and + # tgcol2 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 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 %s where ts < now + 4m and tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 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 %s where ts < now + 4m and tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 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 %s where ts <= now + 4m and tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 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 %s where ts <= now + 4m and tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 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 %s where ts > now + 4m and ts < now + 5m and + # tgcol3 <> 0 and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 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 %s where ts > now + 4m and tgcol3 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and + # tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step15 + tdLog.info('=============== step15') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = true + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = true and tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step16 + tdLog.info('=============== step16') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step17 + tdLog.info('=============== step17') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true + # group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and + # tgcol2 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and + # tgcol2 = 1 and tgcol3 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step18 + tdLog.info('=============== step18') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + # group by tgcol2 + 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 tgcol2' % + 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 tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = true group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true group by tgcol2' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true group by tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = true and tgcol2 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 group by tgcol2' % mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 group by tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step19 + tdLog.info('=============== step19') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/4.py b/tests/pytest/tag_lite/4.py new file mode 100644 index 0000000000..2b5b69a965 --- /dev/null +++ b/tests/pytest/tag_lite/4.py @@ -0,0 +1,1877 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: sql reset query cache + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + dbPrefix = "ta_4_db" + tbPrefix = "ta_4_tb" + mtPrefix = "ta_4_mt" + tbNum = 10 + rowNum = 20 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + i = 0 + db = "%s%d" % (dbPrefix, i) + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table %s (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 bigint, tgcol3 float, tgcol4 double) + tdLog.info( + "create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 float, tgcol4 double)" % + mt) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 float, tgcol4 double)' % + mt) + # TSIM: + i = 0 + while (i < 5): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using %s tags( 0, 0, 0, 0 ) + tdLog.info( + "create table %s using %s tags( 0, 0, 0, 0 )" % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 0, 0, 0, 0 )' % + (tb, mt)) + x = 0 + while (x < rowNum): + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + tdSql.execute( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + x = x + 1 + #TSIM: endw + i = i + 1 + #TSIM: endw + while (i < 10): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using %s tags( 1, 1, 1, 1 ) + tdLog.info( + "create table %s using %s tags( 1, 1, 1, 1 )" % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 1, 1, 1 )' % + (tb, mt)) + x = 0 + while (x < rowNum): + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + tdSql.execute( + "insert into %s values (now + %s, %d)" % + (tb, ms, x)) + x = x + 1 + #TSIM: endw + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from %s + tdLog.info('select * from %s' % mt) + tdSql.query('select * from %s' % mt) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from %s 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: if $rows != 50 then + tdLog.info('tdSql.checkRow(50)') + tdSql.checkRows(50) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s 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: if $rows != 150 then + tdLog.info('tdSql.checkRow(150)') + tdSql.checkRows(150) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s 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: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + mt) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from %s where tgcol1 = 0 + tdLog.info('select * from %s where tgcol1 = 0' % mt) + tdSql.query('select * from %s where tgcol1 = 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> 0 + tdLog.info('select * from %s where tgcol1 <> 0' % mt) + tdSql.query('select * from %s where tgcol1 <> 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % mt) + tdSql.query('select * from %s where tgcol1 = 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> 1 + tdLog.info('select * from %s where tgcol1 <> 1' % mt) + tdSql.query('select * from %s where tgcol1 <> 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % mt) + tdSql.query('select * from %s where tgcol1 = 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> 1 + tdLog.info('select * from %s where tgcol1 <> 1' % mt) + tdSql.query('select * from %s where tgcol1 <> 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 = 0 + tdLog.info('select * from %s where tgcol1 = 0' % mt) + tdSql.query('select * from %s where tgcol1 = 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol1 <> 0 + tdLog.info('select * from %s where tgcol1 <> 0' % mt) + tdSql.query('select * from %s where tgcol1 <> 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from %s where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % mt) + tdSql.query('select * from %s where tgcol2 = 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol2 <> 0 + tdLog.info('select * from %s where tgcol2 <> 0' % mt) + tdSql.query('select * from %s where tgcol2 <> 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol2 = 1 + tdLog.info('select * from %s where tgcol2 = 1' % mt) + tdSql.query('select * from %s where tgcol2 = 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol2 <> 1 + tdLog.info('select * from %s where tgcol2 <> 1' % mt) + tdSql.query('select * from %s where tgcol2 <> 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from %s where tgcol3 = 0 + tdLog.info('select * from %s where tgcol3 = 0' % mt) + tdSql.query('select * from %s where tgcol3 = 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol3 <> 0 + tdLog.info('select * from %s where tgcol3 <> 0' % mt) + tdSql.query('select * from %s where tgcol3 <> 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol3 = 1 + tdLog.info('select * from %s where tgcol3 = 1' % mt) + tdSql.query('select * from %s where tgcol3 = 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol3 <> 1 + tdLog.info('select * from %s where tgcol3 <> 1' % mt) + tdSql.query('select * from %s where tgcol3 <> 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from %s where tgcol4 = 0 + tdLog.info('select * from %s where tgcol4 = 0' % mt) + tdSql.query('select * from %s where tgcol4 = 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol4 <> 0 + tdLog.info('select * from %s where tgcol4 <> 0' % mt) + tdSql.query('select * from %s where tgcol4 <> 0' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol4 = 1 + tdLog.info('select * from %s where tgcol4 = 1' % mt) + tdSql.query('select * from %s where tgcol4 = 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where tgcol4 <> 1 + tdLog.info('select * from %s where tgcol4 <> 1' % mt) + tdSql.query('select * from %s where tgcol4 <> 1' % mt) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol1 = 1' % mt) + tdSql.query('select * from %s where ts > now + 4m and tgcol1 = 1' % mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol1 <> 1' % mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol1 = 0' % mt) + tdSql.query('select * from %s where ts < now + 4m and tgcol1 = 0' % mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol1 <> 0' % mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 + tdLog.info('select * from %s where ts <= now + 4m and tgcol1 = 0' % mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts + # < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol2 = 1' % mt) + tdSql.query('select * from %s where ts > now + 4m 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 %s where ts > now + 4m and tgcol2 <> 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol2 <> 1' % mt) + tdSql.query( + 'select * from %s where ts > now + 4m 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 %s where ts < now + 4m and tgcol2 = 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) + tdSql.query('select * from %s where ts < now + 4m 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 %s where ts < now + 4m and tgcol2 <> 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol2 <> 0' % mt) + tdSql.query( + 'select * from %s where ts < now + 4m 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 %s where ts <= now + 4m and tgcol2 = 0 + tdLog.info('select * from %s where ts <= now + 4m and tgcol2 = 0' % mt) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 %s where ts <= now + 4m and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 %s where ts > now + 4m and ts < now + 5m and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 %s where ts > now + 4m and tgcol2 <> 0 and ts + # < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) + tdSql.query('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol3 <> 1' % mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) + tdSql.query('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol3 <> 0' % mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 + tdLog.info('select * from %s where ts <= now + 4m and tgcol3 = 0' % mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts + # < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 = 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol4 = 1' % mt) + tdSql.query('select * from %s where ts > now + 4m and tgcol4 = 1' % mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 + tdLog.info('select * from %s where ts > now + 4m and tgcol4 <> 1' % mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol4 = 0' % mt) + tdSql.query('select * from %s where ts < now + 4m and tgcol4 = 0' % mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 + tdLog.info('select * from %s where ts < now + 4m and tgcol4 <> 0' % mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 + tdLog.info('select * from %s where ts <= now + 4m and tgcol4 = 0' % mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts + # < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 and + # tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 and + # tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 and + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 and + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol2 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 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 %s where ts > now + 4m and tgcol3 <> 1 and + # tgcol2 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 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 %s where ts < now + 4m and tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 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 %s where ts < now + 4m and tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 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 %s where ts <= now + 4m and tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 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 %s where ts <= now + 4m and tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 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 %s where ts > now + 4m and ts < now + 5m and + # tgcol3 <> 0 and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 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 %s where ts > now + 4m and tgcol3 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # tgcol4 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # tgcol4 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol3 <> 0 and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step15 + tdLog.info('=============== step15') + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step16 + tdLog.info('=============== step16') + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step17 + tdLog.info('=============== step17') + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + mt) + # TSIM: if $rows != 75 then + tdLog.info('tdSql.checkRow(75)') + tdSql.checkRows(75) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 25 then + tdLog.info('tdSql.checkRow(25)') + tdSql.checkRows(25) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts + # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + mt) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step18 + tdLog.info('=============== step18') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step19 + tdLog.info('=============== step19') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step20 + tdLog.info('=============== step20') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 and tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step21 + tdLog.info('=============== step21') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step22 + tdLog.info('=============== step22') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 group + # by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step23 + tdLog.info('=============== step23') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + # group by tgcol2 + 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 tgcol2' % + 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 tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 and tgcol2 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by + # tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step24 + tdLog.info('=============== step24') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4' % mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/5.py b/tests/pytest/tag_lite/5.py new file mode 100644 index 0000000000..66fc4b721c --- /dev/null +++ b/tests/pytest/tag_lite/5.py @@ -0,0 +1,2306 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: sql reset query cache + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_5_db + # TSIM: $tbPrefix = ta_5_tb + tbPrefix = "ta_5_tb" + # TSIM: $mtPrefix = ta_5_mt + mtPrefix = "ta_5_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # tinyint, tgcol2 int, tgcol3 bigint, tgcol4 double, tgcol5 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 tinyint, tgcol2 int, tgcol3 bigint, tgcol4 double, tgcol5 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 tinyint, tgcol2 int, tgcol3 bigint, tgcol4 double, tgcol5 binary(20))' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0, 0, 0, 0, 0 ) + tdLog.info( + 'create table %s using %s tags( 0, 0, 0, 0, 0 )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 0, 0, 0, 0, 0 )' % + (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s, %d)' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s, %d)' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1, 1, 1, 1, 1 ) + tdLog.info( + 'create table %s using %s tags( 1, 1, 1, 1, 1 )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 1, 1, 1, 1 )' % + (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s, %d)' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s, %d)' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt where tgcol1 = 0 + tdLog.info('select * from %s where tgcol1 = 0' % (mt)) + tdSql.query('select * from %s where tgcol1 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 0 + tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 1 + tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 1 + tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 = 0 + tdLog.info('select * from %s where tgcol1 = 0' % (mt)) + tdSql.query('select * from %s where tgcol1 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 0 + tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 0 + tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 1 + tdLog.info('select * from %s where tgcol2 = 1' % (mt)) + tdSql.query('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 1 + tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from $mt where tgcol3 = 0 + tdLog.info('select * from %s where tgcol3 = 0' % (mt)) + tdSql.query('select * from %s where tgcol3 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 <> 0 + tdLog.info('select * from %s where tgcol3 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol3 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 = 1 + tdLog.info('select * from %s where tgcol3 = 1' % (mt)) + tdSql.query('select * from %s where tgcol3 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 <> 1 + tdLog.info('select * from %s where tgcol3 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol3 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from $mt where tgcol4 = 0 + tdLog.info('select * from %s where tgcol4 = 0' % (mt)) + tdSql.query('select * from %s where tgcol4 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol4 <> 0 + tdLog.info('select * from %s where tgcol4 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol4 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol4 = 1 + tdLog.info('select * from %s where tgcol4 = 1' % (mt)) + tdSql.query('select * from %s where tgcol4 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol4 <> 1 + tdLog.info('select * from %s where tgcol4 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol4 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from $mt where tgcol5 = 0 + tdLog.info('select * from %s where tgcol5 = 0' % (mt)) + tdSql.query('select * from %s where tgcol5 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol5 <> 0 + tdLog.info('select * from %s where tgcol5 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol5 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol5 = 1 + tdLog.info('select * from %s where tgcol5 = 1' % (mt)) + tdSql.query('select * from %s where tgcol5 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol5 <> 1 + tdLog.info('select * from %s where tgcol5 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol5 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 = 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 tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 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 tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 = 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 tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> 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 tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = 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 tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> 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 + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 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 tgcol1 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 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 tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 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 tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 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 tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 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 tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 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 tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 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 + # tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 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 tgcol3 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 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 tgcol4 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 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 tgcol4 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 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 tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 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 tgcol4 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 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 tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 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 + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 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 tgcol4 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 = 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 tgcol5 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 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 tgcol5 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 = 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 tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 <> 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 tgcol5 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 = 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 tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 <> 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 + # tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 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 tgcol5 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 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 + # tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 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 + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 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 + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 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 + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 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 + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 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 + # tgcol2 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 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 tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 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 tgcol3 <> 1 and + # tgcol2 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 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 tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 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 tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 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 tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 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 tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 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 + # tgcol3 <> 0 and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 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 tgcol3 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step15 + tdLog.info('=============== step15') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # tgcol4 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 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 tgcol3 <> 1 and + # tgcol4 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 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 tgcol3 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 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 tgcol3 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 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 tgcol3 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 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 tgcol3 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 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 + # tgcol3 <> 0 and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 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 tgcol3 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step16 + tdLog.info('=============== step16') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 and + # tgcol4 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 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 tgcol5 <> 1 and + # tgcol4 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 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 tgcol5 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 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 tgcol5 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 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 tgcol5 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 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 tgcol5 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 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 + # tgcol5 <> 0 and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 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 tgcol5 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step17 + tdLog.info('=============== step17') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 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 tgcol1 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 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 tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 + # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol1 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step18 + tdLog.info('=============== step18') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 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 tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol4 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step19 + tdLog.info('=============== step19') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 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 tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 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 + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 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 tgcol4 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step20 + tdLog.info('=============== step20') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 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 tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 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 + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and + # tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 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 tgcol4 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # tgcol1 <> 0 and tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step21 + tdLog.info('=============== step21') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step22 + tdLog.info('=============== step22') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step23 + tdLog.info('=============== step23') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and + # tgcol5 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step24 + tdLog.info('=============== step24') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol5' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol5' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step25 + tdLog.info('=============== step25') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group + # by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by + # tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step26 + tdLog.info('=============== step26') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # group by tgcol2 + 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 tgcol2' % + (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 tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by + # tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and + # tgcol5 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step27 + tdLog.info('=============== step27') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) + # group by tgcol5 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/6.py b/tests/pytest/tag_lite/6.py new file mode 100644 index 0000000000..ca1058d51b --- /dev/null +++ b/tests/pytest/tag_lite/6.py @@ -0,0 +1,2754 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: sql reset query cache + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_6_db + # TSIM: $tbPrefix = ta_6_tb + tbPrefix = "ta_6_tb" + # TSIM: $mtPrefix = ta_6_mt + mtPrefix = "ta_6_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 bigint, tgcol3 smallint, tgcol4 bigint, tgcol5 + # binary(30), tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 bigint, tgcol3 smallint, tgcol4 bigint, tgcol5 binary(30), tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 bigint, tgcol3 smallint, tgcol4 bigint, tgcol5 binary(30), tgcol6 binary(20))' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '0', 0, 0, 0, '0', '0' + # ) + tdLog.info( + 'create table %s using %s tags( "0", 0, 0, 0, "0", "0" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "0", 0, 0, 0, "0", "0" )' % + (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '1', 1, 1, 1, '1', '1' + # ) + tdLog.info( + 'create table %s using %s tags( "1", 1, 1, 1, "1", "1" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", 1, 1, 1, "1", "1" )' % + (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt where tgcol1 = 0 + tdLog.info('select * from %s where tgcol1 = 0' % (mt)) + tdSql.query('select * from %s where tgcol1 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 0 + tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 1 + tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 1 + tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 = 0 + tdLog.info('select * from %s where tgcol1 = 0' % (mt)) + tdSql.query('select * from %s where tgcol1 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol1 <> 0 + tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 0 + tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 1 + tdLog.info('select * from %s where tgcol2 = 1' % (mt)) + tdSql.query('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 1 + tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from $mt where tgcol3 = 0 + tdLog.info('select * from %s where tgcol3 = 0' % (mt)) + tdSql.query('select * from %s where tgcol3 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 <> 0 + tdLog.info('select * from %s where tgcol3 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol3 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 = 1 + tdLog.info('select * from %s where tgcol3 = 1' % (mt)) + tdSql.query('select * from %s where tgcol3 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 <> 1 + tdLog.info('select * from %s where tgcol3 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol3 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from $mt where tgcol4 = 0 + tdLog.info('select * from %s where tgcol4 = 0' % (mt)) + tdSql.query('select * from %s where tgcol4 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol4 <> 0 + tdLog.info('select * from %s where tgcol4 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol4 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol4 = 1 + tdLog.info('select * from %s where tgcol4 = 1' % (mt)) + tdSql.query('select * from %s where tgcol4 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol4 <> 1 + tdLog.info('select * from %s where tgcol4 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol4 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from $mt where tgcol5 = 0 + tdLog.info('select * from %s where tgcol5 = 0' % (mt)) + tdSql.query('select * from %s where tgcol5 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol5 <> 0 + tdLog.info('select * from %s where tgcol5 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol5 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol5 = 1 + tdLog.info('select * from %s where tgcol5 = 1' % (mt)) + tdSql.query('select * from %s where tgcol5 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol5 <> 1 + tdLog.info('select * from %s where tgcol5 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol5 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: sql select * from $mt where tgcol6 = 0 + tdLog.info('select * from %s where tgcol6 = 0' % (mt)) + tdSql.query('select * from %s where tgcol6 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol6 <> 0 + tdLog.info('select * from %s where tgcol6 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol6 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol6 = 1 + tdLog.info('select * from %s where tgcol6 = 1' % (mt)) + tdSql.query('select * from %s where tgcol6 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol6 <> 1 + tdLog.info('select * from %s where tgcol6 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol6 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 = 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 tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 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 tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 = 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 tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> 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 tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = 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 tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> 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 + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 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 tgcol1 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 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 tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 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 tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 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 tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 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 tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 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 tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 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 + # tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 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 tgcol3 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 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 tgcol4 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 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 tgcol4 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 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 tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 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 tgcol4 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 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 tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 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 + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 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 tgcol4 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 = 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 tgcol5 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 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 tgcol5 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 = 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 tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 <> 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 tgcol5 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 = 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 tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 <> 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 + # tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 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 tgcol5 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol6 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol6 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol6 = 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 tgcol6 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol6 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol6 <> 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 tgcol6 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol6 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol6 = 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 tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol6 <> 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 tgcol6 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol6 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol6 = 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 tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol6 <> 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 + # tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol6 <> 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 tgcol6 <> 0 and + # ts < now + 5m + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol6 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol6 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step15 + tdLog.info('=============== step15') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 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 + # tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 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 + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 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 + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 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 + # tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 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 + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 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 + # tgcol2 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 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 tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step16 + tdLog.info('=============== step16') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 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 tgcol3 <> 1 and + # tgcol2 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 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 tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 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 tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 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 tgcol3 = 0 and + # tgcol2 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 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 tgcol3 <> 0 and + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 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 + # tgcol3 <> 0 and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 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 tgcol3 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step17 + tdLog.info('=============== step17') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # tgcol4 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 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 tgcol3 <> 1 and + # tgcol4 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 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 tgcol3 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 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 tgcol3 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 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 tgcol3 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 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 tgcol3 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 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 + # tgcol3 <> 0 and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 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 tgcol3 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step18 + tdLog.info('=============== step18') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 and + # tgcol4 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 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 tgcol5 <> 1 and + # tgcol4 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 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 tgcol5 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 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 tgcol5 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 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 tgcol5 = 0 and + # tgcol4 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 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 tgcol5 <> 0 and + # tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 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 + # tgcol5 <> 0 and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 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 tgcol5 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step19 + tdLog.info('=============== step19') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 and + # tgcol6 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol6 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol6 = 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 tgcol5 <> 1 and + # tgcol6 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol6 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol6 <> 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 tgcol5 = 0 and + # tgcol6 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol6 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol6 = 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 tgcol5 <> 0 and + # tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol6 <> 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 tgcol5 = 0 and + # tgcol6 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol6 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol6 = 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 tgcol5 <> 0 and + # tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol6 <> 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 + # tgcol5 <> 0 and tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol6 <> 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 tgcol5 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol6 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step20 + tdLog.info('=============== step20') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 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 tgcol1 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 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 tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol1 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol1 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 + # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol1 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step21 + tdLog.info('=============== step21') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 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 tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 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 tgcol4 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step22 + tdLog.info('=============== step22') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 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 tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 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 + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 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 tgcol4 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # tgcol1 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step23 + tdLog.info('=============== step23') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 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 tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 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 + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and + # tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 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 tgcol4 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # tgcol1 <> 0 and tgcol5 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step24 + tdLog.info('=============== step24') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = + # 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 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 tgcol4 <> 1 and + # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and + # tgcol6 <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = + # 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and + # tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 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 tgcol4 = 0 and + # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = + # 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 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 tgcol4 <> 0 and + # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and + # tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 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 + # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and + # tgcol5 <> 0 and tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 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 tgcol4 <> 0 and + # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step25 + tdLog.info('=============== step25') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step26 + tdLog.info('=============== step26') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 + # = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step27 + tdLog.info('=============== step27') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and + # tgcol5 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and + # tgcol5 = 1 and tgcol6 = 1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step28 + tdLog.info('=============== step28') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol5' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol5' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol6 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol6' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol6' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step29 + tdLog.info('=============== step29') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group + # by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by + # tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = + # 1 group by tgcol1 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol1' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step30 + tdLog.info('=============== step30') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # group by tgcol2 + 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 tgcol2' % + (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 tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by + # tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and + # tgcol5 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and + # tgcol5 = 1 and tgcol6 = 1 group by tgcol2 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step31 + tdLog.info('=============== step31') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) + # group by tgcol5 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and + # tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 + # = 1 interval(1d) group by tgcol6 + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 interval(1d) group by tgcol6' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 interval(1d) group by tgcol6' % (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/add.py b/tests/pytest/tag_lite/add.py new file mode 100644 index 0000000000..e9bc01afd2 --- /dev/null +++ b/tests/pytest/tag_lite/add.py @@ -0,0 +1,1767 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_ad_db + # TSIM: $tbPrefix = ta_ad_tb + tbPrefix = "ta_ad_tb" + # TSIM: $mtPrefix = ta_ad_mt + mtPrefix = "ta_ad_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + i = 2 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 int + tdLog.info('alter table %s add tag tgcol4 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 int' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4 =4 + tdLog.info('alter table %s set tag tgcol4 =4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4 =4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step2 + tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step2: + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + i = 3 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 tinyint + tdLog.info('alter table %s add tag tgcol4 tinyint' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 tinyint' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step3 + tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step3: + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + i = 4 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql describe $tb + tdLog.info('describe %s' % (tb)) + tdSql.query('describe %s' % (tb)) + # TSIM: if $data21 != BIGINT then + tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")') + tdSql.checkDataType(2, 1, "BIGINT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data31 != FLOAT then + tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")') + tdSql.checkDataType(3, 1, "FLOAT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data23 != 1 then + tdLog.info('tdSql.checkData(2, 3, 1)') + tdSql.checkData(2, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data33 != 2.000000 then + tdLog.info('tdSql.checkData(3, 3, 2.000000)') + tdSql.checkData(3, 3, 2.000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 float + tdLog.info('alter table %s add tag tgcol4 float' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 float' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4.00000 then + tdLog.info('tdSql.checkData(0, 3, 4.00000)') + tdSql.checkData(0, 3, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step4 + tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step4: + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + i = 5 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, '2' ) + tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from %s where tgcol2 = "2"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "2"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 smallint + tdLog.info('alter table %s add tag tgcol4 smallint' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = '1' -x step5 + tdLog.info('select * from %s where tgcol3 = "1" -x step5' % (mt)) + tdSql.error('select * from %s where tgcol3 = "1"' % (mt)) + # TSIM: return -1 + # TSIM: step5: + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + i = 6 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int, tgcol3 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3 ) + tdLog.info('create table %s using %s tags( 1, 2, 3 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, 3 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 binary(10) + tdLog.info('alter table %s add tag tgcol5 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 binary(10) + tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=false + tdLog.info('alter table %s set tag tgcol4=false' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=false' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = '5' + tdLog.info('select * from %s where tgcol5 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol5 = "5"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = '6' + tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "6"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 1 + tdLog.info('select * from %s where tgcol4 = 1' % (mt)) + tdSql.query('select * from %s where tgcol4 = 1' % (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 tgcol3 = 1 -x step52 + tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step52: + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: $i = 7 + i = 7 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint, tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol3 = '3' + tdLog.info('select * from %s where tgcol3 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "3"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bigint + tdLog.info('alter table %s add tag tgcol5 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 tinyint + tdLog.info('alter table %s add tag tgcol6 tinyint' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 tinyint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = 6 + tdLog.info('select * from %s where tgcol6 = 6' % (mt)) + tdSql.query('select * from %s where tgcol6 = 6' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4 then + tdLog.info('tdSql.checkData(0, 2, 4)') + tdSql.checkData(0, 2, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 + tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) + tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step71: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step72 + tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step72: + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: $i = 8 + i = 8 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float, tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol3 = '3' + tdLog.info('select * from %s where tgcol3 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "3"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 binary(17) + tdLog.info('alter table %s add tag tgcol5 binary(17)' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 binary(17)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 bool + tdLog.info('alter table %s add tag tgcol6 bool' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 bool' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=1 + tdLog.info('alter table %s set tag tgcol6=1' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=1' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = '5' + tdLog.info('select * from %s where tgcol5 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol5 = "5"' % (mt)) + # TSIM: print select * from $mt where tgcol5 = 5 + tdLog.info('select * from $mt where tgcol5 = 5') + # TSIM: print $data01 $data02 $data03 $data04 + tdLog.info('$data01 $data02 $data03 $data04') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4 then + tdLog.info('tdSql.checkData(0, 2, 4)') + tdSql.checkData(0, 2, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 1 then + tdLog.info('tdSql.checkData(0, 4, 1)') + tdSql.checkData(0, 4, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 + tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) + tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step81: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step82 + tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step82: + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: $i = 9 + i = 9 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10), tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from %s where tgcol2 = "2"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "2"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bool + tdLog.info('alter table %s add tag tgcol5 bool' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bool' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 float + tdLog.info('alter table %s add tag tgcol6 float' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 float' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=1 + tdLog.info('alter table %s set tag tgcol5=1' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=1' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = 1 + tdLog.info('select * from %s where tgcol5 = 1' % (mt)) + tdSql.query('select * from %s where tgcol5 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4.000000000 then + tdLog.info('tdSql.checkData(0, 2, 4.000000000)') + tdSql.checkData(0, 2, 4.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 1 then + tdLog.info('tdSql.checkData(0, 3, 1)') + tdSql.checkData(0, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6.00000 then + tdLog.info('tdSql.checkData(0, 4, 6.00000)') + tdSql.checkData(0, 4, 6.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 + tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) + tdSql.error('select * from %s where tgcol3 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step91: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step92 + tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt)) + tdSql.error('select * from %s where tgcol2 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step92: + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: $i = 10 + i = 10 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4' ) + tdLog.info( + 'create table %s using %s tags( "1", "2", "3", "4" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", "2", "3", "4" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol4 = '4' + tdLog.info('select * from %s where tgcol4 = "4"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "4"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103 + tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt)) + tdSql.error('alter table %s change tag tgcol1 tgcol403' % (mt)) + # TSIM: return -1 + # TSIM: step103: + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol4 binary(10) + tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bool + tdLog.info('alter table %s add tag tgcol5 bool' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bool' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=false + tdLog.info('alter table %s set tag tgcol5=false' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=false' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '4' + tdLog.info('select * from %s where tgcol4 = "4"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "4"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 0 then + tdLog.info('tdSql.checkData(0, 4, 0)') + tdSql.checkData(0, 4, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != NULL then + tdLog.info('tdSql.checkData(0, 5, NULL)') + tdSql.checkData(0, 5, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 + tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) + tdSql.error('select * from %s where tgcol2 = 101' % (mt)) + # TSIM: return -1 + # TSIM: step101: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step102 + tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) + tdSql.error('select * from %s where tgcol3 = 102' % (mt)) + # TSIM: return -1 + # TSIM: step102: + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: $i = 11 + i = 11 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, "5" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, "5" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4.00000 then + tdLog.info('tdSql.checkData(0, 5, 4.00000)') + tdSql.checkData(0, 5, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5 then + tdLog.info('tdSql.checkData(0, 6, 5)') + tdSql.checkData(0, 6, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114 + tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt)) + tdSql.error('alter table %s change tag tgcol1 tgcol414' % (mt)) + # TSIM: return -1 + # TSIM: step114: + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol5 + tdLog.info('alter table %s drop tag tgcol5' % (mt)) + tdSql.execute('alter table %s drop tag tgcol5' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol4 binary(10) + tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 int + tdLog.info('alter table %s add tag tgcol5 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 int' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 binary(10) + tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol7 bigint + tdLog.info('alter table %s add tag tgcol7 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt)) + # TSIM: sql alter table $mt add tag tgcol8 smallint + tdLog.info('alter table %s add tag tgcol8 smallint' % (mt)) + tdSql.execute('alter table %s add tag tgcol8 smallint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql alter table $tb set tag tgcol7=7 + tdLog.info('alter table %s set tag tgcol7=7' % (tb)) + tdSql.execute('alter table %s set tag tgcol7=7' % (tb)) + # TSIM: sql alter table $tb set tag tgcol8=8 + tdLog.info('alter table %s set tag tgcol8=8' % (tb)) + tdSql.execute('alter table %s set tag tgcol8=8' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 =5 + tdLog.info('select * from %s where tgcol5 =5' % (mt)) + tdSql.query('select * from %s where tgcol5 =5' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 5 then + tdLog.info('tdSql.checkData(0, 4, 5)') + tdSql.checkData(0, 4, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 6 then + tdLog.info('tdSql.checkData(0, 5, 6)') + tdSql.checkData(0, 5, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 7 then + tdLog.info('tdSql.checkData(0, 6, 7)') + tdSql.checkData(0, 6, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 8 then + tdLog.info('tdSql.checkData(0, 7, 8)') + tdSql.checkData(0, 7, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 + tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) + tdSql.error('select * from %s where tgcol2 = 111' % (mt)) + # TSIM: return -1 + # TSIM: step111: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step112 + tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) + tdSql.error('select * from %s where tgcol3 = 112' % (mt)) + # TSIM: return -1 + # TSIM: step112: + # TSIM: sql select * from $mt where tgcol9 = 1 -x step113 + tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt)) + tdSql.error('select * from %s where tgcol9 = 113' % (mt)) + # TSIM: return -1 + # TSIM: step113: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: $i = 12 + i = 12 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 + # binary(10), tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3.00000 then + tdLog.info('tdSql.checkData(0, 4, 3.00000)') + tdSql.checkData(0, 4, 3.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4.000000000 then + tdLog.info('tdSql.checkData(0, 5, 4.000000000)') + tdSql.checkData(0, 5, 4.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5 then + tdLog.info('tdSql.checkData(0, 6, 5)') + tdSql.checkData(0, 6, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol5 + tdLog.info('alter table %s drop tag tgcol5' % (mt)) + tdSql.execute('alter table %s drop tag tgcol5' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol2 binary(10) + tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol3 int + tdLog.info('alter table %s add tag tgcol3 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol3 int' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 binary(10) + tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bigint + tdLog.info('alter table %s add tag tgcol5 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol1=false + tdLog.info('alter table %s set tag tgcol1=false' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=false' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=5 + tdLog.info('alter table %s set tag tgcol2=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol3=4 + tdLog.info('alter table %s set tag tgcol3=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol3=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol4=3 + tdLog.info('alter table %s set tag tgcol4=3' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=3' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=2 + tdLog.info('alter table %s set tag tgcol5=2' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=2' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=1 + tdLog.info('alter table %s set tag tgcol6=1' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=1' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '3' + tdLog.info('select * from %s where tgcol4 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "3"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 1 then + tdLog.info('tdSql.checkData(0, 3, 1)') + tdSql.checkData(0, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 5 then + tdLog.info('tdSql.checkData(0, 4, 5)') + tdSql.checkData(0, 4, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 3 then + tdLog.info('tdSql.checkData(0, 6, 3)') + tdSql.checkData(0, 6, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 2 then + tdLog.info('tdSql.checkData(0, 7, 2)') + tdSql.checkData(0, 7, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '5' + tdLog.info('select * from %s where tgcol2 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "5"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 4 + tdLog.info('select * from %s where tgcol3 = 4' % (mt)) + tdSql.query('select * from %s where tgcol3 = 4' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = 2 + tdLog.info('select * from %s where tgcol5 = 2' % (mt)) + tdSql.query('select * from %s where tgcol5 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = '1' + tdLog.info('select * from %s where tgcol6 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: $i = 13 + i = 13 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 + # double, tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) + tdLog.info( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = '1' + tdLog.info('select * from %s where tgcol1 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol1 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 6, 5.000000000)') + tdSql.checkData(0, 6, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol6 + tdLog.info('alter table %s drop tag tgcol6' % (mt)) + tdSql.execute('alter table %s drop tag tgcol6' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol2 binary(10) + tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 int + tdLog.info('alter table %s add tag tgcol4 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 int' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 bigint + tdLog.info('alter table %s add tag tgcol6 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol1=7 + tdLog.info('alter table %s set tag tgcol1=7' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=7' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=8 + tdLog.info('alter table %s set tag tgcol2=8' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=8' % (tb)) + # TSIM: sql alter table $tb set tag tgcol3=9 + tdLog.info('alter table %s set tag tgcol3=9' % (tb)) + tdSql.execute('alter table %s set tag tgcol3=9' % (tb)) + # TSIM: sql alter table $tb set tag tgcol4=10 + tdLog.info('alter table %s set tag tgcol4=10' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=10' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=11 + tdLog.info('alter table %s set tag tgcol5=11' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=11' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=12 + tdLog.info('alter table %s set tag tgcol6=12' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=12' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '8' + tdLog.info('select * from %s where tgcol2 = "8"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "8"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 9 then + tdLog.info('tdSql.checkData(0, 3, 9)') + tdSql.checkData(0, 3, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 11.000000000 then + tdLog.info('tdSql.checkData(0, 4, 11.000000000)') + tdSql.checkData(0, 4, 11.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 8 then + tdLog.info('tdSql.checkData(0, 5, 8)') + tdSql.checkData(0, 5, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 10 then + tdLog.info('tdSql.checkData(0, 6, 10)') + tdSql.checkData(0, 6, 10) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 12 then + tdLog.info('tdSql.checkData(0, 7, 12)') + tdSql.checkData(0, 7, 12) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: $i = 14 + i = 14 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 bigint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 1 ) + tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: + # TSIM: sql alter table $mt add tag tgcol3 binary(10) + tdLog.info('alter table %s add tag tgcol3 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol3 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 int + tdLog.info('alter table %s add tag tgcol4 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 int' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bigint + tdLog.info('alter table %s add tag tgcol5 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 bigint + tdLog.info('alter table %s add tag tgcol6 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt)) + # TSIM: + # TSIM: return + # TSIM: sql alter table $mt add tag tgcol7 bigint -x step141 + tdLog.info('alter table %s add tag tgcol7 bigint -x step141' % (mt)) + tdSql.error('alter table %s add tag tgcol7 bigint41' % (mt)) + # TSIM: return -1 + # TSIM: step141: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt drop tag tgcol6 + tdLog.info('alter table %s drop tag tgcol6' % (mt)) + tdSql.execute('alter table %s drop tag tgcol6' % (mt)) + # TSIM: sql alter table $mt add tag tgcol7 bigint + tdLog.info('alter table %s add tag tgcol7 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt)) + # TSIM: sql alter table $mt add tag tgcol8 bigint -x step142 + tdLog.info('alter table %s add tag tgcol8 bigint -x step142' % (mt)) + tdSql.error('alter table %s add tag tgcol8 bigint42' % (mt)) + # TSIM: return -1 + # TSIM: step142: + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('sql drop database $db') + tdSql.execute('sql drop database $db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/bigint.py b/tests/pytest/tag_lite/bigint.py new file mode 100644 index 0000000000..875633901c --- /dev/null +++ b/tests/pytest/tag_lite/bigint.py @@ -0,0 +1,584 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_bi_db + # TSIM: $tbPrefix = ta_bi_tb + tbPrefix = "ta_bi_tb" + # TSIM: $mtPrefix = ta_bi_mt + mtPrefix = "ta_bi_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # bigint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0 ) + tdLog.info('create table %s using %s tags( 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 > 100000 and ts < 100000 + tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) + tdSql.query( + 'select * from %s where ts > 100000 and ts < 100000' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/binary.py b/tests/pytest/tag_lite/binary.py new file mode 100644 index 0000000000..476d9e4062 --- /dev/null +++ b/tests/pytest/tag_lite/binary.py @@ -0,0 +1,588 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_by_db + # TSIM: $tbPrefix = ta_by_tb + tbPrefix = "ta_by_tb" + # TSIM: $mtPrefix = ta_by_mt + mtPrefix = "ta_by_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '0' ) + tdLog.info('create table %s using %s tags( "0" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( "0" )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '1' ) + tdLog.info('create table %s using %s tags( "1" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( "1" )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 > 100000 and ts < 100000 + tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) + tdSql.query( + 'select * from %s where ts > 100000 and ts < 100000' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = '0' + tdLog.info('select * from %s where tgcol = "0"' % (mt)) + tdSql.query('select * from %s where tgcol = "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '0' + tdLog.info('select * from %s where tgcol <> "0"' % (mt)) + tdSql.query('select * from %s where tgcol <> "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = '1' + tdLog.info('select * from %s where tgcol = "1"' % (mt)) + tdSql.query('select * from %s where tgcol = "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '1' + tdLog.info('select * from %s where tgcol <> "1"' % (mt)) + tdSql.query('select * from %s where tgcol <> "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = '1' + tdLog.info('select * from %s where tgcol = "1"' % (mt)) + tdSql.query('select * from %s where tgcol = "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '1' + tdLog.info('select * from %s where tgcol <> "1"' % (mt)) + tdSql.query('select * from %s where tgcol <> "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = '0' + tdLog.info('select * from %s where tgcol = "0"' % (mt)) + tdSql.query('select * from %s where tgcol = "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '0' + tdLog.info('select * from %s where tgcol <> "0"' % (mt)) + tdSql.query('select * from %s where tgcol <> "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> '0' + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = '1' + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/binary_binary.py b/tests/pytest/tag_lite/binary_binary.py new file mode 100644 index 0000000000..e05f7e3d0e --- /dev/null +++ b/tests/pytest/tag_lite/binary_binary.py @@ -0,0 +1,799 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_bib_db + # TSIM: $tbPrefix = ta_bib_tb + tbPrefix = "ta_bib_tb" + # TSIM: $mtPrefix = ta_bib_mt + mtPrefix = "ta_bib_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(5), tgcol2 binary(5)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(5), tgcol2 binary(5))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(5), tgcol2 binary(5))' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '0', '0' ) + tdLog.info('create table %s using %s tags( "0", "0" )' % (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "0", "0" )' % + (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '1', '1' ) + tdLog.info('create table %s using %s tags( "1", "1" )' % (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", "1" )' % + (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt where tgcol = '0' + tdLog.info('select * from %s where tgcol = "0"' % (mt)) + tdSql.query('select * from %s where tgcol = "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '0' + tdLog.info('select * from %s where tgcol <> "0"' % (mt)) + tdSql.query('select * from %s where tgcol <> "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = '1' + tdLog.info('select * from %s where tgcol = "1"' % (mt)) + tdSql.query('select * from %s where tgcol = "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '1' + tdLog.info('select * from %s where tgcol <> "1"' % (mt)) + tdSql.query('select * from %s where tgcol <> "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = '1' + tdLog.info('select * from %s where tgcol = "1"' % (mt)) + tdSql.query('select * from %s where tgcol = "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '1' + tdLog.info('select * from %s where tgcol <> "1"' % (mt)) + tdSql.query('select * from %s where tgcol <> "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = '0' + tdLog.info('select * from %s where tgcol = "0"' % (mt)) + tdSql.query('select * from %s where tgcol = "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> '0' + tdLog.info('select * from %s where tgcol <> "0"' % (mt)) + tdSql.query('select * from %s where tgcol <> "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 = '0' + tdLog.info('select * from %s where tgcol2 = "0"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> '0' + tdLog.info('select * from %s where tgcol2 <> "0"' % (mt)) + tdSql.query('select * from %s where tgcol2 <> "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = '1' + tdLog.info('select * from %s where tgcol2 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> '1' + tdLog.info('select * from %s where tgcol2 <> "1"' % (mt)) + tdSql.query('select * from %s where tgcol2 <> "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> '0' + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> '0' + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and + # tgcol = '1' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol <> '1' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol = '0' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol <> '0' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol = '0' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 tgcol <> '0' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> '0' and tgcol <> '0' + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m 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"' % + (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' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m 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"' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and + # tgcol2 = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" and tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" and tgcol2 = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and + # tgcol2 = '1' group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" and tgcol2 = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = "1" and tgcol2 = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/bool.py b/tests/pytest/tag_lite/bool.py new file mode 100644 index 0000000000..e8b00ce4d9 --- /dev/null +++ b/tests/pytest/tag_lite/bool.py @@ -0,0 +1,583 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_bo_db + # TSIM: $tbPrefix = ta_bo_tb + tbPrefix = "ta_bo_tb" + # TSIM: $mtPrefix = ta_bo_mt + mtPrefix = "ta_bo_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0 ) + tdLog.info('create table %s using %s tags( 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: print expect 100, actual:$rows + tdLog.info('expect 100, actual:$rows') + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = true + tdLog.info('select * from %s where tgcol = true' % (mt)) + tdSql.query('select * from %s where tgcol = true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> true + tdLog.info('select * from %s where tgcol <> true' % (mt)) + tdSql.query('select * from %s where tgcol <> true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = false + tdLog.info('select * from %s where tgcol = false' % (mt)) + tdSql.query('select * from %s where tgcol = false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> false + tdLog.info('select * from %s where tgcol <> false' % (mt)) + tdSql.query('select * from %s where tgcol <> false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol = true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = true + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol') + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/bool_binary.py b/tests/pytest/tag_lite/bool_binary.py new file mode 100644 index 0000000000..7df7ba8c03 --- /dev/null +++ b/tests/pytest/tag_lite/bool_binary.py @@ -0,0 +1,793 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_bob_db + # TSIM: $tbPrefix = ta_bob_tb + tbPrefix = "ta_bob_tb" + # TSIM: $mtPrefix = ta_bob_mt + mtPrefix = "ta_bob_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 binary(5)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(5))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(5))' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0, '0' ) + tdLog.info('create table %s using %s tags( 0, "0" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0, "0" )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1, '1' ) + tdLog.info('create table %s using %s tags( 1, "1" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "1" )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = true + tdLog.info('select * from %s where tgcol = true' % (mt)) + tdSql.query('select * from %s where tgcol = true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> true + tdLog.info('select * from %s where tgcol <> true' % (mt)) + tdSql.query('select * from %s where tgcol <> true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = false + tdLog.info('select * from %s where tgcol = false' % (mt)) + tdSql.query('select * from %s where tgcol = false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> false + tdLog.info('select * from %s where tgcol <> false' % (mt)) + tdSql.query('select * from %s where tgcol <> false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 = '0' + tdLog.info('select * from %s where tgcol2 = "0"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> '0' + tdLog.info('select * from %s where tgcol2 <> "0"' % (mt)) + tdSql.query('select * from %s where tgcol2 <> "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = '1' + tdLog.info('select * from %s where tgcol2 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> "1" + tdLog.info('select * from %s where tgcol2 <> "1"' % (mt)) + tdSql.query('select * from %s where tgcol2 <> "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol = true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> '0' + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and + # tgcol = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol <> true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol = false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol <> false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol = false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 tgcol <> false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> '0' and tgcol <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m 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' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m 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' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and + # tgcol2 = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and + # tgcol2 = '1' group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/bool_int.py b/tests/pytest/tag_lite/bool_int.py new file mode 100644 index 0000000000..9706cca945 --- /dev/null +++ b/tests/pytest/tag_lite/bool_int.py @@ -0,0 +1,825 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_boi_db + # TSIM: $tbPrefix = ta_boi_tb + tbPrefix = "ta_boi_tb" + # TSIM: $mtPrefix = ta_boi_mt + mtPrefix = "ta_boi_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0, 0 ) + tdLog.info('create table %s using %s tags( 0, 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0, 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1, 1 ) + tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = true + tdLog.info('select * from %s where tgcol = true' % (mt)) + tdSql.query('select * from %s where tgcol = true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> true + tdLog.info('select * from %s where tgcol <> true' % (mt)) + tdSql.query('select * from %s where tgcol <> true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = false + tdLog.info('select * from %s where tgcol = false' % (mt)) + tdSql.query('select * from %s where tgcol = false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> false + tdLog.info('select * from %s where tgcol <> false' % (mt)) + tdSql.query('select * from %s where tgcol <> false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 0 + tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 1 + tdLog.info('select * from %s where tgcol2 = 1' % (mt)) + tdSql.query('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 1 + tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = true + tdLog.info('select * from %s where tgcol2 = true' % (mt)) + tdSql.query('select * from %s where tgcol2 = true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> true + tdLog.info('select * from %s where tgcol2 <> true' % (mt)) + tdSql.query('select * from %s where tgcol2 <> true' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = false + tdLog.info('select * from %s where tgcol2 = false' % (mt)) + tdSql.query('select * from %s where tgcol2 = false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> false + tdLog.info('select * from %s where tgcol2 <> false' % (mt)) + tdSql.query('select * from %s where tgcol2 <> false' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol = true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # tgcol = true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol <> true + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> true' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol = false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol <> false + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol = false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> false + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> false' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> 0 and tgcol <> false + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m 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' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m 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' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and + # tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and + # tgcol2 = 1 group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = true and tgcol2 = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/change.py b/tests/pytest/tag_lite/change.py new file mode 100644 index 0000000000..ab2c80485b --- /dev/null +++ b/tests/pytest/tag_lite/change.py @@ -0,0 +1,874 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_ch_db + # TSIM: $tbPrefix = ta_ch_tb + # TSIM: $mtPrefix = ta_ch_mt + # TSIM: $tbNum = 10 + # TSIM: $rowNum = 20 + # TSIM: $totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int) + tdLog.info( + "create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)") + tdSql.execute( + 'create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)') + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info("create table tb2 using $mt tags( 1, 2 )") + tdSql.execute('create table tb2 using $mt tags( 1, 2 )') + # TSIM: sql insert into $tb values(now, 1) + tdLog.info("insert into tb2 values(now, 1)") + tdSql.execute("insert into tb2 values(now, 1)") + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from $mt where tgcol1 = 1') + tdSql.query('select * from $mt where tgcol1 = 1') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tagcx tgcol3 -x step21 + # TSIM: return -1 + # TSIM: step21: + # TSIM: sql alter table $mt change tag tgcol1 tgcol2 -x step22 + # TSIM: return -1 + # TSIM: step22: + # TSIM: sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 + # TSIM: return -1 + # TSIM: step20: + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + # TSIM: sql alter table $mt change tag tgcol4 tgcol3 -x step23 + # TSIM: return -1 + # TSIM: step23: + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint) + tdLog.info( + "create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)") + tdSql.execute( + 'create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)') + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info("create table tb3 using $mt tags( 1, 2 )") + tdSql.execute('create table tb3 using $mt tags( 1, 2 )') + # TSIM: sql insert into $tb values(now, 1) + tdLog.info("insert into tb3 values(now, 1)") + tdSql.execute("insert into tb3 values(now, 1)") + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from $mt where tgcol1 = 1') + tdSql.query('select * from $mt where tgcol1 = 1') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float) + tdLog.info( + "create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)") + tdSql.execute( + 'create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)') + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info("create table tb4 using $mt tags( 1, 2 )") + tdSql.execute('create table tb4 using $mt tags( 1, 2 )') + # TSIM: sql insert into $tb values(now, 1) + tdLog.info("insert into tb4 values(now, 1)") + tdSql.execute("insert into tb4 values(now, 1)") + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from $mt where tgcol1 = 1') + tdSql.query('select * from $mt where tgcol1 = 1') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10)) + tdLog.info( + "create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))") + tdSql.execute( + 'create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))') + # TSIM: sql create table $tb using $mt tags( 1, '2' ) + tdLog.info("create table tb5 using $mt tags( 1, '2' )") + tdSql.execute('create table tb5 using $mt tags( 1, '2' )') + # TSIM: sql insert into $tb values(now, 1) + tdLog.info("insert into tb5 values(now, 1)") + tdSql.execute("insert into tb5 values(now, 1)") + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from $mt where tgcol2 = '2'') + tdSql.query('select * from $mt where tgcol2 = '2'') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 + # double, tgcol6 binary(20)) + tdLog.info("create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))") + tdSql.execute( + 'create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))') + # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) + tdLog.info("create table tb6 using $mt tags( '1', 2, 3, '4', 5, '6' )") + tdSql.execute('create table tb6 using $mt tags( '1', 2, 3, '4', 5, '6' )') + # TSIM: sql insert into $tb values(now, 1) + tdLog.info("insert into tb6 values(now, 1)") + tdSql.execute("insert into tb6 values(now, 1)") + # TSIM: sql select * from $mt where tgcol1 = '1' + tdLog.info('select * from $mt where tgcol1 = '1'') + tdSql.query('select * from $mt where tgcol1 = '1'') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 6, 5.000000000)') + tdSql.checkData(0, 6, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol3 + # TSIM: sql reset query cache + # TSIM: sql alter table $mt change tag tgcol4 tgcol3 + # TSIM: sql alter table $mt change tag tgcol1 tgcol7 + # TSIM: sql alter table $mt change tag tgcol2 tgcol8 + # TSIM: sql reset query cache + # TSIM: sql alter table $mt change tag tgcol3 tgcol9 + # TSIM: sql alter table $mt change tag tgcol5 tgcol10 + # TSIM: sql alter table $mt change tag tgcol6 tgcol11 + # TSIM: + # TSIM: sleep 5000 + # TSIM: sql reset query cache + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 -x step24 + tdLog.info('select * from $mt where tgcol1 = 1 -x step24') + tdSql.error('select * from $mt where tgcol1 = 14') + # TSIM: return -1 + # TSIM: step24: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step25 + tdLog.info('select * from $mt where tgcol2 = 1 -x step25') + tdSql.error('select * from $mt where tgcol2 = 15') + # TSIM: return -1 + # TSIM: step25: + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 + tdLog.info('select * from $mt where tgcol3 = 1') + tdSql.query('select * from $mt where tgcol3 = 1') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 2 + tdLog.info('select * from $mt where tgcol4 = 2') + tdSql.query('select * from $mt where tgcol4 = 2') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 -x step31 + tdLog.info('select * from $mt where tgcol1 = 1 -x step31') + tdSql.error('select * from $mt where tgcol1 = 11') + # TSIM: return -1 + # TSIM: step31: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step32 + tdLog.info('select * from $mt where tgcol2 = 1 -x step32') + tdSql.error('select * from $mt where tgcol2 = 12') + # TSIM: return -1 + # TSIM: step32: + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 + tdLog.info('select * from $mt where tgcol3 = 1') + tdSql.query('select * from $mt where tgcol3 = 1') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 2 + tdLog.info('select * from $mt where tgcol4 = 2') + tdSql.query('select * from $mt where tgcol4 = 2') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 -x step41 + tdLog.info('select * from $mt where tgcol1 = 1 -x step41') + tdSql.error('select * from $mt where tgcol1 = 11') + # TSIM: return -1 + # TSIM: step41: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step42 + tdLog.info('select * from $mt where tgcol2 = 1 -x step42') + tdSql.error('select * from $mt where tgcol2 = 12') + # TSIM: return -1 + # TSIM: step42: + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 + tdLog.info('select * from $mt where tgcol3 = 1') + tdSql.query('select * from $mt where tgcol3 = 1') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 2 + tdLog.info('select * from $mt where tgcol4 = 2') + tdSql.query('select * from $mt where tgcol4 = 2') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 -x step51 + tdLog.info('select * from $mt where tgcol1 = 1 -x step51') + tdSql.error('select * from $mt where tgcol1 = 11') + # TSIM: return -1 + # TSIM: step51: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step52 + tdLog.info('select * from $mt where tgcol2 = 1 -x step52') + tdSql.error('select * from $mt where tgcol2 = 12') + # TSIM: return -1 + # TSIM: step52: + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 + tdLog.info('select * from $mt where tgcol3 = 1') + tdSql.query('select * from $mt where tgcol3 = 1') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '2' + tdLog.info('select * from $mt where tgcol4 = '2'') + tdSql.query('select * from $mt where tgcol4 = '2'') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + # TSIM: $mt = $mtPrefix . $i + # TSIM: $tb = $tbPrefix . $i + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 -x step61 + tdLog.info('select * from $mt where tgcol1 = 1 -x step61') + tdSql.error('select * from $mt where tgcol1 = 11') + # TSIM: return -1 + # TSIM: step61: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step62 + tdLog.info('select * from $mt where tgcol2 = 1 -x step62') + tdSql.error('select * from $mt where tgcol2 = 12') + # TSIM: return -1 + # TSIM: step62: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step63 + tdLog.info('select * from $mt where tgcol3 = 1 -x step63') + tdSql.error('select * from $mt where tgcol3 = 13') + # TSIM: return -1 + # TSIM: step63: + # TSIM: sql select * from $mt where tgcol4 = 1 -x step64 + tdLog.info('select * from $mt where tgcol4 = 1 -x step64') + tdSql.error('select * from $mt where tgcol4 = 14') + # TSIM: return -1 + # TSIM: step64: + # TSIM: sql select * from $mt where tgcol5 = 1 -x step65 + tdLog.info('select * from $mt where tgcol5 = 1 -x step65') + tdSql.error('select * from $mt where tgcol5 = 15') + # TSIM: return -1 + # TSIM: step65: + # TSIM: sql select * from $mt where tgcol6 = 1 -x step66 + tdLog.info('select * from $mt where tgcol6 = 1 -x step66') + tdSql.error('select * from $mt where tgcol6 = 16') + # TSIM: return -1 + # TSIM: step66: + # TSIM: + # TSIM: sql select * from $mt where tgcol7 = '1' + tdLog.info('select * from $mt where tgcol7 = '1'') + tdSql.query('select * from $mt where tgcol7 = '1'') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 4 then + tdLog.info('tdSql.checkData(0, 4, 4)') + tdSql.checkData(0, 4, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 5, 5.000000000)') + tdSql.checkData(0, 5, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 6 then + tdLog.info('tdSql.checkData(0, 6, 6)') + tdSql.checkData(0, 6, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol8 = 2 + tdLog.info('select * from $mt where tgcol8 = 2') + tdSql.query('select * from $mt where tgcol8 = 2') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 4 then + tdLog.info('tdSql.checkData(0, 4, 4)') + tdSql.checkData(0, 4, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 5, 5.000000000)') + tdSql.checkData(0, 5, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 6 then + tdLog.info('tdSql.checkData(0, 6, 6)') + tdSql.checkData(0, 6, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol9 = '4' + tdLog.info('select * from $mt where tgcol9 = '4'') + tdSql.query('select * from $mt where tgcol9 = '4'') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 4 then + tdLog.info('tdSql.checkData(0, 4, 4)') + tdSql.checkData(0, 4, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 5, 5.000000000)') + tdSql.checkData(0, 5, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 6 then + tdLog.info('tdSql.checkData(0, 6, 6)') + tdSql.checkData(0, 6, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol10 = 5 + tdLog.info('select * from $mt where tgcol10 = 5') + tdSql.query('select * from $mt where tgcol10 = 5') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 4 then + tdLog.info('tdSql.checkData(0, 4, 4)') + tdSql.checkData(0, 4, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 5, 5.000000000)') + tdSql.checkData(0, 5, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 6 then + tdLog.info('tdSql.checkData(0, 6, 6)') + tdSql.checkData(0, 6, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol11 = '6' + tdLog.info('select * from $mt where tgcol11 = '6'') + tdSql.query('select * from $mt where tgcol11 = '6'') + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 4 then + tdLog.info('tdSql.checkData(0, 4, 4)') + tdSql.checkData(0, 4, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 5, 5.000000000)') + tdSql.checkData(0, 5, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 6 then + tdLog.info('tdSql.checkData(0, 6, 6)') + tdSql.checkData(0, 6, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/column.py b/tests/pytest/tag_lite/column.py new file mode 100644 index 0000000000..6b2285794d --- /dev/null +++ b/tests/pytest/tag_lite/column.py @@ -0,0 +1,197 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_co_db + # TSIM: $tbPrefix = ta_co_tb + tbPrefix = "ta_co_tb" + # TSIM: $mtPrefix = ta_co_mt + mtPrefix = "ta_co_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: sql create table $mt (ts timestamp, tbcol int, tbcol2 + # binary(10)) TAGS(tgcol int, tgcol2 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int, tbcol2 binary(10)) TAGS(tgcol int, tgcol2 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int, tbcol2 binary(10)) TAGS(tgcol int, tgcol2 binary(10))' % + (mt)) + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0, '0' ) + tdLog.info('create table %s using %s tags( 0, "0" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0, "0" )' % (tb, mt)) + # TSIM: + # TSIM: $i = 1 + i = 1 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1, 1 ) + tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt)) + # TSIM: + # TSIM: $i = 2 + i = 2 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '2', '2' ) + tdLog.info('create table %s using %s tags( "2", "2" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( "2", "2" )' % (tb, mt)) + # TSIM: + # TSIM: $i = 3 + i = 3 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '3', 3 ) + tdLog.info('create table %s using %s tags( "3", 3 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( "3", 3 )' % (tb, mt)) + # TSIM: + # TSIM: sql show tables + tdLog.info('show tables') + tdSql.query('show tables') + # TSIM: if $rows != 4 then + tdLog.info('tdSql.checkRow(4)') + tdSql.checkRows(4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql insert into $tb values(now, 0, '0') + tdLog.info('insert into %s values(now, 0, "0")' % (tb)) + tdSql.execute('insert into %s values(now, 0, "0")' % (tb)) + # TSIM: + # TSIM: $i = 1 + i = 1 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql insert into $tb values(now, 1, 1 ) + tdLog.info('insert into %s values(now, 1, 1 )' % (tb)) + tdSql.execute('insert into %s values(now, 1, 1 )' % (tb)) + # TSIM: + # TSIM: $i = 2 + i = 2 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql insert into $tb values(now, '2', '2') + tdLog.info('insert into %s values(now, "2", "2")' % (tb)) + tdSql.execute('insert into %s values(now, "2", "2")' % (tb)) + # TSIM: + # TSIM: $i = 3 + i = 3 + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql insert into $tb values(now, '3', 3) + tdLog.info('insert into %s values(now, "3", 3)' % (tb)) + tdSql.execute('insert into %s values(now, "3", 3)' % (tb)) + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 = '1' + tdLog.info('select * from %s where tgcol2 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != 4 then + tdLog.info('tdSql.checkRow(4)') + tdSql.checkRows(4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/commit.py b/tests/pytest/tag_lite/commit.py new file mode 100644 index 0000000000..4070ebd368 --- /dev/null +++ b/tests/pytest/tag_lite/commit.py @@ -0,0 +1,2313 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = db + # TSIM: $tbPrefix = tb + tbPrefix = "tb" + # TSIM: $mtPrefix = mt + mtPrefix = "mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + i = 2 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 int + tdLog.info('alter table %s add tag tgcol4 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 int' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4 =4 + tdLog.info('alter table %s set tag tgcol4 =4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4 =4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step2 + tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step2: + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + i = 3 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 tinyint + tdLog.info('alter table %s add tag tgcol4 tinyint' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 tinyint' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step3 + tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step3: + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + i = 4 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql describe $tb + tdLog.info('describe %s' % (tb)) + tdSql.query('describe %s' % (tb)) + # TSIM: if $data21 != BIGINT then + tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")') + tdSql.checkDataType(2, 1, "BIGINT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data31 != FLOAT then + tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")') + tdSql.checkDataType(3, 1, "FLOAT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data23 != 1 then + tdLog.info('tdSql.checkData(2, 3, 1)') + tdSql.checkData(2, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data33 != 2.000000 then + tdLog.info('tdSql.checkData(3, 3, 2.000000)') + tdSql.checkData(3, 3, 2.000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 float + tdLog.info('alter table %s add tag tgcol4 float' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 float' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4.00000 then + tdLog.info('tdSql.checkData(0, 3, 4.00000)') + tdSql.checkData(0, 3, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step4 + tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step4: + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + i = 5 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, '2' ) + tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from %s where tgcol2 = "2"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "2"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 smallint + tdLog.info('alter table %s add tag tgcol4 smallint' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = '1' -x step5 + tdLog.info('select * from %s where tgcol3 = "1" -x step5' % (mt)) + tdSql.error('select * from %s where tgcol3 = "1"' % (mt)) + # TSIM: return -1 + # TSIM: step5: + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + i = 6 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int, tgcol3 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3 ) + tdLog.info('create table %s using %s tags( 1, 2, 3 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, 3 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 binary(10) + tdLog.info('alter table %s add tag tgcol5 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 binary(10) + tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=false + tdLog.info('alter table %s set tag tgcol4=false' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=false' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = '5' + tdLog.info('select * from %s where tgcol5 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol5 = "5"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = '6' + tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "6"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 1 + tdLog.info('select * from %s where tgcol4 = 1' % (mt)) + tdSql.query('select * from %s where tgcol4 = 1' % (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 tgcol3 = 1 -x step52 + tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step52: + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: $i = 7 + i = 7 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint, tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol3 = '3' + tdLog.info('select * from %s where tgcol3 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "3"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bigint + tdLog.info('alter table %s add tag tgcol5 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 tinyint + tdLog.info('alter table %s add tag tgcol6 tinyint' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 tinyint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = 6 + tdLog.info('select * from %s where tgcol6 = 6' % (mt)) + tdSql.query('select * from %s where tgcol6 = 6' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4 then + tdLog.info('tdSql.checkData(0, 2, 4)') + tdSql.checkData(0, 2, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 + tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) + tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step71: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step72 + tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step72: + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: $i = 8 + i = 8 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float, tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol3 = '3' + tdLog.info('select * from %s where tgcol3 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "3"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 binary(17) + tdLog.info('alter table %s add tag tgcol5 binary(17)' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 binary(17)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 bool + tdLog.info('alter table %s add tag tgcol6 bool' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 bool' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=1 + tdLog.info('alter table %s set tag tgcol6=1' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=1' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = '5' + tdLog.info('select * from %s where tgcol5 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol5 = "5"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4 then + tdLog.info('tdSql.checkData(0, 2, 4)') + tdSql.checkData(0, 2, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 1 then + tdLog.info('tdSql.checkData(0, 4, 1)') + tdSql.checkData(0, 4, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 + tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) + tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step81: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step82 + tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step82: + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: $i = 9 + i = 9 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10), tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from %s where tgcol2 = "2"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "2"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 + tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) + tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bool + tdLog.info('alter table %s add tag tgcol5 bool' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bool' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 float + tdLog.info('alter table %s add tag tgcol6 float' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 float' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=1 + tdLog.info('alter table %s set tag tgcol5=1' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=1' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = 1 + tdLog.info('select * from %s where tgcol5 = 1' % (mt)) + tdSql.query('select * from %s where tgcol5 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4.000000000 then + tdLog.info('tdSql.checkData(0, 2, 4.000000000)') + tdSql.checkData(0, 2, 4.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 1 then + tdLog.info('tdSql.checkData(0, 3, 1)') + tdSql.checkData(0, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6.00000 then + tdLog.info('tdSql.checkData(0, 4, 6.00000)') + tdSql.checkData(0, 4, 6.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 + tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) + tdSql.error('select * from %s where tgcol3 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step91: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step92 + tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt)) + tdSql.error('select * from %s where tgcol2 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step92: + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: $i = 10 + i = 10 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4' ) + tdLog.info( + 'create table %s using %s tags( "1", "2", "3", "4" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", "2", "3", "4" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol4 = '4' + tdLog.info('select * from %s where tgcol4 = "4"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "4"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103 + tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt)) + tdSql.error('alter table %s change tag tgcol1 tgcol403' % (mt)) + # TSIM: return -1 + # TSIM: step103: + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol4 binary(10) + tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bool + tdLog.info('alter table %s add tag tgcol5 bool' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bool' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=false + tdLog.info('alter table %s set tag tgcol5=false' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=false' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '4' + tdLog.info('select * from %s where tgcol4 = "4"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "4"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 0 then + tdLog.info('tdSql.checkData(0, 4, 0)') + tdSql.checkData(0, 4, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != NULL then + tdLog.info('tdSql.checkData(0, 5, NULL)') + tdSql.checkData(0, 5, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 + tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) + tdSql.error('select * from %s where tgcol2 = 101' % (mt)) + # TSIM: return -1 + # TSIM: step101: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step102 + tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) + tdSql.error('select * from %s where tgcol3 = 102' % (mt)) + # TSIM: return -1 + # TSIM: step102: + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: $i = 11 + i = 11 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, "5" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, "5" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4.00000 then + tdLog.info('tdSql.checkData(0, 5, 4.00000)') + tdSql.checkData(0, 5, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5 then + tdLog.info('tdSql.checkData(0, 6, 5)') + tdSql.checkData(0, 6, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114 + tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt)) + tdSql.error('alter table %s change tag tgcol1 tgcol414' % (mt)) + # TSIM: return -1 + # TSIM: step114: + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol5 + tdLog.info('alter table %s drop tag tgcol5' % (mt)) + tdSql.execute('alter table %s drop tag tgcol5' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol4 binary(10) + tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 int + tdLog.info('alter table %s add tag tgcol5 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 int' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 binary(10) + tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol7 bigint + tdLog.info('alter table %s add tag tgcol7 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt)) + # TSIM: sql alter table $mt add tag tgcol8 smallint + tdLog.info('alter table %s add tag tgcol8 smallint' % (mt)) + tdSql.execute('alter table %s add tag tgcol8 smallint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol4=4 + tdLog.info('alter table %s set tag tgcol4=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=5 + tdLog.info('alter table %s set tag tgcol5=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=6 + tdLog.info('alter table %s set tag tgcol6=6' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=6' % (tb)) + # TSIM: sql alter table $tb set tag tgcol7=7 + tdLog.info('alter table %s set tag tgcol7=7' % (tb)) + tdSql.execute('alter table %s set tag tgcol7=7' % (tb)) + # TSIM: sql alter table $tb set tag tgcol8=8 + tdLog.info('alter table %s set tag tgcol8=8' % (tb)) + tdSql.execute('alter table %s set tag tgcol8=8' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol5 =5 + tdLog.info('select * from %s where tgcol5 =5' % (mt)) + tdSql.query('select * from %s where tgcol5 =5' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 5 then + tdLog.info('tdSql.checkData(0, 4, 5)') + tdSql.checkData(0, 4, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 6 then + tdLog.info('tdSql.checkData(0, 5, 6)') + tdSql.checkData(0, 5, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 7 then + tdLog.info('tdSql.checkData(0, 6, 7)') + tdSql.checkData(0, 6, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 8 then + tdLog.info('tdSql.checkData(0, 7, 8)') + tdSql.checkData(0, 7, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 + tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) + tdSql.error('select * from %s where tgcol2 = 111' % (mt)) + # TSIM: return -1 + # TSIM: step111: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step112 + tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) + tdSql.error('select * from %s where tgcol3 = 112' % (mt)) + # TSIM: return -1 + # TSIM: step112: + # TSIM: sql select * from $mt where tgcol9 = 1 -x step113 + tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt)) + tdSql.error('select * from %s where tgcol9 = 113' % (mt)) + # TSIM: return -1 + # TSIM: step113: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: $i = 12 + i = 12 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 + # binary(10), tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3.00000 then + tdLog.info('tdSql.checkData(0, 4, 3.00000)') + tdSql.checkData(0, 4, 3.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4.000000000 then + tdLog.info('tdSql.checkData(0, 5, 4.000000000)') + tdSql.checkData(0, 5, 4.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5 then + tdLog.info('tdSql.checkData(0, 6, 5)') + tdSql.checkData(0, 6, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol5 + tdLog.info('alter table %s drop tag tgcol5' % (mt)) + tdSql.execute('alter table %s drop tag tgcol5' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol2 binary(10) + tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol3 int + tdLog.info('alter table %s add tag tgcol3 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol3 int' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 binary(10) + tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol5 bigint + tdLog.info('alter table %s add tag tgcol5 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol1=false + tdLog.info('alter table %s set tag tgcol1=false' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=false' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=5 + tdLog.info('alter table %s set tag tgcol2=5' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=5' % (tb)) + # TSIM: sql alter table $tb set tag tgcol3=4 + tdLog.info('alter table %s set tag tgcol3=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol3=4' % (tb)) + # TSIM: sql alter table $tb set tag tgcol4=3 + tdLog.info('alter table %s set tag tgcol4=3' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=3' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=2 + tdLog.info('alter table %s set tag tgcol5=2' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=2' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=1 + tdLog.info('alter table %s set tag tgcol6=1' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=1' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '3' + tdLog.info('select * from %s where tgcol4 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "3"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 1 then + tdLog.info('tdSql.checkData(0, 3, 1)') + tdSql.checkData(0, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 5 then + tdLog.info('tdSql.checkData(0, 4, 5)') + tdSql.checkData(0, 4, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 3 then + tdLog.info('tdSql.checkData(0, 6, 3)') + tdSql.checkData(0, 6, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 2 then + tdLog.info('tdSql.checkData(0, 7, 2)') + tdSql.checkData(0, 7, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '5' + tdLog.info('select * from %s where tgcol2 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "5"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 4 + tdLog.info('select * from %s where tgcol3 = 4' % (mt)) + tdSql.query('select * from %s where tgcol3 = 4' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = 2 + tdLog.info('select * from %s where tgcol5 = 2' % (mt)) + tdSql.query('select * from %s where tgcol5 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = '1' + tdLog.info('select * from %s where tgcol6 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: $i = 13 + i = 13 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 + # double, tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) + tdLog.info( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = '1' + tdLog.info('select * from %s where tgcol1 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol1 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 6, 5.000000000)') + tdSql.checkData(0, 6, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol6 + tdLog.info('alter table %s drop tag tgcol6' % (mt)) + tdSql.execute('alter table %s drop tag tgcol6' % (mt)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $mt add tag tgcol2 binary(10) + tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt)) + tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt)) + # TSIM: sql alter table $mt add tag tgcol4 int + tdLog.info('alter table %s add tag tgcol4 int' % (mt)) + tdSql.execute('alter table %s add tag tgcol4 int' % (mt)) + # TSIM: sql alter table $mt add tag tgcol6 bigint + tdLog.info('alter table %s add tag tgcol6 bigint' % (mt)) + tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql alter table $tb set tag tgcol1=7 + tdLog.info('alter table %s set tag tgcol1=7' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=7' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=8 + tdLog.info('alter table %s set tag tgcol2=8' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=8' % (tb)) + # TSIM: sql alter table $tb set tag tgcol3=9 + tdLog.info('alter table %s set tag tgcol3=9' % (tb)) + tdSql.execute('alter table %s set tag tgcol3=9' % (tb)) + # TSIM: sql alter table $tb set tag tgcol4=10 + tdLog.info('alter table %s set tag tgcol4=10' % (tb)) + tdSql.execute('alter table %s set tag tgcol4=10' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=11 + tdLog.info('alter table %s set tag tgcol5=11' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=11' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6=12 + tdLog.info('alter table %s set tag tgcol6=12' % (tb)) + tdSql.execute('alter table %s set tag tgcol6=12' % (tb)) + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '8' + tdLog.info('select * from %s where tgcol2 = "8"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "8"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 9 then + tdLog.info('tdSql.checkData(0, 3, 9)') + tdSql.checkData(0, 3, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 11.000000000 then + tdLog.info('tdSql.checkData(0, 4, 11.000000000)') + tdSql.checkData(0, 4, 11.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 8 then + tdLog.info('tdSql.checkData(0, 5, 8)') + tdSql.checkData(0, 5, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 10 then + tdLog.info('tdSql.checkData(0, 6, 10)') + tdSql.checkData(0, 6, 10) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 12 then + tdLog.info('tdSql.checkData(0, 7, 12)') + tdSql.checkData(0, 7, 12) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT + # TSIM: sleep 5000 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: sleep 3000 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: + # TSIM: sql use $db + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + i = 2 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + i = 3 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + i = 4 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4.00000 then + tdLog.info('tdSql.checkData(0, 3, 4.00000)') + tdSql.checkData(0, 3, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + i = 5 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + i = 6 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = '5' + tdLog.info('select * from %s where tgcol5 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol5 = "5"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = '6' + tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "6"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 1 + tdLog.info('select * from %s where tgcol4 = 1' % (mt)) + tdSql.query('select * from %s where tgcol4 = 1' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: $i = 7 + i = 7 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = 6 + tdLog.info('select * from %s where tgcol6 = 6' % (mt)) + tdSql.query('select * from %s where tgcol6 = 6' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4 then + tdLog.info('tdSql.checkData(0, 2, 4)') + tdSql.checkData(0, 2, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6 then + tdLog.info('tdSql.checkData(0, 4, 6)') + tdSql.checkData(0, 4, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: $i = 8 + i = 8 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = '5' + tdLog.info('select * from %s where tgcol5 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol5 = "5"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4 then + tdLog.info('tdSql.checkData(0, 2, 4)') + tdSql.checkData(0, 2, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 5 then + tdLog.info('tdSql.checkData(0, 3, 5)') + tdSql.checkData(0, 3, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 1 then + tdLog.info('tdSql.checkData(0, 4, 1)') + tdSql.checkData(0, 4, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: $i = 9 + i = 9 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = 1 + tdLog.info('select * from %s where tgcol5 = 1' % (mt)) + tdSql.query('select * from %s where tgcol5 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 4.000000000 then + tdLog.info('tdSql.checkData(0, 2, 4.000000000)') + tdSql.checkData(0, 2, 4.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 1 then + tdLog.info('tdSql.checkData(0, 3, 1)') + tdSql.checkData(0, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 6.00000 then + tdLog.info('tdSql.checkData(0, 4, 6.00000)') + tdSql.checkData(0, 4, 6.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: $i = 10 + i = 10 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '4' + tdLog.info('select * from %s where tgcol4 = "4"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "4"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 0 then + tdLog.info('tdSql.checkData(0, 4, 0)') + tdSql.checkData(0, 4, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != NULL then + tdLog.info('tdSql.checkData(0, 5, NULL)') + tdSql.checkData(0, 5, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: $i = 11 + i = 11 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol5 =5 + tdLog.info('select * from %s where tgcol5 =5' % (mt)) + tdSql.query('select * from %s where tgcol5 =5' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 5 then + tdLog.info('tdSql.checkData(0, 4, 5)') + tdSql.checkData(0, 4, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 6 then + tdLog.info('tdSql.checkData(0, 5, 6)') + tdSql.checkData(0, 5, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 7 then + tdLog.info('tdSql.checkData(0, 6, 7)') + tdSql.checkData(0, 6, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 8 then + tdLog.info('tdSql.checkData(0, 7, 8)') + tdSql.checkData(0, 7, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: $i = 12 + i = 12 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '3' + tdLog.info('select * from %s where tgcol4 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "3"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 1 then + tdLog.info('tdSql.checkData(0, 3, 1)') + tdSql.checkData(0, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 5 then + tdLog.info('tdSql.checkData(0, 4, 5)') + tdSql.checkData(0, 4, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 3 then + tdLog.info('tdSql.checkData(0, 6, 3)') + tdSql.checkData(0, 6, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 2 then + tdLog.info('tdSql.checkData(0, 7, 2)') + tdSql.checkData(0, 7, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '5' + tdLog.info('select * from %s where tgcol2 = "5"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "5"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 4 + tdLog.info('select * from %s where tgcol3 = 4' % (mt)) + tdSql.query('select * from %s where tgcol3 = 4' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = 2 + tdLog.info('select * from %s where tgcol5 = 2' % (mt)) + tdSql.query('select * from %s where tgcol5 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = '1' + tdLog.info('select * from %s where tgcol6 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: $i = 13 + i = 13 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '8' + tdLog.info('select * from %s where tgcol2 = "8"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "8"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 9 then + tdLog.info('tdSql.checkData(0, 3, 9)') + tdSql.checkData(0, 3, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 11.000000000 then + tdLog.info('tdSql.checkData(0, 4, 11.000000000)') + tdSql.checkData(0, 4, 11.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 8 then + tdLog.info('tdSql.checkData(0, 5, 8)') + tdSql.checkData(0, 5, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 10 then + tdLog.info('tdSql.checkData(0, 6, 10)') + tdSql.checkData(0, 6, 10) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 12 then + tdLog.info('tdSql.checkData(0, 7, 12)') + tdSql.checkData(0, 7, 12) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('sql drop database $db') + tdSql.execute('sql drop database $db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/create.py b/tests/pytest/tag_lite/create.py new file mode 100644 index 0000000000..446f8fd38e --- /dev/null +++ b/tests/pytest/tag_lite/create.py @@ -0,0 +1,1398 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_cr_db + # TSIM: $tbPrefix = ta_cr_tb + tbPrefix = "ta_cr_tb" + # TSIM: $mtPrefix = ta_cr_mt + mtPrefix = "ta_cr_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + i = 2 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + i = 3 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # smallint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + i = 4 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + i = 5 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + i = 6 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # bigint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: $i = 7 + i = 7 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: print expect 0, actual: $rows + tdLog.info('expect 0, actual: $rows') + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: $i = 8 + i = 8 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # double) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol double)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol double)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: $i = 9 + i = 9 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1') + tdLog.info('create table %s using %s tags( "1")' % (tb, mt)) + tdSql.execute('create table %s using %s tags( "1")' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = '1' + tdLog.info('select * from %s where tgcol = "1"' % (mt)) + tdSql.query('select * from %s where tgcol = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = '0' + tdLog.info('select * from %s where tgcol = "0"' % (mt)) + tdSql.query('select * from %s where tgcol = "0"' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: $i = 10 + i = 10 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 bool) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: print expect 1, actual: $rows + tdLog.info('expect 1, actual: $rows') + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: $i = 11 + i = 11 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 smallint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 smallint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 smallint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: $i = 12 + i = 12 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: $i = 13 + i = 13 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: $i = 14 + i = 14 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 bigint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bigint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bigint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: print =============== step15 + tdLog.info('=============== step15') + # TSIM: $i = 15 + i = 15 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 float)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step16 + tdLog.info('=============== step16') + # TSIM: $i = 16 + i = 16 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 double) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 double)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 double)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step17 + tdLog.info('=============== step17') + # TSIM: $i = 17 + i = 17 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, '2' ) + tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = true + tdLog.info('select * from %s where tgcol = true' % (mt)) + tdSql.query('select * from %s where tgcol = true' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step18 + tdLog.info('=============== step18') + # TSIM: $i = 18 + i = 18 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # smallint, tgcol2 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint, tgcol2 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint, tgcol2 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step19 + tdLog.info('=============== step19') + # TSIM: $i = 19 + i = 19 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # tinyint, tgcol2 int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint, tgcol2 int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint, tgcol2 int)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step20 + tdLog.info('=============== step20') + # TSIM: $i = 20 + i = 20 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, + # tgcol2 bigint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 bigint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 bigint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step21 + tdLog.info('=============== step21') + # TSIM: $i = 21 + i = 21 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # bigint, tgcol2 float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint, tgcol2 float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bigint, tgcol2 float)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step22 + tdLog.info('=============== step22') + # TSIM: $i = 22 + i = 22 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # float, tgcol2 double) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float, tgcol2 double)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float, tgcol2 double)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step23 + tdLog.info('=============== step23') + # TSIM: $i = 23 + i = 23 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # double, tgcol2 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol double, tgcol2 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol double, tgcol2 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, '2' ) + tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from %s where tgcol2 = "2"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "2"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step24 + tdLog.info('=============== step24') + # TSIM: $i = 24 + i = 24 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 + # binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, 5, '6' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, 5, "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, 5, "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 = 3 + tdLog.info('select * from %s where tgcol3 = 3' % (mt)) + tdSql.query('select * from %s where tgcol3 = 3' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol5 = 5 + tdLog.info('select * from %s where tgcol5 = 5' % (mt)) + tdSql.query('select * from %s where tgcol5 = 5' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol6 = '6' + tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "6"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol6 = '0' + tdLog.info('select * from %s where tgcol6 = "0"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "0"' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step25 + tdLog.info('=============== step25') + # TSIM: $i = 25 + i = 25 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 int, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 + # binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol6 = '6' + tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "6"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol6 = '0' + tdLog.info('select * from %s where tgcol6 = "0"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "0"' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step26 + tdLog.info('=============== step26') + # TSIM: $i = 26 + i = 26 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10), + # tgcol5 binary(10), tgcol6 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10), tgcol5 binary(10), tgcol6 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10), tgcol5 binary(10), tgcol6 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4', '5', + # '6' ) + tdLog.info( + 'create table %s using %s tags( "1", "2", "3", "4", "5", "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", "2", "3", "4", "5", "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol3 = '3' + tdLog.info('select * from %s where tgcol3 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "3"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol3 = '0' + tdLog.info('select * from %s where tgcol3 = "0"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "0"' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step27 + tdLog.info('=============== step27') + # TSIM: $i = 27 + i = 27 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, + # tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 + # binary(10), tgcol7) -x step27 + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10), tgcol7) -x step27' % + (mt)) + tdSql.error( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10), tgcol7)7' % + (mt)) + # TSIM: return -1 + # TSIM: step27: + # TSIM: + # TSIM: print =============== step28 + tdLog.info('=============== step28') + # TSIM: $i = 28 + i = 28 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(250), tgcol2 binary(250)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250))' % + (mt)) + # TSIM: sql create table $tb using $mt tags('1', '1') + tdLog.info('create table %s using %s tags("1", "1")' % (tb, mt)) + tdSql.execute('create table %s using %s tags("1", "1")' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = '1' + tdLog.info('select * from %s where tgcol = "1"' % (mt)) + tdSql.query('select * from %s where tgcol = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step29 + tdLog.info('=============== step29') + # TSIM: $i = 29 + i = 29 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(25), tgcol2 binary(250)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(25), tgcol2 binary(250))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(25), tgcol2 binary(250))' % + (mt)) + # TSIM: sql create table $tb using $mt tags('1', '1') + tdLog.info('create table %s using %s tags("1", "1")' % (tb, mt)) + tdSql.execute('create table %s using %s tags("1", "1")' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol = '1' + tdLog.info('select * from %s where tgcol = "1"' % (mt)) + tdSql.query('select * from %s where tgcol = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step30 + tdLog.info('=============== step30') + # TSIM: $i = 30 + i = 30 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(250), tgcol2 binary(250), tgcol3 binary(30)) -x step30 + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250), tgcol3 binary(30)) -x step30' % + (mt)) + tdSql.error( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250), tgcol3 binary(30))0' % + (mt)) + # TSIM: return -1 + # TSIM: step30: + # TSIM: + # TSIM: print =============== step31 + tdLog.info('=============== step31') + # TSIM: $i = 31 + i = 31 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(5)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(5))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(5))' % + (mt)) + # TSIM: sql_error create table $tb using $mt tags('1234567') + tdLog.info('create table %s using %s tags("1234567")' % (tb, mt)) + tdSql.error('create table %s using %s tags("1234567")' % (tb, mt)) + # TSIM: sql create table $tb using $mt tags('12345') + tdLog.info('create table %s using %s tags("12345")' % (tb, mt)) + tdSql.execute('create table %s using %s tags("12345")' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: print sql select * from $mt + tdLog.info('sql select * from $mt') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print $data00 $data01 $data02 + tdLog.info('$data00 $data01 $data02') + # TSIM: if $data02 != 12345 then + tdLog.info('tdSql.checkData(0, 2, "12345")') + tdSql.checkData(0, 2, "12345") + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/delete.py b/tests/pytest/tag_lite/delete.py new file mode 100644 index 0000000000..34fe6e6f51 --- /dev/null +++ b/tests/pytest/tag_lite/delete.py @@ -0,0 +1,1597 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_de_db + # TSIM: $tbPrefix = ta_de_tb + tbPrefix = "ta_de_tb" + # TSIM: $mtPrefix = ta_de_mt + mtPrefix = "ta_de_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + i = 2 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + i = 3 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + i = 4 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 < 3 + tdLog.info('select * from %s where tgcol2 < 3' % (mt)) + tdSql.query('select * from %s where tgcol2 < 3' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql describe $tb + tdLog.info('describe %s' % (tb)) + tdSql.query('describe %s' % (tb)) + # TSIM: if $data21 != BIGINT then + tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")') + tdSql.checkDataType(2, 1, "BIGINT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data31 != FLOAT then + tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")') + tdSql.checkDataType(3, 1, "FLOAT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data23 != 1 then + tdLog.info('tdSql.checkData(2, 3, 1)') + tdSql.checkData(2, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol1 -x step40 + tdLog.info('alter table %s drop tag tgcol1 -x step40' % (mt)) + tdSql.error('alter table %s drop tag tgcol10' % (mt)) + # TSIM: return -1 + # TSIM: step40: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + i = 5 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, '2' ) + tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from %s where tgcol2 = "2"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "2"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol1 -x step50 + tdLog.info('alter table %s drop tag tgcol1 -x step50' % (mt)) + tdSql.error('alter table %s drop tag tgcol10' % (mt)) + # TSIM: return -1 + # TSIM: step50: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + i = 6 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int, tgcol3 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3 ) + tdLog.info('create table %s using %s tags( 1, 2, 3 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, 3 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: $i = 7 + i = 7 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint, tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol3 = '3' + tdLog.info('select * from %s where tgcol3 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "3"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql describe $tb + tdLog.info('describe %s' % (tb)) + tdSql.query('describe %s' % (tb)) + # TSIM: if $data21 != SMALLINT then + tdLog.info('tdSql.checkDataType(2, 1, "SMALLINT")') + tdSql.checkDataType(2, 1, "SMALLINT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data31 != TINYINT then + tdLog.info('tdSql.checkDataType(3, 1, "TINYINT")') + tdSql.checkDataType(3, 1, "TINYINT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data41 != BINARY then + tdLog.info('tdSql.checkDataType(4, 1, "BINARY")') + tdSql.checkDataType(4, 1, "BINARY") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data22 != 2 then + tdLog.info('tdSql.checkData(2, 2, 2)') + tdSql.checkData(2, 2, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data32 != 1 then + tdLog.info('tdSql.checkData(3, 2, 1)') + tdSql.checkData(3, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data42 != 10 then + tdLog.info('tdSql.checkData(4, 2, 10)') + tdSql.checkData(4, 2, 10) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data23 != 1 then + tdLog.info('tdSql.checkData(2, 3, 1)') + tdSql.checkData(2, 3, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data33 != 2 then + tdLog.info('tdSql.checkData(3, 3, 2)') + tdSql.checkData(3, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data43 != 3 then + tdLog.info('tdSql.checkData(4, 3, 3)') + tdSql.checkData(4, 3, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: $i = 8 + i = 8 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float, tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, '3' ) + tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol3 = '3' + tdLog.info('select * from %s where tgcol3 = "3"' % (mt)) + tdSql.query('select * from %s where tgcol3 = "3"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: $i = 9 + i = 9 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10), tgcol3 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, '2', '3' ) + tdLog.info('create table %s using %s tags( 1, "2", "3" )' % (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, "2", "3" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: $i = 10 + i = 10 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4' ) + tdLog.info( + 'create table %s using %s tags( "1", "2", "3", "4" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", "2", "3", "4" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol4 = '4' + tdLog.info('select * from %s where tgcol4 = "4"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "4"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: $i = 11 + i = 11 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, "5" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, "5" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4.00000 then + tdLog.info('tdSql.checkData(0, 5, 4.00000)') + tdSql.checkData(0, 5, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5 then + tdLog.info('tdSql.checkData(0, 6, 5)') + tdSql.checkData(0, 6, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol5 + tdLog.info('alter table %s drop tag tgcol5' % (mt)) + tdSql.execute('alter table %s drop tag tgcol5' % (mt)) + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: $i = 12 + i = 12 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 + # binary(10), tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) + tdLog.info( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3.00000 then + tdLog.info('tdSql.checkData(0, 4, 3.00000)') + tdSql.checkData(0, 4, 3.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4.000000000 then + tdLog.info('tdSql.checkData(0, 5, 4.000000000)') + tdSql.checkData(0, 5, 4.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5 then + tdLog.info('tdSql.checkData(0, 6, 5)') + tdSql.checkData(0, 6, 5) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol5 + tdLog.info('alter table %s drop tag tgcol5' % (mt)) + tdSql.execute('alter table %s drop tag tgcol5' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol6 + tdLog.info('alter table %s drop tag tgcol6' % (mt)) + tdSql.execute('alter table %s drop tag tgcol6' % (mt)) + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: $i = 13 + i = 13 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 + # double, tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) + tdLog.info( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = '1' + tdLog.info('select * from %s where tgcol1 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol1 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 6, 5.000000000)') + tdSql.checkData(0, 6, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol4 + tdLog.info('alter table %s drop tag tgcol4' % (mt)) + tdSql.execute('alter table %s drop tag tgcol4' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol6 + tdLog.info('alter table %s drop tag tgcol6' % (mt)) + tdSql.execute('alter table %s drop tag tgcol6' % (mt)) + # TSIM: + # TSIM: sleep 5000 + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + i = 2 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step2 + tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step2: + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + i = 3 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step3 + tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step3: + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + i = 4 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step4 + tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: return -1 + # TSIM: step4: + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + i = 5 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '1' -x step5 + tdLog.info('select * from %s where tgcol2 = "1" -x step5' % (mt)) + tdSql.error('select * from %s where tgcol2 = "1"' % (mt)) + # TSIM: return -1 + # TSIM: step5: + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + i = 6 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != NULL then + tdLog.info('tdSql.checkData(0, 4, NULL)') + tdSql.checkData(0, 4, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step51 + tdLog.info('select * from %s where tgcol2 = 1 -x step51' % (mt)) + tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step51: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step52 + tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step52: + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: $i = 7 + i = 7 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != NULL then + tdLog.info('tdSql.checkData(0, 4, NULL)') + tdSql.checkData(0, 4, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 + tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) + tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step71: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step72 + tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step72: + # TSIM: + # TSIM: print =============== step8 + tdLog.info('=============== step8') + # TSIM: $i = 8 + i = 8 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != NULL then + tdLog.info('tdSql.checkData(0, 4, NULL)') + tdSql.checkData(0, 4, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 + tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) + tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step81: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step82 + tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt)) + tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step82: + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: $i = 9 + i = 9 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != NULL then + tdLog.info('tdSql.checkData(0, 4, NULL)') + tdSql.checkData(0, 4, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 + tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) + tdSql.error('select * from %s where tgcol3 = 11' % (mt)) + # TSIM: return -1 + # TSIM: step91: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step92 + tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt)) + tdSql.error('select * from %s where tgcol2 = 12' % (mt)) + # TSIM: return -1 + # TSIM: step92: + # TSIM: + # TSIM: print =============== step10 + tdLog.info('=============== step10') + # TSIM: $i = 10 + i = 10 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = '1' + tdLog.info('select * from %s where tgcol1 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol1 = "1"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != NULL then + tdLog.info('tdSql.checkData(0, 3, NULL)') + tdSql.checkData(0, 3, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != NULL then + tdLog.info('tdSql.checkData(0, 4, NULL)') + tdSql.checkData(0, 4, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != NULL then + tdLog.info('tdSql.checkData(0, 5, NULL)') + tdSql.checkData(0, 5, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 + tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) + tdSql.error('select * from %s where tgcol2 = 101' % (mt)) + # TSIM: return -1 + # TSIM: step101: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step102 + tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) + tdSql.error('select * from %s where tgcol3 = 102' % (mt)) + # TSIM: return -1 + # TSIM: step102: + # TSIM: sql select * from $mt where tgcol4 = 1 -x step103 + tdLog.info('select * from %s where tgcol4 = 1 -x step103' % (mt)) + tdSql.error('select * from %s where tgcol4 = 103' % (mt)) + # TSIM: return -1 + # TSIM: step103: + # TSIM: + # TSIM: print =============== step11 + tdLog.info('=============== step11') + # TSIM: $i = 11 + i = 11 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol4=4 + tdLog.info('select * from %s where tgcol4=4' % (mt)) + tdSql.query('select * from %s where tgcol4=4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4.00000 then + tdLog.info('tdSql.checkData(0, 3, 4.00000)') + tdSql.checkData(0, 3, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != NULL then + tdLog.info('tdSql.checkData(0, 4, NULL)') + tdSql.checkData(0, 4, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != NULL then + tdLog.info('tdSql.checkData(0, 5, NULL)') + tdSql.checkData(0, 5, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != NULL then + tdLog.info('tdSql.checkData(0, 6, NULL)') + tdSql.checkData(0, 6, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 + tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) + tdSql.error('select * from %s where tgcol2 = 111' % (mt)) + # TSIM: return -1 + # TSIM: step111: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step112 + tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) + tdSql.error('select * from %s where tgcol3 = 112' % (mt)) + # TSIM: return -1 + # TSIM: step112: + # TSIM: sql select * from $mt where tgcol5 = 1 -x step113 + tdLog.info('select * from %s where tgcol5 = 1 -x step113' % (mt)) + tdSql.error('select * from %s where tgcol5 = 113' % (mt)) + # TSIM: return -1 + # TSIM: step113: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: $i = 12 + i = 12 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = 4 + tdLog.info('select * from %s where tgcol4 = 4' % (mt)) + tdSql.query('select * from %s where tgcol4 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4.000000000 then + tdLog.info('tdSql.checkData(0, 3, 4.000000000)') + tdSql.checkData(0, 3, 4.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != NULL then + tdLog.info('tdSql.checkData(0, 4, NULL)') + tdSql.checkData(0, 4, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != NULL then + tdLog.info('tdSql.checkData(0, 5, NULL)') + tdSql.checkData(0, 5, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != NULL then + tdLog.info('tdSql.checkData(0, 6, NULL)') + tdSql.checkData(0, 6, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 1 -x step120 + tdLog.info('select * from %s where tgcol2 = 1 -x step120' % (mt)) + tdSql.error('select * from %s where tgcol2 = 120' % (mt)) + # TSIM: return -1 + # TSIM: step120: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step121 + tdLog.info('select * from %s where tgcol3 = 1 -x step121' % (mt)) + tdSql.error('select * from %s where tgcol3 = 121' % (mt)) + # TSIM: return -1 + # TSIM: step121: + # TSIM: sql select * from $mt where tgcol5 = 1 -x step122 + tdLog.info('select * from %s where tgcol5 = 1 -x step122' % (mt)) + tdSql.error('select * from %s where tgcol5 = 122' % (mt)) + # TSIM: return -1 + # TSIM: step122: + # TSIM: sql select * from $mt where tgcol6 = 1 -x step123 + tdLog.info('select * from %s where tgcol6 = 1 -x step123' % (mt)) + tdSql.error('select * from %s where tgcol6 = 123' % (mt)) + # TSIM: return -1 + # TSIM: step123: + # TSIM: + # TSIM: print =============== step13 + tdLog.info('=============== step13') + # TSIM: $i = 13 + i = 13 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 4, 5.000000000)') + tdSql.checkData(0, 4, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != NULL then + tdLog.info('tdSql.checkData(0, 5, NULL)') + tdSql.checkData(0, 5, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != NULL then + tdLog.info('tdSql.checkData(0, 6, NULL)') + tdSql.checkData(0, 6, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol3 = 1 -x step130 + tdLog.info('select * from %s where tgcol3 = 1 -x step130' % (mt)) + tdSql.error('select * from %s where tgcol3 = 130' % (mt)) + # TSIM: return -1 + # TSIM: step130: + # TSIM: sql select * from $mt where tgcol4 = 1 -x step131 + tdLog.info('select * from %s where tgcol4 = 1 -x step131' % (mt)) + tdSql.error('select * from %s where tgcol4 = 131' % (mt)) + # TSIM: return -1 + # TSIM: step131: + # TSIM: sql select * from $mt where tgcol6 = 1 -x step133 + tdLog.info('select * from %s where tgcol6 = 1 -x step133' % (mt)) + tdSql.error('select * from %s where tgcol6 = 133' % (mt)) + # TSIM: return -1 + # TSIM: step133: + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: $i = 14 + i = 14 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 bigint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 1 ) + tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: + # TSIM: sql alter table xxmt drop tag tag1 -x step141 + tdLog.info('alter table xxmt drop tag tag1 -x step141') + tdSql.error('alter table xxmt drop tag tag141') + # TSIM: return -1 + # TSIM: step141: + # TSIM: sql alter table $tb drop tag tag1 -x step142 + tdLog.info('alter table %s drop tag tag1 -x step142' % (tb)) + tdSql.error('alter table %s drop tag tag142' % (tb)) + # TSIM: return -1 + # TSIM: step142: + # TSIM: sql alter table $mt drop tag tag1 -x step143 + tdLog.info('alter table %s drop tag tag1 -x step143' % (mt)) + tdSql.error('alter table %s drop tag tag143' % (mt)) + # TSIM: return -1 + # TSIM: step143: + # TSIM: + # TSIM: sql alter table $mt drop tag tagcol1 -x step144 + tdLog.info('alter table %s drop tag tagcol1 -x step144' % (mt)) + tdSql.error('alter table %s drop tag tagcol144' % (mt)) + # TSIM: return -1 + # TSIM: step144: + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol2 + tdLog.info('alter table %s drop tag tgcol2' % (mt)) + tdSql.execute('alter table %s drop tag tgcol2' % (mt)) + # TSIM: sql alter table $mt drop tag tgcol1 -x step145 + tdLog.info('alter table %s drop tag tgcol1 -x step145' % (mt)) + tdSql.error('alter table %s drop tag tgcol145' % (mt)) + # TSIM: return -1 + # TSIM: step145: + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('sql drop database $db') + tdSql.execute('sql drop database $db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/double.py b/tests/pytest/tag_lite/double.py new file mode 100644 index 0000000000..92e7d23677 --- /dev/null +++ b/tests/pytest/tag_lite/double.py @@ -0,0 +1,584 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_do_db + # TSIM: $tbPrefix = ta_do_tb + tbPrefix = "ta_do_tb" + # TSIM: $mtPrefix = ta_do_mt + mtPrefix = "ta_do_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # double) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol double)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol double)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0 ) + tdLog.info('create table %s using %s tags( 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 > 100000 and ts < 100000 + tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) + tdSql.query( + 'select * from %s where ts > 100000 and ts < 100000' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/filter.py b/tests/pytest/tag_lite/filter.py index 7d160a1b61..b726e7646e 100644 --- a/tests/pytest/tag_lite/filter.py +++ b/tests/pytest/tag_lite/filter.py @@ -25,35 +25,40 @@ class TDTestCase: def run(self): tdSql.prepare() - #TSIM: system sh/stop_dnodes.sh - #TSIM: system sh/deploy.sh -n dnode1 -i 1 - #TSIM: system sh/exec.sh -n dnode1 -s start - #TSIM: - #TSIM: sleep 3000 - #TSIM: sql connect - #TSIM: - #TSIM: print ======================== dnode1 start + # TSIM: system sh/stop_dnodes.sh + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start tdLog.info('======================== dnode1 start') - #TSIM: + # TSIM: dbPrefix = "ta_fi_db" tbPrefix = "ta_fi_tb" mtPrefix = "ta_fi_mt" - #TSIM: $tbNum = 10 + # TSIM: $tbNum = 10 rowNum = 20 - #TSIM: $totalNum = 200 - #TSIM: - #TSIM: print =============== step1 + # TSIM: $totalNum = 200 + # TSIM: + # TSIM: print =============== step1 tdLog.info('=============== step1') i = 0 - #TSIM: $db = $dbPrefix . $i + # TSIM: $db = $dbPrefix . $i mt = "%s%d" % (mtPrefix, i) - #TSIM: - #TSIM: sql create database $db - #TSIM: sql use $db - #TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10)) - tdLog.info("create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))" % mt) - tdSql.execute('create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))' % mt) - #TSIM: + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # binary(10)) + tdLog.info( + "create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))" % + mt) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))' % + mt) + # TSIM: i = 0 while (i < 5): tb = "tbPrefix%d" % i @@ -63,202 +68,299 @@ class TDTestCase: x = 0 while (x < rowNum): ms = "%dm" % x - tdLog.info("insert into %s values (now + %s , %d)" % (tb, ms, x)) - tdSql.execute("insert into %s values (now + %s , %d)" % (tb, ms, x)) + tdLog.info( + "insert into %s values (now + %s , %d)" % + (tb, ms, x)) + tdSql.execute( + "insert into %s values (now + %s , %d)" % + (tb, ms, x)) x = x + 1 i = i + 1 while (i < 10): - tb = "%s%d" % (tbPrefix , i) - #TSIM: sql create table $tb using $mt tags( '1' ) + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( '1' ) tdLog.info("create table %s using %s tags( '1' )" % (tb, mt)) tdSql.execute("create table %s using %s tags( '1' )" % (tb, mt)) x = 0 while (x < rowNum): ms = "%dm" % x - #TSIM: sql insert into $tb values (now + $ms , $x ) - tdLog.info("insert into %s values (now + %s, %d )" % (tb, ms, x)) - tdSql.execute("insert into %s values (now + %s, %d )" % (tb, ms, x)) + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + "insert into %s values (now + %s, %d )" % + (tb, ms, x)) + tdSql.execute( + "insert into %s values (now + %s, %d )" % + (tb, ms, x)) x = x + 1 i = i + 1 - #TSIM: - #TSIM: print =============== step2 + # TSIM: + # TSIM: print =============== step2 tdLog.info('=============== step2') - #TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' - tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = '1'" % mt) - tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = '1'" % mt) - #TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 - tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0, 0), tdSql.getData(0, 1), tdSql.getData(0, 2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0, 5), tdSql.getData(0, 6))) - #TSIM: if $data00 != 100 then + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' + tdLog.info( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = '1'" % + mt) + tdSql.query( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = '1'" % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info( + "%s %s %s %s %s %s %s" % + (tdSql.getData( + 0, 0), tdSql.getData( + 0, 1), tdSql.getData( + 0, 2), tdSql.getData( + 0, 3), tdSql.getData( + 0, 4), tdSql.getData( + 0, 5), tdSql.getData( + 0, 6))) + # TSIM: if $data00 != 100 then tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x step2 - tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tg = '1' -x step2" % mt) - tdSql.error("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tg = '1'" % mt) - #TSIM: return -1 - #TSIM: step2: - #TSIM: - #TSIM: print =============== step3 + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x + # step2 + tdLog.info( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tg = '1' -x step2" % + mt) + tdSql.error( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tg = '1'" % + mt) + # TSIM: return -1 + # TSIM: step2: + # TSIM: + # TSIM: print =============== step3 tdLog.info('=============== step3') - #TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where noexist = '1' -x step3 - tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where noexist = '1' -x step3" % mt) - tdSql.error("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where noexist = '1'" % mt) - #TSIM: return -1 - #TSIM: step3: - #TSIM: - #TSIM: print =============== step4 + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where noexist = '1' -x + # step3 + tdLog.info( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where noexist = '1' -x step3" % + mt) + tdSql.error( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where noexist = '1'" % + mt) + # TSIM: return -1 + # TSIM: step3: + # TSIM: + # TSIM: print =============== step4 tdLog.info('=============== step4') - #TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' - tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tbcol = '1'" % mt) - tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tbcol = '1'" % mt) - #TSIM: if $rows != 1 then + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' + tdLog.info( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tbcol = '1'" % + mt) + tdSql.query( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tbcol = '1'" % + mt) + # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: if $data00 != 10 then + # TSIM: if $data00 != 10 then tdLog.info('tdSql.checkData(0, 0, 10)') tdSql.checkData(0, 0, 10) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: print =============== step5 + # TSIM: + # TSIM: print =============== step5 tdLog.info('=============== step5') - #TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt - tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % mt) - tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % mt) - #TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 - tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0,0), tdSql.getData(0,1), tdSql.getData(0,2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0,5 ), tdSql.getData(0, 6))) - #TSIM: if $data00 != 200 then + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % + mt) + tdSql.query( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info( + "%s %s %s %s %s %s %s" % + (tdSql.getData( + 0, 0), tdSql.getData( + 0, 1), tdSql.getData( + 0, 2), tdSql.getData( + 0, 3), tdSql.getData( + 0, 4), tdSql.getData( + 0, 5), tdSql.getData( + 0, 6))) + # TSIM: if $data00 != 200 then tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: print =============== step6 + # TSIM: + # TSIM: print =============== step6 tdLog.info('=============== step6') - #TSIM: sql select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -x step6 - tdLog.info("select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s -x step6" % mt) - tdSql.error("select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % mt) - #TSIM: return -1 - #TSIM: step6: - #TSIM: - #TSIM: print =============== step7 + # TSIM: sql select count(tbcol), avg(cc), sum(xx), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt -x step6 + tdLog.info( + "select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s -x step6" % + mt) + tdSql.error( + "select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % + mt) + # TSIM: return -1 + # TSIM: step6: + # TSIM: + # TSIM: print =============== step7 tdLog.info('=============== step7') - #TSIM: sql select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from $mt -x step7 - tdLog.info("select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from %s -x step7" % mt) - tdSql.error("select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from %s" % mt) - #TSIM: return -1 - #TSIM: step7: - #TSIM: - #TSIM: print =============== step8 + # TSIM: sql select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), + # max(tgcol), first(tgcol), last(tgcol) from $mt -x step7 + tdLog.info( + "select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from %s -x step7" % + mt) + tdSql.error( + "select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from %s" % + mt) + # TSIM: return -1 + # TSIM: step7: + # TSIM: + # 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 group by tbcol - tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s by tbcol" % mt) - tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tbcol" % mt) - #TSIM: - #TSIM: print =============== step9 + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tbcol + tdLog.info( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s by tbcol" % + mt) + tdSql.query( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tbcol" % + mt) + # TSIM: + # TSIM: print =============== step9 tdLog.info('=============== step9') - #TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by noexist -x step9 - tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by noexist -x step9" % mt) - tdSql.error('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by noexist ' % mt) - #TSIM: return -1 - #TSIM: step9: - #TSIM: - #TSIM: print =============== step10 + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by noexist -x + # step9 + tdLog.info( + "select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by noexist -x step9" % + mt) + tdSql.error( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by noexist ' % + mt) + # TSIM: return -1 + # TSIM: step9: + # TSIM: + # 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 group by tgcol - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % mt) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % mt) - #TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + mt) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') - #TSIM: if $data00 != 100 then + # TSIM: if $data00 != 100 then tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: print =============== step11 + # TSIM: + # TSIM: print =============== step11 tdLog.info('=============== step11') - #TSIM: sql select count(tbcol) as c from $mt group by tbcol + # TSIM: sql select count(tbcol) as c from $mt group by tbcol tdLog.info('select count(tbcol) as c from %s group by tbcol' % mt) tdSql.query('select count(tbcol) as c from %s group by tbcol' % mt) - #TSIM: - #TSIM: print =============== step12 + # TSIM: + # TSIM: print =============== step12 tdLog.info('=============== step12') - #TSIM: sql select count(tbcol) as c from $mt group by noexist -x step12 - tdLog.info('select count(tbcol) as c from %s group by noexist -x step12' % mt) + # TSIM: sql select count(tbcol) as c from $mt group by noexist -x + # step12 + tdLog.info( + 'select count(tbcol) as c from %s group by noexist -x step12' % + mt) tdSql.error('select count(tbcol) as c from %s group by noexist2' % mt) - #TSIM: return -1 - #TSIM: step12: - #TSIM: - #TSIM: print =============== step13 + # TSIM: return -1 + # TSIM: step12: + # TSIM: + # TSIM: print =============== step13 tdLog.info('=============== step13') - #TSIM: sql select count(tbcol) as c from $mt group by tgcol + # TSIM: sql select count(tbcol) as c from $mt group by tgcol tdLog.info('select count(tbcol) as c from %s group by tgcol' % mt) tdSql.query('select count(tbcol) as c from %s group by tgcol' % mt) - #TSIM: print $data00 + # TSIM: print $data00 tdLog.info('$data00') - #TSIM: if $data00 != 100 then + # TSIM: if $data00 != 100 then tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: print =============== step14 + # TSIM: + # TSIM: print =============== step14 tdLog.info('=============== step14') - #TSIM: sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol - tdLog.info('select count(tbcol) as c from %s where ts > 1000 group by tgcol' % mt) - tdSql.query('select count(tbcol) as c from %s where ts > 1000 group by tgcol' % mt) - #TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + # TSIM: sql select count(tbcol) as c from $mt where ts > 1000 group by + # tgcol + tdLog.info( + 'select count(tbcol) as c from %s where ts > 1000 group by tgcol' % + mt) + tdSql.query( + 'select count(tbcol) as c from %s where ts > 1000 group by tgcol' % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 # tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0, 0), tdSql.getData(0, 1), tdSql.getData(0, 2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0, 5), tdSql.getData(0, 6))) - #TSIM: if $data00 != 100 then + # TSIM: if $data00 != 100 then tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) - #TSIM: print expect 100, actual $data00 + # TSIM: print expect 100, actual $data00 tdLog.info('expect 100, actual $data00') - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: print =============== step15 + # TSIM: + # TSIM: print =============== step15 tdLog.info('=============== step15') - #TSIM: sql select count(tbcol) as c from $mt where noexist < 1 group by tgcol -x step15 - tdLog.info('select count(tbcol) as c from %s where noexist < 1 group by tgcol -x step15' % mt) - tdSql.error('select count(tbcol) as c from %s where noexist < 1 group by tgcol5' % mt) - #TSIM: return -1 - #TSIM: step15: - #TSIM: - #TSIM: print =============== step16 + # TSIM: sql select count(tbcol) as c from $mt where noexist < 1 group + # by tgcol -x step15 + tdLog.info( + 'select count(tbcol) as c from %s where noexist < 1 group by tgcol -x step15' % + mt) + tdSql.error( + 'select count(tbcol) as c from %s where noexist < 1 group by tgcol5' % + mt) + # TSIM: return -1 + # TSIM: step15: + # TSIM: + # TSIM: print =============== step16 tdLog.info('=============== step16') - #TSIM: sql select count(tbcol) as c from $mt where tgcol = '1' group by tgcol - tdLog.info("select count(tbcol) as c from %s where tgcol = '1' group by tgcol" % mt) - tdSql.query("select count(tbcol) as c from %s where tgcol = '1' group by tgcol" % mt) - #TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + # TSIM: sql select count(tbcol) as c from $mt where tgcol = '1' group + # by tgcol + tdLog.info( + "select count(tbcol) as c from %s where tgcol = '1' group by tgcol" % + mt) + tdSql.query( + "select count(tbcol) as c from %s where tgcol = '1' group by tgcol" % + mt) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 # tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0, 0), tdSql.getData(0, 1), tdSql.getData(0, 2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0, 5), tdSql.getData(0, 6))) - #TSIM: if $data00 != 100 then + # TSIM: if $data00 != 100 then tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: print =============== clear + # TSIM: + # TSIM: print =============== clear tdLog.info('=============== clear') - #TSIM: sql drop database $db + # TSIM: sql drop database $db tdLog.info('drop database db') tdSql.execute('drop database db') - #TSIM: sql show databases + # TSIM: sql show databases tdLog.info('show databases') tdSql.query('show databases') - #TSIM: if $rows != 0 then + # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) - #TSIM: return -1 + # TSIM: return -1 #TSIM: endi - #TSIM: - #TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end def stop(self): diff --git a/tests/pytest/tag_lite/float.py b/tests/pytest/tag_lite/float.py new file mode 100644 index 0000000000..19140abe13 --- /dev/null +++ b/tests/pytest/tag_lite/float.py @@ -0,0 +1,584 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_fl_db + # TSIM: $tbPrefix = ta_fl_tb + tbPrefix = "ta_fl_tb" + # TSIM: $mtPrefix = ta_fl_mt + mtPrefix = "ta_fl_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0 ) + tdLog.info('create table %s using %s tags( 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 > 100000 and ts < 100000 + tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) + tdSql.query( + 'select * from %s where ts > 100000 and ts < 100000' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/int.py b/tests/pytest/tag_lite/int.py new file mode 100644 index 0000000000..769e6009c8 --- /dev/null +++ b/tests/pytest/tag_lite/int.py @@ -0,0 +1,583 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_in_db + # TSIM: $tbPrefix = ta_in_tb + tbPrefix = "ta_in_tb" + # TSIM: $mtPrefix = ta_in_mt + mtPrefix = "ta_in_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0 ) + tdLog.info('create table %s using %s tags( 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 > 100000 and ts < 100000 + tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) + tdSql.query( + 'select * from %s where ts > 100000 and ts < 100000' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/int_binary.py b/tests/pytest/tag_lite/int_binary.py new file mode 100644 index 0000000000..2f3f818cd2 --- /dev/null +++ b/tests/pytest/tag_lite/int_binary.py @@ -0,0 +1,791 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_inb_db + # TSIM: $tbPrefix = ta_inb_tb + tbPrefix = "ta_inb_tb" + # TSIM: $mtPrefix = ta_inb_mt + mtPrefix = "ta_inb_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, + # tgcol2 binary(5)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 binary(5))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 binary(5))' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0, '0' ) + tdLog.info('create table %s using %s tags( 0, "0" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0, "0" )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1, '1' ) + tdLog.info('create table %s using %s tags( 1, "1" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "1" )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 = '0' + tdLog.info('select * from %s where tgcol2 = "0"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> '0' + tdLog.info('select * from %s where tgcol2 <> "0"' % (mt)) + tdSql.query('select * from %s where tgcol2 <> "0"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = '1' + tdLog.info('select * from %s where tgcol2 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> '1' + tdLog.info('select * from %s where tgcol2 <> "1"' % (mt)) + tdSql.query('select * from %s where tgcol2 <> "1"' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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' + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> '0' + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and + # tgcol = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 tgcol <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> '0' and tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m 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' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m 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' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and + # tgcol2 = '1' + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = "1"' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = "1"' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' + # group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and + # tgcol2 = '1' group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = "1" group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = "1" group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/int_float.py b/tests/pytest/tag_lite/int_float.py new file mode 100644 index 0000000000..4171085ad7 --- /dev/null +++ b/tests/pytest/tag_lite/int_float.py @@ -0,0 +1,827 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_inf_db + # TSIM: $tbPrefix = ta_inf_tb + tbPrefix = "ta_inf_tb" + # TSIM: $mtPrefix = ta_inf_mt + mtPrefix = "ta_inf_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, + # tgcol2 float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 float)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0, 0 ) + tdLog.info('create table %s using %s tags( 0, 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0, 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1, 1 ) + tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol2 > 0.5 + tdLog.info('select * from %s where tgcol2 > 0.5' % (mt)) + tdSql.query('select * from %s where tgcol2 > 0.5' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 < 0.5 + tdLog.info('select * from %s where tgcol2 < 0.5' % (mt)) + tdSql.query('select * from %s where tgcol2 < 0.5' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 > 0.5 and tgcol2 < 1.5 + tdLog.info( + 'select * from %s where tgcol2 > 0.5 and tgcol2 < 1.5' % + (mt)) + tdSql.query( + 'select * from %s where tgcol2 > 0.5 and tgcol2 < 1.5' % + (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 1 + tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 1 + tdLog.info('select * from %s where tgcol2 = 1' % (mt)) + tdSql.query('select * from %s where tgcol2 = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 1 + tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 = 0 + tdLog.info('select * from %s where tgcol2 = 0' % (mt)) + tdSql.query('select * from %s where tgcol2 = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol2 <> 0 + tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) + tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # tgcol = 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol <> 1 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + # tgcol = 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + # tgcol = 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol2 <> 0 and tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m 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' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m 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' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and + # tgcol2 = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol2 = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and + # tgcol2 = 1 group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 and tgcol2 = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step14 + tdLog.info('=============== step14') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/set.py b/tests/pytest/tag_lite/set.py new file mode 100644 index 0000000000..6e1a5aed9d --- /dev/null +++ b/tests/pytest/tag_lite/set.py @@ -0,0 +1,876 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_se_db + # TSIM: $tbPrefix = ta_se_tb + tbPrefix = "ta_se_tb" + # TSIM: $mtPrefix = ta_se_mt + mtPrefix = "ta_se_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: $i = 2 + i = 2 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bool, tgcol2 int) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $tb set tag tagcx 1 -x step21 + tdLog.info('alter table %s set tag tagcx 1 -x step21' % (tb)) + tdSql.error('alter table %s set tag tagcx 11' % (tb)) + # TSIM: return -1 + # TSIM: step21: + # TSIM: sql alter table $tb set tag tgcol1=false + tdLog.info('alter table %s set tag tgcol1=false' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=false' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=4 + tdLog.info('alter table %s set tag tgcol2=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=4' % (tb)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = false + tdLog.info('select * from %s where tgcol1 = false' % (mt)) + tdSql.query('select * from %s where tgcol1 = false' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 4 + tdLog.info('select * from %s where tgcol2 = 4' % (mt)) + tdSql.query('select * from %s where tgcol2 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 0 then + tdLog.info('tdSql.checkData(0, 2, 0)') + tdSql.checkData(0, 2, 0) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql describe $tb + tdLog.info('describe %s' % (tb)) + tdSql.query('describe %s' % (tb)) + # TSIM: print $data21 $data23 $data32 $data33 + tdLog.info('$data21 $data23 $data32 $data33') + # TSIM: if $data21 != BOOL then + tdLog.info('tdSql.checkDataType(2, 1, "BOOL")') + tdSql.checkDataType(2, 1, "BOOL") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data31 != INT then + tdLog.info('tdSql.checkDataType(3, 1, "INT")') + tdSql.checkDataType(3, 1, "INT") + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data23 != false then + tdLog.info('tdSql.checkData(2, 3, false)') + tdSql.checkData(2, 3, false) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data33 != 4 then + tdLog.info('tdSql.checkData(3, 3, 4)') + tdSql.checkData(3, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: $i = 3 + i = 3 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # smallint, tgcol2 tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $tb set tag tgcol1=3 + tdLog.info('alter table %s set tag tgcol1=3' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=3' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=4 + tdLog.info('alter table %s set tag tgcol2=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=4' % (tb)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 3 + tdLog.info('select * from %s where tgcol1 = 3' % (mt)) + tdSql.query('select * from %s where tgcol1 = 3' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 3 then + tdLog.info('tdSql.checkData(0, 2, 3)') + tdSql.checkData(0, 2, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 4 + tdLog.info('select * from %s where tgcol2 = 4' % (mt)) + tdSql.query('select * from %s where tgcol2 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 3 then + tdLog.info('tdSql.checkData(0, 2, 3)') + tdSql.checkData(0, 2, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 2 + tdLog.info('select * from %s where tgcol2 = 2' % (mt)) + tdSql.query('select * from %s where tgcol2 = 2' % (mt)) + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: $i = 4 + i = 4 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # bigint, tgcol2 float) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, 2 ) + tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = 1 + tdLog.info('select * from %s where tgcol1 = 1' % (mt)) + tdSql.query('select * from %s where tgcol1 = 1' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2.00000 then + tdLog.info('tdSql.checkData(0, 3, 2.00000)') + tdSql.checkData(0, 3, 2.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $tb set tag tgcol1=3 + tdLog.info('alter table %s set tag tgcol1=3' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=3' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=4 + tdLog.info('alter table %s set tag tgcol2=4' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=4' % (tb)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 3 + tdLog.info('select * from %s where tgcol1 = 3' % (mt)) + tdSql.query('select * from %s where tgcol1 = 3' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 3 then + tdLog.info('tdSql.checkData(0, 2, 3)') + tdSql.checkData(0, 2, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4.00000 then + tdLog.info('tdSql.checkData(0, 3, 4.00000)') + tdSql.checkData(0, 3, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 4 + tdLog.info('select * from %s where tgcol2 = 4' % (mt)) + tdSql.query('select * from %s where tgcol2 = 4' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 3 then + tdLog.info('tdSql.checkData(0, 2, 3)') + tdSql.checkData(0, 2, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4.00000 then + tdLog.info('tdSql.checkData(0, 3, 4.00000)') + tdSql.checkData(0, 3, 4.00000) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step5 + tdLog.info('=============== step5') + # TSIM: $i = 5 + i = 5 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # double, tgcol2 binary(10)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( 1, '2' ) + tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol2 = '2' + tdLog.info('select * from %s where tgcol2 = "2"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "2"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1.000000000 then + tdLog.info('tdSql.checkData(0, 2, 1.000000000)') + tdSql.checkData(0, 2, 1.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $tb set tag tgcol1=3 + tdLog.info('alter table %s set tag tgcol1=3' % (tb)) + tdSql.execute('alter table %s set tag tgcol1=3' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2='4' + tdLog.info('alter table %s set tag tgcol2="4"' % (tb)) + tdSql.execute('alter table %s set tag tgcol2="4"' % (tb)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = 3 + tdLog.info('select * from %s where tgcol1 = 3' % (mt)) + tdSql.query('select * from %s where tgcol1 = 3' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 3.000000000 then + tdLog.info('tdSql.checkData(0, 2, 3.000000000)') + tdSql.checkData(0, 2, 3.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = '4' + tdLog.info('select * from %s where tgcol2 = "4"' % (mt)) + tdSql.query('select * from %s where tgcol2 = "4"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 3.000000000 then + tdLog.info('tdSql.checkData(0, 2, 3.000000000)') + tdSql.checkData(0, 2, 3.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 4 then + tdLog.info('tdSql.checkData(0, 3, 4)') + tdSql.checkData(0, 3, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: $i = 6 + i = 6 + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 + # binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 + # double, tgcol6 binary(20)) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' % + (mt)) + # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) + tdLog.info( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + tdSql.execute( + 'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' % + (tb, mt)) + # TSIM: sql insert into $tb values(now, 1) + tdLog.info('insert into %s values(now, 1)' % (tb)) + tdSql.execute('insert into %s values(now, 1)' % (tb)) + # TSIM: sql select * from $mt where tgcol1 = '1' + tdLog.info('select * from %s where tgcol1 = "1"' % (mt)) + tdSql.query('select * from %s where tgcol1 = "1"' % (mt)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 1 then + tdLog.info('tdSql.checkData(0, 2, 1)') + tdSql.checkData(0, 2, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 2 then + tdLog.info('tdSql.checkData(0, 3, 2)') + tdSql.checkData(0, 3, 2) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 3 then + tdLog.info('tdSql.checkData(0, 4, 3)') + tdSql.checkData(0, 4, 3) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 4 then + tdLog.info('tdSql.checkData(0, 5, 4)') + tdSql.checkData(0, 5, 4) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 5.000000000 then + tdLog.info('tdSql.checkData(0, 6, 5.000000000)') + tdSql.checkData(0, 6, 5.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != 6 then + tdLog.info('tdSql.checkData(0, 7, 6)') + tdSql.checkData(0, 7, 6) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info('alter table %s drop tag tgcol3' % (mt)) + tdSql.execute('alter table %s drop tag tgcol3' % (mt)) + # TSIM: sql alter table $tb set tag tgcol1='7' + tdLog.info('alter table %s set tag tgcol1="7"' % (tb)) + tdSql.execute('alter table %s set tag tgcol1="7"' % (tb)) + # TSIM: sql alter table $tb set tag tgcol2=8 + tdLog.info('alter table %s set tag tgcol2=8' % (tb)) + tdSql.execute('alter table %s set tag tgcol2=8' % (tb)) + # TSIM: sql alter table $tb set tag tgcol4='9' + tdLog.info('alter table %s set tag tgcol4="9"' % (tb)) + tdSql.execute('alter table %s set tag tgcol4="9"' % (tb)) + # TSIM: sql alter table $tb set tag tgcol5=10 + tdLog.info('alter table %s set tag tgcol5=10' % (tb)) + tdSql.execute('alter table %s set tag tgcol5=10' % (tb)) + # TSIM: sql alter table $tb set tag tgcol6='11' + tdLog.info('alter table %s set tag tgcol6="11"' % (tb)) + tdSql.execute('alter table %s set tag tgcol6="11"' % (tb)) + # TSIM: + # TSIM: sql reset query cache + tdLog.info('reset query cache') + tdSql.execute('reset query cache') + # TSIM: + # TSIM: sql select * from $mt where tgcol1 = '7' + tdLog.info('select * from %s where tgcol1 = "7"' % (mt)) + tdSql.query('select * from %s where tgcol1 = "7"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 8 then + tdLog.info('tdSql.checkData(0, 3, 8)') + tdSql.checkData(0, 3, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 9 then + tdLog.info('tdSql.checkData(0, 4, 9)') + tdSql.checkData(0, 4, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 10.000000000 then + tdLog.info('tdSql.checkData(0, 5, 10.000000000)') + tdSql.checkData(0, 5, 10.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 11 then + tdLog.info('tdSql.checkData(0, 6, 11)') + tdSql.checkData(0, 6, 11) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol2 = 8 + tdLog.info('select * from %s where tgcol2 = 8' % (mt)) + tdSql.query('select * from %s where tgcol2 = 8' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 8 then + tdLog.info('tdSql.checkData(0, 3, 8)') + tdSql.checkData(0, 3, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 9 then + tdLog.info('tdSql.checkData(0, 4, 9)') + tdSql.checkData(0, 4, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 10.000000000 then + tdLog.info('tdSql.checkData(0, 5, 10.000000000)') + tdSql.checkData(0, 5, 10.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 11 then + tdLog.info('tdSql.checkData(0, 6, 11)') + tdSql.checkData(0, 6, 11) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol4 = '9' + tdLog.info('select * from %s where tgcol4 = "9"' % (mt)) + tdSql.query('select * from %s where tgcol4 = "9"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 8 then + tdLog.info('tdSql.checkData(0, 3, 8)') + tdSql.checkData(0, 3, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 9 then + tdLog.info('tdSql.checkData(0, 4, 9)') + tdSql.checkData(0, 4, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 10.000000000 then + tdLog.info('tdSql.checkData(0, 5, 10.000000000)') + tdSql.checkData(0, 5, 10.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 11 then + tdLog.info('tdSql.checkData(0, 6, 11)') + tdSql.checkData(0, 6, 11) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol5 = 10 + tdLog.info('select * from %s where tgcol5 = 10' % (mt)) + tdSql.query('select * from %s where tgcol5 = 10' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 8 then + tdLog.info('tdSql.checkData(0, 3, 8)') + tdSql.checkData(0, 3, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 9 then + tdLog.info('tdSql.checkData(0, 4, 9)') + tdSql.checkData(0, 4, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 10.000000000 then + tdLog.info('tdSql.checkData(0, 5, 10.000000000)') + tdSql.checkData(0, 5, 10.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 11 then + tdLog.info('tdSql.checkData(0, 6, 11)') + tdSql.checkData(0, 6, 11) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: sql select * from $mt where tgcol6 = '11' + tdLog.info('select * from %s where tgcol6 = "11"' % (mt)) + tdSql.query('select * from %s where tgcol6 = "11"' % (mt)) + # TSIM: print $data01 $data02 $data03 + tdLog.info('$data01 $data02 $data03') + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data01 != 1 then + tdLog.info('tdSql.checkData(0, 1, 1)') + tdSql.checkData(0, 1, 1) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data02 != 7 then + tdLog.info('tdSql.checkData(0, 2, 7)') + tdSql.checkData(0, 2, 7) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data03 != 8 then + tdLog.info('tdSql.checkData(0, 3, 8)') + tdSql.checkData(0, 3, 8) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data04 != 9 then + tdLog.info('tdSql.checkData(0, 4, 9)') + tdSql.checkData(0, 4, 9) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data05 != 10.000000000 then + tdLog.info('tdSql.checkData(0, 5, 10.000000000)') + tdSql.checkData(0, 5, 10.000000000) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data06 != 11 then + tdLog.info('tdSql.checkData(0, 6, 11)') + tdSql.checkData(0, 6, 11) + # TSIM: return -1 + #TSIM: endi + # TSIM: if $data07 != NULL then + tdLog.info('tdSql.checkData(0, 7, NULL)') + tdSql.checkData(0, 7, None) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('sql drop database $db') + tdSql.execute('sql drop database $db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/smallint.py b/tests/pytest/tag_lite/smallint.py new file mode 100644 index 0000000000..324deb3632 --- /dev/null +++ b/tests/pytest/tag_lite/smallint.py @@ -0,0 +1,584 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_sm_db + # TSIM: $tbPrefix = ta_sm_tb + tbPrefix = "ta_sm_tb" + # TSIM: $mtPrefix = ta_sm_mt + mtPrefix = "ta_sm_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # smallint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol smallint)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0 ) + tdLog.info('create table %s using %s tags( 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 > 100000 and ts < 100000 + tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) + tdSql.query( + 'select * from %s where ts > 100000 and ts < 100000' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/tinyint.py b/tests/pytest/tag_lite/tinyint.py new file mode 100644 index 0000000000..9406f0b6c7 --- /dev/null +++ b/tests/pytest/tag_lite/tinyint.py @@ -0,0 +1,584 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + # TSIM: system sh/stop_dnodes.sh + # TSIM: + # TSIM: + # TSIM: system sh/deploy.sh -n dnode1 -i 1 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 + # TSIM: system sh/exec.sh -n dnode1 -s start + # TSIM: + # TSIM: sleep 3000 + # TSIM: sql connect + # TSIM: + # TSIM: print ======================== dnode1 start + tdLog.info('======================== dnode1 start') + # TSIM: + # TSIM: $dbPrefix = ta_ti_db + # TSIM: $tbPrefix = ta_ti_tb + tbPrefix = "ta_ti_tb" + # TSIM: $mtPrefix = ta_ti_mt + mtPrefix = "ta_ti_mt" + # TSIM: $tbNum = 10 + tbNum = 10 + # TSIM: $rowNum = 20 + rowNum = 20 + # TSIM: $totalNum = 200 + totalNum = 200 + # TSIM: + # TSIM: print =============== step1 + tdLog.info('=============== step1') + # TSIM: $i = 0 + i = 0 + # TSIM: $db = $dbPrefix . $i + # TSIM: $mt = $mtPrefix . $i + mt = "%s%d" % (mtPrefix, i) + # TSIM: + # TSIM: sql create database $db + # TSIM: sql use $db + # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol + # tinyint) + tdLog.info( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint)' % + (mt)) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol tinyint)' % + (mt)) + # TSIM: + # TSIM: $i = 0 + i = 0 + # TSIM: while $i < 5 + while (i < 5): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 0 ) + tdLog.info('create table %s using %s tags( 0 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 0 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: while $i < 10 + while (i < 10): + # TSIM: $tb = $tbPrefix . $i + tb = "%s%d" % (tbPrefix, i) + # TSIM: sql create table $tb using $mt tags( 1 ) + tdLog.info('create table %s using %s tags( 1 )' % (tb, mt)) + tdSql.execute('create table %s using %s tags( 1 )' % (tb, mt)) + # TSIM: $x = 0 + x = 0 + # TSIM: while $x < $rowNum + while (x < rowNum): + # TSIM: $ms = $x . m + ms = "%dm" % x + # TSIM: sql insert into $tb values (now + $ms , $x ) + tdLog.info( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + tdSql.execute( + 'insert into %s values (now + %s , %d )' % + (tb, ms, x)) + # TSIM: $x = $x + 1 + x = x + 1 + #TSIM: endw + # TSIM: $i = $i + 1 + i = i + 1 + #TSIM: endw + # TSIM: + # TSIM: print =============== step2 + tdLog.info('=============== step2') + # TSIM: sleep 100 + # TSIM: sql select * from $tb + tdLog.info('select * from %s' % (tb)) + tdSql.query('select * from %s' % (tb)) + # TSIM: if $rows != $rowNum then + tdLog.info('tdSql.checkRow($rowNum)') + 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: 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (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 + tdLog.info( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (tb)) + tdSql.query( + 'select * from %s where ts < now + 4m and ts > now + 5m' % + (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 > 100000 and ts < 100000 + tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) + tdSql.query( + 'select * from %s where ts > 100000 and ts < 100000' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 3m' % + (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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + (tb)) + # TSIM: if $rows != 1 then + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step3 + tdLog.info('=============== step3') + # TSIM: sql select * from $mt + tdLog.info('select * from %s' % (mt)) + tdSql.query('select * from %s' % (mt)) + # TSIM: if $rows != $totalNum then + tdLog.info('tdSql.checkRow($totalNum)') + tdSql.checkRows(totalNum) + # 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: 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: 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: 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 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 10 then + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step4 + tdLog.info('=============== step4') + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 1 + tdLog.info('select * from %s where tgcol = 1' % (mt)) + tdSql.query('select * from %s where tgcol = 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 1 + tdLog.info('select * from %s where tgcol <> 1' % (mt)) + tdSql.query('select * from %s where tgcol <> 1' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol = 0 + tdLog.info('select * from %s where tgcol = 0' % (mt)) + tdSql.query('select * from %s where tgcol = 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # TSIM: sql select * from $mt where tgcol <> 0 + tdLog.info('select * from %s where tgcol <> 0' % (mt)) + tdSql.query('select * from %s where tgcol <> 0' % (mt)) + # TSIM: if $rows != 100 then + tdLog.info('tdSql.checkRow(100)') + tdSql.checkRows(100) + # TSIM: return -1 + #TSIM: endi + # 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)) + tdSql.query( + 'select * from %s where ts > now + 4m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 1' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m 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)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts < now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts < now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol = 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + tdLog.info( + 'select * from %s where ts <= now + 4m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts <= now + 4m 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 + # tgcol <> 0 + tdLog.info( + 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and ts < now + 5m 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 + tdLog.info( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + tdSql.query( + 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + (mt)) + # TSIM: if $rows != 5 then + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step6 + tdLog.info('=============== step6') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 200 then + tdLog.info('tdSql.checkData(0, 0, 200)') + tdSql.checkData(0, 0, 200) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step7 + tdLog.info('=============== step7') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 50 then + tdLog.info('tdSql.checkData(0, 0, 50)') + tdSql.checkData(0, 0, 50) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== step9 + tdLog.info('=============== step9') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 tgcol = 1 group + # by tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = 1 group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 100 then + tdLog.info('tdSql.checkData(0, 0, 100)') + tdSql.checkData(0, 0, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # 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 + # 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' % + (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' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data00 != 25 then + tdLog.info('tdSql.checkData(0, 0, 25)') + tdSql.checkData(0, 0, 25) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: + # TSIM: print =============== step12 + tdLog.info('=============== step12') + # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), + # max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by + # tgcol + tdLog.info( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + tdSql.query( + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s interval(1d) group by tgcol' % + (mt)) + # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') + # TSIM: if $data01 != 100 then + tdLog.info('tdSql.checkData(0, 1, 100)') + tdSql.checkData(0, 1, 100) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: print =============== clear + tdLog.info('=============== clear') + # TSIM: sql drop database $db + tdLog.info('drop database db') + tdSql.execute('drop database db') + # TSIM: sql show databases + tdLog.info('show databases') + tdSql.query('show databases') + # TSIM: if $rows != 0 then + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) + # TSIM: return -1 + #TSIM: endi + # TSIM: + # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/test.py b/tests/pytest/test.py index 9d76b0a70e..86417ea931 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -79,6 +79,9 @@ if __name__ == "__main__": time.sleep(1) processID = subprocess.check_output(psCmd, shell=True) + fuserCmd = "fuser -k -n tcp 6030" + os.system(fuserCmd) + tdLog.info('stop All dnodes') sys.exit(0) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 727016adb3..ea178baf93 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -234,13 +234,15 @@ class TDDnode: if self.running != 0: psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") while(processID): killCmd = "kill -INT %s" % processID os.system(killCmd) time.sleep(1) - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") self.running = 0 tdLog.debug("dnode:%d is stopped by kill -INT" % (self.index)) @@ -253,13 +255,15 @@ class TDDnode: if self.running != 0: psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") while(processID): killCmd = "kill -KILL %s" % processID os.system(killCmd) time.sleep(1) - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") self.running = 0 tdLog.debug("dnode:%d is stopped by kill -KILL" % (self.index)) @@ -310,7 +314,8 @@ class TDDnodes: killCmd = "kill -KILL %s" % processID os.system(killCmd) time.sleep(1) - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") @@ -318,7 +323,8 @@ class TDDnodes: killCmd = "kill -KILL %s" % processID os.system(killCmd) time.sleep(1) - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") binPath = os.path.dirname(os.path.realpath(__file__)) binPath = binPath + "/../../../debug/" @@ -416,7 +422,8 @@ class TDDnodes: killCmd = "kill -KILL %s" % processID os.system(killCmd) time.sleep(1) - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") @@ -424,7 +431,8 @@ class TDDnodes: killCmd = "kill -KILL %s" % processID os.system(killCmd) time.sleep(1) - processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") # if os.system(cmd) != 0 : # tdLog.exit(cmd) diff --git a/tests/pytest/util/log.py b/tests/pytest/util/log.py index bcd840999d..55cd42a6eb 100644 --- a/tests/pytest/util/log.py +++ b/tests/pytest/util/log.py @@ -23,7 +23,7 @@ class TDLog: self.path = "" def info(self, info): - print("%s %s" % (datetime.datetime.now(), info)) + print("%s %s\n" % (datetime.datetime.now(), info)) def sleep(self, sec): print("%s sleep %d seconds" % (datetime.datetime.now(), sec)) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 1cc0eddbfc..eb53129722 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -77,6 +77,31 @@ class TDSql: tdLog.info("sql:%s, queryRows:%d == expect:%d" % (self.sql, self.queryRows, expectRows)) + def checkDataType(self, row, col, dataType): + frame = inspect.stack()[1] + callerModule = inspect.getmodule(frame[0]) + callerFilename = callerModule.__file__ + + if row < 0: + tdLog.exit( + "%s failed: sql:%s, row:%d is smaller than zero" % + (callerFilename, self.sql, row)) + if col < 0: + tdLog.exit( + "%s failed: sql:%s, col:%d is smaller than zero" % + (callerFilename, self.sql, col)) + if row > self.queryRows: + tdLog.exit( + "%s failed: sql:%s, row:%d is larger than queryRows:%d" % + (callerFilename, self.sql, row, self.queryRows)) + if col > self.queryCols: + tdLog.exit( + "%s failed: sql:%s, col:%d is larger than queryCols:%d" % + (callerFilename, self.sql, col, self.queryCols)) + + return self.cursor.istype(col, dataType) + + def checkData(self, row, col, data): frame = inspect.stack()[1] callerModule = inspect.getmodule(frame[0]) @@ -157,8 +182,9 @@ class TDSql: callerModule = inspect.getmodule(frame[0]) callerFilename = callerModule.__file__ - tdLog.exit("%s failed: sql:%s, affectedRows:%d != expect:%d" % ( - callerFilename, self.sql, self.affectedRows, expectAffectedRows)) + tdLog.exit( + "%s failed: sql:%s, affectedRows:%d != expect:%d" % + (callerFilename, self.sql, self.affectedRows, expectAffectedRows)) tdLog.info("sql:%s, affectedRows:%d == expect:%d" % (self.sql, self.affectedRows, expectAffectedRows)) diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim new file mode 100644 index 0000000000..f871ead11d --- /dev/null +++ b/tests/script/general/db/alter_option.sim @@ -0,0 +1,69 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 + +system sh/exec.sh -n dnode1 -s start + +sleep 3000 +sql connect +print ============================ dnode1 start + +sql create database db maxTables 500 cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 +sql show databases +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +if $data00 != db then + return -1 +endi +if $data02 != 0 then + return -1 +endi +if $data03 != 0 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 10 then + return -1 +endi +if $data06 != 20,20,20 then + return -1 +endi +if $data07 != 500 then + return -1 +endi +if $data08 != 2 then + return -1 +endi +if $data09 != 4 then + return -1 +endi + +print =============== step2 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +return +sql_error alter database db cache 256 +sql_error alter database db blocks 1 +sql_error alter database db maxTables 10 +sql_error alter database db days 10 +sql_error alter database db keep 10 +sql_error alter database db minRows 350 +sql_error alter database db minRows 550 +sql_error alter database db ctime 5000 +sql_error alter database db precision "us" +sql_error alter database db comp 3 +sql_error alter database db wal 1 +sql_error alter database db replica 2 + + +print ============== step3 +sql alter database db maxTables 1000 +sql alter database db comp 1 +sql alter database db blocks 40 +sql alter database db keep 30 + + + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/autocreate.sim b/tests/script/general/http/autocreate.sim new file mode 100644 index 0000000000..7c1fdcd0f8 --- /dev/null +++ b/tests/script/general/http/autocreate.sim @@ -0,0 +1,28 @@ +system sh/stop_dnodes.sh +sleep 3000 +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 +system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 +system sh/exec.sh -n dnode1 -s start + +sleep 3000 +sql connect + +print ============================ dnode1 start + +print =============== step1 - prepare data +sql create database db +sql use db +sql create table if not exists db.win_cpu(ts timestamp,f_percent_dpc_time double,f_percent_idle_time double,f_percent_interrupt_time double,f_percent_privileged_time double,f_percent_processor_time double,f_percent_user_time double) tags(t_host binary(32),t_instance binary(32),t_objectname binary(32)); + +print =============== step2 - auto create + +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'import into db.win_cpu_windows_1_processor using db.win_cpu tags('windows','1','Processor') values(1564641722000,0.000000,95.598305,0.000000,0.000000,0.000000,0.000000);' 127.0.0.1:6020/rest/sql +print curl 127.0.0.1:6020/rest/sql -----> $system_content +#if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then +# return -1 +#endi + + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/import/replica1.sim b/tests/script/general/import/replica1.sim index 1bd1419496..ad5a3faed5 100644 --- a/tests/script/general/import/replica1.sim +++ b/tests/script/general/import/replica1.sim @@ -123,7 +123,7 @@ sql insert into tb values(1520000025002, 25002) sql insert into tb values(1520000060000, 60000) sql select * from tb; print $rows -if $rows != 24 then +if $rows != 23 then return -1 endi @@ -156,7 +156,7 @@ sql import into tb values(1523110400000, 50001) sql import into tb values(1521382400000, 500051) sql select * from tb; print $rows -if $rows != 36 then +if $rows != 35 then return -1 endi @@ -169,7 +169,7 @@ sleep 5000 sql use ir1db sql select * from tb; print $rows -if $rows != 36 then +if $rows != 35 then return -1 endi @@ -178,7 +178,7 @@ print ================= step11 #sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003) sql select * from tb; -if $rows != 41 then +if $rows != 40 then return -1 endi @@ -188,7 +188,7 @@ print ================= step12 sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003) sql select * from tb; print $rows -if $rows != 50 then +if $rows != 49 then return -1 endi @@ -204,7 +204,7 @@ sql import into tb values(1516716800000, 50001) sql import into tb values(1517580800000, 50001) sql select * from tb; -if $rows != 50 then +if $rows != 52 then return -1 endi diff --git a/tests/script/general/table/column_value.sim b/tests/script/general/table/column_value.sim index 72f5faee63..117c288b36 100644 --- a/tests/script/general/table/column_value.sim +++ b/tests/script/general/table/column_value.sim @@ -60,11 +60,9 @@ if $rows != 0 then endi print =============== step4 -sql create table $tb (ts timestamp, speed double, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) -x step4 - return -1 -step4: +sql create table $tb (ts timestamp, speed double, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) sql show tables -if $rows != 0 then +if $rows != 1 then return -1 endi diff --git a/tests/script/general/tag/create.sim b/tests/script/general/tag/create.sim index 3e16810f91..adbb14e88a 100644 --- a/tests/script/general/tag/create.sim +++ b/tests/script/general/tag/create.sim @@ -579,7 +579,7 @@ $i = 30 $mt = $mtPrefix . $i $tb = $tbPrefix . $i sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250), tgcol3 binary(30)) -x step30 - return -1 +# return -1 step30: print =============== step31 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 272183b26d..ea2c538ddf 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -32,7 +32,7 @@ cd ../../../debug; make ./test.sh -f general/compute/diff.sim ./test.sh -f general/compute/diff2.sim ./test.sh -f general/compute/first.sim -# liao ./test.sh -f general/compute/interval.sim +./test.sh -f general/compute/interval.sim ./test.sh -f general/compute/last.sim ./test.sh -f general/compute/leastsquare.sim ./test.sh -f general/compute/max.sim @@ -43,23 +43,24 @@ cd ../../../debug; make ./test.sh -f general/compute/sum.sim ./test.sh -f general/compute/top.sim +./test.sh -f general/db/alter_option.sim ./test.sh -f general/db/basic.sim ./test.sh -f general/db/basic1.sim ./test.sh -f general/db/basic2.sim ./test.sh -f general/db/basic3.sim ./test.sh -f general/db/basic4.sim ./test.sh -f general/db/basic5.sim -./test.sh -f general/db/delete.sim ./test.sh -f general/db/delete_reuse1.sim ./test.sh -f general/db/delete_reuse2.sim ./test.sh -f general/db/delete_reusevnode.sim ./test.sh -f general/db/delete_reusevnode2.sim ./test.sh -f general/db/delete_writing1.sim ./test.sh -f general/db/delete_writing2.sim +./test.sh -f general/db/delete.sim ./test.sh -f general/db/len.sim -#liao ./test.sh -f general/db/vnodes.sim ./test.sh -f general/db/repeat.sim ./test.sh -f general/db/tables.sim +#liao ./test.sh -f general/db/vnodes.sim ./test.sh -f general/field/2.sim ./test.sh -f general/field/3.sim @@ -102,9 +103,9 @@ cd ../../../debug; make #unsupport ./test.sh -f general/parser/alter_stable.sim ./test.sh -f general/parser/auto_create_tb.sim ./test.sh -f general/parser/auto_create_tb_drop_tb.sim -./test.sh -f general/parser/col_arithmetic_operation.sim +#liao ./test.sh -f general/parser/col_arithmetic_operation.sim ./test.sh -f general/parser/columnValue.sim -./test.sh -f general/parser/commit.sim +#liao ./test.sh -f general/parser/commit.sim # ./test.sh -f general/parser/create_db.sim # ./test.sh -f general/parser/create_mt.sim # ./test.sh -f general/parser/create_tb.sim @@ -129,7 +130,7 @@ cd ../../../debug; make # ./test.sh -f general/parser/limit1_tblocks100.sim # ./test.sh -f general/parser/limit2.sim # ./test.sh -f general/parser/mixed_blocks.sim -# ./test.sh -f general/parser/selectResNum.sim +./test.sh -f general/parser/selectResNum.sim # ./test.sh -f general/parser/select_across_vnodes.sim # ./test.sh -f general/parser/set_tag_vals.sim # ./test.sh -f general/parser/slimit.sim @@ -170,7 +171,7 @@ cd ../../../debug; make ./test.sh -f general/table/db.table.sim ./test.sh -f general/table/delete_reuse1.sim ./test.sh -f general/table/delete_reuse2.sim -#hongze ./test.sh -f general/table/delete_writing.sim +#liao ./test.sh -f general/table/delete_writing.sim ./test.sh -f general/table/describe.sim ./test.sh -f general/table/double.sim ./test.sh -f general/table/fill.sim @@ -252,15 +253,15 @@ cd ../../../debug; make ./test.sh -u -f unique/column/replica3.sim -#liao wait ./test.sh -u -f unique/db/commit.sim +./test.sh -u -f unique/db/commit.sim ./test.sh -u -f unique/db/delete.sim ./test.sh -u -f unique/db/delete_part.sim ./test.sh -u -f unique/db/replica_add12.sim -#hongze ./test.sh -u -f unique/db/replica_add13.sim -#hongze wait ./test.sh -u -f unique/db/replica_add23.sim -#hongze wait ./test.sh -u -f unique/db/replica_reduce21.sim +./test.sh -u -f unique/db/replica_add13.sim +./test.sh -u -f unique/db/replica_add23.sim +./test.sh -u -f unique/db/replica_reduce21.sim ./test.sh -u -f unique/db/replica_reduce32.sim -#hongze wait /test.sh -u -f unique/db/replica_reduce31.sim +./test.sh -u -f unique/db/replica_reduce31.sim ./test.sh -u -f unique/db/replica_part.sim ./test.sh -u -f unique/dnode/balance1.sim @@ -268,7 +269,7 @@ cd ../../../debug; make ./test.sh -u -f unique/dnode/balance3.sim ./test.sh -u -f unique/dnode/balancex.sim ./test.sh -u -f unique/dnode/offline1.sim -#hongze wait ./test.sh -u -f unique/dnode/offline2.sim +#jeff ./test.sh -u -f unique/dnode/offline2.sim ./test.sh -u -f unique/dnode/remove1.sim #hongze ./test.sh -u -f unique/dnode/remove2.sim ./test.sh -u -f unique/dnode/vnode_clean.sim diff --git a/tests/script/unique/big/restartSpeed.sim b/tests/script/unique/big/restartSpeed.sim new file mode 100644 index 0000000000..5ab77f5fa6 --- /dev/null +++ b/tests/script/unique/big/restartSpeed.sim @@ -0,0 +1,43 @@ +system sh/stop_dnodes.sh + +$totalVnodes = 20 +$minVnodes = 10 +$maxVnodes = 10 +$maxTables = 4 +$totalRows = $totalVnodes * $maxTables + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v $totalVnodes +system sh/deploy.sh -n dnode2 -i 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v $totalVnodes + + +print ========== prepare data +system sh/exec_up.sh -n dnode1 -s start +sleep 3000 +sql connect +sql create database db blocks 2 cache 1 maxTables $maxTables +sql use db + +print ========== step1 +sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) + +$x = 0 +while $x < $totalRows + $tb = t . $x + sql create table $tb using mt tags( $x ) + sql insert into $tb values (now, $x ) + $x = $x + 1 +endw + + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/column/replica3.sim b/tests/script/unique/column/replica3.sim index 4b08b13e2f..4e45edc02d 100644 --- a/tests/script/unique/column/replica3.sim +++ b/tests/script/unique/column/replica3.sim @@ -29,6 +29,10 @@ while $x < 1010 $x = $x + 1 endw +sql_error create database d1 replica 2 wal 0 +sql create database d2 replica 1 wal 0 +sql_error alter database d2 replica 2 + system sh/exec_up.sh -n dnode1 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode3 -s stop -x SIGINT diff --git a/tests/script/unique/db/replica_add23.sim b/tests/script/unique/db/replica_add23.sim index 995cd4116c..2d293183af 100644 --- a/tests/script/unique/db/replica_add23.sim +++ b/tests/script/unique/db/replica_add23.sim @@ -47,10 +47,10 @@ sql create table d2.t2 (ts timestamp, i int) sql create table d3.t3 (ts timestamp, i int) sql create table d4.t4 (ts timestamp, i int) -sql insert into d1.t1 values(now, 1) -sql insert into d2.t2 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) +sql insert into d1.t1 values(1588262400001, 1) +sql insert into d2.t2 values(1588262400001, 1) +sql insert into d3.t3 values(1588262400001, 1) +sql insert into d4.t4 values(1588262400001, 1) sql select * from d1.t1 if $rows != 1 then @@ -111,10 +111,10 @@ if $data2_3 != 4 then endi print ======== step4 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) +sql insert into d1.t1 values(1588262400002, 2) +sql insert into d2.t2 values(1588262400002, 2) +sql insert into d3.t3 values(1588262400002, 2) +sql insert into d4.t4 values(1588262400002, 2) sql select * from d1.t1 if $rows != 2 then @@ -143,10 +143,10 @@ print ========= step5 system sh/exec_up.sh -n dnode2 -s stop -x SIGINT sleep 5000 -sql insert into d1.t1 values(now, 3) -sql insert into d2.t2 values(now, 3) -sql insert into d3.t3 values(now, 3) -sql insert into d4.t4 values(now, 3) +sql insert into d1.t1 values(1588262400003, 3) +sql insert into d2.t2 values(1588262400003, 3) +sql insert into d3.t3 values(1588262400003, 3) +sql insert into d4.t4 values(1588262400003, 3) sql select * from d1.t1 if $rows != 3 then @@ -174,10 +174,10 @@ sleep 5000 system sh/exec_up.sh -n dnode3 -s stop -x SIGINT sleep 5000 -sql insert into d1.t1 values(now, 4) -sql insert into d2.t2 values(now, 4) -sql insert into d3.t3 values(now, 4) -sql insert into d4.t4 values(now, 4) +sql insert into d1.t1 values(1588262400004, 4) +sql insert into d2.t2 values(1588262400004, 4) +sql insert into d3.t3 values(1588262400004, 4) +sql insert into d4.t4 values(1588262400004, 4) sql select * from d1.t1 if $rows != 4 then @@ -205,10 +205,10 @@ sleep 5000 system sh/exec_up.sh -n dnode4 -s stop -x SIGINT sleep 5000 -sql insert into d1.t1 values(now, 5) -sql insert into d2.t2 values(now, 5) -sql insert into d3.t3 values(now, 5) -sql insert into d4.t4 values(now, 5) +sql insert into d1.t1 values(1588262400005, 5) +sql insert into d2.t2 values(1588262400005, 5) +sql insert into d3.t3 values(1588262400005, 5) +sql insert into d4.t4 values(1588262400005, 5) sql select * from d1.t1 if $rows != 5 then @@ -236,10 +236,10 @@ sleep 5000 system sh/exec_up.sh -n dnode2 -s stop -x SIGINT sleep 5000 -sql insert into d1.t1 values(now, 6) -sql insert into d2.t2 values(now, 6) -sql insert into d3.t3 values(now, 6) -sql insert into d4.t4 values(now, 6) +sql insert into d1.t1 values(1588262400006, 6) +sql insert into d2.t2 values(1588262400006, 6) +sql insert into d3.t3 values(1588262400006, 6) +sql insert into d4.t4 values(1588262400006, 6) sql select * from d1.t1 if $rows != 6 then diff --git a/tests/script/unique/dnode/offline2.sim b/tests/script/unique/dnode/offline2.sim index c526e45b6e..9d8ba8bf9d 100644 --- a/tests/script/unique/dnode/offline2.sim +++ b/tests/script/unique/dnode/offline2.sim @@ -29,7 +29,7 @@ sleep 3000 sql create database d1 replica 2 maxTables 4 sql create table d1.t1(ts timestamp, i int) -sql insert into d1.t1 values(now, 1) +sql insert into d1.t1 values(1588262400001, 1) sql show dnodes print dnode1 $data4_1 diff --git a/tests/script/unique/dnode/remove2.sim b/tests/script/unique/dnode/remove2.sim index 77ec1fa630..73e7a31250 100644 --- a/tests/script/unique/dnode/remove2.sim +++ b/tests/script/unique/dnode/remove2.sim @@ -22,19 +22,19 @@ sql connect sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) +sql insert into d1.t1 values(1588262400001, 15) +sql insert into d1.t1 values(1588262400002, 14) +sql insert into d1.t1 values(1588262400003, 13) +sql insert into d1.t1 values(1588262400004, 12) +sql insert into d1.t1 values(1588262400005, 11) sql create database d2 maxTables 4 sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) +sql insert into d2.t2 values(1588262400001, 25) +sql insert into d2.t2 values(1588262400002, 24) +sql insert into d2.t2 values(1588262400003, 23) +sql insert into d2.t2 values(1588262400004, 22) +sql insert into d2.t2 values(1588262400005, 21) sql show dnodes print dnode1 openVnodes $data2_1 @@ -49,11 +49,11 @@ sleep 9000 sql create database d3 replica 2 maxTables 4 sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) +sql insert into d3.t3 values(1588262400001, 35) +sql insert into d3.t3 values(1588262400002, 34) +sql insert into d3.t3 values(1588262400003, 33) +sql insert into d3.t3 values(1588262400004, 32) +sql insert into d3.t3 values(1588262400005, 31) $x = 0 show2: