diff --git a/cmake/cmake.define b/cmake/cmake.define index 78eab0a59a..3f152f1f09 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -100,6 +100,8 @@ IF (TD_WINDOWS) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}") + SET(JEMALLOC_ENABLED OFF) + ELSE () IF (${TD_DARWIN}) set(CMAKE_MACOSX_RPATH 0) diff --git a/examples/c/tmq.c b/examples/c/tmq.c index d3fc803c94..1147671ea1 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -47,7 +47,7 @@ static int32_t msg_process(TAOS_RES* msg) { int32_t precision = taos_result_precision(msg); rows++; taos_print_row(buf, row, fields, numOfFields); - printf("row content: %s\n", buf); + printf("precision: %d, row content: %s\n", precision, buf); } return rows; @@ -70,7 +70,7 @@ static int32_t init_env() { taos_free_result(pRes); // create database - pRes = taos_query(pConn, "create database tmqdb"); + pRes = taos_query(pConn, "create database tmqdb precision 'ns'"); if (taos_errno(pRes) != 0) { printf("error in create tmqdb, reason:%s\n", taos_errstr(pRes)); return -1; diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index d4dde391c8..f777d10918 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -47,6 +47,15 @@ copy %binary_dir%\\build\\bin\\udfd.exe %tagert_dir% > nul if exist %binary_dir%\\build\\bin\\taosBenchmark.exe ( copy %binary_dir%\\build\\bin\\taosBenchmark.exe %tagert_dir% > nul ) +if exist %binary_dir%\\build\\lib\\taosws.dll.lib ( + copy %binary_dir%\\build\\lib\\taosws.dll.lib %tagert_dir%\\driver > nul +) +if exist %binary_dir%\\build\\lib\\taosws.dll ( + copy %binary_dir%\\build\\lib\\taosws.dll %tagert_dir%\\driver > nul +) +if exist %binary_dir%\\build\\bin\\taosdump.exe ( + copy %binary_dir%\\build\\bin\\taosdump.exe %tagert_dir% > nul +) if exist %binary_dir%\\build\\bin\\taosadapter.exe ( copy %binary_dir%\\build\\bin\\taosadapter.exe %tagert_dir% > nul ) @@ -54,4 +63,7 @@ if exist %binary_dir%\\build\\bin\\taosadapter.exe ( mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&& echo To start/stop TDengine with administrator privileges: sc start/stop taosd &goto :eof :hasAdmin copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul +if exist C:\\TDengine\\driver\\taosws.dll ( + copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul +) sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index a4ca1f796b..c18e1e3e40 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1619,7 +1619,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { taosGetQitem(tmq->qall, (void**)&rspWrapper); if (rspWrapper == NULL) { - tscDebug("consumer %" PRId64 " mqueue empty", tmq->consumerId); + /*tscDebug("consumer %" PRId64 " mqueue empty", tmq->consumerId);*/ return NULL; } } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index aea689c0de..a001126b21 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5988,7 +5988,11 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { if (pRsp->withSchema) { SSchemaWrapper *pSW = (SSchemaWrapper *)taosMemoryCalloc(1, sizeof(SSchemaWrapper)); if (pSW == NULL) return -1; - if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) return -1; + if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) { + taosMemoryFree(pSW); + return -1; + } + taosArrayPush(pRsp->blockSchema, &pSW); } @@ -6069,7 +6073,10 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, STaosxRsp *pRsp) { if (pRsp->withSchema) { SSchemaWrapper *pSW = (SSchemaWrapper *)taosMemoryCalloc(1, sizeof(SSchemaWrapper)); if (pSW == NULL) return -1; - if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) return -1; + if (tDecodeSSchemaWrapper(pDecoder, pSW) < 0) { + taosMemoryFree(pSW); + return -1; + } taosArrayPush(pRsp->blockSchema, &pSW); } diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index edd23c80be..ef54adf0d6 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -155,7 +155,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea // tqExec int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp* pRsp); -int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols); +int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols, int8_t precision); int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp); int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 8bf1522d6c..42a597a305 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -433,16 +433,9 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su } #endif - if (subType == TOPIC_SUB_TYPE__COLUMN) { - pRsp->withSchema = false; - } else { - pRsp->withSchema = true; - pRsp->blockSchema = taosArrayInit(0, sizeof(void*)); - if (pRsp->blockSchema == NULL) { - // TODO free - return -1; - } - } + ASSERT(subType == TOPIC_SUB_TYPE__COLUMN); + pRsp->withSchema = false; + return 0; } diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 30f6f81aa9..a6e8767a4d 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -15,14 +15,14 @@ #include "tq.h" -int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols) { +int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols, int8_t precision) { int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); void* buf = taosMemoryCalloc(1, dataStrLen); if (buf == NULL) return -1; SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)buf; pRetrieve->useconds = 0; - pRetrieve->precision = TSDB_DEFAULT_PRECISION; + pRetrieve->precision = precision; pRetrieve->compressed = 0; pRetrieve->completed = 1; pRetrieve->numOfRows = htonl(pBlock->info.rows); @@ -95,7 +95,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs break; } - tqAddBlockDataToRsp(pDataBlock, pRsp, pExec->numOfCols); + tqAddBlockDataToRsp(pDataBlock, pRsp, pExec->numOfCols, pTq->pVnode->config.tsdbCfg.precision); pRsp->blockNum++; if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { @@ -174,7 +174,8 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } } - tqAddBlockDataToRsp(pDataBlock, (SMqDataRsp*)pRsp, taosArrayGetSize(pDataBlock->pDataBlock)); + tqAddBlockDataToRsp(pDataBlock, (SMqDataRsp*)pRsp, taosArrayGetSize(pDataBlock->pDataBlock), + pTq->pVnode->config.tsdbCfg.precision); pRsp->blockNum++; if (pOffset->type == TMQ_OFFSET__LOG) { continue; @@ -256,7 +257,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp pRsp->createTableNum++; } } - tqAddBlockDataToRsp(&block, (SMqDataRsp*)pRsp, taosArrayGetSize(block.pDataBlock)); + tqAddBlockDataToRsp(&block, (SMqDataRsp*)pRsp, taosArrayGetSize(block.pDataBlock), + pTq->pVnode->config.tsdbCfg.precision); blockDataFreeRes(&block); tqAddBlockSchemaToRsp(pExec, (SMqDataRsp*)pRsp); pRsp->blockNum++; @@ -291,7 +293,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp pRsp->createTableNum++; } } - tqAddBlockDataToRsp(&block, (SMqDataRsp*)pRsp, taosArrayGetSize(block.pDataBlock)); + tqAddBlockDataToRsp(&block, (SMqDataRsp*)pRsp, taosArrayGetSize(block.pDataBlock), + pTq->pVnode->config.tsdbCfg.precision); blockDataFreeRes(&block); tqAddBlockSchemaToRsp(pExec, (SMqDataRsp*)pRsp); pRsp->blockNum++; diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c index 35cb305042..12d5b4112b 100644 --- a/source/dnode/vnode/src/tq/tqPush.c +++ b/source/dnode/vnode/src/tq/tqPush.c @@ -270,7 +270,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) break; } - tqAddBlockDataToRsp(pDataBlock, pRsp, pExec->numOfCols); + tqAddBlockDataToRsp(pDataBlock, pRsp, pExec->numOfCols, pTq->pVnode->config.tsdbCfg.precision); pRsp->blockNum++; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index ebfbacaa9e..287d80759e 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2325,9 +2325,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock); pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } } @@ -2337,6 +2334,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { } if (ts == pSliceInfo->current) { + blockDataEnsureCapacity(pResBlock, pResBlock->info.rows + 1); for (int32_t j = 0; j < pOperator->exprSupp.numOfExprs; ++j) { SExprInfo* pExprInfo = &pOperator->exprSupp.pExprInfo[j]; @@ -2377,9 +2375,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock); pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } if (pSliceInfo->current > pSliceInfo->win.ekey) { @@ -2398,10 +2393,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { doSetOperatorCompleted(pOperator); break; } - - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } } else if (ts < pSliceInfo->current) { // in case of interpolation window starts and ends between two datapoints, fill(prev) need to interpolate @@ -2419,9 +2410,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock); pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } if (pSliceInfo->current > pSliceInfo->win.ekey) { @@ -2443,9 +2431,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock); pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } if (pSliceInfo->current > pSliceInfo->win.ekey) { @@ -2467,13 +2452,11 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock); pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } // add current row if timestamp match if (ts == pSliceInfo->current && pSliceInfo->current <= pSliceInfo->win.ekey) { + blockDataEnsureCapacity(pResBlock, pResBlock->info.rows + 1); for (int32_t j = 0; j < pOperator->exprSupp.numOfExprs; ++j) { SExprInfo* pExprInfo = &pOperator->exprSupp.pExprInfo[j]; @@ -2510,9 +2493,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock); pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } if (pSliceInfo->current > pSliceInfo->win.ekey) { @@ -2528,9 +2508,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } } @@ -2549,9 +2526,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { genInterpolationResult(pSliceInfo, &pOperator->exprSupp, pResBlock); pSliceInfo->current = taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision); - if (pResBlock->info.rows >= pResBlock->info.capacity) { - break; - } } // restore the value diff --git a/source/libs/wal/src/walRef.c b/source/libs/wal/src/walRef.c index 5a14bcf962..f9994fd315 100644 --- a/source/libs/wal/src/walRef.c +++ b/source/libs/wal/src/walRef.c @@ -32,6 +32,7 @@ SWalRef *walOpenRef(SWal *pWal) { return pRef; } +#if 0 void walCloseRef(SWal *pWal, int64_t refId) { SWalRef **ppRef = taosHashGet(pWal->pRefHash, &refId, sizeof(int64_t)); if (ppRef == NULL) return; @@ -39,6 +40,7 @@ void walCloseRef(SWal *pWal, int64_t refId) { taosHashRemove(pWal->pRefHash, &refId, sizeof(int64_t)); taosMemoryFree(pRef); } +#endif int32_t walRefVer(SWalRef *pRef, int64_t ver) { SWal *pWal = pRef->pWal; @@ -65,10 +67,12 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) { return 0; } +#if 0 void walUnrefVer(SWalRef *pRef) { pRef->refId = -1; pRef->refFile = -1; } +#endif SWalRef *walRefCommittedVer(SWal *pWal) { SWalRef *pRef = walOpenRef(pWal); diff --git a/source/libs/wal/src/walSeek.c b/source/libs/wal/src/walSeek.c index 4b75db52b7..2cb6614b01 100644 --- a/source/libs/wal/src/walSeek.c +++ b/source/libs/wal/src/walSeek.c @@ -19,6 +19,7 @@ #include "tref.h" #include "walInt.h" +#if 0 static int64_t walSeekWritePos(SWal* pWal, int64_t ver) { int64_t code = 0; @@ -47,6 +48,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) { } return 0; } +#endif int walInitWriteFile(SWal* pWal) { TdFilePtr pIdxTFile, pLogTFile; @@ -134,6 +136,7 @@ int64_t walChangeWrite(SWal* pWal, int64_t ver) { return fileFirstVer; } +#if 0 int walSeekWriteVer(SWal* pWal, int64_t ver) { int64_t code; if (ver == pWal->vers.lastVer) { @@ -158,3 +161,4 @@ int walSeekWriteVer(SWal* pWal, int64_t ver) { return 0; } +#endif diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index 673e795297..c25d1d1f33 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -15,28 +15,30 @@ from util.log import * from util.cases import * from util.sql import * -import subprocess from util.common import * +from util.sqlset import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) - self.dbname = 'db' + self.setsql = TDSetSql() self.ins_param_list = ['dnodes','mnodes','qnodes','cluster','functions','users','grants','topics','subscriptions','streams'] self.perf_param = ['apps','connections','consumers','queries','transactions'] self.perf_param_list = ['apps','connections','consumers','queries','trans'] def ins_check(self): + tdSql.prepare() for param in self.ins_param_list: tdSql.query(f'show {param}') show_result = tdSql.queryResult tdSql.query(f'select * from information_schema.ins_{param}') select_result = tdSql.queryResult tdSql.checkEqual(show_result,select_result) - + tdSql.execute('drop database db') def perf_check(self): + tdSql.prepare() for param in range(len(self.perf_param_list)): tdSql.query(f'show {self.perf_param[param]}') if len(tdSql.queryResult) != 0: @@ -46,11 +48,74 @@ class TDTestCase: tdSql.checkEqual(show_result,select_result) else : continue - def run(self): + tdSql.execute('drop database db') + def set_stb_sql(self,stbname,column_dict,tag_dict): + column_sql = '' + tag_sql = '' + for k,v in column_dict.items(): + column_sql += f"{k} {v}, " + for k,v in tag_dict.items(): + tag_sql += f"{k} {v}, " + create_stb_sql = f'create stable {stbname} ({column_sql[:-2]}) tags ({tag_sql[:-2]})' + return create_stb_sql + def show_sql(self): tdSql.prepare() + tdSql.execute('use db') + stbname = f'`{tdCom.getLongName(5)}`' + tbname = f'`{tdCom.getLongName(3)}`' + column_dict = { + '`ts`': 'timestamp', + '`col1`': 'tinyint', + '`col2`': 'smallint', + '`col3`': 'int', + '`col4`': 'bigint', + '`col5`': 'tinyint unsigned', + '`col6`': 'smallint unsigned', + '`col7`': 'int unsigned', + '`col8`': 'bigint unsigned', + '`col9`': 'float', + '`col10`': 'double', + '`col11`': 'bool', + '`col12`': 'varchar(20)', + '`col13`': 'nchar(20)' + + } + tag_dict = { + '`t1`': 'tinyint', + '`t2`': 'smallint', + '`t3`': 'int', + '`t4`': 'bigint', + '`t5`': 'tinyint unsigned', + '`t6`': 'smallint unsigned', + '`t7`': 'int unsigned', + '`t8`': 'bigint unsigned', + '`t9`': 'float', + '`t10`': 'double', + '`t11`': 'bool', + '`t12`': 'varchar(20)', + '`t13`': 'nchar(20)', + '`t14`': 'timestamp' + + } + create_table_sql = self.set_stb_sql(stbname,column_dict,tag_dict) + tdSql.execute(create_table_sql) + tdSql.query(f'show create table {stbname}') + query_result = tdSql.queryResult + tdSql.checkEqual(query_result[0][1].lower(),create_table_sql) + tdSql.execute(f'create table {tbname} using {stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)') + tag_sql = '(' + for tag_keys in tag_dict.keys(): + tag_sql += f'{tag_keys}, ' + tags = f'{tag_sql[:-2]})' + sql = f'create table {tbname} using {stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)' + tdSql.query(f'show create table {tbname}') + query_result = tdSql.queryResult + tdSql.checkEqual(query_result[0][1].lower(),sql) + tdSql.execute('drop database db') + def run(self): self.ins_check() self.perf_check() - + self.show_sql() def stop(self): tdSql.close() @@ -58,3 +123,4 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) + diff --git a/tests/system-test/1-insert/tb_100w_data_order.py b/tests/system-test/1-insert/tb_100w_data_order.py new file mode 100644 index 0000000000..d489ba21bc --- /dev/null +++ b/tests/system-test/1-insert/tb_100w_data_order.py @@ -0,0 +1,77 @@ +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + self.ts = 1537146000000 + self.binary_str = 'taosdata' + self.nchar_str = '涛思数据' + + def set_create_normaltable_sql(self, ntbname, column_dict): + column_sql = '' + for k, v in column_dict.items(): + column_sql += f"{k} {v}," + create_ntb_sql = f'create table {ntbname} (ts timestamp,{column_sql[:-1]})' + return create_ntb_sql + + def set_create_stable_sql(self,stbname,column_dict,tag_dict): + column_sql = '' + tag_sql = '' + for k,v in column_dict.items(): + column_sql += f"{k} {v}," + for k,v in tag_dict.items(): + tag_sql += f"{k} {v}," + create_stb_sql = f'create table {stbname} (ts timestamp,{column_sql[:-1]}) tags({tag_sql[:-1]})' + return create_stb_sql + + def gen_batch_sql(self, ntbname, batch=10): + values_str = "" + for i in range(batch): + values_str += f'({self.ts}, 1, 1, 1, {i+1}, 1, 1, 1, {i+1}, {i+0.1}, {i+0.1}, {i%2}, {i+1}, {i+1}),' + self.ts += 1 + return f'insert into {ntbname} values {values_str[:-1]};' + + def query_ntb_order_by_col(self, batch_num, rows_count): + tdSql.prepare() + ntbname = f'db.{tdCom.getLongName(5, "letters")}' + column_dict = { + 'col1': 'tinyint', + 'col2': 'smallint', + 'col3': 'int', + 'col4': 'bigint', + 'col5': 'tinyint unsigned', + 'col6': 'smallint unsigned', + 'col7': 'int unsigned', + 'col8': 'bigint unsigned', + 'col9': 'float', + 'col10': 'double', + 'col11': 'bool', + 'col12': 'binary(20)', + 'col13': 'nchar(20)' + } + range_times = int(rows_count/batch_num) + create_ntb_sql = self.set_create_normaltable_sql(ntbname, column_dict) + tdSql.execute(create_ntb_sql) + for i in range(range_times): + tdSql.execute(self.gen_batch_sql(ntbname, batch_num)) + tdSql.query(f'select count(*) from {ntbname}') + tdSql.checkEqual(tdSql.queryResult[0][0], rows_count) + tdSql.query(f'select * from {ntbname} order by col1') + tdSql.execute(f'flush database db') + + + def run(self): + self.query_ntb_order_by_col(batch_num=1000, rows_count=1000000) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/Timediff.py b/tests/system-test/2-query/Timediff.py index d9bac2e930..1f73215dd5 100644 --- a/tests/system-test/2-query/Timediff.py +++ b/tests/system-test/2-query/Timediff.py @@ -16,6 +16,7 @@ class TDTestCase: '2020-5-1 00:00:00.001002001' ] + self.rest_tag = str(conn).lower().split('.')[0].replace("