From 421c8eaf71951efe44cdc4fcf2181a4452274ae0 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 28 Jul 2022 17:38:55 +0800 Subject: [PATCH 01/43] enh: last function optimize --- source/libs/planner/src/planOptimizer.c | 82 ++++++++++++++++--- source/libs/planner/test/planOptimizeTest.cpp | 2 + 2 files changed, 74 insertions(+), 10 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index fcc395af62..f49ca58bb8 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -38,10 +38,13 @@ typedef struct SOptimizeRule { FOptimize optimizeFunc; } SOptimizeRule; +typedef enum EScanOrder { SCAN_ORDER_ASC = 1, SCAN_ORDER_DESC, SCAN_ORDER_BOTH } EScanOrder; + typedef struct SOsdInfo { SScanLogicNode* pScan; SNodeList* pSdrFuncs; SNodeList* pDsoFuncs; + EScanOrder scanOrder; } SOsdInfo; typedef struct SCpdIsMultiTableCondCxt { @@ -179,16 +182,18 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent); SNodeList* pTmpSdrFuncs = NULL; SNodeList* pTmpDsoFuncs = NULL; - SNode* pFunc = NULL; + SNode* pNode = NULL; bool otherFunc = false; - FOREACH(pFunc, pAllFuncs) { - int32_t code = TSDB_CODE_SUCCESS; - if (scanPathOptNeedOptimizeDataRequire((SFunctionNode*)pFunc)) { - code = nodesListMakeStrictAppend(&pTmpSdrFuncs, nodesCloneNode(pFunc)); - } else if (scanPathOptNeedDynOptimize((SFunctionNode*)pFunc)) { - code = nodesListMakeStrictAppend(&pTmpDsoFuncs, nodesCloneNode(pFunc)); + FOREACH(pNode, pAllFuncs) { + SFunctionNode* pFunc = (SFunctionNode*)pNode; + int32_t code = TSDB_CODE_SUCCESS; + if (scanPathOptNeedOptimizeDataRequire(pFunc)) { + code = nodesListMakeStrictAppend(&pTmpSdrFuncs, nodesCloneNode(pNode)); + } else if (scanPathOptNeedDynOptimize(pFunc)) { + code = nodesListMakeStrictAppend(&pTmpDsoFuncs, nodesCloneNode(pNode)); } else { otherFunc = true; + break; } if (TSDB_CODE_SUCCESS != code) { nodesDestroyList(pTmpSdrFuncs); @@ -206,12 +211,46 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd return TSDB_CODE_SUCCESS; } +static int32_t scanPathOptGetScanOrder(SScanLogicNode* pScan, EScanOrder* pScanOrder) { + SNodeList* pAllFuncs = scanPathOptGetAllFuncs(pScan->node.pParent); + SNode* pNode = NULL; + bool hasFirst = false; + bool hasLast = false; + bool otherFunc = false; + FOREACH(pNode, pAllFuncs) { + SFunctionNode* pFunc = (SFunctionNode*)pNode; + if (FUNCTION_TYPE_FIRST == pFunc->funcType) { + hasFirst = true; + } else if (FUNCTION_TYPE_LAST == pFunc->funcType) { + hasLast = true; + } else if (FUNCTION_TYPE_SELECT_VALUE != pFunc->funcType) { + otherFunc = true; + } + } + if (hasFirst && hasLast && !otherFunc) { + *pScanOrder = SCAN_ORDER_BOTH; + } else if (hasLast) { + *pScanOrder = SCAN_ORDER_DESC; + } else { + *pScanOrder = SCAN_ORDER_ASC; + } + return TSDB_CODE_SUCCESS; +} + +static int32_t scanPathOptSetOsdInfo(SOsdInfo* pInfo) { + int32_t code = scanPathOptGetRelatedFuncs(pInfo->pScan, &pInfo->pSdrFuncs, &pInfo->pDsoFuncs); + if (TSDB_CODE_SUCCESS == code) { + code = scanPathOptGetScanOrder(pInfo->pScan, &pInfo->scanOrder); + } + return code; +} + static int32_t scanPathOptMatch(SOptimizeContext* pCxt, SLogicNode* pLogicNode, SOsdInfo* pInfo) { pInfo->pScan = (SScanLogicNode*)optFindPossibleNode(pLogicNode, scanPathOptMayBeOptimized); if (NULL == pInfo->pScan) { return TSDB_CODE_SUCCESS; } - return scanPathOptGetRelatedFuncs(pInfo->pScan, &pInfo->pSdrFuncs, &pInfo->pDsoFuncs); + return scanPathOptSetOsdInfo(pInfo); } static EFuncDataRequired scanPathOptPromoteDataRequired(EFuncDataRequired l, EFuncDataRequired r) { @@ -258,11 +297,34 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) { } } +static void scanPathOptSetScanOrder(EScanOrder scanOrder, SScanLogicNode* pScan) { + if (pScan->scanSeq[0] > 1 || pScan->scanSeq[1] > 1) { + return; + } + switch (scanOrder) { + case SCAN_ORDER_ASC: + pScan->scanSeq[0] = 1; + pScan->scanSeq[1] = 0; + break; + case SCAN_ORDER_DESC: + pScan->scanSeq[0] = 0; + pScan->scanSeq[1] = 1; + break; + case SCAN_ORDER_BOTH: + pScan->scanSeq[0] = 1; + pScan->scanSeq[1] = 1; + break; + default: + break; + } +} + static int32_t scanPathOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { - SOsdInfo info = {0}; + SOsdInfo info = {.scanOrder = SCAN_ORDER_ASC}; int32_t code = scanPathOptMatch(pCxt, pLogicSubplan->pNode, &info); if (TSDB_CODE_SUCCESS == code && info.pScan) { - scanPathOptSetScanWin((SScanLogicNode*)info.pScan); + scanPathOptSetScanWin(info.pScan); + scanPathOptSetScanOrder(info.scanOrder, info.pScan); } if (TSDB_CODE_SUCCESS == code && (NULL != info.pDsoFuncs || NULL != info.pSdrFuncs)) { info.pScan->dataRequired = scanPathOptGetDataRequired(info.pSdrFuncs); diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 058705403b..793486cb20 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -30,6 +30,8 @@ TEST_F(PlanOptimizeTest, scanPath) { run("SELECT COUNT(CAST(c1 AS BIGINT)) FROM t1"); run("SELECT PERCENTILE(c1, 40), COUNT(*) FROM t1"); + + run("SELECT LAST(c1) FROM t1"); } TEST_F(PlanOptimizeTest, pushDownCondition) { From bffea34cb9a5306b51b256d3aafe1aaebb03c2c5 Mon Sep 17 00:00:00 2001 From: tangfangzhi Date: Thu, 28 Jul 2022 18:00:33 +0800 Subject: [PATCH 02/43] ci: remove packaging stage --- Jenkinsfile2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 83fa1479dc..e9e7538872 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -443,7 +443,7 @@ pipeline { } } } - catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + /*catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { timeout(time: 15, unit: 'MINUTES'){ script { sh ''' @@ -455,7 +455,7 @@ pipeline { ''' } } - } + }*/ } } } From fc0780c35a920f514a220e017542284ba56ef05e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 28 Jul 2022 19:27:37 +0800 Subject: [PATCH 03/43] enh: last function optimize --- include/libs/nodes/plannodes.h | 1 + source/libs/planner/src/planOptimizer.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 644185a244..abb2630b39 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -96,6 +96,7 @@ typedef struct SScanLogicNode { bool groupSort; int8_t cacheLastMode; bool hasNormalCols; // neither tag column nor primary key tag column + bool sortPrimaryKey; } SScanLogicNode; typedef struct SJoinLogicNode { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index f49ca58bb8..3552febd58 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -298,7 +298,7 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) { } static void scanPathOptSetScanOrder(EScanOrder scanOrder, SScanLogicNode* pScan) { - if (pScan->scanSeq[0] > 1 || pScan->scanSeq[1] > 1) { + if (pScan->sortPrimaryKey || pScan->scanSeq[0] > 1 || pScan->scanSeq[1] > 1) { return; } switch (scanOrder) { @@ -329,6 +329,8 @@ static int32_t scanPathOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub if (TSDB_CODE_SUCCESS == code && (NULL != info.pDsoFuncs || NULL != info.pSdrFuncs)) { info.pScan->dataRequired = scanPathOptGetDataRequired(info.pSdrFuncs); info.pScan->pDynamicScanFuncs = info.pDsoFuncs; + } + if (TSDB_CODE_SUCCESS == code && info.pScan) { OPTIMIZE_FLAG_SET_MASK(info.pScan->node.optimizedFlag, OPTIMIZE_FLAG_SCAN_PATH); pCxt->optimized = true; } @@ -1129,6 +1131,7 @@ static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicS pScan->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; } sortPriKeyOptSetParentOrder(pScan->node.pParent, order); + pScan->sortPrimaryKey = true; } SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0); From 9053645ab71c0dfeea93fd7dc1fd12f68f6bd080 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 28 Jul 2022 20:24:49 +0800 Subject: [PATCH 04/43] feat: super table order by primary key optimization --- source/libs/executor/src/tfill.c | 20 ++++++++++---------- source/libs/planner/src/planOptimizer.c | 2 +- tests/script/tsim/parser/limit_stb.sim | 12 ++++++------ tests/script/tsim/parser/limit_tb.sim | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index ff856a48b6..38dc25cbc0 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -66,7 +66,7 @@ static void setNullRow(SSDataBlock* pBlock, int64_t ts, int32_t rowIndex) { static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey); -static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32_t rowIndex, int64_t currentKey) { +static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32_t rowIndex, int64_t currentKey) { if (pDst->info.type == TSDB_DATA_TYPE_FLOAT) { float v = 0; GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); @@ -184,7 +184,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* continue; } - SVariant* pVar = &pFillInfo->pFillCol[i].fillVal; + SVariant* pVar = &pFillInfo->pFillCol[i].fillVal; SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); doSetUserSpecifiedValue(pDst, pVar, index, pFillInfo->currentKey); } @@ -298,7 +298,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t SColumnInfoData* pSrc = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, srcSlotId); char* src = colDataGetData(pSrc, pFillInfo->index); - if (/*i == 0 || (*/!colDataIsNull_s(pSrc, pFillInfo->index)) { + if (/*i == 0 || (*/ !colDataIsNull_s(pSrc, pFillInfo->index)) { bool isNull = colDataIsNull_s(pSrc, pFillInfo->index); colDataAppend(pDst, index, src, isNull); saveColData(pFillInfo->prev, i, src, isNull); @@ -313,7 +313,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t } else if (pFillInfo->type == TSDB_FILL_LINEAR) { bool isNull = colDataIsNull_s(pSrc, pFillInfo->index); colDataAppend(pDst, index, src, isNull); - saveColData(pFillInfo->prev, i, src, isNull); // todo: + saveColData(pFillInfo->prev, i, src, isNull); // todo: } else if (pFillInfo->type == TSDB_FILL_NULL) { colDataAppendNULL(pDst, index); } else if (pFillInfo->type == TSDB_FILL_NEXT) { @@ -434,8 +434,8 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) { } struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, - SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t primaryTsSlotId, - const char* id) { + SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, + int32_t primaryTsSlotId, const char* id) { if (fillType == TSDB_FILL_NONE) { return NULL; } @@ -581,7 +581,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma int64_t numOfRes = -1; if (numOfRows > 0) { // still fill gap within current data block, not generating data after the result set. - TSKEY lastKey = tsList[pFillInfo->numOfRows - 1]; + TSKEY lastKey = (TSDB_ORDER_ASC == pFillInfo->order ? tsList[pFillInfo->numOfRows - 1] : tsList[0]); numOfRes = taosTimeCountInterval(lastKey, pFillInfo->currentKey, pFillInfo->interval.sliding, pFillInfo->interval.slidingUnit, pFillInfo->interval.precision); numOfRes += 1; @@ -626,9 +626,9 @@ int64_t taosFillResultDataBlock(SFillInfo* pFillInfo, SSDataBlock* p, int32_t ca } qDebug("fill:%p, generated fill result, src block:%d, index:%d, brange:%" PRId64 "-%" PRId64 ", currentKey:%" PRId64 - ", current : % d, total : % d, %s", pFillInfo, - pFillInfo->numOfRows, pFillInfo->index, pFillInfo->start, pFillInfo->end, pFillInfo->currentKey, - pFillInfo->numOfCurrent, pFillInfo->numOfTotal, pFillInfo->id); + ", current : % d, total : % d, %s", + pFillInfo, pFillInfo->numOfRows, pFillInfo->index, pFillInfo->start, pFillInfo->end, pFillInfo->currentKey, + pFillInfo->numOfCurrent, pFillInfo->numOfTotal, pFillInfo->id); return numOfRes; } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 3552febd58..c1013949eb 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1122,7 +1122,7 @@ static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicS SNode* pScanNode = NULL; FOREACH(pScanNode, pScanNodes) { SScanLogicNode* pScan = (SScanLogicNode*)pScanNode; - if (ORDER_DESC == order && pScan->scanSeq[0] > 0) { + if ((ORDER_DESC == order && pScan->scanSeq[0] > 0) || (ORDER_ASC == order && pScan->scanSeq[1] > 0)) { TSWAP(pScan->scanSeq[0], pScan->scanSeq[1]); } if (TSDB_SUPER_TABLE == pScan->tableType) { diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim index 0d0e4a8ea3..40ce404895 100644 --- a/tests/script/tsim/parser/limit_stb.sim +++ b/tests/script/tsim/parser/limit_stb.sim @@ -469,7 +469,7 @@ if $data24 != 9.000000000 then endi ### supertable aggregation + where + interval + limit offset -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit 5 offset 1 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) order by _wstart limit 5 offset 1 if $rows != 5 then return -1 endi @@ -487,7 +487,7 @@ if $data41 != 5 then endi $offset = $rowNum / 2 $offset = $offset + 1 -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit $offset offset $offset +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) order by _wstart limit $offset offset $offset $val = $rowNum - $offset if $rows != $val then return -1 @@ -507,7 +507,7 @@ endi ### supertable aggregation + where + interval + group by order by tag + limit offset ## TBASE-345 -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 0 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 3 offset 0 if $rows != 3 then return -1 endi @@ -531,7 +531,7 @@ if $data29 != 3 then endi -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 1 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 3 offset 1 if $rows != 3 then return -1 endi @@ -542,7 +542,7 @@ if $data09 != 4 then return -1 endi -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 1 offset 0 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 1 offset 0 if $rows != 1 then return -1 endi @@ -553,7 +553,7 @@ if $data09 != 4 then return -1 endi -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 0 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 3 offset 0 if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/parser/limit_tb.sim b/tests/script/tsim/parser/limit_tb.sim index 6c5706778d..4a71813ae8 100644 --- a/tests/script/tsim/parser/limit_tb.sim +++ b/tests/script/tsim/parser/limit_tb.sim @@ -728,7 +728,7 @@ sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb w if $rows != 0 then return -1 endi -sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) order by _wstart limit 3 offset 1 if $rows != 3 then return -1 endi @@ -742,7 +742,7 @@ if $data23 != 9.00000 then return -1 endi -sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 0 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) order by _wstart limit 3 offset 0 if $rows != 3 then return -1 endi @@ -777,7 +777,7 @@ if $data29 != nchar8 then return -1 endi -sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 1 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) order by _wstart limit 3 offset 1 if $rows != 3 then return -1 endi From 78bbfcb4bcd34fe4eeb86c0eb7b6c0aa01918899 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 09:56:03 +0800 Subject: [PATCH 05/43] refactor: do some internal refactor and opt query performance. --- include/common/tmsg.h | 2 +- source/client/test/clientTests.cpp | 26 ++-- source/libs/executor/inc/executil.h | 2 +- source/libs/executor/inc/executorimpl.h | 24 ++-- source/libs/executor/src/executil.c | 2 +- source/libs/executor/src/executorimpl.c | 36 ++--- source/libs/executor/src/groupoperator.c | 3 +- source/libs/executor/src/scanoperator.c | 128 ++++++++++++++---- source/libs/executor/src/timewindowoperator.c | 18 +-- source/libs/function/inc/builtinsimpl.h | 1 + source/libs/function/src/builtins.c | 1 + source/libs/function/src/builtinsimpl.c | 16 +++ source/libs/function/src/functionMgt.c | 7 +- 13 files changed, 185 insertions(+), 81 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index dc83015a89..fbaf2c3e3f 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1404,7 +1404,7 @@ typedef struct STableScanAnalyzeInfo { uint32_t skipBlocks; uint32_t filterOutBlocks; double elapsedTime; - uint64_t filterTime; + double filterTime; } STableScanAnalyzeInfo; int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index e7ae3917f9..08b0f3abb2 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -123,7 +123,7 @@ void createNewTable(TAOS* pConn, int32_t index) { } taos_free_result(pRes); - for(int32_t i = 0; i < 1000; i += 20) { + for(int32_t i = 0; i < 100000; i += 20) { char sql[1024] = {0}; sprintf(sql, "insert into tu%d values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)" @@ -154,7 +154,7 @@ TEST(testCase, driverInit_Test) { } TEST(testCase, connect_Test) { -// taos_options(TSDB_OPTION_CONFIGDIR, "/home/ubuntu/first/cfg"); + taos_options(TSDB_OPTION_CONFIGDIR, "/home/lisa/Documents/workspace/tdengine/sim/dnode1/cfg"); TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); if (pConn == NULL) { @@ -501,7 +501,6 @@ TEST(testCase, show_vgroup_Test) { taos_close(pConn); } - TEST(testCase, create_multiple_tables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); ASSERT_NE(pConn, nullptr); @@ -665,6 +664,7 @@ TEST(testCase, insert_test) { taos_free_result(pRes); taos_close(pConn); } +#endif TEST(testCase, projection_query_tables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -697,7 +697,7 @@ TEST(testCase, projection_query_tables) { } taos_free_result(pRes); - for(int32_t i = 0; i < 100; ++i) { + for(int32_t i = 0; i < 1; ++i) { printf("create table :%d\n", i); createNewTable(pConn, i); } @@ -723,6 +723,7 @@ TEST(testCase, projection_query_tables) { taos_close(pConn); } +#if 0 TEST(testCase, projection_query_stables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); ASSERT_NE(pConn, nullptr); @@ -820,21 +821,8 @@ TEST(testCase, async_api_test) { getchar(); taos_close(pConn); } -#endif - TEST(testCase, update_test) { - - SInterval interval = {0}; - interval.offset = 8000; - interval.interval = 10000; - interval.sliding = 4000; - interval.intervalUnit = 's'; - interval.offsetUnit = 's'; - interval.slidingUnit = 's'; -// STimeWindow w = getAlignQueryTimeWindow(&interval, 0, 1630000000000); - STimeWindow w = getAlignQueryTimeWindow(&interval, 0, 1629999999999); - TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); ASSERT_NE(pConn, nullptr); @@ -869,4 +857,8 @@ TEST(testCase, update_test) { taos_free_result(pRes); } } + +#endif + + #pragma GCC diagnostic pop diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index be97b20455..c3dad1ed7c 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -103,7 +103,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo); void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList); -bool hasDataInGroupInfo(SGroupResInfo* pGroupResInfo); +bool hasRemainResults(SGroupResInfo* pGroupResInfo); int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index d5486d62b1..05dd3806b9 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -297,6 +297,20 @@ enum { TABLE_SCAN__BLOCK_ORDER = 2, }; +typedef struct SAggSupporter { + SHashObj* pResultRowHashTable; // quick locate the window object for each result + char* keyBuf; // window key buffer + SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file + int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row +} SAggSupporter; + +typedef struct { + // if the upstream is an interval operator, the interval info is also kept here to get the time window to check if current data block needs to be loaded. + SInterval interval; + SAggSupporter *pAggSup; + SExprSupp *pExprSup; // expr supporter of aggregate operator +} SAggOptrPushDownInfo; + typedef struct STableScanInfo { STsdbReader* dataReader; SReadHandle readHandle; @@ -312,12 +326,13 @@ typedef struct STableScanInfo { SQueryTableDataCond cond; int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan int32_t dataBlockLoadFlag; - SInterval interval; // if the upstream is an interval operator, the interval info is also kept here to get the time window to check if current data block needs to be loaded. +// SInterval interval; // if the upstream is an interval operator, the interval info is also kept here to get the time window to check if current data block needs to be loaded. SSampleExecInfo sample; // sample execution info int32_t currentGroupId; int32_t currentTable; int8_t scanMode; int8_t noTable; + SAggOptrPushDownInfo pdInfo; } STableScanInfo; typedef struct STableMergeScanInfo { @@ -504,13 +519,6 @@ typedef struct SOptrBasicInfo { SSDataBlock* pRes; } SOptrBasicInfo; -typedef struct SAggSupporter { - SHashObj* pResultRowHashTable; // quick locate the window object for each result - char* keyBuf; // window key buffer - SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file - int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row -} SAggSupporter; - typedef struct SIntervalAggOperatorInfo { // SOptrBasicInfo should be first, SAggSupporter should be second for stream encode SOptrBasicInfo binfo; // basic info diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 65df7140f7..96c20d6136 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -137,7 +137,7 @@ void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayL ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } -bool hasDataInGroupInfo(SGroupResInfo* pGroupResInfo) { +bool hasRemainResults(SGroupResInfo* pGroupResInfo) { if (pGroupResInfo->pRows == NULL) { return false; } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 525d7bf336..12501f9f7a 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -141,8 +141,7 @@ static int32_t doCopyToSDataBlock(SExecTaskInfo* taskInfo, SSDataBlock* pBlock, SqlFunctionCtx* pCtx, int32_t numOfExprs); static void initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size); -static void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, SAggOperatorInfo* pAggInfo, int32_t numOfOutput, - uint64_t groupId); +static void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId); // setup the output buffer for each operator static bool hasNull(SColumn* pColumn, SColumnDataAgg* pStatis) { @@ -1393,10 +1392,11 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR } } -void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, SAggOperatorInfo* pAggInfo, int32_t numOfOutput, - uint64_t groupId) { +void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) { // for simple group by query without interval, all the tables belong to one group result. - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SAggOperatorInfo* pAggInfo = pOperator->info; + SResultRowInfo* pResultRowInfo = &pAggInfo->binfo.resultRowInfo; SqlFunctionCtx* pCtx = pOperator->exprSupp.pCtx; int32_t* rowEntryInfoOffset = pOperator->exprSupp.rowEntryInfoOffset; @@ -1420,14 +1420,13 @@ void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, SAggOperatorInfo* pAggIn setResultRowInitCtx(pResultRow, pCtx, numOfOutput, rowEntryInfoOffset); } -void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId, SAggOperatorInfo* pAggInfo) { - if (pAggInfo->groupId != INT32_MIN && pAggInfo->groupId == groupId) { +static void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) { + SAggOperatorInfo* pAggInfo = pOperator->info; + if (pAggInfo->groupId != UINT64_MAX && pAggInfo->groupId == groupId) { return; } -#ifdef BUF_PAGE_DEBUG - qDebug("page_setbuf, groupId:%" PRIu64, groupId); -#endif - doSetTableGroupOutputBuf(pOperator, pAggInfo, numOfOutput, groupId); + + doSetTableGroupOutputBuf(pOperator, numOfOutput, groupId); // record the current active group id pAggInfo->groupId = groupId; @@ -1594,7 +1593,7 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG pBlock->info.version = pTaskInfo->version; blockDataCleanup(pBlock); - if (!hasDataInGroupInfo(pGroupResInfo)) { + if (!hasRemainResults(pGroupResInfo)) { return; } @@ -2931,7 +2930,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) { } // the pDataBlock are always the same one, no need to call this again - setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.groupId, pAggInfo); + setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.groupId); setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, true); code = doAggregateImpl(pOperator, pSup->pCtx); if (code != 0) { @@ -2966,7 +2965,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, pInfo, &pAggInfo->groupResInfo, pAggInfo->aggSup.pResultBuf); doFilter(pAggInfo->pCondition, pInfo->pRes, NULL); - if (!hasDataInGroupInfo(&pAggInfo->groupResInfo)) { + if (!hasRemainResults(&pAggInfo->groupResInfo)) { doSetOperatorCompleted(pOperator); break; } @@ -3356,7 +3355,6 @@ static void destroyOperatorInfo(SOperatorInfo* pOperator) { pOperator->numOfDownstream = 0; } - cleanupExprSupp(&pOperator->exprSupp); taosMemoryFreeClear(pOperator); } @@ -3501,7 +3499,7 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* goto _error; } - pInfo->groupId = INT32_MIN; + pInfo->groupId = UINT64_MAX; pInfo->pCondition = pCondition; pOperator->name = "TableAggregate"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_HASH_AGG; @@ -3513,6 +3511,12 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* pOperator->fpSet = createOperatorFpSet(doOpenAggregateOptr, getAggregateResult, NULL, NULL, destroyAggOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); + if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { + STableScanInfo* pTableScanInfo = downstream->info; + pTableScanInfo->pdInfo.pExprSup = &pOperator->exprSupp; + pTableScanInfo->pdInfo.pAggSup = &pInfo->aggSup; + } + code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { goto _error; diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index c83206b730..5c37cf01e8 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -301,8 +301,7 @@ static SSDataBlock* buildGroupResultDataBlock(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doFilter(pInfo->pCondition, pRes, NULL); - bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo); - if (!hasRemain) { + if (!hasRemainResults(&pInfo->groupResInfo)) { doSetOperatorCompleted(pOperator); break; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index f07256e88e..34fd9a07ee 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -166,6 +166,67 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn return false; } +// this function is for table scanner to extract temporary results of upstream aggregate results. +static SResultRow* getTableGroupOutputBuf(SOperatorInfo* pOperator, uint64_t groupId, SFilePage** pPage) { + if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { + return NULL; + } + + int64_t buf[2] = {0}; + SET_RES_WINDOW_KEY((char*)buf, &groupId, sizeof(groupId), groupId); + + STableScanInfo* pTableScanInfo = pOperator->info; + + SResultRowPosition* p1 = + (SResultRowPosition*)taosHashGet(pTableScanInfo->pdInfo.pAggSup->pResultRowHashTable, buf, GET_RES_WINDOW_KEY_LEN(sizeof(groupId))); + + if (p1 == NULL) { + return NULL; + } + + *pPage = getBufPage(pTableScanInfo->pdInfo.pAggSup->pResultBuf, p1->pageId); + return (SResultRow*)((char*)(*pPage) + p1->offset); +} + +static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo* pBlockInfo, uint32_t* status) { + STableScanInfo* pTableScanInfo = pOperator->info; + + if (pTableScanInfo->pdInfo.pExprSup == NULL) { + return TSDB_CODE_SUCCESS; + } + + SExprSupp* pSup1 = pTableScanInfo->pdInfo.pExprSup; + + SFilePage* pPage = NULL; + SResultRow* pRow = getTableGroupOutputBuf(pOperator, pBlockInfo->groupId, &pPage); + + if (pRow == NULL) { + return TSDB_CODE_SUCCESS; + } + + bool notLoadBlock = true; + for (int32_t i = 0; i < pSup1->numOfExprs; ++i) { + int32_t functionId = pSup1->pCtx[i].functionId; + + SResultRowEntryInfo* pEntry = getResultEntryInfo(pRow, i, pTableScanInfo->pdInfo.pExprSup->rowEntryInfoOffset); + + int32_t reqStatus = fmFuncDynDataRequired(functionId, pEntry, &pBlockInfo->window); + if (reqStatus != FUNC_DATA_REQUIRED_NOT_LOAD) { + notLoadBlock = false; + break; + } + } + + // release buffer pages + releaseBufPage(pTableScanInfo->pdInfo.pAggSup->pResultBuf, pPage); + + if (notLoadBlock) { + *status = FUNC_DATA_REQUIRED_NOT_LOAD; + } + + return TSDB_CODE_SUCCESS; +} + static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo, SSDataBlock* pBlock, uint32_t* status) { SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; @@ -178,7 +239,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca *status = pInfo->dataBlockLoadFlag; if (pTableScanInfo->pFilterNode != NULL || - overlapWithTimeWindow(&pTableScanInfo->interval, &pBlock->info, pTableScanInfo->cond.order)) { + overlapWithTimeWindow(&pTableScanInfo->pdInfo.interval, &pBlock->info, pTableScanInfo->cond.order)) { (*status) = FUNC_DATA_REQUIRED_DATA_LOAD; } @@ -232,6 +293,16 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca ASSERT(*status == FUNC_DATA_REQUIRED_DATA_LOAD); // todo filter data block according to the block sma data firstly + + doDynamicPruneDataBlock(pOperator, pBlockInfo, status); + if (*status == FUNC_DATA_REQUIRED_NOT_LOAD) { + qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo), + pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); + pCost->skipBlocks += 1; + + return TSDB_CODE_SUCCESS; + } + #if 0 if (!doFilterByBlockStatistics(pBlock->pBlockStatis, pTableScanInfo->pCtx, pBlockInfo->rows)) { pCost->filterOutBlocks += 1; @@ -263,18 +334,20 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca } } - int64_t st = taosGetTimestampMs(); - doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo); + if (pTableScanInfo->pFilterNode != NULL) { + int64_t st = taosGetTimestampUs(); + doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo); - int64_t et = taosGetTimestampMs(); - pTableScanInfo->readRecorder.filterTime += (et - st); + double el = (taosGetTimestampUs() - st) / 1000.0; + pTableScanInfo->readRecorder.filterTime += el; - if (pBlock->info.rows == 0) { - pCost->filterOutBlocks += 1; - qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo), - pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); - } else { - qDebug("%s data block filter out, elapsed time:%" PRId64, GET_TASKID(pTaskInfo), (et - st)); + if (pBlock->info.rows == 0) { + pCost->filterOutBlocks += 1; + qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d, elapsed time:%.2f ms", + GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, el); + } else { + qDebug("%s data block filter applied, elapsed time:%.2f ms", GET_TASKID(pTaskInfo), el); + } } return TSDB_CODE_SUCCESS; @@ -602,11 +675,12 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, pSup->pCtx = createSqlFunctionCtx(pSup->pExprInfo, pSup->numOfExprs, &pSup->rowEntryInfoOffset); } - pInfo->scanInfo = (SScanInfo){.numOfAsc = pTableScanNode->scanSeq[0], .numOfDesc = pTableScanNode->scanSeq[1]}; - // pInfo->scanInfo = (SScanInfo){.numOfAsc = 0, .numOfDesc = 1}; // for debug purpose +// pInfo->scanInfo = (SScanInfo){.numOfAsc = pTableScanNode->scanSeq[0], .numOfDesc = pTableScanNode->scanSeq[1]}; + pInfo->scanInfo = (SScanInfo){.numOfAsc = 0, .numOfDesc = 1}; // for debug purpose + pInfo->cond.order = TSDB_ORDER_DESC; + pInfo->pdInfo.interval = extractIntervalInfo(pTableScanNode); pInfo->readHandle = *readHandle; - pInfo->interval = extractIntervalInfo(pTableScanNode); pInfo->sample.sampleRatio = pTableScanNode->ratio; pInfo->sample.seed = taosGetTimestampSec(); @@ -1484,14 +1558,14 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pInfo->tqReader = pHandle->tqReader; } - if (pTSInfo->interval.interval > 0) { - pInfo->pUpdateInfo = updateInfoInitP(&pTSInfo->interval, pInfo->twAggSup.waterMark); + if (pTSInfo->pdInfo.interval.interval > 0) { + pInfo->pUpdateInfo = updateInfoInitP(&pTSInfo->pdInfo.interval, pInfo->twAggSup.waterMark); } else { pInfo->pUpdateInfo = NULL; } pInfo->pTableScanOp = pTableScanOp; - pInfo->interval = pTSInfo->interval; + pInfo->interval = pTSInfo->pdInfo.interval; pInfo->readHandle = *pHandle; pInfo->tableUid = pScanPhyNode->uid; @@ -2667,16 +2741,20 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc } } - int64_t st = taosGetTimestampMs(); - doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo); + if (pTableScanInfo->pFilterNode != NULL) { + int64_t st = taosGetTimestampMs(); + doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo); - int64_t et = taosGetTimestampMs(); - pTableScanInfo->readRecorder.filterTime += (et - st); + double el = (taosGetTimestampUs() - st) / 1000.0; + pTableScanInfo->readRecorder.filterTime += el; - if (pBlock->info.rows == 0) { - pCost->filterOutBlocks += 1; - qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo), - pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); + if (pBlock->info.rows == 0) { + pCost->filterOutBlocks += 1; + qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d, elapsed time:%.2f ms", + GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, el); + } else { + qDebug("%s data block filter applied, elapsed time:%.2f ms", GET_TASKID(pTaskInfo), el); + } } return TSDB_CODE_SUCCESS; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 9a82b194a9..8dedffce3a 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1216,7 +1216,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doFilter(pInfo->pCondition, pBInfo->pRes, NULL); - bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo); + bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { doSetOperatorCompleted(pOperator); break; @@ -1256,7 +1256,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doFilter(pInfo->pCondition, pBInfo->pRes, NULL); - bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo); + bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { doSetOperatorCompleted(pOperator); break; @@ -1293,7 +1293,7 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doFilter(pInfo->pCondition, pBlock, NULL); - bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo); + bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { doSetOperatorCompleted(pOperator); break; @@ -1562,7 +1562,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { } doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); - if (pInfo->binfo.pRes->info.rows == 0 || !hasDataInGroupInfo(&pInfo->groupResInfo)) { + if (pInfo->binfo.pRes->info.rows == 0 || !hasRemainResults(&pInfo->groupResInfo)) { pOperator->status = OP_EXEC_DONE; qDebug("===stream===single interval is done"); freeAllPages(pInfo->pRecycledPages, pInfo->aggSup.pResultBuf); @@ -2009,7 +2009,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doFilter(pInfo->pCondition, pBInfo->pRes, NULL); - bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo); + bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { doSetOperatorCompleted(pOperator); break; @@ -2052,7 +2052,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doFilter(pInfo->pCondition, pBInfo->pRes, NULL); - bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo); + bool hasRemain = hasRemainResults(&pInfo->groupResInfo); if (!hasRemain) { doSetOperatorCompleted(pOperator); break; @@ -2210,7 +2210,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { // if (pOperator->status == OP_RES_TO_RETURN) { // // doBuildResultDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); - // if (pResBlock->info.rows == 0 || !hasDataInGroupInfo(&pSliceInfo->groupResInfo)) { + // if (pResBlock->info.rows == 0 || !hasRemainResults(&pSliceInfo->groupResInfo)) { // doSetOperatorCompleted(pOperator); // } // @@ -3823,7 +3823,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { return pInfo->pDelRes; } doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); - if (pBInfo->pRes->info.rows == 0 || !hasDataInGroupInfo(&pInfo->groupResInfo)) { + if (pBInfo->pRes->info.rows == 0 || !hasRemainResults(&pInfo->groupResInfo)) { doSetOperatorCompleted(pOperator); } printDataBlock(pBInfo->pRes, IS_FINAL_OP(pInfo) ? "final session" : "single session"); @@ -4379,7 +4379,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { return pInfo->pDelRes; } doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); - if (pBInfo->pRes->info.rows == 0 || !hasDataInGroupInfo(&pInfo->groupResInfo)) { + if (pBInfo->pRes->info.rows == 0 || !hasRemainResults(&pInfo->groupResInfo)) { doSetOperatorCompleted(pOperator); } printDataBlock(pBInfo->pRes, "single state"); diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h index 35669b3e42..0880f2f5c7 100644 --- a/source/libs/function/inc/builtinsimpl.h +++ b/source/libs/function/inc/builtinsimpl.h @@ -118,6 +118,7 @@ int32_t firstLastPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock); int32_t firstCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx); int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx); int32_t getFirstLastInfoSize(int32_t resBytes); +EFuncDataRequired lastDynDataReq(void* pRes, STimeWindow* pTimeWindow); int32_t lastRowFunction(SqlFunctionCtx *pCtx); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 01a5e7997e..8b87a85a8d 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2312,6 +2312,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_LAST, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC, .translateFunc = translateFirstLast, + .dynDataRequiredFunc = lastDynDataReq, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = lastFunction, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index fb82ab206c..5569cc3887 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2702,6 +2702,22 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) return TSDB_CODE_SUCCESS; } +EFuncDataRequired lastDynDataReq(void* pRes, STimeWindow* pTimeWindow) { + SResultRowEntryInfo* pEntry = (SResultRowEntryInfo*) pRes; + + // not initialized yet, data is required + if (pEntry == NULL) { + return FUNC_DATA_REQUIRED_DATA_LOAD; + } + + SFirstLastRes* pResult = GET_ROWCELL_INTERBUF(pEntry); + if (pResult->hasResult && pResult->ts >= pTimeWindow->ekey) { + return FUNC_DATA_REQUIRED_NOT_LOAD; + } else { + return FUNC_DATA_REQUIRED_DATA_LOAD; + } +} + int32_t getFirstLastInfoSize(int32_t resBytes) { return sizeof(SFirstLastRes) + resBytes; } bool getFirstLastFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 020fd648e1..cdf089385e 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -107,7 +107,12 @@ EFuncDataRequired fmFuncDynDataRequired(int32_t funcId, void* pRes, STimeWindow* if (fmIsUserDefinedFunc(funcId) || funcId < 0 || funcId >= funcMgtBuiltinsNum) { return TSDB_CODE_FAILED; } - return funcMgtBuiltins[funcId].dynDataRequiredFunc(pRes, pTimeWindow); + + if (funcMgtBuiltins[funcId].dynDataRequiredFunc == NULL) { + return FUNC_DATA_REQUIRED_DATA_LOAD; + } else { + return funcMgtBuiltins[funcId].dynDataRequiredFunc(pRes, pTimeWindow); + } } int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet) { From 915e4e40c7797fc55bd264f3c73afb6d04c7d084 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 11:00:36 +0800 Subject: [PATCH 06/43] fix(query): add attribute to control output order. --- source/libs/executor/inc/executorimpl.h | 1 + source/libs/executor/inc/tfill.h | 3 ++- source/libs/executor/src/executorimpl.c | 5 +++-- source/libs/executor/src/tfill.c | 12 +++++++++--- source/libs/executor/src/timewindowoperator.c | 5 ++--- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index a80c2c2fea..54c98fa948 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -524,6 +524,7 @@ typedef struct SIntervalAggOperatorInfo { bool timeWindowInterpo; // interpolation needed or not SArray* pInterpCols; // interpolation columns int32_t order; // current SSDataBlock scan order + int32_t resultTsOrder; // result timestamp order EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] STimeWindowAggSupp twAggSup; bool invertible; diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index 0349632b9a..db04c5212c 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -74,11 +74,12 @@ void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struct SSDataB struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfOutput, const struct SNodeListNode* val); bool taosFillHasMoreResults(struct SFillInfo* pFillInfo); -SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, +SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t slotId, const char* id); void* taosDestroyFillInfo(struct SFillInfo *pFillInfo); +void taosFillSetDataOrderInfo(SFillInfo* pFillInfo, int32_t order); int64_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, SSDataBlock* p, int32_t capacity); int64_t getFillInfoStart(struct SFillInfo *pFillInfo); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 525d7bf336..e2727cfb4a 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3234,6 +3234,8 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { return pResBlock; } + taosFillSetDataOrderInfo(pInfo->pFillInfo, TSDB_ORDER_ASC); + SOperatorInfo* pDownstream = pOperator->pDownstream[0]; while (1) { SSDataBlock* pBlock = pDownstream->fpSet.getNextFn(pDownstream); @@ -3592,9 +3594,8 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t STimeWindow w = getAlignQueryTimeWindow(pInterval, pInterval->precision, win.skey); w = getFirstQualifiedTimeWindow(win.skey, &w, pInterval, TSDB_ORDER_ASC); - int32_t order = TSDB_ORDER_ASC; pInfo->pFillInfo = - taosCreateFillInfo(order, w.skey, 0, capacity, numOfCols, pInterval, fillType, pColInfo, pInfo->primaryTsCol, id); + taosCreateFillInfo(w.skey, 0, capacity, numOfCols, pInterval, fillType, pColInfo, pInfo->primaryTsCol, id); pInfo->win = win; pInfo->p = taosMemoryCalloc(numOfCols, POINTER_BYTES); diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 38dc25cbc0..be5631cd85 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -433,7 +433,7 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) { return pFillInfo->numOfRows - pFillInfo->index; } -struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, +struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t primaryTsSlotId, const char* id) { if (fillType == TSDB_FILL_NONE) { @@ -447,9 +447,7 @@ struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTag } pFillInfo->tsSlotId = primaryTsSlotId; - taosResetFillInfo(pFillInfo, skey); - pFillInfo->order = order; switch (fillType) { case FILL_MODE_NONE: @@ -535,6 +533,14 @@ void* taosDestroyFillInfo(SFillInfo* pFillInfo) { return NULL; } +void taosFillSetDataOrderInfo(SFillInfo* pFillInfo, int32_t order) { + if (pFillInfo == NULL || (order != TSDB_ORDER_ASC && order != TSDB_ORDER_DESC)) { + return; + } + + pFillInfo->order = order; +} + void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey) { if (pFillInfo->type == TSDB_FILL_NONE) { return; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index cb18eb9fff..4023009489 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1096,7 +1096,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, scanFlag, NULL); } - initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, pInfo->order); + initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, pInfo->resultTsOrder); OPTR_SET_OPENED(pOperator); pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; @@ -1249,7 +1249,6 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator) { } pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; - pOperator->status = OP_RES_TO_RETURN; initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, TSDB_ORDER_ASC); @@ -1791,6 +1790,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pInfo->win = pTaskInfo->window; pInfo->order = TSDB_ORDER_ASC; + pInfo->resultTsOrder = TSDB_ORDER_ASC; pInfo->interval = *pInterval; pInfo->execModel = pTaskInfo->execModel; pInfo->twAggSup = *pTwAggSupp; @@ -1807,7 +1807,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* } pInfo->primaryTsIndex = primaryTsSlotId; - SExprSupp* pSup = &pOperator->exprSupp; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; From 7dc12d7e4f5b989151d7725d8c525a594c756194 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 29 Jul 2022 11:03:35 +0800 Subject: [PATCH 07/43] refactor(sync): add test case --- source/libs/sync/test/sh/auto_bench.sh | 45 ++++++++++++++ source/libs/sync/test/sh/insert.tpl.json | 77 ++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 source/libs/sync/test/sh/auto_bench.sh create mode 100644 source/libs/sync/test/sh/insert.tpl.json diff --git a/source/libs/sync/test/sh/auto_bench.sh b/source/libs/sync/test/sh/auto_bench.sh new file mode 100644 index 0000000000..32dc071018 --- /dev/null +++ b/source/libs/sync/test/sh/auto_bench.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +if [ $# != 5 ] ; then + echo "Uasge: $0 instances vgroups replica ctables rows" + echo "" + exit 1 +fi + +instances=$1 +vgroups=$2 +replica=$3 +ctables=$4 +rows=$5 + +echo "params: instances:${instances}, vgroups:${vgroups}, replica:${replica}, ctables:${ctables}, rows:${rows}" + +dt=`date "+%Y-%m-%d-%H-%M-%S"` +casedir=instances_${instances}_vgroups_${vgroups}_replica_${replica}_ctables_${ctables}_rows_${rows}_${dt} +mkdir ${casedir} +cp ./insert.tpl.json ${casedir} +cd ${casedir} + +for i in `seq 1 ${instances}`;do + #echo ===$i=== + cfg_file=bench_${i}.json + cp ./insert.tpl.json ${cfg_file} + rstfile=result_${i} + sed -i 's/tpl_vgroups_tpl/'${vgroups}'/g' ${cfg_file} + sed -i 's/tpl_replica_tpl/'${replica}'/g' ${cfg_file} + sed -i 's/tpl_ctables_tpl/'${ctables}'/g' ${cfg_file} + sed -i 's/tpl_stid_tpl/'${i}'/g' ${cfg_file} + sed -i 's/tpl_rows_tpl/'${rows}'/g' ${cfg_file} + sed -i 's/tpl_insert_result_tpl/'${rstfile}'/g' ${cfg_file} +done + +for conf_file in `ls ./bench_*.json`;do + echo "nohup taosBenchmark -f ${conf_file} &" + nohup taosBenchmark -f ${conf_file} & +done + +cd - + +exit 0 + + diff --git a/source/libs/sync/test/sh/insert.tpl.json b/source/libs/sync/test/sh/insert.tpl.json new file mode 100644 index 0000000000..633dd70a24 --- /dev/null +++ b/source/libs/sync/test/sh/insert.tpl.json @@ -0,0 +1,77 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos/", + "host": "v3cluster-0001", + "port": 7100, + "user": "root", + "password": "taosdata", + "thread_count": 8, + "thread_count_create_tbl": 8, + "result_file": "./tpl_insert_result_tpl", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 100000, + "databases": [ + { + "dbinfo": { + "name": "db1", + "drop": "yes", + "vgroups": tpl_vgroups_tpl, + "replica": tpl_replica_tpl + }, + "super_tables": [ + { + "name": "stb_tpl_stid_tpl", + "child_table_exists": "no", + "childtable_count": tpl_ctables_tpl, + "childtable_prefix": "stb_tpl_stid_tpl_", + "auto_create_table": "no", + "batch_create_tbl_num": 50000, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": tpl_rows_tpl, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 10000000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "sample_format": "csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT" + }, + { + "type": "DOUBLE", + "count": 1 + }, + { + "type": "BINARY", + "len": 40, + "count": 1 + }, + { + "type": "nchar", + "len": 20, + "count": 1 + } + ], + "tags": [ + { + "type": "TINYINT", + "count": 1 + }, + { + "type": "BINARY", + "len": 16, + "count": 1 + } + ] + } + ] + } + ] +} From 547ab7028b40d10036e6056f01c4530474824134 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 29 Jul 2022 13:38:24 +0800 Subject: [PATCH 08/43] enh: last function optimize --- include/libs/nodes/plannodes.h | 5 + source/libs/nodes/src/nodesCloneFuncs.c | 2 + source/libs/nodes/src/nodesCodeFuncs.c | 21 ++++ source/libs/planner/src/planLogicCreater.c | 2 + source/libs/planner/src/planOptimizer.c | 105 ++++++++++-------- source/libs/planner/src/planPhysiCreater.c | 3 + source/libs/planner/test/planOptimizeTest.cpp | 11 ++ 7 files changed, 105 insertions(+), 44 deletions(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index abb2630b39..2f6bb603c1 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -205,6 +205,7 @@ typedef struct SWindowLogicNode { int8_t igExpired; EWindowAlgorithm windowAlgo; EOrder inputTsOrder; + EOrder outputTsOrder; } SWindowLogicNode; typedef struct SFillLogicNode { @@ -213,6 +214,7 @@ typedef struct SFillLogicNode { SNode* pWStartTs; SNode* pValues; // SNodeListNode STimeWindow timeRange; + EOrder inputTsOrder; } SFillLogicNode; typedef struct SSortLogicNode { @@ -411,6 +413,8 @@ typedef struct SWinodwPhysiNode { int8_t triggerType; int64_t watermark; int8_t igExpired; + EOrder inputTsOrder; + EOrder outputTsOrder; } SWinodwPhysiNode; typedef struct SIntervalPhysiNode { @@ -435,6 +439,7 @@ typedef struct SFillPhysiNode { SNode* pValues; // SNodeListNode SNodeList* pTargets; STimeWindow timeRange; + EOrder inputTsOrder; } SFillPhysiNode; typedef struct SMultiTableIntervalPhysiNode { diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 5fc94c2642..79ef18eeb6 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -443,6 +443,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p COPY_SCALAR_FIELD(igExpired); COPY_SCALAR_FIELD(windowAlgo); COPY_SCALAR_FIELD(inputTsOrder); + COPY_SCALAR_FIELD(outputTsOrder); return TSDB_CODE_SUCCESS; } @@ -452,6 +453,7 @@ static int32_t logicFillCopy(const SFillLogicNode* pSrc, SFillLogicNode* pDst) { CLONE_NODE_FIELD(pWStartTs); CLONE_NODE_FIELD(pValues); COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow)); + COPY_SCALAR_FIELD(inputTsOrder); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index af3f0c242b..b0c16f26ed 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1936,6 +1936,8 @@ static const char* jkWindowPhysiPlanTsEnd = "TsEnd"; static const char* jkWindowPhysiPlanTriggerType = "TriggerType"; static const char* jkWindowPhysiPlanWatermark = "Watermark"; static const char* jkWindowPhysiPlanIgnoreExpired = "IgnoreExpired"; +static const char* jkWindowPhysiPlanInputTsOrder = "inputTsOrder"; +static const char* jkWindowPhysiPlanOutputTsOrder = "outputTsOrder"; static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj; @@ -1962,6 +1964,12 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanIgnoreExpired, pNode->igExpired); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanInputTsOrder, pNode->inputTsOrder); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanOutputTsOrder, pNode->outputTsOrder); + } return code; } @@ -1991,6 +1999,12 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanIgnoreExpired, &pNode->igExpired); } + if (TSDB_CODE_SUCCESS == code) { + tjsonGetNumberValue(pJson, jkWindowPhysiPlanInputTsOrder, pNode->inputTsOrder, code); + } + if (TSDB_CODE_SUCCESS == code) { + tjsonGetNumberValue(pJson, jkWindowPhysiPlanOutputTsOrder, pNode->outputTsOrder, code); + } return code; } @@ -2053,6 +2067,7 @@ static const char* jkFillPhysiPlanValues = "Values"; static const char* jkFillPhysiPlanTargets = "Targets"; static const char* jkFillPhysiPlanStartTime = "StartTime"; static const char* jkFillPhysiPlanEndTime = "EndTime"; +static const char* jkFillPhysiPlanInputTsOrder = "inputTsOrder"; static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) { const SFillPhysiNode* pNode = (const SFillPhysiNode*)pObj; @@ -2076,6 +2091,9 @@ static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkFillPhysiPlanEndTime, pNode->timeRange.ekey); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkFillPhysiPlanInputTsOrder, pNode->inputTsOrder); + } return code; } @@ -2103,6 +2121,9 @@ static int32_t jsonToPhysiFillNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBigIntValue(pJson, jkFillPhysiPlanEndTime, &pNode->timeRange.ekey); } + if (TSDB_CODE_SUCCESS == code) { + tjsonGetNumberValue(pJson, jkFillPhysiPlanInputTsOrder, pNode->inputTsOrder, code); + } return code; } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index d405b75003..d59ae9b900 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -632,6 +632,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm pWindow->igExpired = pCxt->pPlanCxt->igExpired; } pWindow->inputTsOrder = ORDER_ASC; + pWindow->outputTsOrder = ORDER_ASC; int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_WINDOW, fmIsWindowClauseFunc, &pWindow->pFuncs); if (TSDB_CODE_SUCCESS == code) { @@ -764,6 +765,7 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pFill->node.groupAction = GROUP_ACTION_KEEP; pFill->node.requireDataOrder = DATA_ORDER_LEVEL_IN_GROUP; pFill->node.resultDataOrder = DATA_ORDER_LEVEL_IN_GROUP; + pFill->inputTsOrder = ORDER_ASC; int32_t code = nodesCollectColumns(pSelect, SQL_CLAUSE_WINDOW, NULL, COLLECT_COL_TYPE_ALL, &pFill->node.pTargets); if (TSDB_CODE_SUCCESS == code && NULL == pFill->node.pTargets) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 78537cdb92..f64ea71ccb 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -100,6 +100,27 @@ static EDealRes optRebuildTbanme(SNode** pNode, void* pContext) { return DEAL_RES_CONTINUE; } +static void optSetParentOrder(SLogicNode* pNode, EOrder order) { + if (NULL == pNode) { + return; + } + switch (nodeType(pNode)) { + case QUERY_NODE_LOGIC_PLAN_WINDOW: + ((SWindowLogicNode*)pNode)->inputTsOrder = order; + // window has a sorting function, and the operator behind it uses its output order + return; + case QUERY_NODE_LOGIC_PLAN_JOIN: + ((SJoinLogicNode*)pNode)->inputTsOrder = order; + break; + case QUERY_NODE_LOGIC_PLAN_FILL: + ((SFillLogicNode*)pNode)->inputTsOrder = order; + break; + default: + break; + } + optSetParentOrder(pNode->pParent, order); +} + EDealRes scanPathOptHaveNormalColImpl(SNode* pNode, void* pContext) { if (QUERY_NODE_COLUMN == nodeType(pNode)) { // *((bool*)pContext) = (COLUMN_TYPE_TAG != ((SColumnNode*)pNode)->colType); @@ -305,10 +326,12 @@ static void scanPathOptSetScanOrder(EScanOrder scanOrder, SScanLogicNode* pScan) case SCAN_ORDER_ASC: pScan->scanSeq[0] = 1; pScan->scanSeq[1] = 0; + optSetParentOrder(pScan->node.pParent, ORDER_ASC); break; case SCAN_ORDER_DESC: pScan->scanSeq[0] = 0; pScan->scanSeq[1] = 1; + optSetParentOrder(pScan->node.pParent, ORDER_DESC); break; case SCAN_ORDER_BOTH: pScan->scanSeq[0] = 1; @@ -1038,9 +1061,6 @@ static int32_t pushDownCondOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogi } static bool sortPriKeyOptIsPriKeyOrderBy(SNodeList* pSortKeys) { - if (1 != LIST_LENGTH(pSortKeys)) { - return false; - } SNode* pNode = ((SOrderByExprNode*)nodesListGetNode(pSortKeys, 0))->pExpr; return (QUERY_NODE_COLUMN == nodeType(pNode) ? (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pNode)->colId) : false); } @@ -1051,12 +1071,13 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) { } SSortLogicNode* pSort = (SSortLogicNode*)pNode; if (pSort->groupSort || !sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) { - return TSDB_CODE_SUCCESS; + return false; } return true; } -static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimize, SNodeList** pScanNodes) { +static int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool* pNotOptimize, + SNodeList** pSequencingNodes) { switch (nodeType(pNode)) { case QUERY_NODE_LOGIC_PLAN_SCAN: { SScanLogicNode* pScan = (SScanLogicNode*)pNode; @@ -1064,17 +1085,19 @@ static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimi *pNotOptimize = true; return TSDB_CODE_SUCCESS; } - return nodesListMakeAppend(pScanNodes, (SNode*)pNode); + return nodesListMakeAppend(pSequencingNodes, (SNode*)pNode); } case QUERY_NODE_LOGIC_PLAN_JOIN: { - int32_t code = - sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); + int32_t code = sortPriKeyOptGetSequencingNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), + pNotOptimize, pSequencingNodes); if (TSDB_CODE_SUCCESS == code) { - code = - sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 1), pNotOptimize, pScanNodes); + code = sortPriKeyOptGetSequencingNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 1), pNotOptimize, + pSequencingNodes); } return code; } + case QUERY_NODE_LOGIC_PLAN_WINDOW: + return nodesListMakeAppend(pSequencingNodes, (SNode*)pNode); case QUERY_NODE_LOGIC_PLAN_AGG: case QUERY_NODE_LOGIC_PLAN_PARTITION: *pNotOptimize = true; @@ -1088,14 +1111,15 @@ static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimi return TSDB_CODE_SUCCESS; } - return sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); + return sortPriKeyOptGetSequencingNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, + pSequencingNodes); } -static int32_t sortPriKeyOptGetScanNodes(SLogicNode* pNode, SNodeList** pScanNodes) { +static int32_t sortPriKeyOptGetSequencingNodes(SLogicNode* pNode, SNodeList** pSequencingNodes) { bool notOptimize = false; - int32_t code = sortPriKeyOptGetScanNodesImpl(pNode, ¬Optimize, pScanNodes); + int32_t code = sortPriKeyOptGetSequencingNodesImpl(pNode, ¬Optimize, pSequencingNodes); if (TSDB_CODE_SUCCESS != code || notOptimize) { - nodesClearList(*pScanNodes); + nodesClearList(*pSequencingNodes); } return code; } @@ -1104,34 +1128,26 @@ static EOrder sortPriKeyOptGetPriKeyOrder(SSortLogicNode* pSort) { return ((SOrderByExprNode*)nodesListGetNode(pSort->pSortKeys, 0))->order; } -static void sortPriKeyOptSetParentOrder(SLogicNode* pNode, EOrder order) { - if (NULL == pNode) { - return; - } - if (QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode)) { - ((SWindowLogicNode*)pNode)->inputTsOrder = order; - } else if (QUERY_NODE_LOGIC_PLAN_JOIN == nodeType(pNode)) { - ((SJoinLogicNode*)pNode)->inputTsOrder = order; - } - sortPriKeyOptSetParentOrder(pNode->pParent, order); -} - static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort, - SNodeList* pScanNodes) { + SNodeList* pSequencingNodes) { EOrder order = sortPriKeyOptGetPriKeyOrder(pSort); - SNode* pScanNode = NULL; - FOREACH(pScanNode, pScanNodes) { - SScanLogicNode* pScan = (SScanLogicNode*)pScanNode; - if ((ORDER_DESC == order && pScan->scanSeq[0] > 0) || (ORDER_ASC == order && pScan->scanSeq[1] > 0)) { - TSWAP(pScan->scanSeq[0], pScan->scanSeq[1]); + SNode* pSequencingNode = NULL; + FOREACH(pSequencingNode, pSequencingNodes) { + if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pSequencingNode)) { + SScanLogicNode* pScan = (SScanLogicNode*)pSequencingNode; + if ((ORDER_DESC == order && pScan->scanSeq[0] > 0) || (ORDER_ASC == order && pScan->scanSeq[1] > 0)) { + TSWAP(pScan->scanSeq[0], pScan->scanSeq[1]); + } + if (TSDB_SUPER_TABLE == pScan->tableType) { + pScan->scanType = SCAN_TYPE_TABLE_MERGE; + pScan->node.resultDataOrder = DATA_ORDER_LEVEL_GLOBAL; + pScan->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; + } + pScan->sortPrimaryKey = true; + } else if (QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pSequencingNode)) { + ((SWindowLogicNode*)pSequencingNode)->outputTsOrder = order; } - if (TSDB_SUPER_TABLE == pScan->tableType) { - pScan->scanType = SCAN_TYPE_TABLE_MERGE; - pScan->node.resultDataOrder = DATA_ORDER_LEVEL_GLOBAL; - pScan->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; - } - sortPriKeyOptSetParentOrder(pScan->node.pParent, order); - pScan->sortPrimaryKey = true; + optSetParentOrder(((SLogicNode*)pSequencingNode)->pParent, order); } SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0); @@ -1148,12 +1164,13 @@ static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicS } static int32_t sortPrimaryKeyOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort) { - SNodeList* pScanNodes = NULL; - int32_t code = sortPriKeyOptGetScanNodes((SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0), &pScanNodes); - if (TSDB_CODE_SUCCESS == code && NULL != pScanNodes) { - code = sortPriKeyOptApply(pCxt, pLogicSubplan, pSort, pScanNodes); + SNodeList* pSequencingNodes = NULL; + int32_t code = + sortPriKeyOptGetSequencingNodes((SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0), &pSequencingNodes); + if (TSDB_CODE_SUCCESS == code && NULL != pSequencingNodes) { + code = sortPriKeyOptApply(pCxt, pLogicSubplan, pSort, pSequencingNodes); } - nodesClearList(pScanNodes); + nodesClearList(pSequencingNodes); return code; } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 2e5c4255e6..3771586b34 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1089,6 +1089,8 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* pWindow->triggerType = pWindowLogicNode->triggerType; pWindow->watermark = pWindowLogicNode->watermark; pWindow->igExpired = pWindowLogicNode->igExpired; + pWindow->inputTsOrder = pWindowLogicNode->inputTsOrder; + pWindow->outputTsOrder = pWindowLogicNode->outputTsOrder; SNodeList* pPrecalcExprs = NULL; SNodeList* pFuncs = NULL; @@ -1363,6 +1365,7 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren pFill->mode = pFillNode->mode; pFill->timeRange = pFillNode->timeRange; + pFill->inputTsOrder = pFillNode->inputTsOrder; SDataBlockDescNode* pChildTupe = (((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc); int32_t code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pFillNode->node.pTargets, &pFill->pTargets); diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 793486cb20..6c5b760564 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -32,6 +32,9 @@ TEST_F(PlanOptimizeTest, scanPath) { run("SELECT PERCENTILE(c1, 40), COUNT(*) FROM t1"); run("SELECT LAST(c1) FROM t1"); + + run("SELECT LAST(c1) FROM t1 WHERE ts BETWEEN '2022-7-29 11:10:10' AND '2022-7-30 11:10:10' INTERVAL(10S) " + "FILL(LINEAR)"); } TEST_F(PlanOptimizeTest, pushDownCondition) { @@ -59,7 +62,15 @@ TEST_F(PlanOptimizeTest, sortPrimaryKey) { run("SELECT c1 FROM t1 ORDER BY ts DESC"); + run("SELECT c1 FROM st1 ORDER BY ts DESC"); + run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTART DESC"); + + run("SELECT FIRST(c1) FROM t1 WHERE ts BETWEEN '2022-7-29 11:10:10' AND '2022-7-30 11:10:10' INTERVAL(10S) " + "FILL(LINEAR) ORDER BY _WSTART DESC"); + + run("SELECT LAST(c1) FROM t1 WHERE ts BETWEEN '2022-7-29 11:10:10' AND '2022-7-30 11:10:10' INTERVAL(10S) " + "FILL(LINEAR) ORDER BY _WSTART"); } TEST_F(PlanOptimizeTest, PartitionTags) { From 26e5a7c796a09f9dd3d375d58d308d8af8fa03e8 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 13:54:14 +0800 Subject: [PATCH 09/43] refactor: do some internal refactor. --- source/libs/executor/inc/executorimpl.h | 1 + source/libs/executor/src/executor.c | 15 +++++++++---- source/libs/executor/src/executorimpl.c | 30 +++++++++++++++++++++---- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 05dd3806b9..7aa85279b1 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -1026,6 +1026,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsColIndex); +bool groupbyTbname(SNodeList* pGroupList); int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* groupKey); SSDataBlock* createSpecialDataBlock(EStreamType type); void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 8b1cbb5ae8..0abc6b0624 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -248,9 +248,11 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo } // todo refactor STableList + bool assignUid = false; size_t bufLen = (pScanInfo->pGroupTags != NULL) ? getTableTagsBufLen(pScanInfo->pGroupTags) : 0; char* keyBuf = NULL; if (bufLen > 0) { + assignUid = groupbyTbname(pScanInfo->pGroupTags); keyBuf = taosMemoryMalloc(bufLen); if (keyBuf == NULL) { return TSDB_CODE_OUT_OF_MEMORY; @@ -262,14 +264,19 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo STableKeyInfo keyInfo = {.uid = *uid, .groupId = 0}; if (bufLen > 0) { - code = getGroupIdFromTagsVal(pScanInfo->readHandle.meta, keyInfo.uid, pScanInfo->pGroupTags, keyBuf, - &keyInfo.groupId); - if (code != TSDB_CODE_SUCCESS) { - return code; + if (assignUid) { + keyInfo.groupId = keyInfo.uid; + } else { + code = getGroupIdFromTagsVal(pScanInfo->readHandle.meta, keyInfo.uid, pScanInfo->pGroupTags, keyBuf, + &keyInfo.groupId); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } } taosArrayPush(pTaskInfo->tableqinfoList.pTableList, &keyInfo); + taosHashPut(pTaskInfo->tableqinfoList.map, &keyInfo.uid, sizeof(keyInfo.uid), &keyInfo.groupId, sizeof(keyInfo.groupId)); } if (keyBuf != NULL) { diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 12501f9f7a..fa27dacafa 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3829,6 +3829,19 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo, int32_t groupNum) return TDB_CODE_SUCCESS; } +bool groupbyTbname(SNodeList* pGroupList) { + bool bytbname = false; + if (LIST_LENGTH(pGroupList) == 0) { + SNode* p = nodesListGetNode(pGroupList, 0); + if (p->type == QUERY_NODE_FUNCTION) { + // partition by tbname/group by tbname + bytbname = (strcmp(((struct SFunctionNode*)p)->functionName, "tbname") == 0); + } + } + + return bytbname; +} + int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* group) { if (group == NULL) { return TDB_CODE_SUCCESS; @@ -3855,12 +3868,21 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, return TSDB_CODE_OUT_OF_MEMORY; } + bool assignUid = groupbyTbname(group); + int32_t groupNum = 0; - for (int32_t i = 0; i < taosArrayGetSize(pTableListInfo->pTableList); i++) { + size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList); + + for (int32_t i = 0; i < numOfTables; i++) { STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i); - int32_t code = getGroupIdFromTagsVal(pHandle->meta, info->uid, group, keyBuf, &info->groupId); - if (code != TSDB_CODE_SUCCESS) { - return code; + + if (assignUid) { + info->groupId = info->uid; + } else { + int32_t code = getGroupIdFromTagsVal(pHandle->meta, info->uid, group, keyBuf, &info->groupId); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } taosHashPut(pTableListInfo->map, &(info->uid), sizeof(uint64_t), &info->groupId, sizeof(uint64_t)); From 0ff775c46f99d5a6c13f52444c8cfa5bf1184c55 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 14:33:50 +0800 Subject: [PATCH 10/43] fix(query): keep order info in fill operator. --- source/libs/executor/inc/executorimpl.h | 7 +- source/libs/executor/inc/tfill.h | 3 +- source/libs/executor/src/executorimpl.c | 9 +-- source/libs/executor/src/joinoperator.c | 8 +- source/libs/executor/src/tfill.c | 3 +- source/libs/executor/src/timewindowoperator.c | 75 +++++++++---------- 6 files changed, 51 insertions(+), 54 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 54c98fa948..37818dd91d 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -523,8 +523,8 @@ typedef struct SIntervalAggOperatorInfo { STimeWindow win; // query time range bool timeWindowInterpo; // interpolation needed or not SArray* pInterpCols; // interpolation columns - int32_t order; // current SSDataBlock scan order int32_t resultTsOrder; // result timestamp order + int32_t inputOrder; // input data ts order EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] STimeWindowAggSupp twAggSup; bool invertible; @@ -534,8 +534,7 @@ typedef struct SIntervalAggOperatorInfo { SArray* pDelWins; // SWinRes int32_t delIndex; SSDataBlock* pDelRes; - - SNode *pCondition; + SNode* pCondition; } SIntervalAggOperatorInfo; typedef struct SMergeAlignedIntervalAggOperatorInfo { @@ -805,7 +804,7 @@ typedef struct STagFilterOperatorInfo { typedef struct SJoinOperatorInfo { SSDataBlock *pRes; int32_t joinType; - int32_t inputTsOrder; + int32_t inputOrder; SSDataBlock *pLeft; int32_t leftPos; diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index db04c5212c..b604794dad 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -76,10 +76,9 @@ bool taosFillHasMoreResults(struct SFillInfo* pFillInfo); SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t slotId, - const char* id); + int32_t order, const char* id); void* taosDestroyFillInfo(struct SFillInfo *pFillInfo); -void taosFillSetDataOrderInfo(SFillInfo* pFillInfo, int32_t order); int64_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, SSDataBlock* p, int32_t capacity); int64_t getFillInfoStart(struct SFillInfo *pFillInfo); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index e2727cfb4a..7359a4ea90 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3234,8 +3234,6 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { return pResBlock; } - taosFillSetDataOrderInfo(pInfo->pFillInfo, TSDB_ORDER_ASC); - SOperatorInfo* pDownstream = pOperator->pDownstream[0]; while (1) { SSDataBlock* pBlock = pDownstream->fpSet.getNextFn(pDownstream); @@ -3588,14 +3586,14 @@ void doDestroyExchangeOperatorInfo(void* param) { } static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t numOfCols, SNodeListNode* pValNode, - STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType) { + STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType, int32_t order) { SFillColInfo* pColInfo = createFillColInfo(pExpr, numOfCols, pValNode); STimeWindow w = getAlignQueryTimeWindow(pInterval, pInterval->precision, win.skey); w = getFirstQualifiedTimeWindow(win.skey, &w, pInterval, TSDB_ORDER_ASC); pInfo->pFillInfo = - taosCreateFillInfo(w.skey, 0, capacity, numOfCols, pInterval, fillType, pColInfo, pInfo->primaryTsCol, id); + taosCreateFillInfo(w.skey, 0, capacity, numOfCols, pInterval, fillType, pColInfo, pInfo->primaryTsCol, order, id); pInfo->win = win; pInfo->p = taosMemoryCalloc(numOfCols, POINTER_BYTES); @@ -3625,6 +3623,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* ? &((SMergeAlignedIntervalAggOperatorInfo*)downstream->info)->intervalAggOperatorInfo->interval : &((SIntervalAggOperatorInfo*)downstream->info)->interval; + int32_t order = (pPhyFillNode->inputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC; int32_t type = convertFillType(pPhyFillNode->mode); SResultInfo* pResultInfo = &pOperator->resultInfo; @@ -3636,7 +3635,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* &numOfOutputCols, COL_MATCH_FROM_SLOT_ID); int32_t code = initFillInfo(pInfo, pExprInfo, num, (SNodeListNode*)pPhyFillNode->pValues, pPhyFillNode->timeRange, - pResultInfo->capacity, pTaskInfo->id.str, pInterval, type); + pResultInfo->capacity, pTaskInfo->id.str, pInterval, type, order); if (code != TSDB_CODE_SUCCESS) { goto _error; } diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 8902804fab..17b81cdb82 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -77,11 +77,11 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t pInfo->pCondAfterMerge = NULL; } - pInfo->inputTsOrder = TSDB_ORDER_ASC; + pInfo->inputOrder = TSDB_ORDER_ASC; if (pJoinNode->inputTsOrder == ORDER_ASC) { - pInfo->inputTsOrder = TSDB_ORDER_ASC; + pInfo->inputOrder = TSDB_ORDER_ASC; } else if (pJoinNode->inputTsOrder == ORDER_DESC) { - pInfo->inputTsOrder = TSDB_ORDER_DESC; + pInfo->inputOrder = TSDB_ORDER_DESC; } pOperator->fpSet = @@ -312,7 +312,7 @@ static void doMergeJoinImpl(struct SOperatorInfo* pOperator, SSDataBlock* pRes) int32_t nrows = pRes->info.rows; - bool asc = (pJoinInfo->inputTsOrder == TSDB_ORDER_ASC) ? true : false; + bool asc = (pJoinInfo->inputOrder == TSDB_ORDER_ASC) ? true : false; while (1) { int64_t leftTs = 0; diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index be5631cd85..c5d68676d2 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -435,7 +435,7 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) { struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, - int32_t primaryTsSlotId, const char* id) { + int32_t primaryTsSlotId, int32_t order, const char* id) { if (fillType == TSDB_FILL_NONE) { return NULL; } @@ -446,6 +446,7 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfTags, int32_t capa return NULL; } + pFillInfo->order = order; pFillInfo->tsSlotId = primaryTsSlotId; taosResetFillInfo(pFillInfo, skey); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 4023009489..5e64d14c4c 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -362,7 +362,7 @@ static void setNotInterpoWindowKey(SqlFunctionCtx* pCtx, int32_t numOfOutput, in static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, int32_t pos, SSDataBlock* pBlock, const TSKEY* tsCols, STimeWindow* win, SExprSupp* pSup) { - bool ascQuery = (pInfo->order == TSDB_ORDER_ASC); + bool ascQuery = (pInfo->inputOrder == TSDB_ORDER_ASC); TSKEY curTs = tsCols[pos]; @@ -392,7 +392,7 @@ static bool setTimeWindowInterpolationStartTs(SIntervalAggOperatorInfo* pInfo, i static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SExprSupp* pSup, int32_t endRowIndex, SArray* pDataBlock, const TSKEY* tsCols, TSKEY blockEkey, STimeWindow* win) { - int32_t order = pInfo->order; + int32_t order = pInfo->inputOrder; TSKEY actualEndKey = tsCols[endRowIndex]; TSKEY key = (order == TSDB_ORDER_ASC) ? win->ekey : win->skey; @@ -550,7 +550,7 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB if (!done) { int32_t endRowIndex = startPos + forwardRows - 1; - TSKEY endKey = (pInfo->order == TSDB_ORDER_ASC) ? pBlock->info.window.ekey : pBlock->info.window.skey; + TSKEY endKey = (pInfo->inputOrder == TSDB_ORDER_ASC) ? pBlock->info.window.ekey : pBlock->info.window.skey; bool interp = setTimeWindowInterpolationEndTs(pInfo, pSup, endRowIndex, pBlock->pDataBlock, tsCols, endKey, win); if (interp) { setResultRowInterpo(pResult, RESULT_ROW_END_INTERP); @@ -639,7 +639,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num setNotInterpoWindowKey(pSup->pCtx, numOfExprs, RESULT_ROW_START_INTERP); doApplyFunctions(pTaskInfo, pSup->pCtx, &w, &pInfo->twAggSup.timeWindowData, startPos, 0, tsCols, pBlock->info.rows, - numOfExprs, pInfo->order); + numOfExprs, pInfo->inputOrder); if (isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)) { closeResultRow(pr); @@ -924,11 +924,11 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul int32_t numOfOutput = pSup->numOfExprs; int64_t* tsCols = extractTsCol(pBlock, pInfo); uint64_t tableGroupId = pBlock->info.groupId; - bool ascScan = (pInfo->order == TSDB_ORDER_ASC); + bool ascScan = (pInfo->inputOrder == TSDB_ORDER_ASC); TSKEY ts = getStartTsKey(&pBlock->info.window, tsCols); SResultRow* pResult = NULL; - STimeWindow win = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->order); + STimeWindow win = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->inputOrder); int32_t ret = TSDB_CODE_SUCCESS; if ((!pInfo->ignoreExpiredData || !isCloseWindow(&win, &pInfo->twAggSup)) && inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) { @@ -946,7 +946,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul TSKEY ekey = ascScan ? win.ekey : win.skey; int32_t forwardRows = - getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->order); + getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder); ASSERT(forwardRows > 0); // prev time window not interpolation yet. @@ -969,7 +969,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) { updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &win, true); doApplyFunctions(pTaskInfo, pSup->pCtx, &win, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, - pBlock->info.rows, numOfOutput, pInfo->order); + pBlock->info.rows, numOfOutput, pInfo->inputOrder); } doCloseWindow(pResultRowInfo, pInfo, pResult); @@ -977,14 +977,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul STimeWindow nextWin = win; while (1) { int32_t prevEndPos = forwardRows - 1 + startPos; - startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, pInfo->order); + startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, pInfo->inputOrder); if (startPos < 0) { break; } if (pInfo->ignoreExpiredData && isCloseWindow(&nextWin, &pInfo->twAggSup)) { ekey = ascScan ? nextWin.ekey : nextWin.skey; forwardRows = - getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->order); + getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder); continue; } @@ -1002,14 +1002,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul ekey = ascScan ? nextWin.ekey : nextWin.skey; forwardRows = - getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->order); + getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder); // window start(end) key interpolation doWindowBorderInterpolation(pInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pSup); updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &nextWin, true); doApplyFunctions(pTaskInfo, pSup->pCtx, &nextWin, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, - pBlock->info.rows, numOfOutput, pInfo->order); + pBlock->info.rows, numOfOutput, pInfo->inputOrder); doCloseWindow(pResultRowInfo, pInfo, pResult); } @@ -1082,7 +1082,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { break; } - getTableScanInfo(pOperator, &pInfo->order, &scanFlag); + getTableScanInfo(pOperator, &pInfo->inputOrder, &scanFlag); if (pInfo->scalarSupp.pExprInfo != NULL) { SExprSupp* pExprSup = &pInfo->scalarSupp; @@ -1090,7 +1090,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { } // the pDataBlock are always the same one, no need to call this again - setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->order, scanFlag, true); + setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->inputOrder, scanFlag, true); blockDataUpdateTsWindow(pBlock, pInfo->primaryTsIndex); hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, scanFlag, NULL); @@ -1549,7 +1549,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { SIntervalAggOperatorInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - pInfo->order = TSDB_ORDER_ASC; + pInfo->inputOrder = TSDB_ORDER_ASC; SExprSupp* pSup = &pOperator->exprSupp; if (pOperator->status == OP_EXEC_DONE) { @@ -1609,7 +1609,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { // The timewindow that overlaps the timestamps of the input pBlock need to be recalculated and return to the // caller. Note that all the time window are not close till now. // the pDataBlock are always the same one, no need to call this again - setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->order, MAIN_SCAN, true); + setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->inputOrder, MAIN_SCAN, true); if (pInfo->invertible) { setInverFunction(pSup->pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.type); } @@ -1789,8 +1789,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* } pInfo->win = pTaskInfo->window; - pInfo->order = TSDB_ORDER_ASC; - pInfo->resultTsOrder = TSDB_ORDER_ASC; + pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC; + pInfo->resultTsOrder = (pPhyNode->window.outputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC; pInfo->interval = *pInterval; pInfo->execModel = pTaskInfo->execModel; pInfo->twAggSup = *pTwAggSupp; @@ -1878,7 +1878,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExpr goto _error; } - pInfo->order = TSDB_ORDER_ASC; + pInfo->inputOrder = TSDB_ORDER_ASC; pInfo->interval = *pInterval; pInfo->execModel = OPTR_EXEC_MODEL_STREAM; pInfo->win = pTaskInfo->window; @@ -4563,7 +4563,7 @@ static int32_t outputMergeAlignedIntervalResult(SOperatorInfo* pOperatorInfo, ui SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo; SExprSupp* pSup = &pOperatorInfo->exprSupp; - bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); + bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC); SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &wstartTs, TSDB_KEYSIZE, tableGroupId); SResultRowPosition* p1 = (SResultRowPosition*)taosHashGet(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, @@ -4617,7 +4617,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR } else { updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &currWin, true); doApplyFunctions(pTaskInfo, pSup->pCtx, &currWin, &iaInfo->twAggSup.timeWindowData, startPos, currPos - startPos, - tsCols, pBlock->info.rows, numOfOutput, iaInfo->order); + tsCols, pBlock->info.rows, numOfOutput, iaInfo->inputOrder); outputMergeAlignedIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, currTs); @@ -4636,7 +4636,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR } updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &currWin, true); doApplyFunctions(pTaskInfo, pSup->pCtx, &currWin, &iaInfo->twAggSup.timeWindowData, startPos, currPos - startPos, - tsCols, pBlock->info.rows, numOfOutput, iaInfo->order); + tsCols, pBlock->info.rows, numOfOutput, iaInfo->inputOrder); outputMergeAlignedIntervalResult(pOperatorInfo, tableGroupId, pResultBlock, currTs); } @@ -4681,8 +4681,8 @@ static SSDataBlock* doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { break; } - getTableScanInfo(pOperator, &iaInfo->order, &scanFlag); - setInputDataBlock(pOperator, pSup->pCtx, pBlock, iaInfo->order, scanFlag, true); + getTableScanInfo(pOperator, &iaInfo->inputOrder, &scanFlag); + setInputDataBlock(pOperator, pSup->pCtx, pBlock, iaInfo->inputOrder, scanFlag, true); doMergeAlignedIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes); doFilter(miaInfo->pCondition, pRes, NULL); if (pRes->info.rows >= pOperator->resultInfo.capacity) { @@ -4723,7 +4723,7 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, miaInfo->pCondition = pCondition; iaInfo->win = pTaskInfo->window; - iaInfo->order = TSDB_ORDER_ASC; + iaInfo->inputOrder = TSDB_ORDER_ASC; iaInfo->interval = *pInterval; iaInfo->execModel = pTaskInfo->execModel; iaInfo->primaryTsIndex = primaryTsSlotId; @@ -4805,7 +4805,7 @@ static int32_t finalizeWindowResult(SOperatorInfo* pOperatorInfo, uint64_t table SMergeIntervalAggOperatorInfo* miaInfo = pOperatorInfo->info; SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo; SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo; - bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); + bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC); SExprSupp* pExprSup = &pOperatorInfo->exprSupp; SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &win->skey, TSDB_KEYSIZE, tableGroupId); @@ -4823,7 +4823,7 @@ static int32_t outputPrevIntervalResult(SOperatorInfo* pOperatorInfo, uint64_t t SMergeIntervalAggOperatorInfo* miaInfo = pOperatorInfo->info; SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo; SExecTaskInfo* pTaskInfo = pOperatorInfo->pTaskInfo; - bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); + bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC); SExprSupp* pExprSup = &pOperatorInfo->exprSupp; SGroupTimeWindow groupTimeWindow = {.groupId = tableGroupId, .window = *newWin}; @@ -4859,12 +4859,12 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* int32_t numOfOutput = pExprSup->numOfExprs; int64_t* tsCols = extractTsCol(pBlock, iaInfo); uint64_t tableGroupId = pBlock->info.groupId; - bool ascScan = (iaInfo->order == TSDB_ORDER_ASC); + bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC); TSKEY blockStartTs = getStartTsKey(&pBlock->info.window, tsCols); SResultRow* pResult = NULL; STimeWindow win = - getActiveTimeWindow(iaInfo->aggSup.pResultBuf, pResultRowInfo, blockStartTs, &iaInfo->interval, iaInfo->order); + getActiveTimeWindow(iaInfo->aggSup.pResultBuf, pResultRowInfo, blockStartTs, &iaInfo->interval, iaInfo->inputOrder); int32_t ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pExprSup->pCtx, @@ -4875,7 +4875,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* TSKEY ekey = ascScan ? win.ekey : win.skey; int32_t forwardRows = - getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->order); + getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->inputOrder); ASSERT(forwardRows > 0); // prev time window not interpolation yet. @@ -4896,7 +4896,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &win, true); doApplyFunctions(pTaskInfo, pExprSup->pCtx, &win, &iaInfo->twAggSup.timeWindowData, startPos, forwardRows, tsCols, - pBlock->info.rows, numOfOutput, iaInfo->order); + pBlock->info.rows, numOfOutput, iaInfo->inputOrder); doCloseWindow(pResultRowInfo, iaInfo, pResult); // output previous interval results after this interval (&win) is closed @@ -4905,7 +4905,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* STimeWindow nextWin = win; while (1) { int32_t prevEndPos = forwardRows - 1 + startPos; - startPos = getNextQualifiedWindow(&iaInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, iaInfo->order); + startPos = getNextQualifiedWindow(&iaInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, iaInfo->inputOrder); if (startPos < 0) { break; } @@ -4920,14 +4920,14 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* ekey = ascScan ? nextWin.ekey : nextWin.skey; forwardRows = - getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->order); + getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->inputOrder); // window start(end) key interpolation doWindowBorderInterpolation(iaInfo, pBlock, pResult, &nextWin, startPos, forwardRows, pExprSup); updateTimeWindowInfo(&iaInfo->twAggSup.timeWindowData, &nextWin, true); doApplyFunctions(pTaskInfo, pExprSup->pCtx, &nextWin, &iaInfo->twAggSup.timeWindowData, startPos, forwardRows, - tsCols, pBlock->info.rows, numOfOutput, iaInfo->order); + tsCols, pBlock->info.rows, numOfOutput, iaInfo->inputOrder); doCloseWindow(pResultRowInfo, iaInfo, pResult); // output previous interval results after this interval (&nextWin) is closed @@ -4981,8 +4981,8 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) { break; } - getTableScanInfo(pOperator, &iaInfo->order, &scanFlag); - setInputDataBlock(pOperator, pExpSupp->pCtx, pBlock, iaInfo->order, scanFlag, true); + getTableScanInfo(pOperator, &iaInfo->inputOrder, &scanFlag); + setInputDataBlock(pOperator, pExpSupp->pCtx, pBlock, iaInfo->inputOrder, scanFlag, true); doMergeIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes); if (pRes->info.rows >= pOperator->resultInfo.threshold) { @@ -5024,9 +5024,8 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprI miaInfo->groupIntervals = tdListNew(sizeof(SGroupTimeWindow)); SIntervalAggOperatorInfo* iaInfo = &miaInfo->intervalAggOperatorInfo; - iaInfo->win = pTaskInfo->window; - iaInfo->order = TSDB_ORDER_ASC; + iaInfo->inputOrder = TSDB_ORDER_ASC; iaInfo->interval = *pInterval; iaInfo->execModel = pTaskInfo->execModel; From a7bca145aab921766d9a512a0e98c0a10e245c50 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 29 Jul 2022 14:55:35 +0800 Subject: [PATCH 11/43] enh: last function optimize --- source/libs/command/inc/commandInt.h | 6 +++++- source/libs/command/src/explain.c | 5 +++++ tests/script/tsim/parser/limit_stb.sim | 10 +++++----- tests/script/tsim/parser/limit_tb.sim | 6 +++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h index f60c518d73..104c007756 100644 --- a/source/libs/command/inc/commandInt.h +++ b/source/libs/command/inc/commandInt.h @@ -19,6 +19,8 @@ #ifdef __cplusplus extern "C" { #endif + +// clang-format off #include "nodes.h" #include "plannodes.h" #include "ttime.h" @@ -77,6 +79,8 @@ extern "C" { #define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64 #define EXPLAIN_MODE_FORMAT "mode=%s" #define EXPLAIN_STRING_TYPE_FORMAT "%s" +#define EXPLAIN_INPUT_ORDER_FORMAT "input_order=%s" +#define EXPLAIN_OUTPUT_ORDER_TYPE_FORMAT "output_order=%s" #define COMMAND_RESET_LOG "resetLog" #define COMMAND_SCHEDULE_POLICY "schedulePolicy" @@ -122,7 +126,7 @@ typedef struct SExplainCtx { SHashObj *groupHash; // Hash } SExplainCtx; -#define EXPLAIN_ORDER_STRING(_order) ((TSDB_ORDER_ASC == _order) ? "Ascending" : "Descending") +#define EXPLAIN_ORDER_STRING(_order) ((ORDER_ASC == _order) ? "asc" : "desc") #define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join") #define INVERAL_TIME_FROM_PRECISION_TO_UNIT(_t, _u, _p) (((_u) == 'n' || (_u) == 'y') ? (_t) : (convertTimeFromPrecisionToUnit(_t, _p, _u))) diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 266f96b41e..a6337837aa 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +// clang-format off #include "commandInt.h" #include "plannodes.h" #include "query.h" @@ -849,6 +850,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pIntNode->window.pFuncs->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pIntNode->window.node.pOutputDataBlockDesc->totalRowSize); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_INPUT_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pIntNode->window.inputTsOrder)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_OUTPUT_ORDER_TYPE_FORMAT, EXPLAIN_ORDER_STRING(pIntNode->window.outputTsOrder)); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim index 40ce404895..3214eb26b4 100644 --- a/tests/script/tsim/parser/limit_stb.sim +++ b/tests/script/tsim/parser/limit_stb.sim @@ -469,7 +469,7 @@ if $data24 != 9.000000000 then endi ### supertable aggregation + where + interval + limit offset -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) order by _wstart limit 5 offset 1 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit 5 offset 1 if $rows != 5 then return -1 endi @@ -487,7 +487,7 @@ if $data41 != 5 then endi $offset = $rowNum / 2 $offset = $offset + 1 -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) order by _wstart limit $offset offset $offset +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit $offset offset $offset $val = $rowNum - $offset if $rows != $val then return -1 @@ -507,7 +507,7 @@ endi ### supertable aggregation + where + interval + group by order by tag + limit offset ## TBASE-345 -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 3 offset 0 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 0 if $rows != 3 then return -1 endi @@ -531,7 +531,7 @@ if $data29 != 3 then endi -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 3 offset 1 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 1 if $rows != 3 then return -1 endi @@ -553,7 +553,7 @@ if $data09 != 4 then return -1 endi -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 3 offset 0 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 0 if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/parser/limit_tb.sim b/tests/script/tsim/parser/limit_tb.sim index 4a71813ae8..6c5706778d 100644 --- a/tests/script/tsim/parser/limit_tb.sim +++ b/tests/script/tsim/parser/limit_tb.sim @@ -728,7 +728,7 @@ sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb w if $rows != 0 then return -1 endi -sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) order by _wstart limit 3 offset 1 +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi @@ -742,7 +742,7 @@ if $data23 != 9.00000 then return -1 endi -sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) order by _wstart limit 3 offset 0 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 0 if $rows != 3 then return -1 endi @@ -777,7 +777,7 @@ if $data29 != nchar8 then return -1 endi -sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) order by _wstart limit 3 offset 1 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi From 4e1daca60ea405ca63f0ebbd1bae2d9adba5a6d2 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 29 Jul 2022 14:57:15 +0800 Subject: [PATCH 12/43] enh: last function optimize --- tests/script/tsim/parser/limit_stb.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim index 3214eb26b4..0d0e4a8ea3 100644 --- a/tests/script/tsim/parser/limit_stb.sim +++ b/tests/script/tsim/parser/limit_stb.sim @@ -542,7 +542,7 @@ if $data09 != 4 then return -1 endi -sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc, _wstart limit 1 offset 0 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 1 offset 0 if $rows != 1 then return -1 endi From db856694ec1acf187312a59fcc22621ba63ef56e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 29 Jul 2022 15:01:12 +0800 Subject: [PATCH 13/43] fix sim error --- tests/script/tsim/parser/condition_query.sim | 489 +++++++++---------- 1 file changed, 242 insertions(+), 247 deletions(-) diff --git a/tests/script/tsim/parser/condition_query.sim b/tests/script/tsim/parser/condition_query.sim index dc5eed49be..87ea9f3cbe 100644 --- a/tests/script/tsim/parser/condition_query.sim +++ b/tests/script/tsim/parser/condition_query.sim @@ -132,7 +132,7 @@ if $rows != 28 then return -1 endi -sql select ts,c1,c7 from stb1 where c7 = false +sql select ts,c1,c7 from stb1 where c7 = false order by ts if $rows != 14 then return -1 endi @@ -173,7 +173,7 @@ if $data32 != 0 then return -1 endi -sql select ts,c1,c7 from stb1 where c7 = true +sql select ts,c1,c7 from stb1 where c7 = true order by ts if $rows != 14 then return -1 endi @@ -215,7 +215,7 @@ if $data32 != 1 then endi -sql select * from stb1 where c8 = '51' or c8 = '4' +sql select * from stb1 where c8 = '51' or c8 = '4' order by ts if $rows != 2 then return -1 endi @@ -350,7 +350,7 @@ sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 51 or c1 > 54) if $rows != 4 then return -1 endi -sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 and c1 > 54) +sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 and c1 > 54) order by ts if $rows != 5 then return -1 endi @@ -401,7 +401,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 and c1 > 54) +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 and c1 > 54) order by ts if $rows != 5 then return -1 endi @@ -420,11 +420,11 @@ endi if $data40 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 and c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 and c1 > 54) order by ts if $rows != 0 then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 and c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 and c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -443,7 +443,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) and c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) and c1 > 54 order by ts if $rows != 4 then return -1 endi @@ -459,7 +459,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) and c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) and c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -478,7 +478,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 or c1 > 54) +sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 or c1 > 54) order by ts if $rows != 25 then return -1 endi @@ -497,7 +497,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 or c1 > 54) +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 or c1 > 54) order by ts if $rows != 5 then return -1 endi @@ -516,7 +516,7 @@ endi if $data40 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 25 then return -1 endi @@ -535,7 +535,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 5 then return -1 endi @@ -554,7 +554,7 @@ endi if $data40 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 or c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 or c1 > 54) order by ts if $rows != 4 then return -1 endi @@ -570,7 +570,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 or c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 or c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -589,7 +589,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) or c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) or c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -608,7 +608,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) or c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) or c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -627,7 +627,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 and c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 and c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -646,7 +646,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) and c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) and c1 > 54 order by ts if $rows != 4 then return -1 endi @@ -662,7 +662,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 and c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 and c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -681,7 +681,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) and c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) and c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -700,7 +700,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c1 > 62 or (c1 > 53 or c1 < 51) and c1 > 54 +sql select * from stb1 where c1 > 62 or (c1 > 53 or c1 < 51) and c1 > 54 order by ts if $rows != 4 then return -1 endi @@ -716,7 +716,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 or c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 or c1 > 54) order by ts if $rows != 28 then return -1 endi @@ -735,7 +735,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 or c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 or c1 > 54) order by ts if $rows != 28 then return -1 endi @@ -754,7 +754,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 28 then return -1 endi @@ -773,7 +773,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 28 then return -1 endi @@ -792,7 +792,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select ts,c1 from stb1 where (c1 > 60 or c1 < 10 or (c1 > 20 and c1 < 30)) and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:25.000' and c1 != 21 and c1 != 22 +sql select ts,c1 from stb1 where (c1 > 60 or c1 < 10 or (c1 > 20 and c1 < 30)) and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:25.000' and c1 != 21 and c1 != 22 order by ts if $rows != 6 then return -1 endi @@ -834,7 +834,7 @@ if $data51 != 61 then endi -sql select * from stb1 where (c1 > 40 or c1 < 20) and (c2 < 53 or c2 >= 63) and c3 > 1 and c3 < 5 +sql select * from stb1 where (c1 > 40 or c1 < 20) and (c2 < 53 or c2 >= 63) and c3 > 1 and c3 < 5 order by ts if $rows != 3 then return -1 endi @@ -857,7 +857,7 @@ if $data21 != 4 then return -1 endi -sql select * from stb1 where (c1 > 52 or c1 < 10) and (c2 > 1 and c2 < 61) +sql select * from stb1 where (c1 > 52 or c1 < 10) and (c2 > 1 and c2 < 61) order by ts if $rows != 5 then return -1 endi @@ -892,7 +892,7 @@ if $data41 != 54 then return -1 endi -sql select * from stb1 where (c3 > 52 or c3 < 10) and (c4 > 1 and c4 < 61) and (c5 = 2 or c6 = 3.0 or c6 = 4.0 or c6 = 53); +sql select * from stb1 where (c3 > 52 or c3 < 10) and (c4 > 1 and c4 < 61) and (c5 = 2 or c6 = 3.0 or c6 = 4.0 or c6 = 53) order by ts if $rows != 4 then return -1 endi @@ -1003,7 +1003,7 @@ if $data01 != NULL then endi #xxx -sql select * from stb1 where c8 like '1'; +sql select * from stb1 where c8 like '1' order by ts; if $rows != 1 then return -1 endi @@ -1012,7 +1012,7 @@ if $data00 != @21-05-05 18:19:00.000@ then endi #xxx -sql select * from stb1 where c8 like '1%' and c8 like '%1'; +sql select * from stb1 where c8 like '1%' and c8 like '%1' order by ts; if $rows != 2 then return -1 endi @@ -1024,7 +1024,7 @@ if $data10 != @21-05-05 18:19:04.000@ then endi #xxx -sql select * from stb1 where c8 like '1' and c8 like '2'; +sql select * from stb1 where c8 like '1' and c8 like '2' order by ts; if $rows != 0 then return -1 endi @@ -1040,7 +1040,7 @@ if $data01 != NULL then return -1 endi -sql select * from stb1 where c1 is not null; +sql select * from stb1 where c1 is not null order by ts; if $rows != 28 then return -1 endi @@ -1050,7 +1050,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c2 is not null; +sql select * from stb1 where c2 is not null order by ts; if $rows != 28 then return -1 endi @@ -1060,7 +1060,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c3 is not null; +sql select * from stb1 where c3 is not null order by ts; if $rows != 28 then return -1 endi @@ -1070,7 +1070,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c4 is not null; +sql select * from stb1 where c4 is not null order by ts; if $rows != 28 then return -1 endi @@ -1080,7 +1080,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c5 is not null; +sql select * from stb1 where c5 is not null order by ts; if $rows != 28 then return -1 endi @@ -1090,7 +1090,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c6 is not null; +sql select * from stb1 where c6 is not null order by ts; if $rows != 28 then return -1 endi @@ -1100,7 +1100,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c7 is not null; +sql select * from stb1 where c7 is not null order by ts; if $rows != 28 then return -1 endi @@ -1110,7 +1110,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c8 is not null; +sql select * from stb1 where c8 is not null order by ts; if $rows != 28 then return -1 endi @@ -1120,7 +1120,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c9 is not null; +sql select * from stb1 where c9 is not null order by ts; if $rows != 28 then return -1 endi @@ -1130,7 +1130,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c1 > 63 or c1 is null; +sql select * from stb1 where c1 > 63 or c1 is null order by ts; if $rows != 2 then return -1 endi @@ -1146,7 +1146,7 @@ endi if $data11 != NULL then return -1 endi -sql select * from stb1 where c1 is null and c2 is null; +sql select * from stb1 where c1 is null and c2 is null order by ts; if $rows != 1 then return -1 endi @@ -1156,11 +1156,11 @@ endi if $data01 != NULL then return -1 endi -sql select * from stb1 where c1 is null and c2 is null and c3 is not null; +sql select * from stb1 where c1 is null and c2 is null and c3 is not null order by ts; if $rows != 0 then return -1 endi -sql select * from stb1 where c1 is null and c2 is null and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:28.000'; +sql select * from stb1 where c1 is null and c2 is null and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:28.000' order by ts; if $rows != 0 then return -1 endi @@ -1175,7 +1175,7 @@ if $rows != 29 then return -1 endi -sql select * from stb1 where (c1 is null or c1 > 40) and c1 < 44; +sql select * from stb1 where (c1 is null or c1 > 40) and c1 < 44 order by ts; if $rows != 3 then return -1 endi @@ -1189,7 +1189,7 @@ if $data20 != @21-05-05 18:19:18.000@ then return -1 endi -sql select * from stb1 where c1 in (11,21,31,41) and c1 in (11,42); +sql select * from stb1 where c1 in (11,21,31,41) and c1 in (11,42) order by ts; if $rows != 1 then return -1 endi @@ -1197,7 +1197,7 @@ if $data00 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c8 in ('11','21','31','41') and c8 in ('11','42'); +sql select * from stb1 where c8 in ('11','21','31','41') and c8 in ('11','42') order by ts; if $rows != 1 then return -1 endi @@ -1205,7 +1205,7 @@ if $data00 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where (c1 > 60 and c2 > 40) or (c1 > 62 and c2 > 50); +sql select * from stb1 where (c1 > 60 and c2 > 40) or (c1 > 62 and c2 > 50) order by ts; if $rows != 4 then return -1 endi @@ -1222,7 +1222,7 @@ if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 = 3 or c1 = 5 or c1 >= 44 and c1 <= 52; +sql select * from stb1 where c1 = 3 or c1 = 5 or c1 >= 44 and c1 <= 52 order by ts; if $rows != 4 then return -1 endi @@ -1239,7 +1239,7 @@ if $data30 != @21-05-05 18:19:21.000@ then return -1 endi -sql select * from stb1 where c8 LIKE '%1'; +sql select * from stb1 where c8 LIKE '%1' order by ts; if $rows != 7 then return -1 endi @@ -1264,7 +1264,7 @@ endi if $data60 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c9 LIKE '%1'; +sql select * from stb1 where c9 LIKE '%1' order by ts; if $rows != 7 then return -1 endi @@ -1289,7 +1289,7 @@ endi if $data60 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c8 LIKE '%1' or c9 like '_2') and (c5 > 50 or c6 > 30) and ( c8 like '3_' or c9 like '4_') and (c4 <= 31 or c4 >= 42); +sql select * from stb1 where (c8 LIKE '%1' or c9 like '_2') and (c5 > 50 or c6 > 30) and ( c8 like '3_' or c9 like '4_') and (c4 <= 31 or c4 >= 42) order by ts; if $rows != 2 then return -1 endi @@ -1300,7 +1300,7 @@ if $data10 != @21-05-05 18:19:17.000@ then return -1 endi -sql select * from stb1 where c1 in (1,3); +sql select * from stb1 where c1 in (1,3) order by ts; if $rows != 2 then return -1 endi @@ -1311,7 +1311,7 @@ if $data10 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where c3 in (11,22); +sql select * from stb1 where c3 in (11,22) order by ts; if $rows != 2 then return -1 endi @@ -1322,7 +1322,7 @@ if $data10 != @21-05-05 18:19:09.000@ then return -1 endi -sql select * from stb1 where c4 in (3,33); +sql select * from stb1 where c4 in (3,33) order by ts; if $rows != 2 then return -1 endi @@ -1338,7 +1338,7 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where c5 in (3,33) and c8 in ('33','54'); +sql select * from stb1 where c5 in (3,33) and c8 in ('33','54') order by ts; if $rows != 1 then return -1 endi @@ -1346,7 +1346,7 @@ if $data00 != @21-05-05 18:19:14.000@ then return -1 endi -sql select * from stb1 where c5 in (3,33) or c8 in ('22','54'); +sql select * from stb1 where c5 in (3,33) or c8 in ('22','54') order by ts; if $rows != 4 then return -1 endi @@ -1363,7 +1363,7 @@ if $data30 != @21-05-05 18:19:23.000@ then return -1 endi -sql select * from stb1 where (c9 in ('3','1','2','4','5') or c9 in ('33','11','22','44','55')) and c9 in ('1','3','11','13'); +sql select * from stb1 where (c9 in ('3','1','2','4','5') or c9 in ('33','11','22','44','55')) and c9 in ('1','3','11','13') order by ts; if $rows != 3 then return -1 endi @@ -1377,7 +1377,7 @@ if $data20 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb2 where (u1 in (1) or u2 in (5,6)) and (u3 in (3,6) or u4 in (7,8)) and ts2 in ('2021-05-05 18:28:02.000','2021-05-05 18:28:15.000','2021-05-05 18:28:01.000'); +sql select * from stb2 where (u1 in (1) or u2 in (5,6)) and (u3 in (3,6) or u4 in (7,8)) and ts2 in ('2021-05-05 18:28:02.000','2021-05-05 18:28:15.000','2021-05-05 18:28:01.000') order by ts; if $rows != 2 then return -1 endi @@ -1388,7 +1388,7 @@ if $data10 != @21-05-05 18:19:01.000@ then return -1 endi -sql select * from stb2 where u2 in (2) and u3 in (1,2,3) and u4 in (1,2,4,5) and u1 > 3 and u1 < 6 and u1 != 4; +sql select * from stb2 where u2 in (2) and u3 in (1,2,3) and u4 in (1,2,4,5) and u1 > 3 and u1 < 6 and u1 != 4 order by ts; if $rows != 1 then return -1 endi @@ -1396,7 +1396,7 @@ if $data00 != @21-05-05 18:19:08.000@ then return -1 endi -sql select avg(c1) from tb1 where (c1 > 12 or c2 > 10) and (c3 < 12 or c3 > 13); +sql select avg(c1) from tb1 where (c1 > 12 or c2 > 10) and (c3 < 12 or c3 > 13) ; if $rows != 1 then return -1 endi @@ -1408,22 +1408,16 @@ sql select count(c1),sum(c3) from tb1 where ((c7 = true and c6 > 2) or (c1 > 10 if $rows != 2 then return -1 endi -if $data00 != @21-05-05 18:19:00.000@ then +if $data00 != 3 then return -1 endi -if $data01 != 3 then +if $data01 != 14 then return -1 endi -if $data02 != 14 then +if $data10 != 3 then return -1 endi -if $data10 != @21-05-05 18:19:05.000@ then - return -1 -endi -if $data11 != 3 then - return -1 -endi -if $data12 != 39 then +if $data11 != 39 then return -1 endi @@ -1447,14 +1441,14 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where c2 in (0,1); +sql select * from stb1 where c2 in (0,1) order by ts; if $rows != 1 then return -1 endi if $data00 != @21-05-05 18:19:00.000@ then return -1 endi -sql select * from stb1 where c6 in (0,2,3,1); +sql select * from stb1 where c6 in (0,2,3,1) order by ts; if $rows != 3 then return -1 endi @@ -1467,7 +1461,7 @@ endi if $data20 != @21-05-05 18:19:02.000@ then return -1 endi -sql select ts,c1 from (select * from stb1 where (c1 > 60 or c1 < 10) and (c7 = true or c5 > 2 and c5 < 63)) where (c3 > 61 or c3 < 3); +sql select ts,c1 from (select * from stb1 where (c1 > 60 or c1 < 10) and (c7 = true or c5 > 2 and c5 < 63)) where (c3 > 61 or c3 < 3) order by ts; if $rows != 3 then return -1 endi @@ -1481,66 +1475,66 @@ if $data20 != @21-05-05 18:19:25.000@ then return -1 endi +#sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 order by ts; #sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50; -sql select a.ts from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50; -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:25.000@ then - return -1 -endi +#if $rows != 4 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:20.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:21.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:24.000@ then +# return -1 +#endi +#if $data30 != @21-05-05 18:19:25.000@ then +# return -1 +#endi -#sql select a.ts,a.c1,a.c8,a.c9 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60; -sql select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi - -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.c1 < 10 or a.c1 > 30) and (b.u1 < 5 or b.u1 > 5); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:12.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.c1 < 30 and b.u1 > 1 and a.c1 > 10 and b.u1 < 8 and b.u1<>5; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:04.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:06.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:10.000@ then - return -1 -endi +#sql select a.ts,a.c1,a.c8,a.c9 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60 order by ts; +#sql select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60 order by ts; +#if $rows != 2 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:20.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:21.000@ then +# return -1 +#endi +# +#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.c1 < 10 or a.c1 > 30) and (b.u1 < 5 or b.u1 > 5) order by ts; +#if $rows != 4 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:00.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:02.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:12.000@ then +# return -1 +#endi +#if $data30 != @21-05-05 18:19:14.000@ then +# return -1 +#endi +# +#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.c1 < 30 and b.u1 > 1 and a.c1 > 10 and b.u1 < 8 and b.u1<>5 order by ts; +#if $rows != 3 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:04.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:06.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:10.000@ then +# return -1 +#endi sql select * from stb1 where c1 is null and c1 is not null; if $rows != 0 then @@ -1560,7 +1554,7 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where (c1 > 20 or c1 < 25) and (c1 > 62 or c1 < 3); +sql select * from stb1 where (c1 > 20 or c1 < 25) and (c1 > 62 or c1 < 3) order by ts; if $rows != 4 then return -1 endi @@ -1577,7 +1571,7 @@ if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 11 and c1 != 11 and c1 != 14 and c1 < 14; +sql select * from stb1 where c1 > 11 and c1 != 11 and c1 != 14 and c1 < 14 order by ts; if $rows != 2 then return -1 endi @@ -1587,7 +1581,7 @@ endi if $data10 != @21-05-05 18:19:06.000@ then return -1 endi -sql select * from stb1 where (c1 > 60 or c1 < 4 or c1 > 10 and c1 < 20 and c1 != 13 or c1 < 2 or c1 > 50) +sql select * from stb1 where (c1 > 60 or c1 < 4 or c1 > 10 and c1 < 20 and c1 != 13 or c1 < 2 or c1 > 50) order by ts if $rows != 14 then return -1 endi @@ -1604,7 +1598,7 @@ if $data30 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 62 or c1 >= 62; +sql select * from stb1 where c1 > 62 or c1 >= 62 order by ts; if $rows != 3 then return -1 endi @@ -1618,7 +1612,7 @@ if $data20 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 62 and c1 >= 62; +sql select * from stb1 where c1 > 62 and c1 >= 62 order by ts; if $rows != 2 then return -1 endi @@ -1629,7 +1623,7 @@ if $data10 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 >= 62 and c1 != 62; +sql select * from stb1 where c1 >= 62 and c1 != 62 order by ts; if $rows != 2 then return -1 endi @@ -1653,7 +1647,7 @@ if $data00 != @21-05-05 18:19:25.000@ then return -1 endi -sql select * from stb1 where c1 > 62 and c1 != 62; +sql select * from stb1 where c1 > 62 and c1 != 62 order by ts; if $rows != 2 then return -1 endi @@ -1713,12 +1707,12 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where c2 >= 3 and c2 <= 3; +sql select * from stb1 where c2 >= 3 and c2 <= 3 order by ts; if $data00 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where (c2 in (1,2,3,4) or c2 in (11,12,13,14)) and c2 != 11 and c2 >2 and c2 != 14; +sql select * from stb1 where (c2 in (1,2,3,4) or c2 in (11,12,13,14)) and c2 != 11 and c2 >2 and c2 != 14 order by ts; if $rows != 4 then return -1 endi @@ -1760,7 +1754,7 @@ if $data20 != @21-05-05 18:19:03.000@ then return -1 endi -sql select * from (select * from stb1 where c2 > 10 and c6 < 40) where c9 in ('11','21','31'); +sql select * from (select * from stb1 where c2 > 10 and c6 < 40) where c9 in ('11','21','31') order by ts; if $rows != 3 then return -1 endi @@ -1774,7 +1768,7 @@ if $data20 != @21-05-05 18:19:12.000@ then return -1 endi -sql select * from stb1 where c1 > 40 and c2 > 50 and c3 > 62 or c1 < 2 and c2 < 3; +sql select * from stb1 where c1 > 40 and c2 > 50 and c3 > 62 or c1 < 2 and c2 < 3 order by ts; if $rows != 3 then return -1 endi @@ -1803,7 +1797,7 @@ if $rows != 29 then return -1 endi -sql select * from stb1 where (c1 > 60 and c2 < 63) or (c1 >62 and c3 < 30) or (c1 is null and c2 is null); +sql select * from stb1 where (c1 > 60 and c2 < 63) or (c1 >62 and c3 < 30) or (c1 is null and c2 is null) order by ts; if $rows != 3 then return -1 endi @@ -1817,7 +1811,7 @@ if $data20 != @21-05-05 18:19:28.000@ then return -1 endi -sql select * from stb1 where c1 between 60 and 9999999999; +sql select * from stb1 where c1 between 60 and 9999999999 order by ts; if $rows != 4 then return -1 endi @@ -1873,7 +1867,7 @@ sql select * from stb1 where c5 in (9999999999); if $rows != 0 then return -1 endi -sql select * from stb1 where c5 in (-9999999999,3,4,9999999999); +sql select * from stb1 where c5 in (-9999999999,3,4,9999999999) order by ts; if $rows != 2 then return -1 endi @@ -1884,7 +1878,7 @@ if $data10 != @21-05-05 18:19:03.000@ then return -1 endi -sql select * from stb3 where c1 > 3 and c1 < 2; +sql select * from stb3 where c1 > 3 and c1 < 2 order by ts; if $rows != 0 then return -1 endi @@ -1936,7 +1930,7 @@ if $data70 != @21-04-06 18:19:03.000@ then endi -sql select * from stb3 where c1 > 11; +sql select * from stb3 where c1 > 11 order by ts; if $rows != 4 then return -1 endi @@ -1953,12 +1947,12 @@ if $data30 != @21-05-06 18:19:28.000@ then return -1 endi -sql select * from stb3 where c1 is not null or c1 is null; +sql select * from stb3 where c1 is not null or c1 is null order by ts; if $rows != 14 then return -1 endi -sql select ts,c1 from stb4 where c1 = 200; +sql select ts,c1 from stb4 where c1 = 200 order by ts; if $rows != 1 then return -1 endi @@ -1973,7 +1967,7 @@ endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 200 and c2 > 500 and c3 < 800 and c4 between 33 and 37 and c4 != 35 and c2 < 555 and c1 < 339 and c1 in (331,333,335); +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 200 and c2 > 500 and c3 < 800 and c4 between 33 and 37 and c4 != 35 and c2 < 555 and c1 < 339 and c1 in (331,333,335) order by ts; if $rows != 3 then return -1 endi @@ -1987,7 +1981,7 @@ if $data20 != @21-07-10 01:00:00.334@ then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 > -3 and c1 < 5; +sql select ts,c1,c2,c3,c4 from stb4 where c1 > -3 and c1 < 5 order by ts; if $rows != 4 then return -1 endi @@ -2004,7 +1998,7 @@ if $data30 != @21-07-10 01:00:00.003@ then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 2 and c1 < 5; +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 2 and c1 < 5 order by ts; if $rows != 3 then return -1 endi @@ -2018,12 +2012,12 @@ if $data20 != @21-07-10 01:00:00.003@ then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= -3 and c1 < 1300; +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= -3 and c1 < 1300 order by ts; if $rows != 1299 then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 1298 and c1 < 1300 or c2 > 210 and c2 < 213; +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 1298 and c1 < 1300 or c2 > 210 and c2 < 213 order by ts; if $rows != 4 then return -1 endi @@ -2056,7 +2050,7 @@ if $rows != 1099 then endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 in(10,100, 1100,3300) and c1 != 10; +sql select ts,c1,c2,c3,c4 from stb4 where c1 in(10,100, 1100,3300) and c1 != 10 order by ts; if $rows != 3 then return -1 endi @@ -2072,14 +2066,15 @@ endi print "ts test" -sql_error select ts,c1,c7 from stb1 where ts != '2021-05-05 18:19:27' -sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:02.000'; -sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:20.000' and ts != '2021-05-05 18:19:22.000'; + +sql select ts,c1,c7 from stb1 where ts != '2021-05-05 18:19:27' +sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:02.000'; +sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:20.000' and ts != '2021-05-05 18:19:22.000'; sql_error select * from stb1 where ts2 like '2021-05-05%'; -sql_error select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:05.000') and ts > '2021-05-05 18:19:01.000' and ts < '2021-05-05 18:19:27.000'; -sql_error select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:20.000' or ts < '2021-05-05 18:19:05.000') and ts != '2021-05-05 18:19:25.000'; -sql_error select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.000')); -sql_error select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:24.000'; +sql select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:05.000') and ts > '2021-05-05 18:19:01.000' and ts < '2021-05-05 18:19:27.000'; +sql select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:20.000' or ts < '2021-05-05 18:19:05.000') and ts != '2021-05-05 18:19:25.000'; +sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.000')); +sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:24.000'; sql select * from stb1 where ts is null; if $rows != 0 then return -1 @@ -2125,7 +2120,7 @@ sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '202 if $rows != 29 then return -1 endi -sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts > '2021-05-05 18:19:27.000'; +sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts > '2021-05-05 18:19:27.000' order by ts; if $rows != 4 then return -1 endi @@ -2152,7 +2147,7 @@ if $rows != 29 then return -1 endi -sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.999') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.999')); +sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.999') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.999')) order by ts; if $rows != 16 then return -1 endi @@ -2160,7 +2155,7 @@ if $data00 != @21-05-05 18:19:05.000@ then return -1 endi -sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:12.000' and ts <= '2021-05-05 18:19:14.000') or (ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:17.000'); +sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:12.000' and ts <= '2021-05-05 18:19:14.000') or (ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:17.000') order by ts; if $rows != 13 then return -1 endi @@ -2168,7 +2163,7 @@ if $data00 != @21-05-05 18:19:05.000@ then return -1 endi -sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:01.000' and ts <= '2021-05-05 18:19:08.000'); +sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:01.000' and ts <= '2021-05-05 18:19:08.000') order by ts; if $rows != 10 then return -1 endi @@ -2176,7 +2171,7 @@ if $data00 != @21-05-05 18:19:01.000@ then return -1 endi -sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:06.000') or (ts >= '2021-05-05 18:19:03.000' and ts <= '2021-05-05 18:19:12.000')) and (ts >= '2021-05-05 18:19:10.000'); +sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:06.000') or (ts >= '2021-05-05 18:19:03.000' and ts <= '2021-05-05 18:19:12.000')) and (ts >= '2021-05-05 18:19:10.000') order by ts; if $rows != 3 then return -1 endi @@ -2190,7 +2185,7 @@ if $data20 != @21-05-05 18:19:12.000@ then return -1 endi -sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:25.000' and ts != '2021-05-05 18:19:18'; +sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:25.000' and ts != '2021-05-05 18:19:18' order by ts; if $rows != 3 then return -1 endi @@ -2205,7 +2200,7 @@ if $data20 != @21-05-05 18:19:28.000@ then endi -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:25'; +sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:25' order by ts; if $rows != 3 then return -1 endi @@ -2219,7 +2214,7 @@ if $data20 != @21-05-05 18:19:28.000@ then return -1 endi -sql select * from stb1 where ts < '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:25'; +sql select * from stb1 where ts < '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:25' order by ts; if $rows != 3 then return -1 endi @@ -2241,7 +2236,7 @@ if $data00 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:25'; +sql select * from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:25' order by ts; if $rows != 25 then return -1 endi @@ -2255,7 +2250,7 @@ if $data20 != @21-05-05 18:19:06.000@ then return -1 endi -sql select * from stb1 where ts < '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:25'; +sql select * from stb1 where ts < '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:25' order by ts; if $rows != 25 then return -1 endi @@ -2269,7 +2264,7 @@ if $data20 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25'; +sql select * from stb1 where ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25' order by ts; if $rows != 29 then return -1 endi @@ -2283,7 +2278,7 @@ if $data20 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' and ts < '2021-05-05 18:19:26'); +sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' and ts < '2021-05-05 18:19:26') order by ts; if $rows != 2 then return -1 endi @@ -2294,7 +2289,7 @@ if $data10 != @21-05-05 18:19:25.000@ then return -1 endi -sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' or ts > '2021-05-05 18:19:26'); +sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' or ts > '2021-05-05 18:19:26') order by ts; if $rows != 5 then return -1 endi @@ -2315,7 +2310,7 @@ if $data40 != @21-05-05 18:19:28.000@ then endi -sql select * from stb2 where ts2 in ('2021-05-05 18:28:03','2021-05-05 18:28:05','2021-05-05 18:28:08'); +sql select * from stb2 where ts2 in ('2021-05-05 18:28:03','2021-05-05 18:28:05','2021-05-05 18:28:08') order by ts; if $rows != 3 then return -1 endi @@ -2329,7 +2324,7 @@ if $data20 != @21-05-05 18:19:07.000@ then return -1 endi -sql select * from stb2 where t3 in ('2021-05-05 18:38:38','2021-05-05 18:38:28','2021-05-05 18:38:08') and ts2 in ('2021-05-05 18:28:04','2021-05-05 18:28:04','2021-05-05 18:28:03'); +sql select * from stb2 where t3 in ('2021-05-05 18:38:38','2021-05-05 18:38:28','2021-05-05 18:38:08') and ts2 in ('2021-05-05 18:28:04','2021-05-05 18:28:04','2021-05-05 18:28:03') order by ts; if $rows != 2 then return -1 endi @@ -2340,38 +2335,38 @@ if $data10 != @21-05-05 18:19:03.000@ then return -1 endi -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.ts < '2021-05-05 18:19:03.000' or a.ts >= '2021-05-05 18:19:13.000') and (b.ts >= '2021-05-05 18:19:01.000' and b.ts <= '2021-05-05 18:19:14.000'); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:13.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:14.000@ then - return -1 -endi +#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.ts < '2021-05-05 18:19:03.000' or a.ts >= '2021-05-05 18:19:13.000') and (b.ts >= '2021-05-05 18:19:01.000' and b.ts <= '2021-05-05 18:19:14.000') order by a.ts; +#if $rows != 4 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:01.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:02.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:13.000@ then +# return -1 +#endi +#if $data30 != @21-05-05 18:19:14.000@ then +# return -1 +#endi +# +#sql select a.ts,c.ts,b.c1,c.u1,c.u2 from (select * from stb1) a, (select * from stb1) b, (select * from stb2) c where a.ts=b.ts and b.ts=c.ts and a.ts <= '2021-05-05 18:19:12.000' and b.ts >= '2021-05-05 18:19:06.000' and c.ts >= '2021-05-05 18:19:08.000' and c.ts <= '2021-05-05 18:19:11.000' and a.ts != '2021-05-05 18:19:10.000'; +#if $rows != 3 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:08.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:09.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:11.000@ then +# return -1 +#endi -sql select a.ts,c.ts,b.c1,c.u1,c.u2 from (select * from stb1) a, (select * from stb1) b, (select * from stb2) c where a.ts=b.ts and b.ts=c.ts and a.ts <= '2021-05-05 18:19:12.000' and b.ts >= '2021-05-05 18:19:06.000' and c.ts >= '2021-05-05 18:19:08.000' and c.ts <= '2021-05-05 18:19:11.000' and a.ts != '2021-05-05 18:19:10.000'; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:08.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:09.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:11.000@ then - return -1 -endi - -sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:06.000' or ts >= '2021-05-05 18:19:13.000') and (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:14.000') and ts != '2021-05-05 18:19:04.000'; +sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:06.000' or ts >= '2021-05-05 18:19:13.000') and (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:14.000') and ts != '2021-05-05 18:19:04.000' order by ts; if $rows != 6 then return -1 endi @@ -2394,7 +2389,7 @@ if $data50 != @21-05-05 18:19:14.000@ then return -1 endi -sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:26.000' or ts = '2021-05-05 18:19:26.000') and ts != '2021-05-05 18:19:03.000' and ts != '2021-05-05 18:19:26.000'; +sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:26.000' or ts = '2021-05-05 18:19:26.000') and ts != '2021-05-05 18:19:03.000' and ts != '2021-05-05 18:19:26.000' order by ts; if $rows != 5 then return -1 endi @@ -2415,14 +2410,14 @@ if $data40 != @21-05-05 18:19:28.000@ then endi print "tbname test" -sql_error select * from stb1 where tbname like '%3' and tbname like '%4'; +sql select * from stb1 where tbname like '%3' and tbname like '%4'; sql select * from stb1 where tbname like 'tb%'; if $rows != 29 then return -1 endi -sql select * from stb1 where tbname like '%2'; +sql select * from stb1 where tbname like '%2' order by ts; if $rows != 4 then return -1 endi @@ -2440,7 +2435,7 @@ if $data30 != @21-05-05 18:19:11.000@ then endi print "tag test" -sql select * from stb1 where t1 in (1,2) and t1 in (2,3); +sql select * from stb1 where t1 in (1,2) and t1 in (2,3) order by ts; if $rows != 4 then return -1 endi @@ -2464,7 +2459,7 @@ endi print "join test" sql_error select * from tb1, tb2_1 where tb1.ts=tb2_1.ts or tb1.ts =tb2_1.ts; -sql select tb1.ts from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.ts < '2021-05-05 18:19:06.000'; +sql select tb1.ts from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.ts < '2021-05-05 18:19:06.000' order by ts; if $rows != 2 then return -1 endi @@ -2474,7 +2469,7 @@ endi if $data10 != @21-05-05 18:19:05.000@ then return -1 endi -sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.u1 < 5; +sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.u1 < 5 order by ts; if $rows != 2 then return -1 endi @@ -2485,7 +2480,7 @@ if $data10 != @21-05-05 18:19:06.000@ then return -1 endi -sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts >= '2021-05-05 18:19:03.000' and tb1.c7=false and tb2_1.u3>4; +sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts >= '2021-05-05 18:19:03.000' and tb1.c7=false and tb2_1.u3>4 order by ts; if $rows != 2 then return -1 endi @@ -2496,7 +2491,7 @@ if $data10 != @21-05-05 18:19:07.000@ then return -1 endi -sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4; +sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4 order by ts; if $rows != 9 then return -1 endi @@ -2528,7 +2523,7 @@ if $data80 != @21-05-05 18:19:11.000@ then return -1 endi -sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4 and stb1.c1 > 2 and stb2.u1 <=4; +sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4 and stb1.c1 > 2 and stb2.u1 <=4 order by ts; if $rows != 3 then return -1 endi @@ -2543,8 +2538,8 @@ if $data20 != @21-05-05 18:19:06.000@ then endi print "column&ts test" -sql_error select count(*) from stb1 where ts > 0 or c1 > 0; -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:20.000' and (c1 > 23 or c1 < 14) and c7 in (true) and c8 like '%2'; +sql select count(*) from stb1 where ts > 0 or c1 > 0; +sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:20.000' and (c1 > 23 or c1 < 14) and c7 in (true) and c8 like '%2' order by ts; if $rows != 3 then return -1 endi @@ -2559,7 +2554,7 @@ if $data20 != @21-05-05 18:19:17.000@ then endi print "column&tbname test" -sql_error select count(*) from stb1 where tbname like 'tb%' or c1 > 0; +sql select count(*) from stb1 where tbname like 'tb%' or c1 > 0; sql select * from stb1 where tbname like '%3' and c6 < 34 and c5 != 33 and c4 > 31; if $rows != 1 then return -1 @@ -2569,16 +2564,16 @@ if $data00 != @21-05-05 18:19:13.000@ then endi print "column&tag test" -sql_error select * from stb1 where t1 > 0 or c1 > 0 -sql_error select * from stb1 where c1 > 0 or t1 > 0 -sql_error select * from stb1 where t1 > 0 or c1 > 0 or t1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 or c1 > 1 -sql_error select * from stb1 where t1 > 0 and c1 > 0 or t1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3) -sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1 +sql select * from stb1 where t1 > 0 or c1 > 0 +sql select * from stb1 where c1 > 0 or t1 > 0 +sql select * from stb1 where t1 > 0 or c1 > 0 or t1 > 1 +sql select * from stb1 where c1 > 0 or t1 > 0 or c1 > 1 +sql select * from stb1 where t1 > 0 and c1 > 0 or t1 > 1 +sql select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 +sql select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 +sql select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1 +sql select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3) +sql select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1 sql_error select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.t1=b.t1; sql select * from stb1 where c1 < 63 and t1 > 5 @@ -2591,7 +2586,7 @@ endi if $data10 != @21-05-05 18:19:25.000@ then return -1 endi -sql select * from stb1 where t1 > 3 and t1 < 5 and c1 != 42 and c1 != 44; +sql select * from stb1 where t1 > 3 and t1 < 5 and c1 != 42 and c1 != 44 order by ts; if $rows != 2 then return -1 endi @@ -2608,7 +2603,7 @@ endi if $data00 != @21-05-05 18:19:09.000@ then return -1 endi -sql select * from stb1 where c1 > 1 and (t1 > 3 or t1 < 2) and (c2 > 2 and c2 < 62 and t1 != 4) and (t1 > 2 and t1 < 6) and c7 = true and c8 like '%2'; +sql select * from stb1 where c1 > 1 and (t1 > 3 or t1 < 2) and (c2 > 2 and c2 < 62 and t1 != 4) and (t1 > 2 and t1 < 6) and c7 = true and c8 like '%2' order by ts; if $rows != 1 then return -1 endi @@ -2616,7 +2611,7 @@ if $data00 != @21-05-05 18:19:21.000@ then return -1 endi -sql select * from stb1 where c1!=31 and c1 !=32 and c1 <> 63 and c1 <>1 and c1 <> 21 and c1 <> 2 and c7 <> true and c8 <> '3' and c9 <> '4' and c2<>13 and c3 <> 23 and c4 <> 33 and c5 <> 34 and c6 <> 43 and c2 <> 53 and t1 <> 5 and t2 <>4; +sql select * from stb1 where c1!=31 and c1 !=32 and c1 <> 63 and c1 <>1 and c1 <> 21 and c1 <> 2 and c7 <> true and c8 <> '3' and c9 <> '4' and c2<>13 and c3 <> 23 and c4 <> 33 and c5 <> 34 and c6 <> 43 and c2 <> 53 and t1 <> 5 and t2 <>4 order by ts; if $rows != 3 then return -1 endi @@ -2639,9 +2634,9 @@ print "ts&tbname test" sql_error select count(*) from stb1 where ts > 0 or tbname like 'tb%'; print "ts&tag test" -sql_error select count(*) from stb1 where ts > 0 or t1 > 0; +sql select count(*) from stb1 where ts > 0 or t1 > 0; -sql select * from stb2 where t1!=1 and t2=2 and t3 in ('2021-05-05 18:58:58.000') and ts < '2021-05-05 18:19:13.000'; +sql select * from stb2 where t1!=1 and t2=2 and t3 in ('2021-05-05 18:58:58.000') and ts < '2021-05-05 18:19:13.000' order by ts; if $rows != 2 then return -1 endi @@ -2658,7 +2653,7 @@ sql select tb1.ts,tb1.c1,tb2_1.u1 from tb1, tb2_1 where tb1.ts=tb2_1.ts and (tb1 print "tbname&tag test" -sql select * from stb1 where tbname like 'tb%' and (t1=1 or t2=2 or t3=3) and t1 > 2; +sql select * from stb1 where tbname like 'tb%' and (t1=1 or t2=2 or t3=3) and t1 > 2 order by ts; if $rows != 4 then return -1 endi @@ -2684,20 +2679,20 @@ print "tag&join test" print "column&ts&tbname test" -sql_error select count(*) from stb1 where tbname like 'tb%' or c1 > 0 or ts > 0; +sql select count(*) from stb1 where tbname like 'tb%' or c1 > 0 or ts > 0; print "column&ts&tag test" -sql_error select count(*) from stb1 where t1 > 0 or c1 > 0 or ts > 0; -sql_error select count(*) from stb1 where c1 > 0 or t1 > 0 or ts > 0; +sql select count(*) from stb1 where t1 > 0 or c1 > 0 or ts > 0; +sql select count(*) from stb1 where c1 > 0 or t1 > 0 or ts > 0; -sql select * from stb1 where (t1 > 0 or t1 > 2 ) and ts > '2021-05-05 18:19:10.000' and (c1 > 1 or c1 > 3) and (c6 > 40 or c6 < 30) and (c8 like '%3' or c8 like '_4') and (c9 like '1%' or c9 like '6%' or (c9 like '%3' and c9 != '23')) and ts > '2021-05-05 18:19:22.000' and ts <= '2021-05-05 18:19:26.000'; +sql select * from stb1 where (t1 > 0 or t1 > 2 ) and ts > '2021-05-05 18:19:10.000' and (c1 > 1 or c1 > 3) and (c6 > 40 or c6 < 30) and (c8 like '%3' or c8 like '_4') and (c9 like '1%' or c9 like '6%' or (c9 like '%3' and c9 != '23')) and ts > '2021-05-05 18:19:22.000' and ts <= '2021-05-05 18:19:26.000' order by ts; if $rows != 1 then return -1 endi if $data00 != @21-05-05 18:19:26.000@ then return -1 endi -sql select * from stb1 where ts > '2021-05-05 18:19:00.000' and c1 > 2 and t1 != 1 and c2 >= 23 and t2 >= 3 and c3 < 63 and c7 = false and t3 > 3 and t3 < 6 and c8 like '4%' and ts < '2021-05-05 18:19:19.000' and c2 > 40 and c3 != 42; +sql select * from stb1 where ts > '2021-05-05 18:19:00.000' and c1 > 2 and t1 != 1 and c2 >= 23 and t2 >= 3 and c3 < 63 and c7 = false and t3 > 3 and t3 < 6 and c8 like '4%' and ts < '2021-05-05 18:19:19.000' and c2 > 40 and c3 != 42 order by ts; if $rows != 1 then return -1 endi @@ -2707,12 +2702,12 @@ endi print "column&ts&join test" print "column&tbname&tag test" -sql_error select count(*) from stb1 where c1 > 0 or tbname in ('tb1') or t1 > 0; +sql select count(*) from stb1 where c1 > 0 or tbname in ('tb1') or t1 > 0; print "column&tbname&join test" print "column&tag&join test" print "ts&tbname&tag test" -sql_error select count(*) from stb1 where ts > 0 or tbname in ('tb1') or t1 > 0; +sql select count(*) from stb1 where ts > 0 or tbname in ('tb1') or t1 > 0; print "ts&tbname&join test" print "ts&tag&join test" @@ -2723,7 +2718,7 @@ print "tbname&tag&join test" print "column&ts&tbname&tag test" sql_error select * from stb1 where (tbname like 'tb%' or ts > '2021-05-05 18:19:01.000') and (t1 > 5 or t1 < 4) and c1 > 0; -sql_error select * from stb1 where (ts > '2021-05-05 18:19:01.000') and (ts > '2021-05-05 18:19:02.000' or t1 > 3) and (t1 > 5 or t1 < 4) and c1 > 0; +sql select * from stb1 where (ts > '2021-05-05 18:19:01.000') and (ts > '2021-05-05 18:19:02.000' or t1 > 3) and (t1 > 5 or t1 < 4) and c1 > 0; sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:20.000' and col > 0 and t1 > 0; From 902d604f941a558d6e51ca3d8821b732bec41e7f Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 29 Jul 2022 15:24:05 +0800 Subject: [PATCH 14/43] fix multi read --- tests/script/jenkins/basic.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 41126d560c..88b721d104 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -97,7 +97,7 @@ # TD-17738 ./test.sh -f tsim/parser/col_arithmetic_operation.sim # TD-17661 ./test.sh -f tsim/parser/columnValue.sim ./test.sh -f tsim/parser/commit.sim -# TD-17661 ./test.sh -f tsim/parser/condition.sim +./test.sh -f tsim/parser/condition.sim ./test.sh -f tsim/parser/constCol.sim #./test.sh -f tsim/parser/create_db.sim ./test.sh -f tsim/parser/create_mt.sim From 788c063acc46583e9f4be6963779be16696bf92c Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 29 Jul 2022 15:54:24 +0800 Subject: [PATCH 15/43] feat:modify get meta logic for schemaless --- include/client/taos.h | 2 - source/client/src/clientSml.c | 378 ++++----- source/client/test/smlTest.cpp | 927 +--------------------- tests/system-test/2-query/sml.py | 98 +++ tests/system-test/7-tmq/tmq_taosx.py | 10 +- tests/test/c/CMakeLists.txt | 9 + tests/test/c/sml_test.c | 1101 ++++++++++++++++++++++++++ 7 files changed, 1404 insertions(+), 1121 deletions(-) create mode 100644 tests/system-test/2-query/sml.py create mode 100644 tests/test/c/sml_test.c diff --git a/include/client/taos.h b/include/client/taos.h index 6f3244ea82..b7df0e4d29 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -271,8 +271,6 @@ DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res); DLL_EXPORT int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw); DLL_EXPORT int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw); DLL_EXPORT int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char* tbname); - - DLL_EXPORT void tmq_free_raw(tmq_raw_data raw); DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed by tmq_free_json_meta DLL_EXPORT void tmq_free_json_meta(char* jsonMeta); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 5fe9b6bdb1..15c74dd7ac 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -84,32 +84,11 @@ typedef TSDB_SML_PROTOCOL_TYPE SMLProtocolType; typedef enum { - SCHEMA_ACTION_CREATE_STABLE, - SCHEMA_ACTION_ADD_COLUMN, - SCHEMA_ACTION_ADD_TAG, - SCHEMA_ACTION_CHANGE_COLUMN_SIZE, - SCHEMA_ACTION_CHANGE_TAG_SIZE, + SCHEMA_ACTION_NULL, + SCHEMA_ACTION_COLUMN, + SCHEMA_ACTION_TAG } ESchemaAction; -typedef struct { - char sTableName[TSDB_TABLE_NAME_LEN]; - SArray *tags; - SArray *fields; -} SCreateSTableActionInfo; - -typedef struct { - char sTableName[TSDB_TABLE_NAME_LEN]; - SSmlKv *field; -} SAlterSTableActionInfo; - -typedef struct { - ESchemaAction action; - union { - SCreateSTableActionInfo createSTable; - SAlterSTableActionInfo alterSTable; - }; -} SSchemaAction; - typedef struct { const char *measure; const char *tags; @@ -226,18 +205,20 @@ static inline bool smlCheckDuplicateKey(const char *key, int32_t keyLen, SHashOb } static int32_t smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2) { - memset(pBuf->buf, 0, pBuf->len); - if (msg1) strncat(pBuf->buf, msg1, pBuf->len); - int32_t left = pBuf->len - strlen(pBuf->buf); - if (left > 2 && msg2) { - strncat(pBuf->buf, ":", left - 1); - strncat(pBuf->buf, msg2, left - 2); + if(pBuf->buf){ + memset(pBuf->buf, 0, pBuf->len); + if (msg1) strncat(pBuf->buf, msg1, pBuf->len); + int32_t left = pBuf->len - strlen(pBuf->buf); + if (left > 2 && msg2) { + strncat(pBuf->buf, ":", left - 1); + strncat(pBuf->buf, msg2, left - 2); + } } return TSDB_CODE_SML_INVALID_DATA; } static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSmlKv *kv, bool isTag, - SSchemaAction *action, bool *actionNeeded, SSmlHandle *info) { + ESchemaAction *action, SSmlHandle *info) { uint16_t *index = (uint16_t *)taosHashGet(colHash, kv->key, kv->keyLen); if (index) { if (colField[*index].type != kv->type) { @@ -251,25 +232,17 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm (colField[*index].type == TSDB_DATA_TYPE_NCHAR && ((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) { if (isTag) { - action->action = SCHEMA_ACTION_CHANGE_TAG_SIZE; + *action = SCHEMA_ACTION_TAG; } else { - action->action = SCHEMA_ACTION_CHANGE_COLUMN_SIZE; + *action = SCHEMA_ACTION_COLUMN; } - action->alterSTable.field = kv; - *actionNeeded = true; } } else { if (isTag) { - action->action = SCHEMA_ACTION_ADD_TAG; + *action = SCHEMA_ACTION_TAG; } else { - action->action = SCHEMA_ACTION_ADD_COLUMN; + *action = SCHEMA_ACTION_COLUMN; } - action->alterSTable.field = kv; - *actionNeeded = true; - } - if (*actionNeeded) { - uDebug("SML:0x%" PRIx64 " generate schema action. kv->name: %s, action: %d", info->id, kv->key, - action->action); } return 0; } @@ -284,171 +257,25 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { } else if (type == TSDB_DATA_TYPE_NCHAR && result > (TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE){ result = (TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; } + + if (type == TSDB_DATA_TYPE_NCHAR){ + result = result * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; + }else if (type == TSDB_DATA_TYPE_BINARY){ + result = result + VARSTR_HEADER_SIZE; + } return result; } -static int32_t smlBuildColumnDescription(SSmlKv *field, char *buf, int32_t bufSize, int32_t *outBytes) { - uint8_t type = field->type; - char tname[TSDB_TABLE_NAME_LEN] = {0}; - memcpy(tname, field->key, field->keyLen); - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { - int32_t bytes = smlFindNearestPowerOf2(field->length, type); - int out = snprintf(buf, bufSize, "`%s` %s(%d)", tname, tDataTypes[field->type].name, bytes); - *outBytes = out; - } else { - int out = snprintf(buf, bufSize, "`%s` %s", tname, tDataTypes[type].name); - *outBytes = out; - } - - return 0; -} - -static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) { - int32_t code = 0; - int32_t outBytes = 0; - char *result = (char *)taosMemoryCalloc(1, TSDB_MAX_ALLOWED_SQL_LEN); - int32_t capacity = TSDB_MAX_ALLOWED_SQL_LEN; - - uDebug("SML:0x%" PRIx64 " apply schema action. action: %d", info->id, action->action); - switch (action->action) { - case SCHEMA_ACTION_ADD_COLUMN: { - int n = sprintf(result, "alter stable `%s` add column ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery - code = taos_errno(res); - const char *errStr = taos_errstr(res); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " apply schema action. error: %s", info->id, errStr); - taosMsleep(100); - } - taos_free_result(res); - - break; - } - case SCHEMA_ACTION_ADD_TAG: { - int n = sprintf(result, "alter stable `%s` add tag ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery - code = taos_errno(res); - const char *errStr = taos_errstr(res); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); - taosMsleep(100); - } - taos_free_result(res); - - break; - } - case SCHEMA_ACTION_CHANGE_COLUMN_SIZE: { - int n = sprintf(result, "alter stable `%s` modify column ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery - code = taos_errno(res); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); - taosMsleep(100); - } - taos_free_result(res); - - break; - } - case SCHEMA_ACTION_CHANGE_TAG_SIZE: { - int n = sprintf(result, "alter stable `%s` modify tag ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); - TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); // TODO async doAsyncQuery - code = taos_errno(res); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); - taosMsleep(100); - } - taos_free_result(res); - - break; - } - case SCHEMA_ACTION_CREATE_STABLE: { - int n = sprintf(result, "create stable `%s` (", action->createSTable.sTableName); - char *pos = result + n; - int freeBytes = capacity - n; - - SArray *cols = action->createSTable.fields; - - for (int i = 0; i < taosArrayGetSize(cols); i++) { - SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); - smlBuildColumnDescription(kv, pos, freeBytes, &outBytes); - pos += outBytes; - freeBytes -= outBytes; - *pos = ','; - ++pos; - --freeBytes; - } - - --pos; - ++freeBytes; - - outBytes = snprintf(pos, freeBytes, ") tags ("); - pos += outBytes; - freeBytes -= outBytes; - - cols = action->createSTable.tags; - for (int i = 0; i < taosArrayGetSize(cols); i++) { - SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); - smlBuildColumnDescription(kv, pos, freeBytes, &outBytes); - pos += outBytes; - freeBytes -= outBytes; - *pos = ','; - ++pos; - --freeBytes; - } - if (taosArrayGetSize(cols) == 0) { - outBytes = snprintf(pos, freeBytes, "`%s` %s(%d)", tsSmlTagName, tDataTypes[TSDB_DATA_TYPE_NCHAR].name, 1); - pos += outBytes; - freeBytes -= outBytes; - *pos = ','; - ++pos; - --freeBytes; - } - pos--; - ++freeBytes; - outBytes = snprintf(pos, freeBytes, ")"); - TAOS_RES *res = taos_query((TAOS*)&info->taos->id, result); - code = taos_errno(res); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); - taosMsleep(100); - } - taos_free_result(res); - - break; - } - - default: - break; - } - - taosMemoryFreeClear(result); - if (code != 0) { - uError("SML:0x%" PRIx64 " apply schema action failure. %s", info->id, tstrerror(code)); - } - return code; -} - static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SHashObj *schemaHash, SArray *cols, - SSchemaAction *action, bool isTag) { + ESchemaAction *action, bool isTag) { int32_t code = TSDB_CODE_SUCCESS; for (int j = 0; j < taosArrayGetSize(cols); ++j) { if(j == 0 && !isTag) continue; SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, j); - bool actionNeeded = false; - code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, &actionNeeded, info); + code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, info); if (code != TSDB_CODE_SUCCESS) { return code; } - if (actionNeeded) { - code = smlApplySchemaAction(info, action); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - } } return TSDB_CODE_SUCCESS; } @@ -475,6 +302,103 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool return 0; } +static int32_t getBytes(uint8_t type, int32_t length){ + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { + return smlFindNearestPowerOf2(length, type); + } else { + return tDataTypes[type].bytes; + } +} + +static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *sTableData, + int32_t colVer, int32_t tagVer, int8_t source, uint64_t suid){ + SRequestObj* pRequest = NULL; + SMCreateStbReq pReq = {0}; + int32_t code = TSDB_CODE_SUCCESS; + SCmdMsgInfo pCmdMsg = {0}; + + code = buildRequest(info->taos->id, "", 0, NULL, false, &pRequest); + if (code != TSDB_CODE_SUCCESS) { + goto end; + } + + if (!pRequest->pDb) { + code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; + goto end; + } + + pReq.colVer = colVer; + pReq.tagVer = tagVer; + pReq.source = source; + pReq.commentLen = -1; + pReq.igExists = true; + pReq.suid = suid; + tNameExtractFullName(pName, pReq.name); + + pReq.numOfColumns = taosArrayGetSize(sTableData->cols); + pReq.numOfTags = taosArrayGetSize(sTableData->tags); + + pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SField)); + for (int i = 0; i < pReq.numOfColumns; i++) { + SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->cols, i); + SField field = {0}; + field.type = kv->type; + field.bytes = getBytes(kv->type, kv->length); + memcpy(field.name, kv->key, kv->keyLen); + taosArrayPush(pReq.pColumns, &field); + } + + if (pReq.numOfTags == 0){ + pReq.numOfTags = 1; + pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField)); + SField field = {0}; + field.type = TSDB_DATA_TYPE_NCHAR; + field.bytes = 1; + strcpy(field.name, tsSmlTagName); + taosArrayPush(pReq.pTags, &field); + }else{ + pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField)); + for (int i = 0; i < pReq.numOfTags; i++) { + SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->tags, i); + SField field = {0}; + field.type = kv->type; + field.bytes = getBytes(kv->type, kv->length); + memcpy(field.name, kv->key, kv->keyLen); + taosArrayPush(pReq.pTags, &field); + } + } + + pCmdMsg.epSet = getEpSet_s(&info->taos->pAppInfo->mgmtEp); + pCmdMsg.msgType = TDMT_MND_CREATE_STB; + pCmdMsg.msgLen = tSerializeSMCreateStbReq(NULL, 0, &pReq); + pCmdMsg.pMsg = taosMemoryMalloc(pCmdMsg.msgLen); + if (NULL == pCmdMsg.pMsg) { + tFreeSMCreateStbReq(&pReq); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq); + + SQuery pQuery; + pQuery.execMode = QUERY_EXEC_MODE_RPC; + pQuery.pCmdMsg = &pCmdMsg; + pQuery.msgType = pQuery.pCmdMsg->msgType; + pQuery.stableQuery = true; + + launchQueryImpl(pRequest, &pQuery, true, NULL); + + if(pRequest->code == TSDB_CODE_SUCCESS){ + catalogRemoveTableMeta(info->pCatalog, pName); + } + code = pRequest->code; + taosMemoryFree(pCmdMsg.pMsg); + +end: + destroyRequest(pRequest); + tFreeSMCreateStbReq(&pReq); + return code; +} + static int32_t smlModifyDBSchemas(SSmlHandle *info) { int32_t code = 0; SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; @@ -500,16 +424,9 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_STB_NOT_EXIST) { - SSchemaAction schemaAction; - schemaAction.action = SCHEMA_ACTION_CREATE_STABLE; - memset(&schemaAction.createSTable, 0, sizeof(SCreateSTableActionInfo)); - memcpy(schemaAction.createSTable.sTableName, superTable, superTableLen); - schemaAction.createSTable.tags = sTableData->tags; - schemaAction.createSTable.fields = sTableData->cols; - code = smlApplySchemaAction(info, &schemaAction); + code = smlSendMetaMsg(info, &pName, sTableData, 1, 1, TD_REQ_FROM_APP, 0); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlApplySchemaAction failed. can not create %s", info->id, - schemaAction.createSTable.sTableName); + uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable); goto end; } info->cost.numOfCreateSTables++; @@ -521,24 +438,42 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); } - SSchemaAction schemaAction; - memset(&schemaAction, 0, sizeof(SSchemaAction)); - memcpy(schemaAction.createSTable.sTableName, superTable, superTableLen); - code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->tags, &schemaAction, true); + ESchemaAction action = SCHEMA_ACTION_NULL; + code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->tags, &action, true); if (code != TSDB_CODE_SUCCESS) { taosHashCleanup(hashTmp); goto end; } + if (action == SCHEMA_ACTION_TAG){ + code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta->sversion, pTableMeta->tversion + 1, TD_REQ_FROM_TAOX, pTableMeta->uid); + if (code != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable); + goto end; + } + } + + code = catalogRefreshTableMeta(info->pCatalog, &conn, &pName, -1); + if (code != TSDB_CODE_SUCCESS) { + goto end; + } taosHashClear(hashTmp); for (uint16_t i = 1; i < pTableMeta->tableInfo.numOfColumns; i++) { taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); } - code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->cols, &schemaAction, false); + action = SCHEMA_ACTION_NULL; + code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->cols, &action, false); taosHashCleanup(hashTmp); if (code != TSDB_CODE_SUCCESS) { goto end; } + if (action == SCHEMA_ACTION_COLUMN){ + code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta->sversion + 1, pTableMeta->tversion, TD_REQ_FROM_TAOX, pTableMeta->uid); + if (code != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable); + goto end; + } + } code = catalogRefreshTableMeta(info->pCatalog, &conn, &pName, -1); if (code != TSDB_CODE_SUCCESS) { @@ -1504,11 +1439,13 @@ static SSmlHandle* smlBuildSmlInfo(STscObj* pTscObj, SRequestObj* request, SMLPr } ((SVnodeModifOpStmt *)(info->pQuery->pRoot))->payloadType = PAYLOAD_TYPE_KV; - info->taos = pTscObj; - code = catalogGetHandle(info->taos->pAppInfo->clusterId, &info->pCatalog); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " get catalog error %d", info->id, code); - goto cleanup; + if (pTscObj){ + info->taos = pTscObj; + code = catalogGetHandle(info->taos->pAppInfo->clusterId, &info->pCatalog); + if (code != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " get catalog error %d", info->id, code); + goto cleanup; + } } info->precision = precision; @@ -1518,9 +1455,12 @@ static SSmlHandle* smlBuildSmlInfo(STscObj* pTscObj, SRequestObj* request, SMLPr } else { info->dataFormat = true; } - info->pRequest = request; - info->msgBuf.buf = info->pRequest->msgBuf; - info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; + + if(request){ + info->pRequest = request; + info->msgBuf.buf = info->pRequest->msgBuf; + info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; + } info->exec = smlInitHandle(info->pQuery); info->childTables = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); diff --git a/source/client/test/smlTest.cpp b/source/client/test/smlTest.cpp index d74be742a2..68a8b9d336 100644 --- a/source/client/test/smlTest.cpp +++ b/source/client/test/smlTest.cpp @@ -511,447 +511,10 @@ TEST(testCase, smlParseNumber_Test) { printf("res:%d,v:%f, %f\n", res,kv.d, HUGE_VAL); } -//#include -//TEST(testCase, number_Test) { -// char *str[] = { -//// "-000 0999", -// "- abc", -// }; -// for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){ -// errno = 0; -// char *end = NULL; -// long result = strtol(str[i], &end, 10); -// printf("errno:%d,len:%d,result:%ld\n", errno, end - str[i], result); -// } -// -//} -/* -TEST(testCase, smlProcess_influx_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists inflx_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use inflx_db"); - taos_free_result(pRes); - - const char *sql[] = { - "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 load_capacity=1500,fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=124,velocity=0,heading=221,grade=0 1451606401000000000", - "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 load_capacity=1500,fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=124,velocity=0,heading=221,grade=0,fuel_consumption=25 1451607402000000000", - "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 load_capacity=1500,fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=124,heading=221,grade=0,fuel_consumption=25 1451608403000000000", - "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=124,velocity=0,heading=221,grade=0,fuel_consumption=25 1451609404000000000", - "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 fuel_consumption=25,grade=0 1451619405000000000", - "readings,name=truck_1,fleet=South,driver=Albert,model=F-150,device_version=v1.5 load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=72.45258,longitude=68.83761,elevation=255,velocity=0,heading=181,grade=0,fuel_consumption=25 1451606406000000000", - "readings,name=truck_2,driver=Derek,model=F-150,device_version=v1.5 load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=24.5208,longitude=28.09377,elevation=428,velocity=0,heading=304,grade=0,fuel_consumption=25 1451606407000000000", - "readings,name=truck_2,fleet=North,driver=Derek,model=F-150 load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=24.5208,longitude=28.09377,elevation=428,velocity=0,heading=304,grade=0,fuel_consumption=25 1451609408000000000", - "readings,fleet=South,name=truck_0,driver=Trish,model=H-2,device_version=v2.3 fuel_consumption=25,grade=0 1451629409000000000", - "stable,t1=t1,t2=t2,t3=t3 c1=1,c2=2,c3=\"kk\",c4=4 1451629501000000000", - "stable,t2=t2,t1=t1,t3=t3 c1=1,c3=\"\",c4=4 1451629602000000000", - }; - pRes = taos_schemaless_insert(taos, (char**)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); - - // case 1 - pRes = taos_query(taos, "select * from t_91e0b182be80332b5c530cbf872f760e"); - ASSERT_NE(pRes, nullptr); - int fieldNum = taos_field_count(pRes); - ASSERT_EQ(fieldNum, 11); - printf("fieldNum:%d\n", fieldNum); - - TAOS_ROW row = NULL; - int32_t rowIndex = 0; - while((row = taos_fetch_row(pRes)) != NULL) { - int64_t ts = *(int64_t*)row[0]; - double load_capacity = *(double*)row[1]; - double fuel_capacity = *(double*)row[2]; - double nominal_fuel_consumption = *(double*)row[3]; - double latitude = *(double*)row[4]; - double longitude = *(double*)row[5]; - double elevation = *(double*)row[6]; - double velocity = *(double*)row[7]; - double heading = *(double*)row[8]; - double grade = *(double*)row[9]; - double fuel_consumption = *(double*)row[10]; - if(rowIndex == 0){ - ASSERT_EQ(ts, 1451606407000); - ASSERT_EQ(load_capacity, 2000); - ASSERT_EQ(fuel_capacity, 200); - ASSERT_EQ(nominal_fuel_consumption, 15); - ASSERT_EQ(latitude, 24.5208); - ASSERT_EQ(longitude, 28.09377); - ASSERT_EQ(elevation, 428); - ASSERT_EQ(velocity, 0); - ASSERT_EQ(heading, 304); - ASSERT_EQ(grade, 0); - ASSERT_EQ(fuel_consumption, 25); - }else{ - ASSERT_FALSE(1); - } - rowIndex++; - } - taos_free_result(pRes); - - // case 2 - pRes = taos_query(taos, "select * from t_6885c584b98481584ee13dac399e173d"); - ASSERT_NE(pRes, nullptr); - fieldNum = taos_field_count(pRes); - ASSERT_EQ(fieldNum, 5); - printf("fieldNum:%d\n", fieldNum); - - rowIndex = 0; - while((row = taos_fetch_row(pRes)) != NULL) { - int *length = taos_fetch_lengths(pRes); - - int64_t ts = *(int64_t*)row[0]; - double c1 = *(double*)row[1]; - double c4 = *(double*)row[4]; - if(rowIndex == 0){ - ASSERT_EQ(ts, 1451629501000); - ASSERT_EQ(c1, 1); - ASSERT_EQ(*(double*)row[2], 2); - ASSERT_EQ(length[3], 2); - ASSERT_EQ(memcmp(row[3], "kk", length[3]), 0); - ASSERT_EQ(c4, 4); - }else if(rowIndex == 1){ - ASSERT_EQ(ts, 1451629602000); - ASSERT_EQ(c1, 1); - ASSERT_EQ(row[2], nullptr); - ASSERT_EQ(length[3], 0); - ASSERT_EQ(c4, 4); - }else{ - ASSERT_FALSE(1); - } - rowIndex++; - } - taos_free_result(pRes); - - // case 2 - pRes = taos_query(taos, "show tables"); - ASSERT_NE(pRes, nullptr); - - row = taos_fetch_row(pRes); - int rowNum = taos_affected_rows(pRes); - ASSERT_EQ(rowNum, 5); - taos_free_result(pRes); -} - -// different types -TEST(testCase, smlParseLine_error_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); - - const char *sql[] = { - "krtqjjkzfg,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532", - "krtqjjkzfg,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532", - "krtqjjkzfg,t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532" -// "ecaomjycxl,t0=t,t1=gptkzldguxgnfvlodfomaabofbsdfvwkzwokpyxqhfylzrzmddjllvatokfuzuzevmoxzmrdsgfyxzxcbxlkxtuctbmwgxjekojjbdtfbzabtccidinfsyrrbxjsliujnkqenagebvnkljjrqotmkjkprostwmtmufmihqbzrwpdomwzlyfsyhaydcofohwichlbesgujmlruftlikqsfbjyctopdxnesqfdklwvrkvolxxhinfaczkzynffphsccerjmiwteqllnhxprlpxxgwxrlgprakmvzdedptcxmeicgsewaefufdyicewiabmmduuwygggokwllirsuhstrvgruywfvftqstugcihsepltbtoqgsrvqbuzzjahbitssymdtieksqdjkafztekeybbqdhuyxqeniozgixutoikuugboapfhvknyipgmpnkhaqbccyycjfqohevpgsndcxppbtwemjwrvavvuxaontrknufynenrpnpyuhaozoeuizmvycknmmujmveaskgtybdkemrusekuaofntgzqijcrnnvnrdkbzigtoeiuihoohebaesfafqlszqoccbjakkbqdqohkvpzbzpjivkyqgiprreljvzaavymuojowacoexrbtrkdsmpnjpdapqtbilmihxoytvrphjckehpioilevatiulqgrnvavpzaknocgplwvocvonkjqaxmnzkghfxresuicfxpvurndqvvyuafmmcoaysogdhupdgrxupwzugslzehwtwapyditfhlwgvwypypfyiaouobpdherkdybrhatsejbxxozbencmwxxbveaoyvlwainfjttstygghihqyjpoerxxkdtrzhcephntuueludtywxirjntqvtafxhqkicpogphysnrtsfkqodahxevshxumecnxtenwmgcoalgvfzghmzsnysombtlkowgfuzelvihtzgxmoktqhltuxxyxucleydssoywkvribqkwwziqgllszvfwubtyuwwhyvicbhjiybkrryjvcqwnbwjkyatpaqntkevbrizjuzjnbwplqlpnpdkpewvgsuhhndudznazireluqkebawasxwdpewchxsegrgigxbixsarblhspuvkwcnyjwxygubrmrybvamjjoynozjsradzxnovldcfqesdzrdthgecporhfelhorgqoldssyuqmunrqhhrogjbcbzssrgnasxxixvusykowycwmcbhruxlflejsewksutysezeahfxfvifuujmtvuiddhetsykbrngppqhujuzdnvogltkwdwwvdhahdbtobpjwuqgnunvyenvmqdslkwuanvslyzodvkcfdvhgmixzzqqrukdslxugfqinqhmddwztygynowpkmlitnlcecoyjxtgwpggjrtphznarzwqlojninlqwcwizdmzwyimkirbrgxgroxbrajxbkwzjlhrccwmshfmddmxvewmwtedfwkjpbrrfcxkypigifjwgdiwesbyhbhnumcswcojnqlnzebhlpgsxufqycqadticqgkgbxkhrisyhkwjdfotladolmcspmqxpgreqctibcclbheaaudoigoevqrksohvuoskrufqdnzharmwkfxepzhvnkuywwhpzzmlksnfrjcbntwxzpgdsqonottkaevidbipxpssnlsqprupcvipcdumpeyrezvlzdxzwqpengyiugqbusgobgsxxxbcsobudpoliqndvepamaygrgueglxvxfsowflkzhmtgsninkgiecobbrzidsgtexvlxltipoohoaoxkslooojyyueeczrcaolsejlanqtyeetvtjlscihyibuujclpgbfzgznjxxqbcjymmtgzjiklyywhamjfdpycfaqtywuzhnvkkkpsarqxjszihjnmeorubperzbqdkzxmkjwfmnyfhgqzsintrfdolzxudqnwgkoowirkxmmrtbshgdydbsumeanvtewwfpaytqaaqfwbugwtvawqoxxtbitkgdjiwuuuclitrsaxlyyleqomzzhjdmuxzbdsdqdobnhmqoreewdbpmrvmnzsibrzizsocaziuoxgpxkqlcrxooaiduferfakupcxilxrvgscpdibyyzgvibjtukjdbdwfuebfgylswvvoouywbucdsxgvooaubjhhxnmjmjysvwxpkwemkisvfvpfesgvoksoyaafjrnzvjzscbqgmprmmrbnjtyphrwacmgbhfkpgxiyytvdtjgfurxziauixoymzchfrdynhizwjqqgepswgjimoaunqnqakyksbkkfeejdkemkhvjhnlrwoqzvipjhdreeqanuhqjdfjukhlqgvjczxwgsmfwlwsfnwxxbqwjqnatvffnyqyhbxgknkhlijccnjgxbmkdxixkvhaikxsnoacvsbwuluwfiagacqlfgqdervhzqvqxawsjovvlxvinvuvjqfbisgfcjbgkhrfeknnkqmyqxsqtlgejmdxgrygulpvrdnhoxwxdyszphcxacffedtgzphinzesdzlpxezstravtrytylbwstfzvlnayvvokzegijaclwodhddctlbslpfnnbnububsrwtexlvxfhgkluqzqykupxossvlkheptsoxcgmnocaryvinunlasadffshmrdegjmuglwnzqwvvjwpuwasewzpndmoumqrzjsorblotxjqcuwspdclcnfayyhimzuznfogkrvpcgbcmqsplnbvqebjdzyslqkzpeuqowaokbzjutiqvuxoghpjltfabfmqnnhhggcurgumdqckbowckwskrsogrnkxirlofwcoxqvbcgzpbyyvnpmdetblwxwkhjrfbwqtshaeihnwjaqpvxlmyzbxijfokizeczjdnxwxbsagycumauiuuxcwkxxexpufdmuuggafmtioxbklnfojjbdepdyjqonwwakznwfjusrhfpcufrgtwmvpnpzaymzaamzhzmezjqajzvrojqbkeqncmupdyfdhhpmvlpgviwaslqhkvsamooaekqyphvvmsnvbyrjczojeuxknjtaknktjdopcbmpsyndmvjmgaygrmpgejwelfxquecvoslzgocsvtyklwkaezzghsnpiogfsitwfknfigfbmgjmhzniebmqtaabzaoyxljukylniyagmsmpcxzcmbrxamwlzgbbdpzvicskvywzgidddfjitbereuzqhrbvhogcnalvhlaxdrjblxmdlkrqtppkxgpehmwrinbrurkrizybltkpojwhpnyjsbovbnqbboqgouefbmffobnvhfpgishijqghrixfkrgejmyxeuasepwoyuoorqwbkcxgvfitspizgxifmieyunghxbrsemepnjywuepkwovhimefasnygqdzadbvnuutipmwfnxqvlbztxelyootchpicwlzccxuqxdwfwbenfzdaopqajtureuurquxenlujmetrvxqbsbuswgngrwaexawkgdjlcxviguvmboepwhwvocklvkdpzvdpvkresfvmdqcikpnagssviaaqrwcpwxfwbrdnkvkrbgaicomqspynedeehfbfkxxkkbztvocusvxiyptvflnjvozjdwgituicqkoyierbhpjiitpcrwouoilsqromkoxjsyxytudxcinradsikwiytegqcxsgreuhsdggnjzdtbfcyojyzxtfnzobgejkwtlzqyjedwknrdjoicgtupmbpvcabwvjvqyreyzykrayhgqadtldjbjvrqnvyqpyfwagruxguwicydhcjascvexdqwqcdzydfhryusqdulkretvvjqpdbsawevvkmopfmpznkfbrzaggvrxwsfaeqossiyeipqevryhnuxdaflytknzzttixjovduqvgaduztsjcnefemanvcbjfjppmvfmqvwzjgzbgsliwchsxafnqhqqgehjpzrhactpebmysyuionrdyrjusiekjoexuubgyfntdpxjzfrdwhdckbezsgrapsxmaswjusjoruem c0=f 1626006833639000000" -// "st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000", -// "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000", -// "test_stb,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532" -// "mqjqbesqqq,t0=t c0=f,c1=\"grigbrpnjctnyhamnwfqsjrywdforgpwpabdisdnymlboguwxuoscfyyajiyusxrocjndexxcvcqrzgxceqolvtdrpeabrcokpmcnhduylzxxljospclwuebutrdbpklpdbtkrdppamenzlmkkzttacrfxaozvwodpxzralhmdhvgaurtacnyhlsaojjglfnrylswactjumeldmuuafnmwsuuyiwhpdzqludgpluvllfowkwhfbtgsjsnxdbfbcrqnrxllmokbzrkiuxkhumfcjogeugbbjowmckoeyrilsoenowqwjpuufprqnxxzjlwfxnoljtodghyfdtyyptxafertndevhewboikewxwtwvbusnjpxwpnhhcrqqyicuuxmadxqjhbodsbexgpuaicbxduewqnogdhyjhcyjyftfbvbctgbjrwrkqtmqhzwxnilkmorotbiuwsimuvloeykzxqdepdkvvdcjtzmsvdseygtprbvhuikvomoafwnfojzaojxbkbpwbjqasazgokjjpktofqhjqhxxplkdvttwflbekawvozxiuhoahajwpimnjsbzjfhqgbbcgjgrjszmuqmwupxqlosfdsqnpkertnamcipfanxxewygtkeiaqopvykygkfbihdqqvhwapyctmxbjvzdndobrooemwtotrjzuknaupwxrjbrjzmnmupbwcdwkoghsilyfrjeefwrmgordzlafyjweavrapqqsicqnmkjulambrjxcmmsnvcjbbbwrloifqnmcmqlndubcynhumpikddliddyduafrpfgcltiymwlpbhtukmyawxdaaqiscvpfvsacjdljlfaeqhearjyczdpjsyjygfwaegqtylpibtdqinncmttbtiifbsesqbhpieectocontqhoyggjgbgjiyegoypfxorfqgbewhfqhkqftjdwtcnaiconxwjwryxqyexmlauoiysodziwfyyzyfewnfjyvfnvvxkkxeajmwbypoodsfrfygadcwpcjhzvemaplczgqxpsxkgxuqbxqhchpybojemqgxlhcyxmddjvwnbkvykkhwebfdpoovtvzgpkuwneodbochwxwauggxulmkynhoohchnkkcybhtwelotxpzoqzuczhwbjxsuqckuzsapdfkeiwxkcutimncyfpuaovhzwaebebkxgbognzpcxldjptnnldzqwtzzsiyjambnbrbyuyptxdkyxhlvigovllmkylbyzecxhdxczlkvsconlfvnafqvrwhcughqbtlmwgumeponoonhqqbklqaxvslkxowcuztjikgbutrnkmizschzrjxbmzvkkdlcuchpnrbxhgvxjqxawftlbirksyqbnltbaxtpyivrrqgxcjjgbhhvlltfqogehhddmgzivwlznkfuqgfbxrtixuonnywsxsdunhsmziyitecmrmxjkzmqhivinqkqywggffljpoxnofmzxkrmnxbdkokaleaqwbqizzhvywrweklybntszygkvuvypmukyxawhgbtnltemjchaytpqjplavcbypkwjwdmfogdxiddrtwrvvoqlmhsqlrdmmibawotbouzosrmbzocqvqdhoamuzvrfeyxkrnzpzyuacffbuvlcqupmbmqughegvjrobyzcyhynnpvvjntdcyplahaajwcbbleblkhjyauehbuoudyzrsgrtqnufijaawllbiexvhveipkaxffuiyczbkpcpzdnajwkkbbfrfchpedgabsraaalfbddgypeayprqwjzfvifjmgwaexrezitgaqgjmgizaohcfizhocckuzysshxzwqolddumeomghgsoaaerfxsapupejhywucurrhgctmmlgbyfjigveayriyvdmapvafzeydlxiwxcgnnajwjaqzkecczrdlbxgtdvehelzibmogdijpdiatcafnediqldwszonasgodqnnvajqxuwuftuvcqwtvayeiyysihhckitlimuimjllslrcnbobmumpbtoakqxallkqhszloxzpogfxxclnkmbfnqqomtzfpzdgxnfyvppeybjnekchjsafvhkrpvxpiumfvraeqcwqneatdrxdykoyscehvputknetluvfexdvtnnnaitrbdwyrzwnymuimydmadqbncdfixsgrcxkdnjzzyimcfbomioddimdxzxbmqwgnrezaquhiqytxmgsqpmywzxqksahlgwpxprtuzxtghkdbgxwpmdqxastvqggkhaqkxhjdsfcwyljwlleymorfgkezzroxaalrguityckdxsgqkcpaxxcsqvttvmmmmxezdztmkgcpnxbobuggzuqaetqfnmttjbshhfqqfsmfylavatksdchwvfvhyipfsepkwzqtprzogoxxohvibkwwiuwpsybbqqgbvziecnulnudzpudxvtcosvedrdxkhnkprghljzltucqljhdwpsfrsfryxpzybmybockeswpyihgossicvoxroiuzvgkbtduxzgsmgrohrxjbdvpnqwhgtvfkjrgpmirfdqddoyaztlooxlzllljsniwxfbihodjfywxallozikruusmzigztbzlyofrxtghhjwgptdbntmqkoxmrgzaznesgsgjnbmgarjqsqvswzygkbgquhbxsulabxzfpfnopzfnbiqeivuzayjbaikqrxrhyysttcafyxfdzgbbadcxiqltlwyhbcibkcxildnhmgwskeztcnmzdncqlyzpbzifjrhflsahlecmxwxlzmvpkqdexbfflmjhdqymxmjrktxaratynebetkfaltnrjgvsbdbvdcdyqujuypensmjnjskovbeweuwnqfjueeylefnqvmdmkwjqfvbjcuaibosymddysdymzhscroykljydnfvwosgplfphpznaqsddtbcjmyxhmcnxwdesycovtwrlmixqmpnzsbyfwpgnujxxqillwpbasdnbfxzokimfkujvlabycfwlplzpcgangjagrrhhjbrtddgitpoemixmobwyabyhsnkjtbeasdejawrueegmijbupygyciwbrhiwisguhlthnkpjqyzhiwvfrpgglqphhjtirtjxsjqxvqjpmokcgqbtjpsvravymmrrpyedruuncsjbjyrysjowqsnwtmvbakadxkxbyfunxnrkqhqvoeuzffmbpzfiiwrfdaekcrevffoxpsauhzziuyyjodsisaadbnyuugaxadvyxhfhbwhbmsgaklslihzwgvprpcawdtrniispfdnjoxkatlwebopgdqnaemwsflgfcuhkdnofblftofqzsphykpirzuckdnuxarzakvwurtrtbprdryikxmzytqhdmoyuizplphpvoliisgzhiganghwvqhzdmijccnfqqvboifovqxqvziktibyzpbffaguffgaqpbujvrvxecmaqygoyyptgzmwlnrwbeyuiiapgazdrgyrobtkcmsoheumgzjjpztatlpjkckxjqgfwvlhojdwztjgjdfdvalsglxjggmlfrbvtfeyhdbkggzukvdjnjtoytyrvxgrlvbqkkgrixhmjvwmojeiugbcyetihdtsizatgeukaczqllddwfqtwzsdquxmjmsypnftypppdsrqmkrfwxpwasrbtbeaaflqiatngmxylmhzwfoczsvcvwkgmxvhzyaoxrbblpqhbcozesrkjqncpyjukhppbubshyhwclceaefzhlbncxwdgglbtmzlksugrgnwjghgscqxfydztoraxrnthpqfojlgnablbxsovkcvpboujoczpihxrdblfirvlpxzgjhgiueyinhzasfelqnwmyhwwiaahrwoivetpfyyeeponmaqofwcbpvagruzshxaugnfzpaognklwcmfjmojrmjgmhroomwinouwdosuwtbrpkrzqtjfyspdnzgtbybsjyuohmchoukdyjfgovroyigpxqavcpmwnccdouskjxpqmpkjzkmcouwmauimkpatyfgkerqazsjuhctrbmqvqfdjfogajgrjnskzmrwnfjjfszebtbsioumdvhvqzgdkkhmsciutobqaefncvepnwqhvrfajmmrqnjryniwrckbaampnegmzoiqibwszbrqcpfgvtnlzemcmzaooywydmonegybzpdtukduxedpyquadxslnvirvewqihhnarvkpsbhmoggmoypwbimrnkuuiztvdqltnrytvvzlvhovoaekomlkqacgvlhdjaxhusehccgzjljjxjdpzpfnsrfnrxbzhoopziyrcmtpuvaqpvrevjjvmucezpecyckcmyvgnzgvitbkkdoptciamgkovowlhfcjmraynfyvlepowelkcjmjnibcsnabchcesnrwiplkavzgvdjyhulhthtbjgeckloshfcgobqovmxpryfbaaxfemkkpmtllovhqncrsbgbhjaozoycdnbcilhhlyfxbzvcmumpspgjszohxqhdocwnoxatmtnkqkpvupobukdudumdpsspzjxrcxstvajlarmicnsnjgdyyxcliqftvftmjmztbktbfmddbqtrfrygqzzzplqgemtvgijkydpshxiajzgcpmxsuamhtucpnejafrjqiwdxxflmaeyhntqfftvmsovtzunqszbvmvjhxcemtorseiariixtbnmxhkcwrghzposhvfnorlcwipsolpmkmvfpwdjswietamqfggxhpwfnsbkooocopbjzzxuhqxbtkklsxmmsgqvxldrfutlgntrewlyksrxdfexgkburyxbuqzhjmvqsqdzwppzyoqibdbhavyhexuybqhstktgtvtrckzqezauehcoxlnntilnkqekvdachlmvuxcowizzbqrldzaggpbvvlfwhsqfdyqvwqwrbkqvrqpzdihtnnafxbxqulzfswevlvxsjugrsaombysnngstmnlyayizrynmofiwbggehbfugsufhmyogsctxkfzlwwwshxnvoaqvstgpjtvyczlgoueutienayowbzwuhzearmhhbukmebpyewdrlmflwbvrzfhrkixvgewburjiqfovxrkiwvvbdrswvbcsznriinohlfeukcxmgmoyrlpqzjtgpjpvsnzbriifdyljkbqqiketrpvmvimmxhmpxlfzqluenskwrtshagizqrxigmmynfppfxfzxcvwbogamdxfipiqdasphwixefwvgrihkqjcflqvqqfvzxdtqyvvnnfzeucqhwlmxjconjuqkachpnysbnhrcfadculwgxcruihnuixxuvdmztugpvesdddargavwiudrtybxwmvywqleepplrchioqkyomusvamfawlxcwdkdjnydcmgfrlmkxpvqhcuioilsahnzrvlxnrfyxmjxvtlliyilcjtcwwcuucgurbbcshnlzrzilgkhdojcivhgltssezykltyzcubevrbapzmnhfhtntgnmjytjubvasdfiagwlzzwohzaibzqwqdlsikaodfljcgnhyckowudmfbqimtuszqgyxxzvipniipgsotrpkzamiwpkngnvwmjjivjtxhpzlmrwcjznavijhjjmvhxkjdahleprpynjnqltqhyamkfdfspbridpbuphtqxkncpognjgxwwyzxnkizrzvobpdxepncwvuhdspajmooiybeksqkhpncluiwwgsapihnkvgmwektybpzlnizkhtxtgeqqgaphditecptyoquueofaleodgsvfjxhokmzgjwflceebrbbjkxvqvkymjatpvdcvatnvkecfpxrpvwgnusmuetshyeyphgzjwktlwycqjqmsfjtiqkkbhndslyfxdegaejuzfylnbqlvacephpbuytqmxvwosukulbwdoofqomqlgdptocqlnjkikcvwcvyrpubzoeegonjhdtuibklelcgtacvovyntmucnzknumratvvwcphkfcxzjfmzwbqluzpexancupokekqnykxmwnyxvclvvxstnbbylaqknrgfegxfgkrnipkrstthxkkyborfgciqgksruwjzxwfuztgizrjrilmshcmnfzxwucrsscgotmniegribamhyzwjwyeuminjukrurpspcjmfllgceyuivmqfgegjjjpbswhjijrlajtbtevijdyanduyhbtedmihjaadtwbnjgrhlxgbvxxmtqzinsclkctlvhocntuppgfeaubksbwxouqsmdeaijulvlpawxuuvadmroswmaceodnqnxaxnwxwsoogqctfkadzabezoeufgskhtxgeefigmjcwrsoymyardzujtpejrsjslnorwixaawuqkhtgtqgrbjrzoxdpgetayqwsvptbwoljgypbkaxjcfujykdtikngwvnmwlpefdecpkywsbkoqjuyiaaizknmygqiqdjhfxfzpsdnlzqosmcdgacngjdrmhhnmltesihrwsfrfjvhctfjinwolonpeuibvxhhunarulabdrrwpipkczhxaxrqxvydmuerawuoshzupvvhfhlvbdahibhygftjmfqostlufujpwrfduppuhidftnjegdoqjyfekysuglomymoybrcypfkabcgiddimrpahbmtjwropodagfdfrpffqqgffriqcmvqsbnrjqwkqrpappefsabbjkotyspncbzjdlqjobgzkxzebhuliwikfvhfroqotbwsyywapztlwnnumngdwuinqefmgmndpvfsmmzrozkzplzmgjojgkzwkfwgljxrvvfuvozeihsiwqvksibqdkbsqslxwydowhsekwuslrppizukfcvvfxuffrnnceoriukxnqoujatnhqvgjaertcqcdfccsttyirwzxytgflyoedmkhzufythspclmyrwzxlvvhhqohxdppsvzoqgcvclykgadmtkwxfnzpcoziukoajwjjaiufyzormcokrwbdpnhcotdmvyihscatzmotgqoqthdcdegnxxsxdqgtbdirmvujyvssdvpztvhzaklkqvvhkpqmqyrwbfwcygnvbjjvrfmccrmjmspvqmxadbpipprbcurcjcjyjjbnzbjdnpgobvckrdcbjiphtgmavthjedrkulplgedfiavvdupwfugxvrowmuipujzqdkzebvfgzqxxznnbdfjmfrrgjwpqkudgscpotdhtguvgyymhhwkrctnvuphhjnrwcqzwargqxxpsdvsvfynlhxrzekjfgtdmcaspmtmzdaojduyhqieipeetptyfuhrynsszfnxcgtvnfahfgkjfbxmgnuhxtifzhgtlmjlgayybpshyzixkvocjlorxlpvsjqgssxlwmxwpmwouocgylxbmyfrezwpubyewxsnqalzgetnpdfwrgxsawaargjclnfxoucwljnuqaiokxgixwogrmfhegurpyzitefhejtqawnmglkhlhxoxblmgdhzkavxnqhoeagcrbbqlssotgphffqtcgkupzvlkmljmjomnqxgcmiyysmkvziridmuijdrzozgzxsuiudhjzuxxjoatipfcpjsqqckmvcgsjdaoecooposrptdwtrdwvfltbtczbnyqhvdrkphccwyyponubffazdikxuifbxnqmoubdtqbpxrpsfyoevuwgmwlnvgblxlvshhdavmdhbmurkmlhsiepzyiqoaiugfdzwkpmtjozzpqfrxpafkiebadrglatgpoiargnyofrhsdrpfgdipxnlsxopmbhxupantpxyasrvqziefcarckihgxkbfszzgtjpoazjuuuxxccegqhjtsjqdhgshczrznrbyjrraxeyzdgciyvaeapkwgvkejkrckdsbyekoukliqozslwgghnjrfbzpqkrfwjawoutztlnasoecujozksrefzdduhnvnskvziighbejokbqyrdespapyqbidgkzwlfvapyjcxcoybgwxweivmzblrdyumcxcnddqgvlthtfjwmefwzkzvnycnfduawgvsqmullejnpapzeujmmwkbmtalkrpunhjlargfhxpjphesgxdvldteileyzxpftdikjyyqgldfwrzglixzuegwslfyhrqjceeeggllgbvfeaefztngfpjncbjeyfmyvcmdashzponstxigskortcevevfpqcbwzmqrbvbniwjwajbdhdfqlyujnwiuveihahtbakokmzkpznqqrqdbbivaettleiciafubnklnowubzzhvzhyhkfhzvvcsajxkqnruuyoaxmrahzmqnuedlmjyiioucsaxvhspmrmglcmpoxvqzwssgxgptdcclstkjxwwaqekdwkixnowusxbnftnzjectfsckbeeevhytludfcdzwdiujywcsgwrvmbecqwibvusgqhhvmztiavlsmvlwztgburxaaotbcslvxnffaohthhwhaatkyvaptdxwoztfcqovimzbpsbxwuwbjwkbdvrkuytovzsvcmkporgabibniqiiobhljsbgeqsdbofcdpuxgdiqlmpwpadfuymdmauguvvewtnrkbkgfogitcidofpaduxeetslyqppgsquivqvvmfmdpyfvmqfliuhkasezljpmlagfgqcqahtfojamfwjmptsuvgbslskjmvqhmdlhouymghfngfysjiqkjfcwbjjtorzpjblzuabghntwyxrcqrrtviijbcknzjolpatwpssnzmobrpxwyaubjgakgdzydkkvsisnfscwklbmkdhrzbopcdmimqleofwvfugtbtogbdmazqjmlslpfeukuqcpmpwggseebnoqpadfpudcnriiwlhojpzpbbqdgqoweijlyjplkxxpxawanihmdkxmmdsdlknwcxrbsmrpsxawxxoepzckcilssqxntruzwmtqqjrxsupdaedboovfkecckmdxtymhagyoweznpgtwxkpbnoqfkrnzvsxpdlgynleqcpyrodfqngjgmkweiotmvpmbujluktefwwhhprfqtusjzebtnhyztjhbhlnmfzdrcsxktxbzqsoczgwoydpcssgksstfeslmesjkdbwhlorqtswfcfsxkysbedidqzsxorpgnhgieonzdzlpyqxjkkncypuhjtgwzxvrqmpleelcampexgswcdtezuqdghfzzxkzzyulqpfojwsdgcdniblomxrxflbnylwqxtifxxfkembyxhkvhfjnmpdinrpodvticucowipekvthfobnkdvgfhoobhhtwdtppcogtwqyynixndujqclzrvwfirjqsmvfjxbhisdaugeaswspcljkdigdqcekcftqcemsjlxhplmrxootbcsjylvkvwtvvnusaxtkxcjrxazsjeheguoxrebicpecuuorpwzsgpfgztgtfpilvauzikosbtzbhrwafktgltkteknizcioxefizyvwfgyfwhbgkssmvobxrzvqfkdhcvezdmyvqqedjvspyvsgwqwovdxrecdanapoydetgehibxaslvllrqkxdzhsebmrdflqxylvgfaaghcstzrlutizgxkgfjzatylehdqcctkhqahctbyazuibdkvvgyyoqlmiocgkripiofrbmjvkavkebaelrhrizmzbskptanrhwzcpzrtofjxzkrushctxejlaziteklpjakzskzklmdgukiabxxduslretgbomoexppmgimlfhfehoswtixefjffecudfmacfvlguvvbzcbtgywrxbwifkrxlhoqvtslpwhbcanoaynjonlyiobcwstxshesdowbviqdejatogcfbllmnctasbeininbnwmtpdhmuvurvtpnkqpscvwtlzhtlpvoztdqbncxxmqymjojjnllivocansiodawzlcygkejjgisvzvvdlmacnffffhxyodgtmmlevrjhnplezrfidsuygsariqdqbyvntpqnurmtrxtentgnopsipnayoxipkvysbunxqjisyjevmjvgxoqruhxvsqedcsimagxmsbjslwohsckiivuhbjnegobkpxjdoqfnicgunugidyfngasefvcbwltaljvxamhnuefkvhgbwyozaggdszyqghnnfmcyjfvhfcamcxjrggysglomdptedlthpfxmmbqbfzlzgodcsahagnuepupqbrfxjgqldwbuenabygoeduhwgtxnfmzlsojbvxmmavdbmxivmdozdratbytpyjysrzpejdggqguhyeshcobbfodtuqnwwundapkfkblfzdlnsbylsufiuycoejkljrcovadehyazpwqordifrsomfskmjzogqciiluldojkxfgtwrlbqjekbqotuhffowjptmjkitgolgsofzkvjasgzktoophkpnidqujvcdxofcfuwwwihpgitnsfsrgxxqzvzfjlabwqptlvsusszjajgxshshzncuhafxndwqcxujigvkymfztczglcuwbzhgomvqxkdmxilzewacpnffzlkxezzpxbfvlfosxkvmdopnuwoqkbjrogfecxpzcqvyzeuadikskcwpgyknryrgcumvspxtgzzdsoebizpsehtpqfmtgnwjhrcoqthrjxjugvzyhvoglnerbyffgastsyoizzzrmmeawztdizcebilasdsthmujjvmjsssvhwlyglddnljtigltporpjaiokkoeuqreawmpbvbnjiuvhdslieeanfazyxubwacizffpahfndinebzcqdrnqnbrwdddcorvatawhqeacjtfikkastvtluavsyixwldxuifyxpmgtxqpdcpyggdiztwihzsvhtotqgtscvmwtpsakuuyuastebtsivnoemlzhdllyvyifirqcvxfapegnfyaxepsvvqhdrztwzgbbtbslrtifugxhrsiidptyafyaxbtbrpxlsvwmxvcmrpgatnpnqoghnjqqxwtfpsicpwrtwtqrxgxrdzlkamgspznezzlezvaftrvbvjatefhsrtrqusxnrxrahdckrsdgyzbtflaaelpkwfddzgapzlktcrizyawqeazasrtkcsryowkcjvmsbkvhkmdxrudjjpczpzfxtjbmgpvwhchvtlctrhdqqjijrnkunalsucruwhhfrrdsjztcrkivvrlszopymvuxnnlqklatzgcjjuxmhrmydtcyxhisvxepljzwjuhinuxvsmkdtmrrojutimnivlxxcjvgbpclzuxcppfopckrvndccoelzzmzcdyqrkuxdwompgshazcuzxwytnjeejmpwpabiuaorkhctezqydizuuontnukrkvithhctnmwwivqbabuvqwvjyxpwsgpsoyszfsnjeeofmqoyxyakfcmwrwkisglzadmtcolpwhrnpasmxbkozdfgtuchqhvdnfahlxbzqqxgfisdjrwwqsjihtcgflpnskznnfdzeotcrzylojcuvsabyngjoetcptkdbihowprmxokppjfjvxsztypzkzgwuurqmlwdzapowwsaozebryypltamqzmduirxskstryqrdaagwerlbnwgteibjiktrladowyuhsuasqppzkqtsvpxzdcxyulrqgjzspppjqujffcwrtovaxaflttvrwdlojqdmmcvgeoiieifzkpzfusoozkunhnxaafpnrnhsfraglsbylzbigxjxqbjgxfbtevzeuqrewyjywvmedtwajobluxrsdlvaghovxhfcieuudwrhffehgfuwkqvgpofqijpklraclahqmewxggvrboqxveabgovkfylybrbrxqnvljafuooyscossddrmuosmcxbthyynfuhytjyhkkvwiaqpicrfjxvwftatdwhwuxxqessofyecjfzbzhpqblvqooasrwnlaqrlzindcvxzunpizmgpgsmnangmfargzqcvclgphenedrlpkfnhcccwzkhsgswrtqnqidkaleqitfqyikkjkcjokeelqfldfbzmtmvcyfzbpcgbsjfedviylpheoilpddgtohbywwuuqdcvihhcqtkrmntgfkeytjeytnfjzxongdmvahbyubjbsdkrejpiyezopkkvrfeiwycizgexqcnrpbqwrksztcjqlrhbyhenwqlxxjkicoajfphdxjpndnkfsjrfoqsmntuenabiufbjkyhemewernlberrrlivflnehtterrvdgnrlaosrljjggogsyxpguzinyohitcbcaqebmogtkamdzhgtiufxeshimfdrcmfqrqtcbapddsmerewofiqrwprfcgdmwzuddpavlnohnybgibsnxtsnzilexfehiphpbpqghnocawhmkzakmotjkeuuilvkagummlcclpuwxbyeoubwqtqsokrnxgotuajewgabdyzzyglufirtdfebmvafinbboecugtxacqdxwmbxyhcksiygftwubfrnxlivjiofvjctzygkjqsnjlhhmoshoxpbrkhbqkztkhjcmeqxgpzxymlfwozldnpllxboixvivoquplfrvtwxljpbmyjlbvbgujcczqhjwdvqtgatnvcuwmncazwmsykjsgjpvhkgusfzyctzmigqowhmdicguijmatupdjzxqbunxbeqardupokgfbtgnkwmajdacajwzsuvpiwjmtzyimluenlcrybwpvtuztfxfsvgrgndhljizthoceovimkxsxyneohxnbzbkmnxlidsczqkknlhrbqdlhxsfypqviucqiywljmiqlzlaofolpmtkvhzgvscoowmzlkehvfidefmcfeqssjquavrehjhugjoeeuqrrskpnsituzqjxoydxxssszyzgmczdtdahjisrjjgdwlnjglrqrzrnyudairljibcutnfcojuyjzuhazszfepncfyvoxgnbiyyixzspcnlhclxddafebdukcvdkblnqmzqkonheehbszjkhhyvecpizqjdnwraosmbfntitxhocadbbniuqzxfuyjqfrpvocwnrziazjitmtxxvkewhfdcewxqfovliuxzilicokdjmuncxipcixlipdcmuwukshsotjjcabvewtorjckmmqtknmdrsvvgqzilbwnxuzlogloepyrsaiqyoxwjwmxbnwckvbiesvybwdqvjnywbwthuadbgeieblmdboggqwxugtiporxgkbroidfuykuypwyavecwgfskshqogbvajbthoemgryusercuxztwgtbzofcsiduoavtafszohwwchuqjpjbbrbxsudotmxprrtavzddwxijonauwgscsvtrjwomoqchhwxtohwatxghcvsbaqxsntzsluhxsmrajjefralceyhhympznjuzmwqummdxuwwqzwdffrgkjggfnjnyebxegzzbujfyeivmlwwgwrglrooznuhlfvguwezrqwnekgnahtocwbjamdtrtowwyyohusnsmznehzpieuayritybnlrldihnbdsbsbdqtpdpqyjkdrcecfwlljsljpdgifxetsajmymzcdlefllhtcotecgnbtputyabsmeigdjxwxywoyvyimdleebaadxpsfeadudsvebxbjrnotvqldkxutesdeimkhwpdbbyvhxsgjalsoosgpikstmbapoffdkljthvhlagsjtnglpuomrvejsdvfcxlgwhitnekotzcmagrjnvqdumqohzpshypkcijkgwozgyxvdozkaasbuohhkzaabuhllmnvtxtwqooxzkkcfaveprjtvklmaoxtftwzkdbpvvuezwbgohnzcomtjsudbbdpowrrtvqixxfellzkloxbrxdroctzwywujgzzptupqmfpstlpiowfnmdgvgkciyzlvskiinwoxsxvbgyprttxjgasztpuvjvwztcnutyxplebjnsgipbarhlcnwjkaspbohchtiurjfykknkslygfkomhqnaiocohyccfguufzebncmchjsapecxdbkouugsmtnipfmdxdamfhfoxcdoqjnjnzfpqsgdirbcaszqchlqhxupypvepxgxecyrwpkaziqndjjkjrpqjowpspvbizerthixqznivlbaflzhtujtkmqgcjdkpnjdrxktphtwfbwpcwcavxaxdrojjteqsajvizogsvgcctyinjqzsjplfkjajuxaprouznlyepxtvfswdsglgbaclhnpoiwkfqrggbmlmpdavzubxdcifoxaokwfwonulygizsuvxqxnomczdjcrcgxfduosvazmwzbzlhcuvxywlzguxjjkkvyutqwwlvtgxljaiercxbzmlwgudfdhseusqifvoxksxpbxublditsfyiflzcvzfdfpdeibmoekyjpddexbfnudsusdxbthmtfxhrgwtiirccxhbizvqffcwghjuusqfcbynbfewdsskwexmpvtrilyqsgraromzsuhbqnjldrpchnclecocjykihgzlwynfcrnhigbfxkrwblbphkdjttqjihergujyickvhoaomtnkmsjpzkyvzljexphylviqyhnbuxrgqdirpcfbevfjtmmodmarupbgicdefifsprpfqszlgjpnhzowtorkanvprqqtjiausxyhtjmtiiwfidmasztdcpynqacphntdtmfpdvpjtaekaggbevqmyxymtiokdspbzgnxubwikzaapehiabcktjhwkgjzhzldgrxjsfyuwgmghenfrtzsdauuaodxqvvyerjuebapknrmhwjhbrojwzcodwhpdbgaeninbtyrhzqxsfpdwzrvfnbruccjfqfupcdsiqjlnrfjasrkhznssbintubxchjhhiqahjtkfawlfyonocudtjpgkgjlyrrkohgrzzvqcwfwgprofintyzpwiregtwyxjywrvrusvnsqyvciubsqaotawxlmromuszooghkkfxwjpsdmvxdkjukxjwjdksmrxpkkpxtpbwbfisfqneuohxhbinrbxmaklfdjzhhpzrfnzrkpegzqnjmdlngvthppmovnrbclgpmiqnzzcwxgstfbrtmealyfigyxfnogdxpoxonzlrzjrvoplzkaimklngxqvhkiijuecthgeqrtxfsajsimbwyknlohabegrkrrwfytemczxogrdrrgibzankeqfddiufslellsggwthsvwkentzyrfppyacqczprryimfnhzowoxtrlpvmtfkstlbcgicqsnkgpysifmykfdzreydxneuydzjhqpmbwrbxgefmsojgbhuxkdfhpfxzvdbpfgdhekmnmaokhssvbsdbgqisfcpwsfzsvojfjsrqhuuduwifaywnthkiuhsrgnkrvuknmilvrowfwsqohmrusibdhuhcjvzjlvrufbtypotgjqagipmmhlcmliieerwhuizsvjnxtubqwabqaifcvsrzlklwxbgwfmxrmimdgxjnlaxtctdrerfpxvifkwbxuskrybktiyeambeebcptsvvmsmhgdxollkhlomdzlyjvyvvnrbaddfrujpvzngaisvfluqjscncriugpimqlcinkebcrtczhiyyirdanhddlusnoezbziuwphjeejhfivvznkemfbtcoiyahtljlynrwzearpvekmzhlguwvmgmmbwzadorelfxidnoiwiehpzgzefmppajnmttvdyemgzwfodtlpirdsmnzkitryomcyfukylxoinaornrtmdisoiuddnzwqitqzwhjecrmyhoretzgxciqngpsxcfgfzyneoxresrogmeebiqrcnpyehfriprzueajqfnrczmullahnexfebqaqfnzzkysvbagwemvxttmwvrvflcfjenjoizhuubutzmsxogboepyyezibsqbmgkwkwrcjyqhikbfpiqsmrjmqriwppdbijldaqzxpuiawhxkaujicxchftemfyfmscxhbxweswtjgtlmtkhpyvpybrkmtgtqvtocnqvaxpkjwkedgvvgsjiftgdqdbukackiefopjqpnhzezgrgrzpyvttugsedhmjcmrvnkeofqqignddniiazspgwgfbxolzwwklvairwvqchjxybwfjugmyflkkuuulqzgqkgsuymvrlemwrblieexszuzkygujowopflsaadzidkrqgsnmntbipofuwrahnypixrpzp\" 1626006833639000000", -// "measure,t1=3 c1=8", -// "measure,t2=3 c1=8u8" - }; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_NE(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, smlProcess_telnet_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists telnet_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use telnet_db"); - taos_free_result(pRes); - - const char *sql[] = { - "sys.if.bytes.out 1479496100 1.3E0 host=web01 interface=eth0", - "sys.if.bytes.out 1479496101 1.3E1 interface=eth0 host=web01 ", - "sys.if.bytes.out 1479496102 1.3E3 network=tcp", - " sys.procs.running 1479496100 42 host=web01 " - }; - - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); - - // case 1 - pRes = taos_query(taos, "select * from t_8c30283b3c4131a071d1e16cf6d7094a"); - ASSERT_NE(pRes, nullptr); - int fieldNum = taos_field_count(pRes); - ASSERT_EQ(fieldNum, 2); - - TAOS_ROW row = taos_fetch_row(pRes); - int64_t ts = *(int64_t*)row[0]; - double c1 = *(double*)row[1]; - ASSERT_EQ(ts, 1479496100000); - ASSERT_EQ(c1, 42); - - int rowNum = taos_affected_rows(pRes); - ASSERT_EQ(rowNum, 1); - taos_free_result(pRes); - - // case 2 - pRes = taos_query(taos, "show tables"); - ASSERT_NE(pRes, nullptr); - - row = taos_fetch_row(pRes); - rowNum = taos_affected_rows(pRes); - ASSERT_EQ(rowNum, 3); - taos_free_result(pRes); -} - -TEST(testCase, smlProcess_json1_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES *pRes = taos_query(taos, "create database if not exists json_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use json_db"); - taos_free_result(pRes); - - const char *sql[] = { - "[\n" - " {\n" - " \"metric\": \"sys.cpu.nice\",\n" - " \"timestamp\": 0,\n" - " \"value\": 18,\n" - " \"tags\": {\n" - " \"host\": \"web01\",\n" - " \"id\": \"t1\",\n" - " \"dc\": \"lga\"\n" - " }\n" - " },\n" - " {\n" - " \"metric\": \"sys.cpu.nice\",\n" - " \"timestamp\": 1346846400,\n" - " \"value\": 9,\n" - " \"tags\": {\n" - " \"host\": \"web02\",\n" - " \"dc\": \"lga\"\n" - " }\n" - " }\n" - "]"}; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); - - // case 1 - pRes = taos_query(taos, "select * from t1"); - ASSERT_NE(pRes, nullptr); - int fieldNum = taos_field_count(pRes); - ASSERT_EQ(fieldNum, 2); - - TAOS_ROW row = taos_fetch_row(pRes); - int64_t ts = *(int64_t*)row[0]; - double c1 = *(double*)row[1]; - ASSERT_EQ(ts, 1346846400000); - ASSERT_EQ(c1, 18); - - int rowNum = taos_affected_rows(pRes); - ASSERT_EQ(rowNum, 1); - taos_free_result(pRes); - - // case 2 - pRes = taos_query(taos, "show tables"); - ASSERT_NE(pRes, nullptr); - - row = taos_fetch_row(pRes); - rowNum = taos_affected_rows(pRes); - ASSERT_EQ(rowNum, 2); - taos_free_result(pRes); -} - -TEST(testCase, smlProcess_json2_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); - - const char *sql[] = { - "{\n" - " \"metric\": \"meter_current0\",\n" - " \"timestamp\": {\n" - " \"value\" : 1346846400,\n" - " \"type\" : \"s\"\n" - " },\n" - " \"value\": {\n" - " \"value\" : 10.3,\n" - " \"type\" : \"i64\"\n" - " },\n" - " \"tags\": {\n" - " \"groupid\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"bigint\"\n" - " },\n" - " \"location\": { \n" - " \"value\" : \"北京\",\n" - " \"type\" : \"binary\"\n" - " },\n" - " \"id\": \"d1001\"\n" - " }\n" - "}"}; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, smlProcess_json3_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); - - const char *sql[] ={ - "{\n" - " \"metric\": \"meter_current1\",\n" - " \"timestamp\": {\n" - " \"value\" : 1346846400,\n" - " \"type\" : \"s\"\n" - " },\n" - " \"value\": {\n" - " \"value\" : 10.3,\n" - " \"type\" : \"i64\"\n" - " },\n" - " \"tags\": {\n" - " \"t1\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"bigint\"\n" - " },\n" - " \"t2\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"int\"\n" - " },\n" - " \"t3\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"i16\"\n" - " },\n" - " \"t4\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"i8\"\n" - " },\n" - " \"t5\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"f32\"\n" - " },\n" - " \"t6\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"double\"\n" - " },\n" - " \"t7\": { \n" - " \"value\" : \"8323\",\n" - " \"type\" : \"binary\"\n" - " },\n" - " \"t8\": { \n" - " \"value\" : \"北京\",\n" - " \"type\" : \"nchar\"\n" - " },\n" - " \"t9\": { \n" - " \"value\" : true,\n" - " \"type\" : \"bool\"\n" - " },\n" - " \"id\": \"d1001\"\n" - " }\n" - "}"}; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, smlProcess_json4_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); - - const char *sql[] = {"{\n" - " \"metric\": \"meter_current2\",\n" - " \"timestamp\": {\n" - " \"value\" : 1346846500000,\n" - " \"type\" : \"ms\"\n" - " },\n" - " \"value\": \"ni\",\n" - " \"tags\": {\n" - " \"t1\": { \n" - " \"value\" : 20,\n" - " \"type\" : \"i64\"\n" - " },\n" - " \"t2\": { \n" - " \"value\" : 25,\n" - " \"type\" : \"i32\"\n" - " },\n" - " \"t3\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"smallint\"\n" - " },\n" - " \"t4\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"tinyint\"\n" - " },\n" - " \"t5\": { \n" - " \"value\" : 2,\n" - " \"type\" : \"float\"\n" - " },\n" - " \"t6\": { \n" - " \"value\" : 0.2,\n" - " \"type\" : \"f64\"\n" - " },\n" - " \"t7\": \"nsj\",\n" - " \"t8\": { \n" - " \"value\" : \"北京\",\n" - " \"type\" : \"nchar\"\n" - " },\n" - " \"t9\": false,\n" - " \"id\": \"d1001\"\n" - " }\n" - "}"}; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - TEST(testCase, smlParseTelnetLine_error_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); - - SRequestObj *request = (SRequestObj *)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT); - ASSERT_NE(request, nullptr); - - STscObj* pTscObj = acquireTscObj(*(int64_t*)taos); - SSmlHandle *info = smlBuildSmlInfo(pTscObj, request, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); + SSmlHandle *info = smlBuildSmlInfo(NULL, NULL, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); ASSERT_NE(info, nullptr); - int32_t ret = 0; const char *sql[] = { "sys.procs.running 14794961040 42 host=web01", "sys.procs.running 14791040 42 host=web01", @@ -976,78 +539,36 @@ TEST(testCase, smlParseTelnetLine_error_Test) { "sys.procs.running 1479496100 42 host= web01", }; for(int i = 0; i < sizeof(sql)/sizeof(sql[0]); i++){ - ret = smlParseTelnetLine(info, (void*)sql[i]); + int ret = smlParseTelnetLine(info, (void*)sql[i]); ASSERT_NE(ret, 0); } - destroyRequest(request); smlDestroyInfo(info); } TEST(testCase, smlParseTelnetLine_diff_type_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); + SSmlHandle *info = smlBuildSmlInfo(NULL, NULL, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); + ASSERT_NE(info, nullptr); const char *sql[] = { "sys.procs.running 1479496104000 42 host=web01", "sys.procs.running 1479496104000 42u8 host=web01", "appywjnuct 1626006833641 True id=\"appywjnuct_40601_49808_1\" t0=t t1=127i8 id=\"appywjnuct_40601_49808_2\" t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7=\"binaryTagValue\" t8=L\"ncharTagValue\"" -// "meters 1601481600000 -863431872.000000f32 t0=-418706150i64 t1=844637295i64 t2=482576837i64 t3=736261541i64 t4=L\"5S6jypOYDYkALfeXCf2gbUEio7iTM9vFOrMcGqYae0yNeDAEIrKHacOo0U7JTrev\"", -// "meters 1601481600010 742480256.000000f32 t0=-418706150i64 t1=844637295i64 t2=482576837i64 t3=736261541i64 t4=L\"5S6jypOYDYkALfeXCf2gbUEio7iTM9vFOrMcGqYae0yNeDAEIrKHacOo0U7JTrev\"", -// "meters 1601481600020 -163715920.000000f32 t0=-418706150i64 t1=844637295i64 t2=482576837i64 t3=736261541i64 t4=L\"5S6jypOYDYkALfeXCf2gbUEio7iTM9vFOrMcGqYae0yNeDAEIrKHacOo0U7JTrev\"", -// "meters 1601481600030 63386372.000000f32 t0=-418706150i64 t1=844637295i64 t2=482576837i64 t3=736261541i64 t4=L\"5S6jypOYDYkALfeXCf2gbUEio7iTM9vFOrMcGqYae0yNeDAEIrKHacOo0U7JTrev\"", -// "meters 1601481600040 -82687824.000000f32 t0=-418706150i64 t1=844637295i64 t2=482576837i64 t3=736261541i64 t4=L\"5S6jypOYDYkALfeXCf2gbUEio7iTM9vFOrMcGqYae0yNeDAEIrKHacOo0U7JTrev\"", -// "meters 1601481600000 -683842112.000000f32 t0=354941102i64 t1=-228279853i64 t2=-78283134i64 t3=91718788i64 t4=L\"wQyjbkfama3csU7N9TPIVAzx3v5ZUoMg3bn3jq3tqSuHAqky8X8QnwbeQ64AjGEa\"", -// "meters 1601481600010 362312416.000000f32 t0=354941102i64 t1=-228279853i64 t2=-78283134i64 t3=91718788i64 t4=L\"wQyjbkfama3csU7N9TPIVAzx3v5ZUoMg3bn3jq3tqSuHAqky8X8QnwbeQ64AjGEa\"", -// "meters 1601481600020 178229296.000000f32 t0=354941102i64 t1=-228279853i64 t2=-78283134i64 t3=91718788i64 t4=L\"wQyjbkfama3csU7N9TPIVAzx3v5ZUoMg3bn3jq3tqSuHAqky8X8QnwbeQ64AjGEa\"", -// "meters 1601481600030 977283136.000000f32 t0=354941102i64 t1=-228279853i64 t2=-78283134i64 t3=91718788i64 t4=L\"wQyjbkfama3csU7N9TPIVAzx3v5ZUoMg3bn3jq3tqSuHAqky8X8QnwbeQ64AjGEa\"", -// "meters 1601481600040 -774479360.000000f32 t0=354941102i64 t1=-228279853i64 t2=-78283134i64 t3=91718788i64 t4=L\"wQyjbkfama3csU7N9TPIVAzx3v5ZUoMg3bn3jq3tqSuHAqky8X8QnwbeQ64AjGEa\"", -// "meters 1601481600000 -863431872.000000f32 t0=-503950941i64 t1=-1008101453i64 t2=800907871i64 t3=688116272i64 t4=L\"5kb9hzKk1aOxqn5qnGCmryWaOYtkDPlx1ku8I5hy3UVi6OwikZvBlfzX4R7wwfUm\"", -// "meters 1601481600010 742480256.000000f32 t0=-503950941i64 t1=-1008101453i64 t2=800907871i64 t3=688116272i64 t4=L\"5kb9hzKk1aOxqn5qnGCmryWaOYtkDPlx1ku8I5hy3UVi6OwikZvBlfzX4R7wwfUm\"", -// "meters 1601481600020 -163715920.000000f32 t0=-503950941i64 t1=-1008101453i64 t2=800907871i64 t3=688116272i64 t4=L\"5kb9hzKk1aOxqn5qnGCmryWaOYtkDPlx1ku8I5hy3UVi6OwikZvBlfzX4R7wwfUm\"", -// "meters 1601481600030 63386372.000000f32 t0=-503950941i64 t1=-1008101453i64 t2=800907871i64 t3=688116272i64 t4=L\"5kb9hzKk1aOxqn5qnGCmryWaOYtkDPlx1ku8I5hy3UVi6OwikZvBlfzX4R7wwfUm\"", -// "meters 1601481600040 -82687824.000000f32 t0=-503950941i64 t1=-1008101453i64 t2=800907871i64 t3=688116272i64 t4=L\"5kb9hzKk1aOxqn5qnGCmryWaOYtkDPlx1ku8I5hy3UVi6OwikZvBlfzX4R7wwfUm\"", -// "meters 1601481600000 -863431872.000000f32 t0=28805371i64 t1=-231884121i64 t2=940124207i64 t3=176395723i64 t4=L\"7pkY8763Ir0QeugozDbqk6NHbvRpx2drfndch74No3sqmyCJZCZaxAFwVmLgcMvh\"", -// "meters 1601481600010 742480256.000000f32 t0=28805371i64 t1=-231884121i64 t2=940124207i64 t3=176395723i64 t4=L\"7pkY8763Ir0QeugozDbqk6NHbvRpx2drfndch74No3sqmyCJZCZaxAFwVmLgcMvh\"", -// "meters 1601481600020 -163715920.000000f32 t0=28805371i64 t1=-231884121i64 t2=940124207i64 t3=176395723i64 t4=L\"7pkY8763Ir0QeugozDbqk6NHbvRpx2drfndch74No3sqmyCJZCZaxAFwVmLgcMvh\"", -// "meters 1601481600030 63386372.000000f32 t0=28805371i64 t1=-231884121i64 t2=940124207i64 t3=176395723i64 t4=L\"7pkY8763Ir0QeugozDbqk6NHbvRpx2drfndch74No3sqmyCJZCZaxAFwVmLgcMvh\"", -// "meters 1601481600040 -82687824.000000f32 t0=28805371i64 t1=-231884121i64 t2=940124207i64 t3=176395723i64 t4=L\"7pkY8763Ir0QeugozDbqk6NHbvRpx2drfndch74No3sqmyCJZCZaxAFwVmLgcMvh\"", -// "meters 1601481600000 -863431872.000000f32 t0=-208520225i64 t1=-254703350i64 t2=-1059776552i64 t3=1056267931i64 t4=L\"1zWxWvHNZYailPvb4XxafeA6QvrUrKUf8ECU1axNWvV9ae851s34wqZcMeU2ME7J\"", -// "meters 1601481600010 742480256.000000f32 t0=-208520225i64 t1=-254703350i64 t2=-1059776552i64 t3=1056267931i64 t4=L\"1zWxWvHNZYailPvb4XxafeA6QvrUrKUf8ECU1axNWvV9ae851s34wqZcMeU2ME7J\"", -// "meters 1601481600020 -163715920.000000f32 t0=-208520225i64 t1=-254703350i64 t2=-1059776552i64 t3=1056267931i64 t4=L\"1zWxWvHNZYailPvb4XxafeA6QvrUrKUf8ECU1axNWvV9ae851s34wqZcMeU2ME7J\"", -// "meters 1601481600030 63386372.000000f32 t0=-208520225i64 t1=-254703350i64 t2=-1059776552i64 t3=1056267931i64 t4=L\"1zWxWvHNZYailPvb4XxafeA6QvrUrKUf8ECU1axNWvV9ae851s34wqZcMeU2ME7J\"", -// "meters 1601481600040 -82687824.000000f32 t0=-208520225i64 t1=-254703350i64 t2=-1059776552i64 t3=1056267931i64 t4=L\"1zWxWvHNZYailPvb4XxafeA6QvrUrKUf8ECU1axNWvV9ae851s34wqZcMeU2ME7J\"" }; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_NE(taos_errno(pRes), 0); - taos_free_result(pRes); + int ret = TSDB_CODE_SUCCESS; + for(int i = 0; i < sizeof(sql)/sizeof(sql[0]); i++){ + ret = smlParseTelnetLine(info, (void*)sql[i]); + if(ret != TSDB_CODE_SUCCESS) break; + } + ASSERT_NE(ret, 0); + smlDestroyInfo(info); } TEST(testCase, smlParseTelnetLine_json_error_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); - - SRequestObj *request = (SRequestObj *)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT); - ASSERT_NE(request, nullptr); - - STscObj* pTscObj = acquireTscObj(*(int64_t*)taos); - SSmlHandle *info = smlBuildSmlInfo(pTscObj, request, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); + SSmlHandle *info = smlBuildSmlInfo(NULL, NULL, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); ASSERT_NE(info, nullptr); - int32_t ret = 0; const char *sql[] = { "[\n" " {\n" @@ -1090,24 +611,20 @@ TEST(testCase, smlParseTelnetLine_json_error_Test) { " },\n" "]", }; + + int ret = TSDB_CODE_SUCCESS; for(int i = 0; i < sizeof(sql)/sizeof(sql[0]); i++){ ret = smlParseTelnetLine(info, (void*)sql[i]); ASSERT_NE(ret, 0); } - destroyRequest(request); smlDestroyInfo(info); } TEST(testCase, smlParseTelnetLine_diff_json_type1_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); + SSmlHandle *info = smlBuildSmlInfo(NULL, NULL, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); + ASSERT_NE(info, nullptr); const char *sql[] = { "[\n" @@ -1131,20 +648,19 @@ TEST(testCase, smlParseTelnetLine_diff_json_type1_Test) { " },\n" "]", }; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_NE(taos_errno(pRes), 0); - taos_free_result(pRes); + + int ret = TSDB_CODE_SUCCESS; + for(int i = 0; i < sizeof(sql)/sizeof(sql[0]); i++){ + ret = smlParseTelnetLine(info, (void*)sql[i]); + if(ret != TSDB_CODE_SUCCESS) break; + } + ASSERT_NE(ret, 0); + smlDestroyInfo(info); } TEST(testCase, smlParseTelnetLine_diff_json_type2_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); + SSmlHandle *info = smlBuildSmlInfo(NULL, NULL, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); + ASSERT_NE(info, nullptr); const char *sql[] = { "[\n" @@ -1168,388 +684,11 @@ TEST(testCase, smlParseTelnetLine_diff_json_type2_Test) { " },\n" "]", }; - pRes = taos_schemaless_insert(taos, (char **)sql, 0, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT_NE(taos_errno(pRes), 0); - taos_free_result(pRes); + int ret = TSDB_CODE_SUCCESS; + for(int i = 0; i < sizeof(sql)/sizeof(sql[0]); i++){ + ret = smlParseTelnetLine(info, (void*)sql[i]); + if(ret != TSDB_CODE_SUCCESS) break; + } + ASSERT_NE(ret, 0); + smlDestroyInfo(info); } - -TEST(testCase, sml_TD15662_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES *pRes = taos_query(taos, "create database if not exists db_15662 precision 'ns' schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use db_15662"); - taos_free_result(pRes); - - const char *sql[] = { - "hetrey c0=f,c1=127i8 1626006833639", - "hetrey,t1=r c0=f,c1=127i8 1626006833640", - }; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, sml_TD15735_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use sml_db"); - taos_free_result(pRes); - - const char *sql[1] = { - "{'metric': 'pekoiw', 'timestamp': {'value': 1626006833639000000, 'type': 'ns'}, 'value': {'value': False, 'type': 'bool'}, 'tags': {'t0': {'value': True, 'type': 'bool'}, 't1': {'value': 127, 'type': 'tinyint'}, 't2': {'value': 32767, 'type': 'smallint'}, 't3': {'value': 2147483647, 'type': 'int'}, 't4': {'value': 9223372036854775807, 'type': 'bigint'}, 't5': {'value': 11.12345027923584, 'type': 'float'}, 't6': {'value': 22.123456789, 'type': 'double'}, 't7': {'value': 'binaryTagValue', 'type': 'binary'}, 't8': {'value': 'ncharTagValue', 'type': 'nchar'}}}", - }; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); - ASSERT_NE(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, sml_TD15742_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists TD15742 schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use TD15742"); - taos_free_result(pRes); - - const char *sql[] = { - "test_ms,t0=t c0=f 1626006833641", - }; - pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, sml_params_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists param"); - taos_free_result(pRes); - - const char *sql[] = { - "test_ms,t0=t c0=f 1626006833641", - }; - TAOS_RES* res = taos_schemaless_insert(taos, (char**)sql, 1, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); - ASSERT_EQ(taos_errno(res), TSDB_CODE_PAR_DB_NOT_SPECIFIED); - taos_free_result(res); - - pRes = taos_query(taos, "use param"); - taos_free_result(res); - - res = taos_schemaless_insert(taos, (char**)sql, 1, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); - ASSERT_EQ(taos_errno(res), TSDB_CODE_SML_INVALID_DB_CONF); - taos_free_result(res); -} - -TEST(testCase, sml_16384_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists d16384 schemaless 1"); - taos_free_result(pRes); - - const char *sql[] = { - "qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=t,c1=127i8 1626006833639000000", - }; - - pRes = taos_query(taos, "use d16384"); - taos_free_result(pRes); - - TAOS_RES* res = taos_schemaless_insert(taos, (char**)sql, 1, TSDB_SML_LINE_PROTOCOL, 0); - ASSERT_EQ(taos_errno(res), 0); - taos_free_result(res); - - const char *sql1[] = { - "qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=f,c1=127i8,c11=L\"ncharColValue\",c10=t 1626006833639000000", - }; - TAOS_RES* res1 = taos_schemaless_insert(taos, (char**)sql1, 1, TSDB_SML_LINE_PROTOCOL, 0); - ASSERT_EQ(taos_errno(res1), 0); - taos_free_result(res1); -} - -TEST(testCase, sml_oom_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists oom schemaless 1"); - taos_free_result(pRes); - - const char *sql[] = { - //"test_ms,t0=t c0=f 1626006833641", - "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pgxbrbga\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"gviggpmi\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", - "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"cexkarjn\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"rzwwuoxu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", - "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"xphrlkey\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"llsawebj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", - "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"jwpkipff\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"euzzhcvu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"jumhnsvw\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"fnetgdhj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"vrmmpgqe\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"lnpfjapr\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"gvbhmsfr\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"kydxrxwc\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pfyarryq\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"uxptotap\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"prolhudh\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ttxaxnac\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"dfgvmjmz\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bloextkn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"dvjxwzsi\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"aigjomaf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"refbidtf\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vuanlfpz\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"nbpajxkx\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ktzzauxh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"prcwdjct\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vmbhvjtp\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"liuddtuz\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"pddsktow\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"algldlvl\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"mlmnjgdl\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"oiynpcog\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"wmynbagb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"asvyulrm\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ohaacrkp\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ytyejhiq\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bbznuerb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"lpebcibw\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"xmqrbafv\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"lnmwpdne\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"jpcsjqun\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"mmxqmavz\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"hhsbgaow\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"uwogyuud\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ytxpaxnk\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"wouwdvtt\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"iitwikkh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"lgyzuyaq\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bdtiigxi\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"qpnsvdhw\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"pjxihgvu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ksxkfetn\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ocukufqs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"qzerxmpe\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"qwcfdyxs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"jldrpmmd\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"lucxlfzc\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"rcewrvya\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"dknvaphs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"nxtxgzdr\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"mbvuugwz\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"uikakffu\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"mwmtqsma\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"bfcxrrpa\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ksajygdj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"vmhhszyv\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"urwjgvut\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"jrvytcxy\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"evqkzygh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"zitdznhg\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"tpqekrxa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"yrrbgjtk\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bnphiuyq\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"huknehjn\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"iudbxfke\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"fjmolwbn\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"gukzgcjs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"bjvdtlgq\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"phxnesxh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"qgpgckvc\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"yechqtfa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pbouxywy\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"kxtuojyo\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"txaniwlj\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"fixgufrj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"okzvalwq\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"iitawgbn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"gayvmird\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"dprkfjph\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"kmuccshq\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vkslsdsd\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"dukccdqk\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"leztxmqf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"kltixbwz\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"xqhkweef\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"idxsimvz\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vbruvcpk\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"uxandqkd\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"dsiosysh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"kxuyanpp\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"wkrktags\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"yvizzpiv\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ddnefben\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"novmfmbc\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"fnusxsfu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ouerfjap\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"sigognkf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"slvzhede\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bknerect\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"tmhcdfjb\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"hpnoanpp\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"okmhelnc\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"xcernjin\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"jdmiismg\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"tmnqozrf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"zgwrftkx\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"zyamlwwh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"nuedqcro\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"lpsvyqaa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"mneitsul\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vpleinwb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"njxuaedy\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"sdgxpqmu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"yjirrebp\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ikqndzfj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ghnfdxhr\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"hrwczpvo\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"nattumpb\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"zoyfzazn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"rdwemofy\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"phkgsjeg\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pyhvvjrt\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"zfslyton\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"bxwjzeri\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"uovzzgjv\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"cfjmacvr\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"jefqgzqx\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"njrksxmr\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"mhvabvgn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"kfekjltr\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"lexfaaby\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"zbblsmwq\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"oqcombkx\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"rcdmhzyw\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"otksuean\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"itbdvowq\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"tswtmhex\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"xoukkzid\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"guangmpq\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"rayxzuky\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"lspwucrv\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pdprzzkf\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"sddqrtza\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"kabndgkx\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"aglnqqxs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"fiwpzmdr\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"hxctooen\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pckjpwyh\",t8=L\"ncharTagValue\" c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ivmvsbai\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"eljdclst\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"rwgdctie\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"zlnthxoz\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"ljtxelle\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"llfggdpy\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"tvnridze\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"hxjpgube\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"zmldmquq\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"bggqwcoj\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"drksfofm\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"jcsixens\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"cdwnwhaf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"nngpumuq\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"hylgooci\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"cozeyjys\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"lcgpfcsa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"qdtzhtyd\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"txpubynb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"gbslzbtu\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"buihcpcl\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ayqezaiq\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"zgkgtilj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"bcjopqif\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"mfzxiaqt\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"xmnlqxoj\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"reyiklyf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"xssuomhk\",t8=L\"ncharTagValue\" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"liazkjll\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"nigjlblo\",t8=L\"ncharTagValue\" c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vmojyznk\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"dotkbvrz\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"kuwdyydw\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"slsfqydw\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"zyironhd\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pktwfhzi\",t8=L\"ncharTagValue\" c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"xybavsvh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"pyrxemvx\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"tlfihwjs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"neumakmg\",t8=L\"ncharTagValue\" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"wxqingoa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", - }; - pRes = taos_query(taos, "use oom"); - taos_free_result(pRes); - - pRes = taos_schemaless_insert(taos, (char**)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, sml_16368_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists d16368 schemaless 1"); - taos_free_result(pRes); - - pRes = taos_query(taos, "use d16368"); - taos_free_result(pRes); - - const char *sql[] = { - "[{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833639000, \"type\": \"us\"}, \"value\": 1, \"tags\": {\"t1\": 3, \"t2\": {\"value\": 4, \"type\": \"double\"}, \"t3\": {\"value\": \"t3\", \"type\": \"binary\"}}},\n" - "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833739000, \"type\": \"us\"}, \"value\": 2, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, \"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}},\n" - "{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006833639100, \"type\": \"us\"}, \"value\": 3, \"tags\": {\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t3\": {\"value\": \"ste\", \"type\": \"nchar\"}}},\n" - "{\"metric\": \"stf567890\", \"timestamp\": {\"value\": 1626006833639200, \"type\": \"us\"}, \"value\": 4, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"bigint\"}, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, \"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}},\n" - "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833639300, \"type\": \"us\"}, \"value\": {\"value\": 5, \"type\": \"double\"}, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t2\": 5.0, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}}},\n" - "{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006833639400, \"type\": \"us\"}, \"value\": {\"value\": 6, \"type\": \"double\"}, \"tags\": {\"t2\": 5.0, \"t3\": {\"value\": \"ste2\", \"type\": \"nchar\"}}},\n" - "{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006834639400, \"type\": \"us\"}, \"value\": {\"value\": 7, \"type\": \"double\"}, \"tags\": {\"t2\": {\"value\": 5.0, \"type\": \"double\"}, \"t3\": {\"value\": \"ste2\", \"type\": \"nchar\"}}},\n" - "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833839006, \"type\": \"us\"}, \"value\": {\"value\": 8, \"type\": \"double\"}, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, \"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}},\n" - "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833939007, \"type\": \"us\"}, \"value\": {\"value\": 9, \"type\": \"double\"}, \"tags\": {\"t1\": 4, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, \"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}}]" - }; - pRes = taos_schemaless_insert(taos, (char**)sql, 0, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_MICRO_SECONDS); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - -TEST(testCase, sml_dup_time_Test) { - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_NE(taos, nullptr); - - TAOS_RES* pRes = taos_query(taos, "create database if not exists dup_time schemaless 1"); - taos_free_result(pRes); - - const char *sql[] = { - //"test_ms,t0=t c0=f 1626006833641", - "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=false,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", - "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000", - "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000", - "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000", - "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000" - }; - pRes = taos_query(taos, "use dup_time"); - taos_free_result(pRes); - - pRes = taos_schemaless_insert(taos, (char**)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); - ASSERT_EQ(taos_errno(pRes), 0); - taos_free_result(pRes); -} - - -TEST(testCase, sml_16960_Test) { -TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); -ASSERT_NE(taos, nullptr); - -TAOS_RES* pRes = taos_query(taos, "create database if not exists d16368 schemaless 1"); -taos_free_result(pRes); - -pRes = taos_query(taos, "use d16368"); -taos_free_result(pRes); - -const char *sql[] = { - "[\n" - "{\n" - "\"timestamp\":\n" - "\n" - "{ \"value\": 1349020800000, \"type\": \"ms\" }\n" - ",\n" - "\"value\":\n" - "\n" - "{ \"value\": 830525384, \"type\": \"int\" }\n" - ",\n" - "\"tags\": {\n" - "\"id\": \"stb00_0\",\n" - "\"t0\":\n" - "\n" - "{ \"value\": 83972721, \"type\": \"int\" }\n" - ",\n" - "\"t1\":\n" - "\n" - "{ \"value\": 539147525, \"type\": \"int\" }\n" - ",\n" - "\"t2\":\n" - "\n" - "{ \"value\": 618258572, \"type\": \"int\" }\n" - ",\n" - "\"t3\":\n" - "\n" - "{ \"value\": -10536201, \"type\": \"int\" }\n" - ",\n" - "\"t4\":\n" - "\n" - "{ \"value\": 349227409, \"type\": \"int\" }\n" - ",\n" - "\"t5\":\n" - "\n" - "{ \"value\": 249347042, \"type\": \"int\" }\n" - "},\n" - "\"metric\": \"stb0\"\n" - "},\n" - "{\n" - "\"timestamp\":\n" - "\n" - "{ \"value\": 1349020800001, \"type\": \"ms\" }\n" - ",\n" - "\"value\":\n" - "\n" - "{ \"value\": -588348364, \"type\": \"int\" }\n" - ",\n" - "\"tags\": {\n" - "\"id\": \"stb00_0\",\n" - "\"t0\":\n" - "\n" - "{ \"value\": 83972721, \"type\": \"int\" }\n" - ",\n" - "\"t1\":\n" - "\n" - "{ \"value\": 539147525, \"type\": \"int\" }\n" - ",\n" - "\"t2\":\n" - "\n" - "{ \"value\": 618258572, \"type\": \"int\" }\n" - ",\n" - "\"t3\":\n" - "\n" - "{ \"value\": -10536201, \"type\": \"int\" }\n" - ",\n" - "\"t4\":\n" - "\n" - "{ \"value\": 349227409, \"type\": \"int\" }\n" - ",\n" - "\"t5\":\n" - "\n" - "{ \"value\": 249347042, \"type\": \"int\" }\n" - "},\n" - "\"metric\": \"stb0\"\n" - "},\n" - "{\n" - "\"timestamp\":\n" - "\n" - "{ \"value\": 1349020800002, \"type\": \"ms\" }\n" - ",\n" - "\"value\":\n" - "\n" - "{ \"value\": -370310823, \"type\": \"int\" }\n" - ",\n" - "\"tags\": {\n" - "\"id\": \"stb00_0\",\n" - "\"t0\":\n" - "\n" - "{ \"value\": 83972721, \"type\": \"int\" }\n" - ",\n" - "\"t1\":\n" - "\n" - "{ \"value\": 539147525, \"type\": \"int\" }\n" - ",\n" - "\"t2\":\n" - "\n" - "{ \"value\": 618258572, \"type\": \"int\" }\n" - ",\n" - "\"t3\":\n" - "\n" - "{ \"value\": -10536201, \"type\": \"int\" }\n" - ",\n" - "\"t4\":\n" - "\n" - "{ \"value\": 349227409, \"type\": \"int\" }\n" - ",\n" - "\"t5\":\n" - "\n" - "{ \"value\": 249347042, \"type\": \"int\" }\n" - "},\n" - "\"metric\": \"stb0\"\n" - "},\n" - "{\n" - "\"timestamp\":\n" - "\n" - "{ \"value\": 1349020800003, \"type\": \"ms\" }\n" - ",\n" - "\"value\":\n" - "\n" - "{ \"value\": -811250191, \"type\": \"int\" }\n" - ",\n" - "\"tags\": {\n" - "\"id\": \"stb00_0\",\n" - "\"t0\":\n" - "\n" - "{ \"value\": 83972721, \"type\": \"int\" }\n" - ",\n" - "\"t1\":\n" - "\n" - "{ \"value\": 539147525, \"type\": \"int\" }\n" - ",\n" - "\"t2\":\n" - "\n" - "{ \"value\": 618258572, \"type\": \"int\" }\n" - ",\n" - "\"t3\":\n" - "\n" - "{ \"value\": -10536201, \"type\": \"int\" }\n" - ",\n" - "\"t4\":\n" - "\n" - "{ \"value\": 349227409, \"type\": \"int\" }\n" - ",\n" - "\"t5\":\n" - "\n" - "{ \"value\": 249347042, \"type\": \"int\" }\n" - "},\n" - "\"metric\": \"stb0\"\n" - "},\n" - "{\n" - "\"timestamp\":\n" - "\n" - "{ \"value\": 1349020800004, \"type\": \"ms\" }\n" - ",\n" - "\"value\":\n" - "\n" - "{ \"value\": -330340558, \"type\": \"int\" }\n" - ",\n" - "\"tags\": {\n" - "\"id\": \"stb00_0\",\n" - "\"t0\":\n" - "\n" - "{ \"value\": 83972721, \"type\": \"int\" }\n" - ",\n" - "\"t1\":\n" - "\n" - "{ \"value\": 539147525, \"type\": \"int\" }\n" - ",\n" - "\"t2\":\n" - "\n" - "{ \"value\": 618258572, \"type\": \"int\" }\n" - ",\n" - "\"t3\":\n" - "\n" - "{ \"value\": -10536201, \"type\": \"int\" }\n" - ",\n" - "\"t4\":\n" - "\n" - "{ \"value\": 349227409, \"type\": \"int\" }\n" - ",\n" - "\"t5\":\n" - "\n" - "{ \"value\": 249347042, \"type\": \"int\" }\n" - "},\n" - "\"metric\": \"stb0\"\n" - "}\n" - "]" -}; - -pRes = taos_schemaless_insert(taos, (char**)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); -ASSERT_EQ(taos_errno(pRes), 0); -taos_free_result(pRes); -} -*/ diff --git a/tests/system-test/2-query/sml.py b/tests/system-test/2-query/sml.py new file mode 100644 index 0000000000..ae89ffb5b4 --- /dev/null +++ b/tests/system-test/2-query/sml.py @@ -0,0 +1,98 @@ + +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def checkFileContent(self): + buildPath = tdCom.getBuildPath() + cmdStr = '%s/build/bin/sml_test'%(buildPath) + tdLog.info(cmdStr) + ret = os.system(cmdStr) + if ret != 0: + tdLog.exit("sml_test failed") + + tdSql.execute('use sml_db') + tdSql.query("select * from t_b7d815c9222ca64cdf2614c61de8f211") + tdSql.checkRows(1) + + tdSql.checkData(0, 0, '2016-01-01 08:00:07.000') + tdSql.checkData(0, 1, 2000) + tdSql.checkData(0, 2, 200) + tdSql.checkData(0, 3, 15) + tdSql.checkData(0, 4, 24.5208) + tdSql.checkData(0, 5, 28.09377) + tdSql.checkData(0, 6, 428) + tdSql.checkData(0, 7, 0) + tdSql.checkData(0, 8, 304) + tdSql.checkData(0, 9, 0) + tdSql.checkData(0, 10, 25) + + tdSql.query("select * from readings") + tdSql.checkRows(9) + + tdSql.query("select distinct tbname from readings") + tdSql.checkRows(4) + + tdSql.query("select * from t_0799064f5487946e5d22164a822acfc8 order by _ts") + tdSql.checkRows(2) + tdSql.checkData(0, 3, "kk") + tdSql.checkData(1, 3, None) + + + tdSql.query("select distinct tbname from `sys.if.bytes.out`") + tdSql.checkRows(2) + + tdSql.query("select * from t_fc70dec6677d4277c5d9799c4da806da order by _ts") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1.300000000) + tdSql.checkData(1, 1,13.000000000) + + tdSql.query("select * from `sys.procs.running`") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 42.000000000) + tdSql.checkData(0, 2, "web01") + + tdSql.query("select distinct tbname from `sys.cpu.nice`") + tdSql.checkRows(2) + + tdSql.query("select * from `sys.cpu.nice` order by _ts") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9.000000000) + tdSql.checkData(0, 2, "lga") + tdSql.checkData(0, 3, "web02") + tdSql.checkData(0, 4, None) + tdSql.checkData(1, 1, 18.000000000) + tdSql.checkData(1, 2, "lga") + tdSql.checkData(1, 3, "web01") + tdSql.checkData(1, 4, "t1") + + return + + def run(self): + tdSql.prepare() + self.checkFileContent() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index a136d0a1a2..cd13535684 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -45,7 +45,7 @@ class TDTestCase: break tdSql.execute('use db_taosx') - tdSql.query("select * from ct3") + tdSql.query("select * from ct3 order by c1 desc") tdSql.checkRows(2) tdSql.checkData(0, 1, 51) tdSql.checkData(0, 4, 940) @@ -58,17 +58,17 @@ class TDTestCase: tdSql.query("select * from ct2") tdSql.checkRows(0) - tdSql.query("select * from ct0") + tdSql.query("select * from ct0 order by c1") tdSql.checkRows(2) tdSql.checkData(0, 3, "a") tdSql.checkData(1, 4, None) - tdSql.query("select * from n1") + tdSql.query("select * from n1 order by cc3 desc") tdSql.checkRows(2) tdSql.checkData(0, 1, "eeee") tdSql.checkData(1, 2, 940) - tdSql.query("select * from jt") + tdSql.query("select * from jt order by i desc") tdSql.checkRows(2) tdSql.checkData(0, 1, 11) tdSql.checkData(0, 2, None) @@ -85,7 +85,5 @@ class TDTestCase: tdSql.close() tdLog.success(f"{__file__} successfully executed") -event = threading.Event() - tdCases.addLinux(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/test/c/CMakeLists.txt b/tests/test/c/CMakeLists.txt index 605eef9be3..31331b5265 100644 --- a/tests/test/c/CMakeLists.txt +++ b/tests/test/c/CMakeLists.txt @@ -2,6 +2,7 @@ add_executable(tmq_demo tmqDemo.c) add_executable(tmq_sim tmqSim.c) add_executable(create_table createTable.c) add_executable(tmq_taosx_ci tmq_taosx_ci.c) +add_executable(sml_test sml_test.c) target_link_libraries( create_table PUBLIC taos_static @@ -31,6 +32,14 @@ target_link_libraries( PUBLIC os ) +target_link_libraries( + sml_test + PUBLIC taos_static + PUBLIC util + PUBLIC common + PUBLIC os +) + add_executable(sdbDump sdbDump.c) target_link_libraries( sdbDump diff --git a/tests/test/c/sml_test.c b/tests/test/c/sml_test.c new file mode 100644 index 0000000000..fc6cdd0ec2 --- /dev/null +++ b/tests/test/c/sml_test.c @@ -0,0 +1,1101 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include "taos.h" +#include "types.h" + +int smlProcess_influx_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 " + "load_capacity=1500,fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=" + "124,velocity=0,heading=221,grade=0 1451606401000000000", + "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 " + "load_capacity=1500,fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=" + "124,velocity=0,heading=221,grade=0,fuel_consumption=25 1451607402000000000", + "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 " + "load_capacity=1500,fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=" + "124,heading=221,grade=0,fuel_consumption=25 1451608403000000000", + "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 " + "fuel_capacity=150,nominal_fuel_consumption=12,latitude=52.31854,longitude=4.72037,elevation=124,velocity=0," + "heading=221,grade=0,fuel_consumption=25 1451609404000000000", + "readings,name=truck_0,fleet=South,driver=Trish,model=H-2,device_version=v2.3 fuel_consumption=25,grade=0 " + "1451619405000000000", + "readings,name=truck_1,fleet=South,driver=Albert,model=F-150,device_version=v1.5 " + "load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=72.45258,longitude=68.83761,elevation=" + "255,velocity=0,heading=181,grade=0,fuel_consumption=25 1451606406000000000", + "readings,name=truck_2,driver=Derek,model=F-150,device_version=v1.5 " + "load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=24.5208,longitude=28.09377,elevation=" + "428,velocity=0,heading=304,grade=0,fuel_consumption=25 1451606407000000000", + "readings,name=truck_2,fleet=North,driver=Derek,model=F-150 " + "load_capacity=2000,fuel_capacity=200,nominal_fuel_consumption=15,latitude=24.5208,longitude=28.09377,elevation=" + "428,velocity=0,heading=304,grade=0,fuel_consumption=25 1451609408000000000", + "readings,fleet=South,name=truck_0,driver=Trish,model=H-2,device_version=v2.3 fuel_consumption=25,grade=0 " + "1451629409000000000", + "stable,t1=t1,t2=t2,t3=t3 c1=1,c2=2,c3=\"kk\",c4=4 1451629501000000000", + "stable,t2=t2,t1=t1,t3=t3 c1=1,c3=\"\",c4=4 1451629602000000000", + }; + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int smlProcess_telnet_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = {"sys.if.bytes.out 1479496100 1.3E0 host=web01 interface=eth0", + "sys.if.bytes.out 1479496101 1.3E1 interface=eth0 host=web01 ", + "sys.if.bytes.out 1479496102 1.3E3 network=tcp", + " sys.procs.running 1479496100 42 host=web01 "}; + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_TELNET_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int smlProcess_json1_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "[" + " {" + " \"metric\": \"sys.cpu.nice\"," + " \"timestamp\": 0," + " \"value\": 18," + " \"tags\": {" + " \"host\": \"web01\"," + " \"id\": \"t1\"," + " \"dc\": \"lga\"" + " }" + " }," + " {" + " \"metric\": \"sys.cpu.nice\"," + " \"timestamp\": 1346846400," + " \"value\": 9," + " \"tags\": {" + " \"host\": \"web02\"," + " \"dc\": \"lga\"" + " }" + " }" + "]"}; + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int smlProcess_json2_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "{" + " \"metric\": \"meter_current0\"," + " \"timestamp\": {" + " \"value\" : 1346846400," + " \"type\" : \"s\"" + " }," + " \"value\": {" + " \"value\" : 10.3," + " \"type\" : \"i64\"" + " }," + " \"tags\": {" + " \"groupid\": { " + " \"value\" : 2," + " \"type\" : \"bigint\"" + " }," + " \"location\": { " + " \"value\" : \"北京\"," + " \"type\" : \"binary\"" + " }," + " \"id\": \"d1001\"" + " }" + "}"}; + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int smlProcess_json3_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "{" + " \"metric\": \"meter_current1\"," + " \"timestamp\": {" + " \"value\" : 1346846400," + " \"type\" : \"s\"" + " }," + " \"value\": {" + " \"value\" : 10.3," + " \"type\" : \"i64\"" + " }," + " \"tags\": {" + " \"t1\": { " + " \"value\" : 2," + " \"type\" : \"bigint\"" + " }," + " \"t2\": { " + " \"value\" : 2," + " \"type\" : \"int\"" + " }," + " \"t3\": { " + " \"value\" : 2," + " \"type\" : \"i16\"" + " }," + " \"t4\": { " + " \"value\" : 2," + " \"type\" : \"i8\"" + " }," + " \"t5\": { " + " \"value\" : 2," + " \"type\" : \"f32\"" + " }," + " \"t6\": { " + " \"value\" : 2," + " \"type\" : \"double\"" + " }," + " \"t7\": { " + " \"value\" : \"8323\"," + " \"type\" : \"binary\"" + " }," + " \"t8\": { " + " \"value\" : \"北京\"," + " \"type\" : \"nchar\"" + " }," + " \"t9\": { " + " \"value\" : true," + " \"type\" : \"bool\"" + " }," + " \"id\": \"d1001\"" + " }" + "}"}; + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int smlProcess_json4_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "{" + " \"metric\": \"meter_current2\"," + " \"timestamp\": {" + " \"value\" : 1346846500000," + " \"type\" : \"ms\"" + " }," + " \"value\": \"ni\"," + " \"tags\": {" + " \"t1\": { " + " \"value\" : 20," + " \"type\" : \"i64\"" + " }," + " \"t2\": { " + " \"value\" : 25," + " \"type\" : \"i32\"" + " }," + " \"t3\": { " + " \"value\" : 2," + " \"type\" : \"smallint\"" + " }," + " \"t4\": { " + " \"value\" : 2," + " \"type\" : \"tinyint\"" + " }," + " \"t5\": { " + " \"value\" : 2," + " \"type\" : \"float\"" + " }," + " \"t6\": { " + " \"value\" : 0.2," + " \"type\" : \"f64\"" + " }," + " \"t7\": \"nsj\"," + " \"t8\": { " + " \"value\" : \"北京\"," + " \"type\" : \"nchar\"" + " }," + " \"t9\": false," + " \"id\": \"d1001\"" + " }" + "}"}; + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int sml_TD15662_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db precision 'ns' schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "hetrey c0=f,c1=127i8 1626006833639", + "hetrey,t1=r c0=f,c1=127i8 1626006833640", + }; + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int sml_TD15742_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "test_ms,t0=t c0=f 1626006833641", + }; + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int sml_16384_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + const char *sql[] = { + "qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=t,c1=127i8 1626006833639000000", + }; + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + TAOS_RES *res = taos_schemaless_insert(taos, (char **)sql, 1, TSDB_SML_LINE_PROTOCOL, 0); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(res); + if(code) return code; + + const char *sql1[] = { + "qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=f,c1=127i8,c11=L\"ncharColValue\",c10=t 1626006833639000000", + }; + TAOS_RES *res1 = taos_schemaless_insert(taos, (char **)sql1, 1, TSDB_SML_LINE_PROTOCOL, 0); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int sml_oom_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + const char *sql[] = { + //"test_ms,t0=t c0=f 1626006833641", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pgxbrbga\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"gviggpmi\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"cexkarjn\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"rzwwuoxu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"xphrlkey\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"llsawebj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"jwpkipff\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"euzzhcvu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"jumhnsvw\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"fnetgdhj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"vrmmpgqe\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"lnpfjapr\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"gvbhmsfr\",t8=L\"ncharTagValue\" " + "c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"kydxrxwc\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pfyarryq\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"uxptotap\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"prolhudh\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ttxaxnac\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"dfgvmjmz\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"bloextkn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"dvjxwzsi\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"aigjomaf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"refbidtf\",t8=L\"ncharTagValue\" " + "c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"vuanlfpz\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"nbpajxkx\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ktzzauxh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"prcwdjct\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"vmbhvjtp\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"liuddtuz\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"pddsktow\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"algldlvl\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"mlmnjgdl\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"oiynpcog\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"wmynbagb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"asvyulrm\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ohaacrkp\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"ytyejhiq\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"bbznuerb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"lpebcibw\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"xmqrbafv\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"lnmwpdne\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"jpcsjqun\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"mmxqmavz\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"hhsbgaow\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"uwogyuud\",t8=L\"ncharTagValue\" " + "c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ytxpaxnk\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"wouwdvtt\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"iitwikkh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"lgyzuyaq\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"bdtiigxi\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"qpnsvdhw\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"pjxihgvu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"ksxkfetn\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ocukufqs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"qzerxmpe\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"qwcfdyxs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"jldrpmmd\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"lucxlfzc\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"rcewrvya\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"dknvaphs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"nxtxgzdr\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"mbvuugwz\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"uikakffu\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"mwmtqsma\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"bfcxrrpa\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ksajygdj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"vmhhszyv\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"urwjgvut\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"jrvytcxy\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"evqkzygh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"zitdznhg\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"tpqekrxa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"yrrbgjtk\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"bnphiuyq\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"huknehjn\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"iudbxfke\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"fjmolwbn\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"gukzgcjs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"bjvdtlgq\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"phxnesxh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"qgpgckvc\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"yechqtfa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pbouxywy\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"kxtuojyo\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"txaniwlj\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"fixgufrj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"okzvalwq\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"iitawgbn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"gayvmird\",t8=L\"ncharTagValue\" " + "c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"dprkfjph\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"kmuccshq\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"vkslsdsd\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"dukccdqk\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"leztxmqf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"kltixbwz\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"xqhkweef\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"idxsimvz\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"vbruvcpk\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"uxandqkd\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"dsiosysh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"kxuyanpp\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"wkrktags\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"yvizzpiv\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ddnefben\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"novmfmbc\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"fnusxsfu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"ouerfjap\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"sigognkf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"slvzhede\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"bknerect\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"tmhcdfjb\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"hpnoanpp\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"okmhelnc\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"xcernjin\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"jdmiismg\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"tmnqozrf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"zgwrftkx\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"zyamlwwh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"nuedqcro\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"lpsvyqaa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"mneitsul\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"vpleinwb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"njxuaedy\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"sdgxpqmu\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"yjirrebp\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ikqndzfj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"ghnfdxhr\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"hrwczpvo\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"nattumpb\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"zoyfzazn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"rdwemofy\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"phkgsjeg\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pyhvvjrt\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"zfslyton\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"bxwjzeri\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"uovzzgjv\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"cfjmacvr\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"jefqgzqx\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"njrksxmr\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"mhvabvgn\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"kfekjltr\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"lexfaaby\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"zbblsmwq\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"oqcombkx\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"rcdmhzyw\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"otksuean\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"itbdvowq\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"tswtmhex\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"xoukkzid\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"guangmpq\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"rayxzuky\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"lspwucrv\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pdprzzkf\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"sddqrtza\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"kabndgkx\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"aglnqqxs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"fiwpzmdr\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"hxctooen\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pckjpwyh\",t8=L\"ncharTagValue\" " + "c0=false,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ivmvsbai\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"eljdclst\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"rwgdctie\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"zlnthxoz\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"ljtxelle\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"llfggdpy\",t8=L\"ncharTagValue\" " + "c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"tvnridze\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"hxjpgube\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"zmldmquq\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"bggqwcoj\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"drksfofm\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"jcsixens\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"cdwnwhaf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"nngpumuq\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"hylgooci\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"cozeyjys\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"lcgpfcsa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"qdtzhtyd\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"txpubynb\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"gbslzbtu\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"buihcpcl\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"ayqezaiq\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"zgkgtilj\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"bcjopqif\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"mfzxiaqt\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"xmnlqxoj\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"reyiklyf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"xssuomhk\",t8=L\"ncharTagValue\" " + "c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"liazkjll\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"nigjlblo\",t8=L\"ncharTagValue\" " + "c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"vmojyznk\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"dotkbvrz\",t8=L\"ncharTagValue\" " + "c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"kuwdyydw\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"slsfqydw\",t8=L\"ncharTagValue\" " + "c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"zyironhd\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pktwfhzi\",t8=L\"ncharTagValue\" " + "c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"xybavsvh\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"pyrxemvx\",t8=L\"ncharTagValue\" " + "c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"tlfihwjs\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ogirwqci,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64," + "t7=\"neumakmg\",t8=L\"ncharTagValue\" " + "c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=" + "\"wxqingoa\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + }; + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int sml_16368_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "[{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833639000, \"type\": \"us\"}, \"value\": 1, " + "\"tags\": {\"t1\": 3, \"t2\": {\"value\": 4, \"type\": \"double\"}, \"t3\": {\"value\": \"t3\", \"type\": " + "\"binary\"}}}," + "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833739000, \"type\": \"us\"}, \"value\": 2, " + "\"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, " + "\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}}," + "{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006833639100, \"type\": \"us\"}, \"value\": 3, " + "\"tags\": {\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t3\": {\"value\": \"ste\", \"type\": \"nchar\"}}}," + "{\"metric\": \"stf567890\", \"timestamp\": {\"value\": 1626006833639200, \"type\": \"us\"}, \"value\": 4, " + "\"tags\": {\"t1\": {\"value\": 4, \"type\": \"bigint\"}, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, " + "\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}}," + "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833639300, \"type\": \"us\"}, \"value\": " + "{\"value\": 5, \"type\": \"double\"}, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t2\": 5.0, " + "\"t3\": {\"value\": \"t4\", \"type\": \"binary\"}}}," + "{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006833639400, \"type\": \"us\"}, \"value\": " + "{\"value\": 6, \"type\": \"double\"}, \"tags\": {\"t2\": 5.0, \"t3\": {\"value\": \"ste2\", \"type\": " + "\"nchar\"}}}," + "{\"metric\": \"stb_name\", \"timestamp\": {\"value\": 1626006834639400, \"type\": \"us\"}, \"value\": " + "{\"value\": 7, \"type\": \"double\"}, \"tags\": {\"t2\": {\"value\": 5.0, \"type\": \"double\"}, \"t3\": " + "{\"value\": \"ste2\", \"type\": \"nchar\"}}}," + "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833839006, \"type\": \"us\"}, \"value\": " + "{\"value\": 8, \"type\": \"double\"}, \"tags\": {\"t1\": {\"value\": 4, \"type\": \"double\"}, \"t3\": " + "{\"value\": \"t4\", \"type\": \"binary\"}, \"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, " + "\"type\": \"double\"}}}," + "{\"metric\": \"st123456\", \"timestamp\": {\"value\": 1626006833939007, \"type\": \"us\"}, \"value\": " + "{\"value\": 9, \"type\": \"double\"}, \"tags\": {\"t1\": 4, \"t3\": {\"value\": \"t4\", \"type\": \"binary\"}, " + "\"t2\": {\"value\": 5, \"type\": \"double\"}, \"t4\": {\"value\": 5, \"type\": \"double\"}}}]"}; + pRes = taos_schemaless_insert(taos, (char **)sql, 0, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_MICRO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int sml_dup_time_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + const char *sql[] = {//"test_ms,t0=t c0=f 1626006833641", + "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11." + "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" " + "c0=false,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22." + "123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000", + "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11." + "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" " + "c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22." + "123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000", + "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11." + "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" " + "c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22." + "123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000", + "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11." + "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" " + "c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22." + "123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000", + "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11." + "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" " + "c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22." + "123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000"}; + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int sml_16960_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "[" + "{" + "\"timestamp\":" + "" + "{ \"value\": 1349020800000, \"type\": \"ms\" }" + "," + "\"value\":" + "" + "{ \"value\": 830525384, \"type\": \"int\" }" + "," + "\"tags\": {" + "\"id\": \"stb00_0\"," + "\"t0\":" + "" + "{ \"value\": 83972721, \"type\": \"int\" }" + "," + "\"t1\":" + "" + "{ \"value\": 539147525, \"type\": \"int\" }" + "," + "\"t2\":" + "" + "{ \"value\": 618258572, \"type\": \"int\" }" + "," + "\"t3\":" + "" + "{ \"value\": -10536201, \"type\": \"int\" }" + "," + "\"t4\":" + "" + "{ \"value\": 349227409, \"type\": \"int\" }" + "," + "\"t5\":" + "" + "{ \"value\": 249347042, \"type\": \"int\" }" + "}," + "\"metric\": \"stb0\"" + "}," + "{" + "\"timestamp\":" + "" + "{ \"value\": 1349020800001, \"type\": \"ms\" }" + "," + "\"value\":" + "" + "{ \"value\": -588348364, \"type\": \"int\" }" + "," + "\"tags\": {" + "\"id\": \"stb00_0\"," + "\"t0\":" + "" + "{ \"value\": 83972721, \"type\": \"int\" }" + "," + "\"t1\":" + "" + "{ \"value\": 539147525, \"type\": \"int\" }" + "," + "\"t2\":" + "" + "{ \"value\": 618258572, \"type\": \"int\" }" + "," + "\"t3\":" + "" + "{ \"value\": -10536201, \"type\": \"int\" }" + "," + "\"t4\":" + "" + "{ \"value\": 349227409, \"type\": \"int\" }" + "," + "\"t5\":" + "" + "{ \"value\": 249347042, \"type\": \"int\" }" + "}," + "\"metric\": \"stb0\"" + "}," + "{" + "\"timestamp\":" + "" + "{ \"value\": 1349020800002, \"type\": \"ms\" }" + "," + "\"value\":" + "" + "{ \"value\": -370310823, \"type\": \"int\" }" + "," + "\"tags\": {" + "\"id\": \"stb00_0\"," + "\"t0\":" + "" + "{ \"value\": 83972721, \"type\": \"int\" }" + "," + "\"t1\":" + "" + "{ \"value\": 539147525, \"type\": \"int\" }" + "," + "\"t2\":" + "" + "{ \"value\": 618258572, \"type\": \"int\" }" + "," + "\"t3\":" + "" + "{ \"value\": -10536201, \"type\": \"int\" }" + "," + "\"t4\":" + "" + "{ \"value\": 349227409, \"type\": \"int\" }" + "," + "\"t5\":" + "" + "{ \"value\": 249347042, \"type\": \"int\" }" + "}," + "\"metric\": \"stb0\"" + "}," + "{" + "\"timestamp\":" + "" + "{ \"value\": 1349020800003, \"type\": \"ms\" }" + "," + "\"value\":" + "" + "{ \"value\": -811250191, \"type\": \"int\" }" + "," + "\"tags\": {" + "\"id\": \"stb00_0\"," + "\"t0\":" + "" + "{ \"value\": 83972721, \"type\": \"int\" }" + "," + "\"t1\":" + "" + "{ \"value\": 539147525, \"type\": \"int\" }" + "," + "\"t2\":" + "" + "{ \"value\": 618258572, \"type\": \"int\" }" + "," + "\"t3\":" + "" + "{ \"value\": -10536201, \"type\": \"int\" }" + "," + "\"t4\":" + "" + "{ \"value\": 349227409, \"type\": \"int\" }" + "," + "\"t5\":" + "" + "{ \"value\": 249347042, \"type\": \"int\" }" + "}," + "\"metric\": \"stb0\"" + "}," + "{" + "\"timestamp\":" + "" + "{ \"value\": 1349020800004, \"type\": \"ms\" }" + "," + "\"value\":" + "" + "{ \"value\": -330340558, \"type\": \"int\" }" + "," + "\"tags\": {" + "\"id\": \"stb00_0\"," + "\"t0\":" + "" + "{ \"value\": 83972721, \"type\": \"int\" }" + "," + "\"t1\":" + "" + "{ \"value\": 539147525, \"type\": \"int\" }" + "," + "\"t2\":" + "" + "{ \"value\": 618258572, \"type\": \"int\" }" + "," + "\"t3\":" + "" + "{ \"value\": -10536201, \"type\": \"int\" }" + "," + "\"t4\":" + "" + "{ \"value\": 349227409, \"type\": \"int\" }" + "," + "\"t5\":" + "" + "{ \"value\": 249347042, \"type\": \"int\" }" + "}," + "\"metric\": \"stb0\"" + "}" + "]"}; + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + return code; +} + +int main(int argc, char *argv[]) { + int ret = 0; + ret = smlProcess_influx_Test(); + if(ret) return ret; + ret = smlProcess_telnet_Test(); + if(ret) return ret; + ret = smlProcess_json1_Test(); + if(ret) return ret; + ret = smlProcess_json2_Test(); + if(ret) return ret; + ret = smlProcess_json3_Test(); + if(ret) return ret; + ret = smlProcess_json4_Test(); + if(ret) return ret; + ret = sml_TD15662_Test(); + if(ret) return ret; + ret = sml_TD15742_Test(); + if(ret) return ret; + ret = sml_16384_Test(); + if(ret) return ret; + ret = sml_oom_Test(); + if(ret) return ret; + ret = sml_16368_Test(); + if(ret) return ret; + ret = sml_dup_time_Test(); + if(ret) return ret; + ret = sml_16960_Test(); + return ret; +} From 75e42d92be45f8ec02c06182095c65fcd840e91e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 29 Jul 2022 15:59:19 +0800 Subject: [PATCH 16/43] feat:modify get meta logic for schemaless --- tests/system-test/fulltest.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 458951b815..7a3ad1070c 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -426,4 +426,5 @@ python3 ./test.py -f 2-query/function_null.py -Q 3 python3 ./test.py -f 2-query/count_partition.py -Q 3 python3 ./test.py -f 2-query/max_partition.py -Q 3 python3 ./test.py -f 2-query/last_row.py -Q 3 -python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 \ No newline at end of file +python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 +python3 ./test.py -f 2-query/sml.py -Q 3 \ No newline at end of file From 8cee6817ca88c90cbabfd5e0e153d79783d2bad1 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 29 Jul 2022 16:23:20 +0800 Subject: [PATCH 17/43] fix: init mergedRow to NULL --- source/dnode/vnode/src/tsdb/tsdbCache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 4e6a450d35..f03b02af27 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -175,7 +175,7 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST cacheRow = (STSRow *)taosLRUCacheValue(pCache, h); if (row->ts >= cacheRow->ts) { if (row->ts == cacheRow->ts) { - STSRow *mergedRow; + STSRow *mergedRow = NULL; SRowMerger merger = {0}; STSchema *pTSchema = metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1); From f79637f5a889474deaab9c93d8f14a126d309c31 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 29 Jul 2022 16:36:42 +0800 Subject: [PATCH 18/43] os: add win service and crashdump --- cmake/cmake.options | 20 +++++--- cmake/crashdump_CMakeLists.txt.in | 12 +++++ contrib/CMakeLists.txt | 15 ++++++ packaging/tools/make_install.bat | 5 +- source/client/CMakeLists.txt | 5 -- source/client/src/taos.def | 81 ------------------------------- source/dnode/mgmt/exe/dmMain.c | 19 ++++++++ source/os/CMakeLists.txt | 2 +- source/os/src/osSysinfo.c | 4 +- source/os/src/osSystem.c | 57 ++++++++++++++++++++++ 10 files changed, 123 insertions(+), 97 deletions(-) create mode 100644 cmake/crashdump_CMakeLists.txt.in delete mode 100644 source/client/src/taos.def diff --git a/cmake/cmake.options b/cmake/cmake.options index 8b33353632..d2dd48c1a0 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -47,15 +47,21 @@ IF(${TD_WINDOWS}) ) option( - BUILD_TEST - "If build unit tests using googletest" - ON - ) + BUILD_TEST + "If build unit tests using googletest" + ON + ) option( - TDENGINE_3 - "TDengine 3.x" - ON + TDENGINE_3 + "TDengine 3.x for taos-tools" + ON + ) + + option( + BUILD_CRASHDUMP + "If build crashdump on Windows" + ON ) ELSEIF (TD_DARWIN_64) diff --git a/cmake/crashdump_CMakeLists.txt.in b/cmake/crashdump_CMakeLists.txt.in new file mode 100644 index 0000000000..af4b551159 --- /dev/null +++ b/cmake/crashdump_CMakeLists.txt.in @@ -0,0 +1,12 @@ + +# crashdump +ExternalProject_Add(crashdump + GIT_REPOSITORY https://github.com/Arnavion/crashdump.git + GIT_TAG master + SOURCE_DIR "${TD_CONTRIB_DIR}/crashdump" + BINARY_DIR "${TD_CONTRIB_DIR}/crashdump" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" + ) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 384cffc08c..83246289f1 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -120,6 +120,11 @@ if(${BUILD_WITH_NURAFT}) cat("${TD_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) endif(${BUILD_WITH_NURAFT}) +# crashdump +if(${BUILD_CRASHDUMP}) + cat("${TD_SUPPORT_DIR}/crashdump_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) +endif(${BUILD_CRASHDUMP}) + # addr2line if(${BUILD_ADDR2LINE}) if(NOT ${TD_WINDOWS}) @@ -257,6 +262,16 @@ if(${BUILD_PTHREAD}) target_link_libraries(pthread INTERFACE libpthreadVC3) endif() +# crashdump +if(${BUILD_CRASHDUMP}) + add_executable(dumper "crashdump/dumper/dumper.c") + target_link_libraries(dumper User32.lib dbghelp.lib) + file(READ "crashdump/crasher/crasher.c" CRASHDUMP_CONTENT) + string(REPLACE "main(" "main_crashdump(" CRASHDUMP_CONTENT "${CRASHDUMP_CONTENT}") + file(WRITE "crashdump/crasher/crasher.c" "${CRASHDUMP_CONTENT}") + add_library(crashdump STATIC "crashdump/crasher/crasher.c") +endif() + # iconv if(${BUILD_WITH_ICONV}) add_library(iconv STATIC iconv/win_iconv.c) diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index 64f30b8465..0f9e836ae2 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -1,6 +1,7 @@ @echo off goto %1 :needAdmin -mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&goto :eof +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 -cp -f C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 \ No newline at end of file +cp -f C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 +sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index 129e20e5de..f52edbe71f 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -20,11 +20,6 @@ target_link_libraries( ) if(TD_WINDOWS) - set_target_properties(taos - PROPERTIES - LINK_FLAGS - /DEF:${CMAKE_CURRENT_SOURCE_DIR}/src/taos.def - ) INCLUDE_DIRECTORIES(jni/windows) INCLUDE_DIRECTORIES(jni/windows/win32) INCLUDE_DIRECTORIES(jni/windows/win32/bridge) diff --git a/source/client/src/taos.def b/source/client/src/taos.def deleted file mode 100644 index 994dd75090..0000000000 --- a/source/client/src/taos.def +++ /dev/null @@ -1,81 +0,0 @@ -taos_cleanup -taos_options -taos_set_config -taos_init -taos_connect -taos_connect_l -taos_connect_auth -taos_close -taos_data_type -taos_stmt_init -taos_stmt_prepare -taos_stmt_set_tbname_tags -taos_stmt_set_tbname -taos_stmt_set_sub_tbname -taos_stmt_is_insert -taos_stmt_num_params -taos_stmt_get_param -taos_stmt_bind_param -taos_stmt_bind_param_batch -taos_stmt_bind_single_param_batch -taos_stmt_add_batch -taos_stmt_execute -taos_stmt_use_result -taos_stmt_close -taos_stmt_errstr -taos_stmt_affected_rows -taos_stmt_affected_rows_once -taos_query -taos_query_l -taos_fetch_row -taos_result_precision -taos_free_result -taos_field_count -taos_num_fields -taos_affected_rows -taos_fetch_fields -taos_select_db -taos_print_row -taos_stop_query -taos_is_null -taos_is_update_query -taos_fetch_block -taos_fetch_block_s -taos_fetch_raw_block -taos_get_column_data_offset -taos_validate_sql -taos_reset_current_db -taos_fetch_lengths -taos_result_block -taos_get_server_info -taos_get_client_info -taos_errstr -taos_errno -taos_query_a -taos_fetch_rows_a -taos_subscribe -taos_consume -taos_unsubscribe -taos_load_table_info -taos_schemaless_insert -tmq_list_new -tmq_list_append -tmq_list_destroy -tmq_list_get_size -tmq_list_to_c_array -tmq_consumer_new -tmq_err2str -tmq_subscribe -tmq_unsubscribe -tmq_subscription -tmq_consumer_poll -tmq_consumer_close -tmq_commit -tmq_conf_new -tmq_conf_set -tmq_conf_destroy -tmq_conf_set_offset_commit_cb -tmq_get_topic_name -tmq_get_vgroup_id -tmq_create_stream -taos_check_server_status \ No newline at end of file diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 013cc05c65..34c3b40556 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -27,6 +27,9 @@ #define DM_VERSION "Print program version." #define DM_EMAIL "" static struct { +#ifdef WINDOWS + bool winServiceMode; +#endif bool dumpConfig; bool generateGrant; bool printAuth; @@ -93,6 +96,10 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { global.dumpConfig = true; } else if (strcmp(argv[i], "-V") == 0) { global.printVersion = true; + #ifdef WINDOWS + } else if (strcmp(argv[i], "--win_service") == 0) { + global.winServiceMode = true; + #endif } else if (strcmp(argv[i], "-e") == 0) { global.envCmd[cmdEnvIndex] = argv[++i]; cmdEnvIndex++; @@ -169,6 +176,18 @@ int main(int argc, char const *argv[]) { return -1; } +#ifdef WINDOWS + int mainWindows(int argc,char** argv); + if (global.winServiceMode) { + stratWindowsService(mainWindows); + } else { + return mainWindows(argc, argv); + } + return 0; +} +int mainWindows(int argc,char** argv) { +#endif + if (global.generateGrant) { dmGenerateGrant(); taosCleanupArgs(); diff --git a/source/os/CMakeLists.txt b/source/os/CMakeLists.txt index f773e4ff58..2a9d0c8535 100644 --- a/source/os/CMakeLists.txt +++ b/source/os/CMakeLists.txt @@ -41,7 +41,7 @@ target_link_libraries( ) if(TD_WINDOWS) target_link_libraries( - os PUBLIC ws2_32 iconv msvcregex wcwidth winmm + os PUBLIC ws2_32 iconv msvcregex wcwidth winmm crashdump ) elseif(TD_DARWIN_64) target_link_libraries( diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index fa94bc6a13..812e4c2802 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -91,6 +91,7 @@ LONG WINAPI FlCrashDump(PEXCEPTION_POINTERS ep) { return EXCEPTION_CONTINUE_SEARCH; } +LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS exception); #elif defined(_TD_DARWIN_64) @@ -841,7 +842,8 @@ char *taosGetCmdlineByPID(int pid) { void taosSetCoreDump(bool enable) { #ifdef WINDOWS - SetUnhandledExceptionFilter(&FlCrashDump); + SetUnhandledExceptionFilter(exceptionHandler); + // SetUnhandledExceptionFilter(&FlCrashDump); #elif defined(_TD_DARWIN_64) #else if (!enable) return; diff --git a/source/os/src/osSystem.c b/source/os/src/osSystem.c index ad7fa57182..c86cd19e32 100644 --- a/source/os/src/osSystem.c +++ b/source/os/src/osSystem.c @@ -18,6 +18,63 @@ #include "os.h" #if defined(WINDOWS) +typedef void (*MainWindows)(int argc,char** argv); +MainWindows mainWindowsFunc = NULL; + +SERVICE_STATUS ServiceStatus; +SERVICE_STATUS_HANDLE hServiceStatusHandle; +void WINAPI windowsServiceCtrlHandle(DWORD request) { + switch (request) { + case SERVICE_CONTROL_STOP: + case SERVICE_CONTROL_SHUTDOWN: + raise(SIGINT); + ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; + if (!SetServiceStatus(hServiceStatusHandle, &ServiceStatus)) { + DWORD nError = GetLastError(); + printf("failed to send stopped status to windows service: %d",nError); + } + break; + default: + return; + } +} +void WINAPI mainWindowsService(int argc,char** argv) { + int ret = 0; + ServiceStatus.dwServiceType = SERVICE_WIN32; + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_PAUSE_CONTINUE | SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + ServiceStatus.dwCurrentState = SERVICE_START_PENDING; + ServiceStatus.dwWin32ExitCode = 0; + ServiceStatus.dwCheckPoint = 0; + ServiceStatus.dwWaitHint = 0; + ServiceStatus.dwServiceSpecificExitCode = 0; + hServiceStatusHandle = RegisterServiceCtrlHandler("taosd", &windowsServiceCtrlHandle); + if (hServiceStatusHandle == 0) { + DWORD nError = GetLastError(); + printf("failed to register windows service ctrl handler: %d",nError); + } + + ServiceStatus.dwCurrentState = SERVICE_RUNNING; + if (SetServiceStatus(hServiceStatusHandle, &ServiceStatus)) { + DWORD nError = GetLastError(); + printf("failed to send running status to windows service: %d",nError); + } + if (mainWindowsFunc != NULL) mainWindowsFunc(argc, argv); + ServiceStatus.dwCurrentState = SERVICE_STOPPED; + if (!SetServiceStatus(hServiceStatusHandle, &ServiceStatus)) { + DWORD nError = GetLastError(); + printf("failed to send stopped status to windows service: %d",nError); + } +} +void stratWindowsService(MainWindows mainWindows) { + mainWindowsFunc = mainWindows; + SERVICE_TABLE_ENTRY ServiceTable[2]; + ServiceTable[0].lpServiceName = "taosd"; + ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)mainWindowsService; + ServiceTable[1].lpServiceName = NULL; + ServiceTable[1].lpServiceProc = NULL; + StartServiceCtrlDispatcher(ServiceTable); +} + #elif defined(_TD_DARWIN_64) #else #include From 0f3c2ef5a92e450b391109fd6656dfda1dfbedb3 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 29 Jul 2022 17:26:57 +0800 Subject: [PATCH 19/43] docs: update arch --- docs/zh/21-tdinternal/01-arch.md | 8 +++--- tests/script/jenkins/basic.txt | 22 ++++++++-------- tests/script/tsim/parser/alter1.sim | 2 +- tests/script/tsim/parser/tags_filter.sim | 2 +- tests/script/tsim/parser/union_sysinfo.sim | 6 ----- tests/script/tsim/parser/where.sim | 30 ++++++++++++---------- tests/script/tsim/tag/change.sim | 2 +- tests/script/tsim/tag/delete.sim | 10 +++----- 8 files changed, 38 insertions(+), 44 deletions(-) diff --git a/docs/zh/21-tdinternal/01-arch.md b/docs/zh/21-tdinternal/01-arch.md index 4edad0fd1d..e60debc87f 100644 --- a/docs/zh/21-tdinternal/01-arch.md +++ b/docs/zh/21-tdinternal/01-arch.md @@ -25,9 +25,9 @@ TDengine 分布式架构的逻辑结构图如下: **管理节点(mnode):** 一个虚拟的逻辑单元,负责所有数据节点运行状态的监控和维护,以及节点之间的负载均衡(图中 M)。同时,管理节点也负责元数据(包括用户、数据库、超级表等)的存储和管理,因此也称为 Meta Node。TDengine 集群中可配置多个(最多不超过 3 个)mnode,它们自动构建成为一个虚拟管理节点组(图中 M1,M2,M3)。mnode 支持多副本,采用 RAFT 一致性协议,保证系统的高可用与高可靠,任何数据更新操作只能在 Leader 上进行。mnode 集群的第一个节点在集群部署时自动完成,其他节点的创建与删除由用户通过 SQL 命令完成。每个 dnode 上至多有一个 mnode,由所属的数据节点的 EP 来唯一标识。每个 dnode 通过内部消息交互自动获取整个集群中所有 mnode 所在的 dnode 的 EP。 -**弹性计算点(qnode):** 一个虚拟的逻辑单元,运行查询计算任务,也包括基于系统表来实现的 show 命令(图中 Q)。集群中可配置多个 qnode,在整个集群内部共享使用(图中 Q1,Q2,Q3)。qnode 不与具体的 DB 绑定,即一个 qnode 可以同时执行多个 DB 的查询任务。每个 dnode 上至多有一个 qnode,由所属的数据节点的 EP 来唯一标识。客户端通过与 mnode 交互,获取可用的 qnode 列表,当没有可用的 qnode 时,计算任务在 vnode 中执行。 +**弹性计算节点(qnode):** 一个虚拟的逻辑单元,运行查询计算任务,也包括基于系统表来实现的 show 命令(图中 Q)。集群中可配置多个 qnode,在整个集群内部共享使用(图中 Q1,Q2,Q3)。qnode 不与具体的 DB 绑定,即一个 qnode 可以同时执行多个 DB 的查询任务。每个 dnode 上至多有一个 qnode,由所属的数据节点的 EP 来唯一标识。客户端通过与 mnode 交互,获取可用的 qnode 列表,当没有可用的 qnode 时,计算任务在 vnode 中执行。 -**流计算点(snode):** 一个虚拟的逻辑单元,只运行流计算任务(图中 S)。集群中可配置多个 snode,在整个集群内部共享使用(图中 S1,S2,S3)。snode 不与具体的 stream 绑定,即一个 snode 可以同时执行多个 stream 的计算任务。每个 dnode 上至多有一个 snode,由所属的数据节点的 EP 来唯一标识。由 mnode 调度可用的 snode 完成流计算任务,当没有可用的 snode 时,流计算任务在 vnode 中执行。 +**流计算节点(snode):** 一个虚拟的逻辑单元,只运行流计算任务(图中 S)。集群中可配置多个 snode,在整个集群内部共享使用(图中 S1,S2,S3)。snode 不与具体的 stream 绑定,即一个 snode 可以同时执行多个 stream 的计算任务。每个 dnode 上至多有一个 snode,由所属的数据节点的 EP 来唯一标识。由 mnode 调度可用的 snode 完成流计算任务,当没有可用的 snode 时,流计算任务在 vnode 中执行。 **虚拟节点组(VGroup):** 不同数据节点上的 vnode 可以组成一个虚拟节点组(vgroup),采用 RAFT 一致性协议,保证系统的高可用与高可靠。写操作只能在 leader vnode 上进行,系统采用异步复制的方式将数据同步到 follower vnode,这样确保了一份数据在多个物理节点上有拷贝。一个 vgroup 里虚拟节点个数就是数据的副本数。如果一个 DB 的副本数为 N,系统必须有至少 N 数据节点。副本数在创建 DB 时通过参数 replica 可以指定,缺省为 1。使用 TDengine 的多副本特性,可以不再需要昂贵的磁盘阵列等存储设备,就可以获得同样的数据高可靠性。虚拟节点组由管理节点创建、管理,并且由管理节点分配一个系统唯一的 ID,VGroup ID。如果两个虚拟节点的 VGroup ID 相同,说明他们属于同一个组,数据互为备份。虚拟节点组里虚拟节点的个数是可以动态改变的,容许只有一个,也就是没有数据复制。VGroup ID 是永远不变的,即使一个虚拟节点组被删除,它的 ID 也不会被收回重复利用。 @@ -103,11 +103,11 @@ TDengine 存储的数据包括采集的时序数据以及库、表相关的元 vnode(虚拟数据节点)负责为采集的时序数据提供写入、查询和计算功能。为便于负载均衡、数据恢复、支持异构环境,TDengine 将一个数据节点根据其计算和存储资源切分为多个 vnode。这些 vnode 的管理是 TDengine 自动完成的,对应用完全透明。 -对于单独一个数据采集点,无论其数据量多大,一个 vnode(或 vgroup,如果副本数大于 1)有足够的计算资源和存储资源来处理(如果每秒生成一条 16 字节的记录,一年产生的原始数据不到 0.5G),因此 TDengine 将一张表(一个数据采集点)的所有数据都存放在一个 vnode 里,而不会让同一个采集点的数据分布到两个或多个 dnode 上。而且一个 vnode 可存储多个数据采集点(表)的数据,一个 vnode 可容纳的表的数目的上限为一百万。设计上,一个 vnode 里所有的表都属于同一个 DB。一个数据节点上,除非特殊配置,一个 DB 拥有的 vnode 数目不会超过系统核的数目。 +对于单独一个数据采集点,无论其数据量多大,一个 vnode(或 vgroup,如果副本数大于 1)有足够的计算资源和存储资源来处理(如果每秒生成一条 16 字节的记录,一年产生的原始数据不到 0.5G),因此 TDengine 将一张表(一个数据采集点)的所有数据都存放在一个 vnode 里,而不会让同一个采集点的数据分布到两个或多个 dnode 上。而且一个 vnode 可存储多个数据采集点(表)的数据,一个 vnode 可容纳的表的数目的上限为一百万。设计上,一个 vnode 里所有的表都属于同一个 DB。 TDengine 3.0 采用 hash 一致性算法,确定每张数据表所在的 vnode。创建 DB 时,系统会立刻分配指定数目的 vnode,并确定每个 vnode 所负责的数据表范围。当创建一张表时,系统根据数据表名计算出所在的 vnodeID,立即在该 vnode 创建表。如果 DB 有多个副本,系统不是只创建一个 vnode,而是一个 vgroup(虚拟数据节点组)。系统对 vnode 的数目没有任何限制,仅仅受限于物理节点本身的计算和存储资源。 -每张表的 meta data(包含 schema,标签等)也存放于 vnode 里,而不是集中存放于 mnode,实际上这是对 Meta 数据的分片,这样便于高效并行的进行标签过滤操作。 +每张表的 meta data(包含 schema,标签等)也存放于 vnode 里,而不是集中存放于 mnode,实际上这是对 meta 数据的分片,这样便于高效并行的进行标签过滤操作。 ### 数据分区 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 41126d560c..41d571f7f1 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -89,7 +89,7 @@ ./test.sh -f tsim/parser/alter_column.sim ./test.sh -f tsim/parser/alter_stable.sim ./test.sh -f tsim/parser/alter.sim -# TD-17661 ./test.sh -f tsim/parser/alter1.sim +# TD-17959 ./test.sh -f tsim/parser/alter1.sim ./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim ./test.sh -f tsim/parser/auto_create_tb.sim ./test.sh -f tsim/parser/between_and.sim @@ -145,7 +145,7 @@ ./test.sh -f tsim/parser/select_across_vnodes.sim ./test.sh -f tsim/parser/select_distinct_tag.sim ./test.sh -f tsim/parser/select_from_cache_disk.sim -# TD-17832 ./test.sh -f tsim/parser/select_with_tags.sim +./test.sh -f tsim/parser/select_with_tags.sim ./test.sh -f tsim/parser/selectResNum.sim ./test.sh -f tsim/parser/set_tag_vals.sim ./test.sh -f tsim/parser/single_row_in_tb.sim @@ -155,14 +155,14 @@ ./test.sh -f tsim/parser/slimit1.sim ./test.sh -f tsim/parser/stableOp.sim # TD-17661 ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim -# TD-17661 ./test.sh -f tsim/parser/tags_filter.sim +./test.sh -f tsim/parser/tags_filter.sim ./test.sh -f tsim/parser/tbnameIn.sim ./test.sh -f tsim/parser/timestamp.sim ./test.sh -f tsim/parser/top_groupby.sim ./test.sh -f tsim/parser/topbot.sim ./test.sh -f tsim/parser/union.sim -# TD-17704 ./test.sh -f tsim/parser/union_sysinfo.sim -# TD-17661 ./test.sh -f tsim/parser/where.sim +./test.sh -f tsim/parser/union_sysinfo.sim +./test.sh -f tsim/parser/where.sim # ---- query ---- ./test.sh -f tsim/query/charScalarFunction.sim @@ -422,18 +422,18 @@ ./test.sh -f tsim/tag/bool_binary.sim ./test.sh -f tsim/tag/bool_int.sim ./test.sh -f tsim/tag/bool.sim -# TD-17661 ./test.sh -f tsim/tag/change.sim +# TD-17407 ./test.sh -f tsim/tag/change.sim ./test.sh -f tsim/tag/column.sim ./test.sh -f tsim/tag/commit.sim -# TD-17661 ./test.sh -f tsim/tag/create.sim -# TD-17661 ./test.sh -f tsim/tag/delete.sim -# TD-17661 ./test.sh -f tsim/tag/double.sim -# TD-17661 ./test.sh -f tsim/tag/filter.sim +# TD-17407 ./test.sh -f tsim/tag/create.sim +# TD-17407 ./test.sh -f tsim/tag/delete.sim +# TD-17407 ./test.sh -f tsim/tag/double.sim +./test.sh -f tsim/tag/filter.sim # TD-17407 ./test.sh -f tsim/tag/float.sim ./test.sh -f tsim/tag/int_binary.sim ./test.sh -f tsim/tag/int_float.sim ./test.sh -f tsim/tag/int.sim -# TD-17661 ./test.sh -f tsim/tag/set.sim +# TD-17959 ./test.sh -f tsim/tag/set.sim ./test.sh -f tsim/tag/smallint.sim ./test.sh -f tsim/tag/tinyint.sim diff --git a/tests/script/tsim/parser/alter1.sim b/tests/script/tsim/parser/alter1.sim index b01e98a834..d917f4b61e 100644 --- a/tests/script/tsim/parser/alter1.sim +++ b/tests/script/tsim/parser/alter1.sim @@ -103,7 +103,7 @@ endi print ================== change a tag value sql alter table car1 set tag carid=10 -sql select carId, carmodel from car1 +sql select distinct carId, carmodel from car1 if $rows != 1 then return -1 endi diff --git a/tests/script/tsim/parser/tags_filter.sim b/tests/script/tsim/parser/tags_filter.sim index bf33febdae..10fb135de3 100644 --- a/tests/script/tsim/parser/tags_filter.sim +++ b/tests/script/tsim/parser/tags_filter.sim @@ -100,7 +100,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/union_sysinfo.sim b/tests/script/tsim/parser/union_sysinfo.sim index ea45dc68e1..50d7c88e88 100644 --- a/tests/script/tsim/parser/union_sysinfo.sim +++ b/tests/script/tsim/parser/union_sysinfo.sim @@ -25,11 +25,5 @@ sql (select database()) union all (select database()) if $rows != 2 then return -1 endi -if $data00 != @union_db0@ then - return -1 -endi -if $data10 != @union_db0@ then - return -1 -endi system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/where.sim b/tests/script/tsim/parser/where.sim index 596bffa6f0..08e250c03e 100644 --- a/tests/script/tsim/parser/where.sim +++ b/tests/script/tsim/parser/where.sim @@ -77,12 +77,12 @@ if $rows != $val then return -1 endi -sql select tbname from $mt +sql select distinct tbname from $mt if $rows != $tbNum then return -1 endi -sql select tbname from $mt where t1 < 2 +sql select distinct tbname from $mt where t1 < 2 if $rows != 2 then return -1 endi @@ -249,14 +249,14 @@ sql_error insert into tb_where_NULL values(now, ?, '12') sql insert into tb_where_NULL values ('2019-01-01 09:00:00.000', 1, 'val1') sql insert into tb_where_NULL values ('2019-01-01 09:00:01.000', NULL, NULL) sql insert into tb_where_NULL values ('2019-01-01 09:00:02.000', 2, 'val2') -sql_error select * from tb_where_NULL where c1 = NULL -sql_error select * from tb_where_NULL where c1 <> NULL -sql_error select * from tb_where_NULL where c1 < NULL -sql_error select * from tb_where_NULL where c1 = "NULL" -sql_error select * from tb_where_NULL where c1 <> "NULL" -sql_error select * from tb_where_NULL where c1 <> "nulL" -sql_error select * from tb_where_NULL where c1 > "NULL" -sql_error select * from tb_where_NULL where c1 >= "NULL" +sql select * from tb_where_NULL where c1 = NULL +sql select * from tb_where_NULL where c1 <> NULL +sql select * from tb_where_NULL where c1 < NULL +sql select * from tb_where_NULL where c1 = "NULL" +sql select * from tb_where_NULL where c1 <> "NULL" +sql select * from tb_where_NULL where c1 <> "nulL" +sql select * from tb_where_NULL where c1 > "NULL" +sql select * from tb_where_NULL where c1 >= "NULL" sql select * from tb_where_NULL where c2 = "NULL" if $rows != 0 then return -1 @@ -300,15 +300,17 @@ endw system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -sql_error select * from wh_mt0 where c3 = 'abc' and tbname in ('test_null_filter'); +sql select * from wh_mt0 where c3 = 'abc' and tbname in ('test_null_filter'); sql select * from wh_mt0 where c3 = '1' and tbname in ('test_null_filter'); if $row != 0 then return -1 endi -sql select * from wh_mt0 where c3 = '1'; -if $row == 0 then +sql select * from wh_mt0 where c3 = 1; +print $rows -> 1000 +print $data00 $data01 $data02 +if $row != 1000 then return -1 endi @@ -336,7 +338,7 @@ sql insert into where_ts values('2021-06-19 16:22:00', 1); sql insert into where_ts values('2021-06-19 16:23:00', 2); sql insert into where_ts values('2021-06-19 16:24:00', 3); sql insert into where_ts values('2021-06-19 16:25:00', 1); -sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00' +sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00' order by ts; if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/tag/change.sim b/tests/script/tsim/tag/change.sim index 236ad8ea67..13b2da4693 100644 --- a/tests/script/tsim/tag/change.sim +++ b/tests/script/tsim/tag/change.sim @@ -311,7 +311,7 @@ sql select * from $mt where tgcol2 = 1 -x step52 return -1 step52: -sql select * from $mt where tgcol3 = 1 +sql select * from $mt where tgcol3 < 2 print $data01 $data02 $data03 if $rows != 1 then return -1 diff --git a/tests/script/tsim/tag/delete.sim b/tests/script/tsim/tag/delete.sim index bcfd822dbd..720f4341f9 100644 --- a/tests/script/tsim/tag/delete.sim +++ b/tests/script/tsim/tag/delete.sim @@ -97,10 +97,10 @@ if $data23 != TAG then return -1 endi +sql alter table $mt drop tag tgcol2 sql alter table $mt drop tag tgcol1 -x step40 return -1 step40: -sql alter table $mt drop tag tgcol2 print =============== step5 $i = 5 @@ -123,11 +123,11 @@ if $data03 != 2 then return -1 endi +sql alter table $mt drop tag tgcol2 sql alter table $mt drop tag tgcol1 -x step50 return -1 step50: -sql alter table $mt drop tag tgcol2 - + print =============== step6 $i = 6 $mt = $mtPrefix . $i @@ -186,7 +186,7 @@ endi if $data31 != TINYINT then return -1 endi -if $data41 != BINARY then +if $data41 != VARCHAR then return -1 endi if $data22 != 2 then @@ -405,8 +405,6 @@ sql alter table $mt drop tag tgcol3 sql alter table $mt drop tag tgcol4 sql alter table $mt drop tag tgcol6 -sleep 3000 - print =============== step2 $i = 2 $mt = $mtPrefix . $i From 2af6f2fc3ae14803a2cc1f60c1f7d09eb993ecf1 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 29 Jul 2022 09:43:54 +0000 Subject: [PATCH 20/43] fix: replica bug --- source/dnode/vnode/src/meta/metaSnapshot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index 85261d302e..46609cf561 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -145,6 +145,8 @@ int32_t metaSnapWriterOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapWr pWriter->sver = sver; pWriter->ever = ever; + metaBegin(pMeta); + *ppWriter = pWriter; return code; From 60c5b2beac42efaec8fa5fcde11a3501ad8f10c1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 17:53:30 +0800 Subject: [PATCH 21/43] fix(query): optimize the row merge procedure for files. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 97 ++++++++++++++++++++------ 1 file changed, 76 insertions(+), 21 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 03985654f8..c259a7cfe0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -145,7 +145,8 @@ static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanI SRowMerger* pMerger); static int32_t doMergeRowsInBuf(SIterInfo* pIter, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader); -static int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow); +static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow); +static int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBlockData* pBlockData, int32_t rowIndex); static void setComposedBlockFlag(STsdbReader* pReader, bool composed); static void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader); static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order); @@ -691,16 +692,13 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(pBlockIter); SBlock* pBlock = getCurrentBlock(pBlockIter); SSDataBlock* pResBlock = pReader->pResBlock; - int32_t numOfCols = blockDataGetNumOfCols(pResBlock); + int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock); SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo; SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - int64_t st = taosGetTimestampUs(); - SColVal cv = {0}; - int32_t colIndex = 0; - + int64_t st = taosGetTimestampUs(); bool asc = ASCENDING_TRAVERSE(pReader->order); int32_t step = asc ? 1 : -1; @@ -724,7 +722,9 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn i += 1; } - while (i < numOfCols && colIndex < taosArrayGetSize(pBlockData->aIdx)) { + int32_t colIndex = 0; + int32_t num = taosArrayGetSize(pBlockData->aIdx); + while (i < numOfOutputCols && colIndex < num) { rowIndex = 0; pColData = taosArrayGet(pResBlock->pDataBlock, i); @@ -744,7 +744,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn i += 1; } - while (i < numOfCols) { + while (i < numOfOutputCols) { pColData = taosArrayGet(pResBlock->pDataBlock, i); colDataAppendNNULL(pColData, 0, remain); i += 1; @@ -1256,7 +1256,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* } tRowMergerClear(&merge); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); taosMemoryFree(pTSRow); return TSDB_CODE_SUCCESS; @@ -1300,7 +1300,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* } tRowMergerGetRow(&merge, &pTSRow); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } else { // key > ik.ts || key > k.ts ASSERT(key != ik.ts); @@ -1309,7 +1309,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* // [4] ik.ts < k.ts <= key if (ik.ts < k.ts) { doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } @@ -1317,7 +1317,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* // [6] k.ts < ik.ts <= key if (k.ts < ik.ts) { doMergeMultiRows(pRow, uid, &pBlockScanInfo->iter, pDelList, &pTSRow, pReader); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } @@ -1326,7 +1326,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* ASSERT(key > ik.ts && key > k.ts); doMergeMemIMemRows(pRow, piRow, pBlockScanInfo, pReader, &pTSRow); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } } @@ -1350,7 +1350,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* } tRowMergerGetRow(&merge, &pTSRow); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } else { ASSERT(ik.ts != k.ts); // this case has been included in the previous if branch @@ -1359,7 +1359,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* // [4] ik.ts > key >= k.ts if (ik.ts > key) { doMergeMultiRows(piRow, uid, &pBlockScanInfo->iiter, pDelList, &pTSRow, pReader); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } @@ -1371,7 +1371,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); tRowMergerGetRow(&merge, &pTSRow); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } @@ -1383,7 +1383,7 @@ static int32_t doMergeThreeLevelRows(STsdbReader* pReader, STableBlockScanInfo* tRowMerge(&merge, &fRow); doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); tRowMergerGetRow(&merge, &pTSRow); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); return TSDB_CODE_SUCCESS; } } @@ -1438,6 +1438,21 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI } // imem & mem are all empty, only file exist + + // opt version + // 1. it is not a border point + // 2. the direct next point is not an duplicated timestamp + if ((pDumpInfo->rowIndex < pDumpInfo->totalRows - 1 && pReader->order == TSDB_ORDER_ASC) || + (pDumpInfo->rowIndex > 0 && pReader->order == TSDB_ORDER_DESC)) { + int32_t step = pReader->order == TSDB_ORDER_ASC? 1:-1; + int64_t nextKey = pBlockData->aTSKEY[pDumpInfo->rowIndex + step]; + if (nextKey != key) { + // merge is not needed + doAppendRowFromBlock(pReader->pResBlock, pReader, pBlockData, pDumpInfo->rowIndex); + return TSDB_CODE_SUCCESS; + } + } + TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); STSRow* pTSRow = NULL; @@ -1446,7 +1461,7 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI tRowMergerInit(&merge, &fRow, pReader->pSchema); doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); tRowMergerGetRow(&merge, &pTSRow); - doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + doAppendRowFromTSRow(pReader->pResBlock, pReader, pTSRow); taosMemoryFree(pTSRow); tRowMergerClear(&merge); @@ -2201,7 +2216,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc int32_t step = asc ? 1 : -1; pDumpInfo->rowIndex += step; - if (pDumpInfo->rowIndex <= pBlockData->nRow - 1) { + if ((pDumpInfo->rowIndex <= pBlockData->nRow - 1 && asc) ||(pDumpInfo->rowIndex >= 0 && !asc)) { pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step); } @@ -2325,7 +2340,7 @@ int32_t tsdbGetNextRowInMem(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pR return TSDB_CODE_SUCCESS; } -int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow) { +int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow) { int32_t numOfRows = pBlock->info.rows; int32_t numOfCols = (int32_t)taosArrayGetSize(pBlock->pDataBlock); @@ -2369,6 +2384,46 @@ int32_t doAppendOneRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow return TSDB_CODE_SUCCESS; } +int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBlockData* pBlockData, int32_t rowIndex) { + int32_t i = 0, j = 0; + int32_t outputRowIndex = pResBlock->info.rows; + + SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo; + + SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i); + if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) { + colDataAppendInt64(pColData, outputRowIndex, &pBlockData->aTSKEY[rowIndex]); + } + + SColVal cv = {0}; + int32_t numOfInputCols = taosArrayGetSize(pBlockData->aIdx); + int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock); + + while(i < numOfOutputCols && j < numOfInputCols) { + SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i); + SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j); + + if (pData->cid == pCol->info.colId) { + tColDataGetValue(pData, j, &cv); + doCopyColVal(pCol, outputRowIndex++, i, &cv, pSupInfo); + j += 1; + } else { // the specified column does not exist in file block, fill with null data + colDataAppendNULL(pCol, outputRowIndex); + } + + i += 1; + } + + while (i < numOfOutputCols) { + SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i); + colDataAppendNULL(pCol, rowIndex); + i += 1; + } + + pResBlock->info.rows += 1; + return TSDB_CODE_SUCCESS; +} + int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity, STsdbReader* pReader) { SSDataBlock* pBlock = pReader->pResBlock; @@ -2380,7 +2435,7 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e break; } - doAppendOneRow(pBlock, pReader, pTSRow); + doAppendRowFromTSRow(pBlock, pReader, pTSRow); taosMemoryFree(pTSRow); // no data in buffer, return immediately From 73050d71bb733ad88e15e6caeae1370315c4c00f Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Fri, 29 Jul 2022 17:57:50 +0800 Subject: [PATCH 22/43] doc: correct errors in configuration --- docs/zh/14-reference/12-config/index.md | 231 +++++++++++++++--------- 1 file changed, 141 insertions(+), 90 deletions(-) diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index fefb50c541..845693a98e 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -1,6 +1,6 @@ --- title: 配置参数 -description: 'TDengine 客户端和服务配置列表' +description: "TDengine 客户端和服务配置列表" --- ## 为服务端指定配置文件 @@ -21,8 +21,6 @@ taosd -C TDengine 系统的前台交互客户端应用程序为 taos,以及应用驱动,它可以与 taosd 共享同一个配置文件 taos.cfg,也可以使用单独指定配置文件。运行 taos 时,使用参数-c 指定配置文件目录,如 taos -c /home/cfg,表示使用/home/cfg/目录下的 taos.cfg 配置文件中的参数,缺省目录是/etc/taos。更多 taos 的使用方法请见帮助信息 `taos --help`。 -**2.0.10.0 之后版本支持命令行以下参数显示当前客户端参数的配置** - ```bash taos -C ``` @@ -47,19 +45,19 @@ taos --dump-config ### firstEp -| 属性 | 说明 | -| -------- | --------------------------------------------------------------- | -| 适用范围 | 服务端和客户端均适用 | +| 属性 | 说明 | +| -------- | -------------------------------------------------------------- | +| 适用范围 | 服务端和客户端均适用 | | 含义 | taosd 或者 taos 启动时,主动连接的集群中首个 dnode 的 endpoint | -| 缺省值 | localhost:6030 | +| 缺省值 | localhost:6030 | ### secondEp -| 属性 | 说明 | -| -------- | -------------------------------------------------------------------------------------- | -| 适用范围 | 服务端和客户端均适用 | +| 属性 | 说明 | +| -------- | ------------------------------------------------------------------------------------- | +| 适用范围 | 服务端和客户端均适用 | | 含义 | taosd 或者 taos 启动时,如果 firstEp 连接不上,尝试连接集群中第二个 dnode 的 endpoint | -| 缺省值 | 无 | +| 缺省值 | 无 | ### fqdn @@ -77,7 +75,6 @@ taos --dump-config | 适用范围 | 仅服务端适用 | | 含义 | taosd 启动后,对外服务的端口号 | | 缺省值 | 6030 | -| 补充说明 | RESTful 服务在 2.4.0.0 之前(不含)由 taosd 提供,默认端口为 6041; 在 2.4.0.0 及后续版本由 taosAdapter,默认端口为 6041 | :::note 确保集群中所有主机在端口 6030 上的 TCP 协议能够互通。(详细的端口情况请参见下表) @@ -87,8 +84,8 @@ taos --dump-config | TCP | 6030 | 客户端与服务端之间通讯,多节点集群的节点间通讯。 | 由配置文件设置 serverPort 决定。 | | TCP | 6041 | 客户端与服务端之间的 RESTful 通讯。 | 随 serverPort 端口变化。注意 taosAdapter 配置或有不同,请参考相应[文档](/reference/taosadapter/)。 | | TCP | 6043 | TaosKeeper 监控服务端口。 | 随 TaosKeeper 启动参数设置变化。 | -| TCP | 6044 | 支持 StatsD 的数据接入端口。 | 随 taosAdapter 启动参数设置变化(2.3.0.1+以上版本)。 | -| UDP | 6045 | 支持 collectd 数据接入端口。 | 随 taosAdapter 启动参数设置变化(2.3.0.1+以上版本)。 | +| TCP | 6044 | 支持 StatsD 的数据接入端口。 | 随 taosAdapter 启动参数设置变化| +| UDP | 6045 | 支持 collectd 数据接入端口。 | 随 taosAdapter 启动参数设置变化 | | TCP | 6060 | 企业版内 Monitor 服务的网络端口。 | | ### maxShellConns @@ -104,28 +101,28 @@ taos --dump-config ### monitor -| 属性 | 说明 | -| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 适用范围 | 仅服务端适用 | | 含义 | 服务器内部的系统监控开关。监控主要负责收集物理节点的负载状况,包括 CPU、内存、硬盘、网络带宽的监控记录,监控信息将通过 HTTP 协议发送给由 `monitorFqdn` 和 `monitorProt` 指定的 TaosKeeper 监控服务 | -| 取值范围 | 0:关闭监控服务, 1:激活监控服务。 | -| 缺省值 | 1 | +| 取值范围 | 0:关闭监控服务, 1:激活监控服务。 | +| 缺省值 | 1 | ### monitorFqdn -| 属性 | 说明 | -| -------- | -------------------------------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | -------------------------- | +| 适用范围 | 仅服务端适用 | | 含义 | TaosKeeper 监控服务的 FQDN | -| 缺省值 | 无 | +| 缺省值 | 无 | ### monitorPort -| 属性 | 说明 | -| -------- | -------------------------------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | --------------------------- | +| 适用范围 | 仅服务端适用 | | 含义 | TaosKeeper 监控服务的端口号 | -| 缺省值 | 6043 | +| 缺省值 | 6043 | ### monitorInterval @@ -134,10 +131,9 @@ taos --dump-config | 适用范围 | 仅服务端适用 | | 含义 | 监控数据库记录系统参数(CPU/内存)的时间间隔 | | 单位 | 秒 | -| 取值范围 | 1-200000 | +| 取值范围 | 1-200000 | | 缺省值 | 30 | - ### telemetryReporting | 属性 | 说明 | @@ -149,25 +145,43 @@ taos --dump-config ## 查询相关 -### queryBufferSize +### queryPolicy + +| 属性 | 说明 | +| -------- | ----------------------------- | +| 适用范围 | 仅客户端适用 | +| 含义 | 查询语句的执行策略 | +| 单位 | 无 | +| 缺省值 | 1 | +| 补充说明 | 1: 只使用 vnode,不使用 qnode | + +2: 没有扫描算子的子任务在 qnode 执行,带扫描算子的子任务在 vnode 执行 + +3: vnode 只运行扫描算子,其余算子均在 qnode 执行 | + +### querySmaOptimize + +| 属性 | 说明 | +| -------- | -------------------- | +| 适用范围 | 仅客户端适用 | +| 含义 | sma index 的优化策略 | +| 单位 | 无 | +| 缺省值 | 0 | +| 补充说明 | + +0: 表示不使用 sma index,永远从原始数据进行查询 + +1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 | -| 属性 | 说明 | -| -------- | ------------------------------------------------------------------------------------------------------------------- | -| 适用范围 | 仅服务端适用 | -| 含义 | 为所有并发查询占用保留的内存大小。 | -| 单位 | MB | -| 缺省值 | 无 | -| 补充说明 | 计算规则可以根据实际应用可能的最大并发数和表的数字相乘,再乘 170 。
(2.0.15 以前的版本中,此参数的单位是字节) | ### maxNumOfDistinctRes | 属性 | 说明 | -| -------- | -------------------------------- | +| -------- | -------------------------------- | --- | | 适用范围 | 仅服务端适用 | | 含义 | 允许返回的 distinct 结果最大行数 | | 取值范围 | 默认值为 10 万,最大值 1 亿 | | 缺省值 | 10 万 | -| 补充说明 | 2.3 版本新增。 | | ## 区域相关 @@ -306,12 +320,12 @@ charset 的有效值是 UTF-8。 ### supportVnodes -| 属性 | 说明 | -| -------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| 适用范围 | 仅服务端适用 | -| 含义 | dnode 支持的最大 vnode 数目 | -| 取值范围 | 0-4096 | -| 缺省值 | 256 | +| 属性 | 说明 | +| -------- | --------------------------- | +| 适用范围 | 仅服务端适用 | +| 含义 | dnode 支持的最大 vnode 数目 | +| 取值范围 | 0-4096 | +| 缺省值 | 256 | ## 时间相关 @@ -366,7 +380,6 @@ charset 的有效值是 UTF-8。 | 单位 | bytes | | 取值范围 | 0: 对所有查询结果均进行压缩 >0: 查询结果中任意列大小超过该值的消息才进行压缩 -1: 不压缩 | | 缺省值 | -1 | -| 补充说明 | 2.3.0.0 版本新增。 | ## 日志相关 @@ -464,7 +477,7 @@ charset 的有效值是 UTF-8。 | 属性 | 说明 | | -------- | -------------------- | | 适用范围 | 服务端和客户端均适用 | -| 含义 | query 模块的日志开关 | +| 含义 | query 模块的日志开关 | | 取值范围 | 同上 | | 缺省值 | | @@ -481,7 +494,7 @@ charset 的有效值是 UTF-8。 | 属性 | 说明 | | -------- | -------------------- | -| 适用范围 | 仅服务端适用 | +| 适用范围 | 仅服务端适用 | | 含义 | dnode 模块的日志开关 | | 取值范围 | 同上 | | 缺省值 | 135 | @@ -490,28 +503,28 @@ charset 的有效值是 UTF-8。 | 属性 | 说明 | | -------- | -------------------- | -| 适用范围 | 仅服务端适用 | +| 适用范围 | 仅服务端适用 | | 含义 | vnode 模块的日志开关 | | 取值范围 | 同上 | | 缺省值 | | ### mDebugFlag -| 属性 | 说明 | -| -------- | ------------------ | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | -------------------- | +| 适用范围 | 仅服务端适用 | | 含义 | mnode 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | 135 | +| 取值范围 | 同上 | +| 缺省值 | 135 | ### wDebugFlag -| 属性 | 说明 | -| -------- | -------------------- | -| 适用范围 | 仅服务端适用 | -| 含义 | wal 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | 135 | +| 属性 | 说明 | +| -------- | ------------------ | +| 适用范围 | 仅服务端适用 | +| 含义 | wal 模块的日志开关 | +| 取值范围 | 同上 | +| 缺省值 | 135 | ### sDebugFlag @@ -533,57 +546,86 @@ charset 的有效值是 UTF-8。 ### tqDebugFlag -| 属性 | 说明 | -| -------- | ------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | ----------------- | +| 适用范围 | 仅服务端适用 | | 含义 | tq 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | | +| 取值范围 | 同上 | +| 缺省值 | | ### fsDebugFlag -| 属性 | 说明 | -| -------- | ------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | ----------------- | +| 适用范围 | 仅服务端适用 | | 含义 | fs 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | | +| 取值范围 | 同上 | +| 缺省值 | | ### udfDebugFlag -| 属性 | 说明 | -| -------- | ---------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | ------------------ | +| 适用范围 | 仅服务端适用 | | 含义 | UDF 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | | +| 取值范围 | 同上 | +| 缺省值 | | ### smaDebugFlag -| 属性 | 说明 | -| -------- | ---------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | ------------------ | +| 适用范围 | 仅服务端适用 | | 含义 | sma 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | | +| 取值范围 | 同上 | +| 缺省值 | | ### idxDebugFlag -| 属性 | 说明 | -| -------- | ---------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | -------------------- | +| 适用范围 | 仅服务端适用 | | 含义 | index 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | | +| 取值范围 | 同上 | +| 缺省值 | | ### tdbDebugFlag -| 属性 | 说明 | -| -------- | ---------------------- | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | ------------------ | +| 适用范围 | 仅服务端适用 | | 含义 | tdb 模块的日志开关 | -| 取值范围 | 同上 | -| 缺省值 | | +| 取值范围 | 同上 | +| 缺省值 | | + +## Schemaless 相关 + +### smlChildTableName + +| 属性 | 说明 | +| -------- | ------------------------- | +| 适用范围 | 仅客户端适用 | +| 含义 | schemaless 自定义的子表名 | +| 类型 | 字符串 | +| 缺省值 | 无 | + +### smlTagName + +| 属性 | 说明 | +| -------- | ------------------------------------ | +| 适用范围 | 仅客户端适用 | +| 含义 | schemaless tag 为空时默认的 tag 名字 | +| 类型 | 字符串 | +| 缺省值 | _tag_null | + +### smlDataFormat + +| 属性 | 说明 | +| -------- | ----------------------------- | +| 适用范围 | 仅客户端适用 | +| 含义 | schemaless 列数据是否顺序一致 | +| 值域 | 0:不一致;1: 一致 | +| 缺省值 | 1 | ## 其他 @@ -596,3 +638,12 @@ charset 的有效值是 UTF-8。 | 取值范围 | 0:否,1:是 | | 缺省值 | 1 | | 补充说明 | 不同的启动方式,生成 core 文件的目录如下:1、systemctl start taosd 启动:生成的 core 在根目录下
2、手动启动,就在 taosd 执行目录下。 | + +### udf + +| 属性 | 说明 | +| -------- | ------------------ | +| 适用范围 | 仅服务端适用 | +| 含义 | 是否启动 udf 服务 | +| 取值范围 | 0: 不启动;1:启动 | +| 缺省值 | 1 | From 41b8ef7d932be7f74a9ae25a23a0a2a559b300bc Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 29 Jul 2022 18:00:48 +0800 Subject: [PATCH 23/43] enh: cumulative functions support mixed use --- include/libs/function/functionMgt.h | 10 +++++++ include/libs/nodes/querynodes.h | 1 + source/libs/function/inc/builtins.h | 2 ++ source/libs/function/inc/functionMgtInt.h | 1 + source/libs/function/src/builtins.c | 30 +++++++++++++++---- source/libs/function/src/functionMgt.c | 10 +++++++ source/libs/parser/src/parTranslater.c | 34 ++++++++++++++++------ source/libs/planner/test/planBasicTest.cpp | 10 +++++++ 8 files changed, 83 insertions(+), 15 deletions(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 60ad3ba451..98db7be0d3 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -157,6 +157,13 @@ typedef enum EFunctionType { FUNCTION_TYPE_UDF = 10000 } EFunctionType; +typedef enum EFuncReturnRows { + FUNC_RETURN_ROWS_NORMAL = 1, + FUNC_RETURN_ROWS_INDEFINITE, + FUNC_RETURN_ROWS_N, + FUNC_RETURN_ROWS_N_MINUS_1 +} EFuncReturnRows; + struct SqlFunctionCtx; struct SResultRowEntryInfo; struct STimeWindow; @@ -167,6 +174,8 @@ void fmFuncMgtDestroy(); int32_t fmGetFuncInfo(SFunctionNode* pFunc, char* pMsg, int32_t msgLen); +EFuncReturnRows fmGetFuncReturnRows(SFunctionNode* pFunc); + bool fmIsBuiltinFunc(const char* pFunc); bool fmIsAggFunc(int32_t funcId); @@ -198,6 +207,7 @@ bool fmIsImplicitTsFunc(int32_t funcId); bool fmIsClientPseudoColumnFunc(int32_t funcId); bool fmIsMultiRowsFunc(int32_t funcId); bool fmIsKeepOrderFunc(int32_t funcId); +bool fmIsCumulativeFunc(int32_t funcId); int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc); diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 0600d16d72..5dc1e7512f 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -253,6 +253,7 @@ typedef struct SSelectStmt { char stmtName[TSDB_TABLE_NAME_LEN]; uint8_t precision; int32_t selectFuncNum; + int32_t returnRows; // EFuncReturnRows bool isEmptyResult; bool isTimeLineResult; bool isSubquery; diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index f5efcd5206..467fb11ae0 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -26,6 +26,7 @@ typedef int32_t (*FTranslateFunc)(SFunctionNode* pFunc, char* pErrBuf, int32_t l typedef EFuncDataRequired (*FFuncDataRequired)(SFunctionNode* pFunc, STimeWindow* pTimeWindow); typedef int32_t (*FCreateMergeFuncParameters)(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters); typedef EFuncDataRequired (*FFuncDynDataRequired)(void* pRes, STimeWindow* pTimeWindow); +typedef EFuncReturnRows (*FEstimateReturnRows)(SFunctionNode* pFunc); typedef struct SBuiltinFuncDefinition { const char* name; @@ -44,6 +45,7 @@ typedef struct SBuiltinFuncDefinition { const char* pPartialFunc; const char* pMergeFunc; FCreateMergeFuncParameters createMergeParaFuc; + FEstimateReturnRows estimateReturnRowsFunc; } SBuiltinFuncDefinition; extern const SBuiltinFuncDefinition funcMgtBuiltins[]; diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index c79306f1e4..10cc20403c 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -48,6 +48,7 @@ extern "C" { #define FUNC_MGT_CLIENT_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(19) #define FUNC_MGT_MULTI_ROWS_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(20) #define FUNC_MGT_KEEP_ORDER_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(21) +#define FUNC_MGT_CUMULATIVE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(22) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 01a5e7997e..579a4c3057 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1277,6 +1277,8 @@ static int32_t translateCsum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { return TSDB_CODE_SUCCESS; } +static EFuncReturnRows csumEstReturnRows(SFunctionNode* pFunc) { return FUNC_RETURN_ROWS_N; } + static int32_t translateMavg(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { if (2 != LIST_LENGTH(pFunc->pParameterList)) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); @@ -1416,6 +1418,11 @@ static int32_t translateDerivative(SFunctionNode* pFunc, char* pErrBuf, int32_t return TSDB_CODE_SUCCESS; } +static EFuncReturnRows derivativeEstReturnRows(SFunctionNode* pFunc) { + return 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 2))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE + : FUNC_RETURN_ROWS_N_MINUS_1; +} + static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { if (1 != LIST_LENGTH(pFunc->pParameterList)) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); @@ -1551,6 +1558,14 @@ static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { return TSDB_CODE_SUCCESS; } +static EFuncReturnRows diffEstReturnRows(SFunctionNode* pFunc) { + if (1 == LIST_LENGTH(pFunc->pParameterList)) { + return FUNC_RETURN_ROWS_N_MINUS_1; + } + return 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE + : FUNC_RETURN_ROWS_N_MINUS_1; +} + static int32_t translateLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { if (1 != LIST_LENGTH(pFunc->pParameterList)) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); @@ -2231,13 +2246,14 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "derivative", .type = FUNCTION_TYPE_DERIVATIVE, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_CUMULATIVE_FUNC, .translateFunc = translateDerivative, .getEnvFunc = getDerivativeFuncEnv, .initFunc = derivativeFuncSetup, .processFunc = derivativeFunction, .sprocessFunc = derivativeScalarFunction, - .finalizeFunc = functionFinalize + .finalizeFunc = functionFinalize, + .estimateReturnRowsFunc = derivativeEstReturnRows }, { .name = "irate", @@ -2436,13 +2452,14 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "diff", .type = FUNCTION_TYPE_DIFF, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC, .translateFunc = translateDiff, .getEnvFunc = getDiffFuncEnv, .initFunc = diffFunctionSetup, .processFunc = diffFunction, .sprocessFunc = diffScalarFunction, - .finalizeFunc = functionFinalize + .finalizeFunc = functionFinalize, + .estimateReturnRowsFunc = diffEstReturnRows }, { .name = "statecount", @@ -2469,13 +2486,14 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "csum", .type = FUNCTION_TYPE_CSUM, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC, .translateFunc = translateCsum, .getEnvFunc = getCsumFuncEnv, .initFunc = functionSetup, .processFunc = csumFunction, .sprocessFunc = csumScalarFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, + .estimateReturnRowsFunc = csumEstReturnRows, }, { .name = "mavg", diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 020fd648e1..2cd06be4b3 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -89,6 +89,14 @@ int32_t fmGetFuncInfo(SFunctionNode* pFunc, char* pMsg, int32_t msgLen) { return TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION; } +EFuncReturnRows fmGetFuncReturnRows(SFunctionNode* pFunc) { + if (NULL != funcMgtBuiltins[pFunc->funcId].estimateReturnRowsFunc) { + return funcMgtBuiltins[pFunc->funcId].estimateReturnRowsFunc(pFunc); + } + return (fmIsIndefiniteRowsFunc(pFunc->funcId) || fmIsMultiRowsFunc(pFunc->funcId)) ? FUNC_RETURN_ROWS_INDEFINITE + : FUNC_RETURN_ROWS_NORMAL; +} + bool fmIsBuiltinFunc(const char* pFunc) { return NULL != taosHashGet(gFunMgtService.pFuncNameHashTable, pFunc, strlen(pFunc)); } @@ -192,6 +200,8 @@ bool fmIsMultiRowsFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, F bool fmIsKeepOrderFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_KEEP_ORDER_FUNC); } +bool fmIsCumulativeFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_CUMULATIVE_FUNC); } + bool fmIsInterpFunc(int32_t funcId) { if (funcId < 0 || funcId >= funcMgtBuiltinsNum) { return false; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 5cba920a43..411f7f772f 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1110,12 +1110,15 @@ static int32_t translateIndefiniteRowsFunc(STranslateContext* pCxt, SFunctionNod if (!fmIsIndefiniteRowsFunc(pFunc->funcId)) { return TSDB_CODE_SUCCESS; } - if (!isSelectStmt(pCxt->pCurrStmt) || SQL_CLAUSE_SELECT != pCxt->currClause || - ((SSelectStmt*)pCxt->pCurrStmt)->hasIndefiniteRowsFunc || ((SSelectStmt*)pCxt->pCurrStmt)->hasAggFuncs || - ((SSelectStmt*)pCxt->pCurrStmt)->hasMultiRowsFunc) { + if (!isSelectStmt(pCxt->pCurrStmt) || SQL_CLAUSE_SELECT != pCxt->currClause) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } - if (NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pWindow || NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pGroupByList) { + SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt; + if (pSelect->hasAggFuncs || pSelect->hasMultiRowsFunc || + (pSelect->hasIndefiniteRowsFunc && pSelect->returnRows != fmGetFuncReturnRows(pFunc))) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); + } + if (NULL != pSelect->pWindow || NULL != pSelect->pGroupByList) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, "%s function is not supported in window query or group query", pFunc->functionName); } @@ -1230,18 +1233,28 @@ static int32_t getMultiResFuncNum(SNodeList* pParameterList) { return LIST_LENGTH(pParameterList); } +static int32_t calcSelectFuncNum(SFunctionNode* pFunc, int32_t currSelectFuncNum) { + if (fmIsCumulativeFunc(pFunc->funcId)) { + return currSelectFuncNum > 0 ? currSelectFuncNum : 1; + } + return currSelectFuncNum + ((fmIsMultiResFunc(pFunc->funcId) && !fmIsLastRowFunc(pFunc->funcId)) + ? getMultiResFuncNum(pFunc->pParameterList) + : 1); +} + static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) { if (NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt)) { SSelectStmt* pSelect = (SSelectStmt*)pCurrStmt; pSelect->hasAggFuncs = pSelect->hasAggFuncs ? true : fmIsAggFunc(pFunc->funcId); pSelect->hasRepeatScanFuncs = pSelect->hasRepeatScanFuncs ? true : fmIsRepeatScanFunc(pFunc->funcId); - pSelect->hasIndefiniteRowsFunc = pSelect->hasIndefiniteRowsFunc ? true : fmIsIndefiniteRowsFunc(pFunc->funcId); + if (fmIsIndefiniteRowsFunc(pFunc->funcId)) { + pSelect->hasIndefiniteRowsFunc = true; + pSelect->returnRows = fmGetFuncReturnRows(pFunc); + } pSelect->hasMultiRowsFunc = pSelect->hasMultiRowsFunc ? true : fmIsMultiRowsFunc(pFunc->funcId); if (fmIsSelectFunc(pFunc->funcId)) { pSelect->hasSelectFunc = true; - pSelect->selectFuncNum += (fmIsMultiResFunc(pFunc->funcId) && !fmIsLastRowFunc(pFunc->funcId)) - ? getMultiResFuncNum(pFunc->pParameterList) - : 1; + pSelect->selectFuncNum = calcSelectFuncNum(pFunc, pSelect->selectFuncNum); } else if (fmIsVectorFunc(pFunc->funcId)) { pSelect->hasOtherVectorFunc = true; } @@ -2481,6 +2494,9 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) { } static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartitionByList) { + if (NULL == pPartitionByList) { + return TSDB_CODE_SUCCESS; + } pCxt->currClause = SQL_CLAUSE_PARTITION_BY; return translateExprList(pCxt, pPartitionByList); } @@ -5568,7 +5584,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { int32_t code = checkCreateTable(pCxt, pStmt, false); SVgroupInfo info = {0}; - SName name; + SName name; toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name); if (TSDB_CODE_SUCCESS == code) { code = getTableHashVgroupImpl(pCxt, &name, &info); diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 9cfae68d34..d7c947a20d 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -175,6 +175,16 @@ TEST_F(PlanBasicTest, pseudoColumn) { "WHERE ts BETWEEN '2017-7-14 18:00:00' AND '2017-7-14 19:00:00' INTERVAL(10S)"); } +TEST_F(PlanBasicTest, indefiniteRowsFunc) { + useDb("root", "test"); + + run("SELECT DIFF(c1) FROM t1"); + + run("SELECT DIFF(c1), c2 FROM t1"); + + run("SELECT DIFF(c1), DIFF(c3), ts FROM t1"); +} + TEST_F(PlanBasicTest, withoutFrom) { useDb("root", "test"); From f929187e63223a2fb0e16bbe8c6ed75daa14c05e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 29 Jul 2022 18:30:03 +0800 Subject: [PATCH 24/43] enh: last function optimize --- source/libs/planner/src/planOptimizer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index f64ea71ccb..577266a697 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1061,6 +1061,9 @@ static int32_t pushDownCondOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogi } static bool sortPriKeyOptIsPriKeyOrderBy(SNodeList* pSortKeys) { + if (1 != LIST_LENGTH(pSortKeys)) { + return false; + } SNode* pNode = ((SOrderByExprNode*)nodesListGetNode(pSortKeys, 0))->pExpr; return (QUERY_NODE_COLUMN == nodeType(pNode) ? (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pNode)->colId) : false); } From 81d424190763af317151b22482c62a60c5755aba Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 29 Jul 2022 18:39:27 +0800 Subject: [PATCH 25/43] test: add case --- tests/script/jenkins/basic.txt | 11 +- tests/script/tsim/parser/columnValue.sim | 22 -- .../script/tsim/parser/columnValue_bigint.sim | 214 +++++------- tests/script/tsim/parser/columnValue_bool.sim | 309 +++++++++--------- .../script/tsim/parser/columnValue_double.sim | 221 +++++++------ .../script/tsim/parser/columnValue_float.sim | 263 +++++++-------- tests/script/tsim/parser/columnValue_int.sim | 215 +++++------- .../tsim/parser/columnValue_smallint.sim | 221 ++++++------- .../tsim/parser/columnValue_tinyint.sim | 218 +++++------- .../script/tsim/parser/columnValue_unsign.sim | 136 +++----- 10 files changed, 822 insertions(+), 1008 deletions(-) delete mode 100644 tests/script/tsim/parser/columnValue.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 059eb43b9b..85a8a5e9dd 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -95,7 +95,14 @@ ./test.sh -f tsim/parser/between_and.sim ./test.sh -f tsim/parser/binary_escapeCharacter.sim # TD-17738 ./test.sh -f tsim/parser/col_arithmetic_operation.sim -# TD-17661 ./test.sh -f tsim/parser/columnValue.sim +./test.sh -f tsim/parser/columnValue_bigint.sim +./test.sh -f tsim/parser/columnValue_bool.sim +./test.sh -f tsim/parser/columnValue_double.sim +./test.sh -f tsim/parser/columnValue_float.sim +./test.sh -f tsim/parser/columnValue_int.sim +./test.sh -f tsim/parser/columnValue_smallint.sim +./test.sh -f tsim/parser/columnValue_tinyint.sim +./test.sh -f tsim/parser/columnValue_unsign.sim ./test.sh -f tsim/parser/commit.sim ./test.sh -f tsim/parser/condition.sim ./test.sh -f tsim/parser/constCol.sim @@ -154,7 +161,7 @@ ./test.sh -f tsim/parser/slimit.sim ./test.sh -f tsim/parser/slimit1.sim ./test.sh -f tsim/parser/stableOp.sim -# TD-17661 ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim +./test.sh -f tsim/parser/tags_dynamically_specifiy.sim ./test.sh -f tsim/parser/tags_filter.sim ./test.sh -f tsim/parser/tbnameIn.sim ./test.sh -f tsim/parser/timestamp.sim diff --git a/tests/script/tsim/parser/columnValue.sim b/tests/script/tsim/parser/columnValue.sim deleted file mode 100644 index 68336cdcc1..0000000000 --- a/tests/script/tsim/parser/columnValue.sim +++ /dev/null @@ -1,22 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/exec.sh -n dnode1 -s start -sql connect - -print ========== columnValues.sim - -sql drop database if exists db -sql create database db -sql use db - -run tsim/parser/columnValue_bool.sim -run tsim/parser/columnValue_tinyint.sim -run tsim/parser/columnValue_smallint.sim -run tsim/parser/columnValue_int.sim -run tsim/parser/columnValue_bigint.sim -run tsim/parser/columnValue_float.sim -run tsim/parser/columnValue_double.sim -run tsim/parser/columnValue_unsign.sim - -system sh/exec.sh -n dnode1 -s stop -x SIGINT - diff --git a/tests/script/tsim/parser/columnValue_bigint.sim b/tests/script/tsim/parser/columnValue_bigint.sim index 8841418ed3..ae97835dff 100644 --- a/tests/script/tsim/parser/columnValue_bigint.sim +++ b/tests/script/tsim/parser/columnValue_bigint.sim @@ -1,5 +1,12 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create database if not exists db + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db sql use db #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value @@ -10,78 +17,64 @@ sql create table mt_bigint (ts timestamp, c bigint) tags (tagname bigint) ## case 00: static create table for test tag values sql create table st_bigint_0 using mt_bigint tags (NULL) -sql select tagname from st_bigint_0 -if $data00 != NULL then +sql show tags from st_bigint_0 +if $data05 != NULL then return -1 endi sql create table st_bigint_1 using mt_bigint tags (NULL) -sql select tagname from st_bigint_1 -if $data00 != NULL then - return -1 -endi -sql create table st_bigint_2 using mt_bigint tags ('NULL') -sql select tagname from st_bigint_2 -if $data00 != NULL then - return -1 -endi -sql create table st_bigint_3 using mt_bigint tags ('NULL') -sql select tagname from st_bigint_3 -if $data00 != NULL then - return -1 -endi -sql create table st_bigint_4 using mt_bigint tags ("NULL") -sql select tagname from st_bigint_4 -if $data00 != NULL then - return -1 -endi -sql create table st_bigint_5 using mt_bigint tags ("NULL") -sql select tagname from st_bigint_5 -if $data00 != NULL then +sql show tags from st_bigint_1 +if $data05 != NULL then return -1 endi + +sql_error create table st_bigint_2 using mt_bigint tags ('NULL') +sql_error create table st_bigint_3 using mt_bigint tags ('NULL') +sql_error create table st_bigint_4 using mt_bigint tags ("NULL") +sql_error create table st_bigint_5 using mt_bigint tags ("NULL") + sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807) -sql select tagname from st_bigint_6 -if $data00 != -9223372036854775807 then +sql show tags from st_bigint_6 +if $data05 != -9223372036854775807 then return -1 endi sql create table st_bigint_7 using mt_bigint tags (9223372036854775807) -sql select tagname from st_bigint_7 -if $data00 != 9223372036854775807 then +sql show tags from st_bigint_7 +if $data05 != 9223372036854775807 then return -1 endi sql create table st_bigint_8 using mt_bigint tags (37) -sql select tagname from st_bigint_8 -if $data00 != 37 then +sql show tags from st_bigint_8 +if $data05 != 37 then return -1 endi sql create table st_bigint_9 using mt_bigint tags (-100) -sql select tagname from st_bigint_9 -if $data00 != -100 then +sql show tags from st_bigint_9 +if $data05 != -100 then return -1 endi sql create table st_bigint_10 using mt_bigint tags (+113) -sql select tagname from st_bigint_10 -if $data00 != 113 then +sql show tags from st_bigint_10 +if $data05 != 113 then return -1 endi sql create table st_bigint_11 using mt_bigint tags ('-100') -sql select tagname from st_bigint_11 -if $data00 != -100 then +sql show tags from st_bigint_11 +if $data05 != -100 then return -1 endi sql create table st_bigint_12 using mt_bigint tags ("+78") -sql select tagname from st_bigint_12 -if $data00 != 78 then +sql show tags from st_bigint_12 +if $data05 != 78 then return -1 endi sql create table st_bigint_13 using mt_bigint tags (+0078) -sql select tagname from st_bigint_13 -if $data00 != 78 then +sql show tags from st_bigint_13 +if $data05 != 78 then return -1 endi sql create table st_bigint_14 using mt_bigint tags (-00078) -sql select tagname from st_bigint_14 -if $data00 != -78 then +sql show tags from st_bigint_14 +if $data05 != -78 then return -1 endi @@ -102,38 +95,7 @@ endi if $data01 != NULL then return -1 endi -sql insert into st_bigint_2 values (now, 'NULL') -sql select * from st_bigint_2 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_bigint_3 values (now, 'NULL') -sql select * from st_bigint_3 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_bigint_4 values (now, "NULL") -sql select * from st_bigint_4 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_bigint_5 values (now, "NULL") -sql select * from st_bigint_5 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi + sql insert into st_bigint_6 values (now, 9223372036854775807) sql select * from st_bigint_6 if $rows != 1 then @@ -211,8 +173,8 @@ endi ## case 02: dynamic create table for test tag values sql insert into st_bigint_16 using mt_bigint tags (NULL) values (now, NULL) -sql select tagname from st_bigint_16 -if $data00 != NULL then +sql show tags from st_bigint_16 +if $data05 != NULL then return -1 endi sql select * from st_bigint_16 @@ -221,8 +183,8 @@ if $data01 != NULL then endi sql insert into st_bigint_17 using mt_bigint tags (NULL) values (now, NULL) -sql select tagname from st_bigint_17 -if $data00 != NULL then +sql show tags from st_bigint_17 +if $data05 != NULL then return -1 endi sql select * from st_bigint_17 @@ -230,8 +192,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bigint_18 using mt_bigint tags ('NULL') values (now, 'NULL') -sql select tagname from st_bigint_18 -if $data00 != NULL then +sql show tags from st_bigint_18 +if $data05 != NULL then return -1 endi sql select * from st_bigint_18 @@ -239,8 +201,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bigint_19 using mt_bigint tags ('NULL') values (now, 'NULL') -sql select tagname from st_bigint_19 -if $data00 != NULL then +sql show tags from st_bigint_19 +if $data05 != NULL then return -1 endi sql select * from st_bigint_19 @@ -248,8 +210,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bigint_20 using mt_bigint tags ("NULL") values (now, "NULL") -sql select tagname from st_bigint_20 -if $data00 != NULL then +sql show tags from st_bigint_20 +if $data05 != NULL then return -1 endi sql select * from st_bigint_20 @@ -257,8 +219,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bigint_21 using mt_bigint tags ("NULL") values (now, "NULL") -sql select tagname from st_bigint_21 -if $data00 != NULL then +sql show tags from st_bigint_21 +if $data05 != NULL then return -1 endi sql select * from st_bigint_21 @@ -266,8 +228,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bigint_22 using mt_bigint tags (9223372036854775807) values (now, 9223372036854775807) -sql select tagname from st_bigint_22 -if $data00 != 9223372036854775807 then +sql show tags from st_bigint_22 +if $data05 != 9223372036854775807 then return -1 endi sql select * from st_bigint_22 @@ -275,8 +237,8 @@ if $data01 != 9223372036854775807 then return -1 endi sql insert into st_bigint_23 using mt_bigint tags (-9223372036854775807) values (now, -9223372036854775807) -sql select tagname from st_bigint_23 -if $data00 != -9223372036854775807 then +sql show tags from st_bigint_23 +if $data05 != -9223372036854775807 then return -1 endi sql select * from st_bigint_23 @@ -284,8 +246,8 @@ if $data01 != -9223372036854775807 then return -1 endi sql insert into st_bigint_24 using mt_bigint tags (10) values (now, 10) -sql select tagname from st_bigint_24 -if $data00 != 10 then +sql show tags from st_bigint_24 +if $data05 != 10 then return -1 endi sql select * from st_bigint_24 @@ -293,8 +255,8 @@ if $data01 != 10 then return -1 endi sql insert into st_bigint_25 using mt_bigint tags ("-0") values (now, "-0") -sql select tagname from st_bigint_25 -if $data00 != 0 then +sql show tags from st_bigint_25 +if $data05 != 0 then return -1 endi sql select * from st_bigint_25 @@ -302,8 +264,8 @@ if $data01 != 0 then return -1 endi sql insert into st_bigint_26 using mt_bigint tags ('123') values (now, '123') -sql select tagname from st_bigint_26 -if $data00 != 123 then +sql show tags from st_bigint_26 +if $data05 != 123 then return -1 endi sql select * from st_bigint_26 @@ -311,8 +273,8 @@ if $data01 != 123 then return -1 endi sql insert into st_bigint_27 using mt_bigint tags (+056) values (now, +00056) -sql select tagname from st_bigint_27 -if $data00 != 56 then +sql show tags from st_bigint_27 +if $data05 != 56 then return -1 endi sql select * from st_bigint_27 @@ -320,8 +282,8 @@ if $data01 != 56 then return -1 endi sql insert into st_bigint_28 using mt_bigint tags (-056) values (now, -0056) -sql select tagname from st_bigint_28 -if $data00 != -56 then +sql show tags from st_bigint_28 +if $data05 != -56 then return -1 endi sql select * from st_bigint_28 @@ -331,50 +293,50 @@ endi ### case 03: alter tag values #sql alter table st_bigint_0 set tag tagname=9223372036854775807 -#sql select tagname from st_bigint_0 -#if $data00 != 9223372036854775807 then +#sql show tags from st_bigint_0 +#if $data05 != 9223372036854775807 then # return -1 #endi #sql alter table st_bigint_0 set tag tagname=-9223372036854775807 -#sql select tagname from st_bigint_0 -#if $data00 != -9223372036854775807 then +#sql show tags from st_bigint_0 +#if $data05 != -9223372036854775807 then # return -1 #endi #sql alter table st_bigint_0 set tag tagname=+100 -#sql select tagname from st_bigint_0 -#if $data00 != 100 then +#sql show tags from st_bigint_0 +#if $data05 != 100 then # return -1 #endi #sql alter table st_bigint_0 set tag tagname=-33 -#sql select tagname from st_bigint_0 -#if $data00 != -33 then +#sql show tags from st_bigint_0 +#if $data05 != -33 then # return -1 #endi #sql alter table st_bigint_0 set tag tagname='+98' -#sql select tagname from st_bigint_0 -#if $data00 != 98 then +#sql show tags from st_bigint_0 +#if $data05 != 98 then # return -1 #endi #sql alter table st_bigint_0 set tag tagname='-076' -#sql select tagname from st_bigint_0 -#if $data00 != -76 then +#sql show tags from st_bigint_0 +#if $data05 != -76 then # return -1 #endi #sql alter table st_bigint_0 set tag tagname=+0012 -#sql select tagname from st_bigint_0 -#if $data00 != 12 then +#sql show tags from st_bigint_0 +#if $data05 != 12 then # return -1 #endi #sql alter table st_bigint_0 set tag tagname=-00063 -#sql select tagname from st_bigint_0 -#if $data00 != -63 then +#sql show tags from st_bigint_0 +#if $data05 != -63 then # return -1 #endi ## case 04: illegal input ################## when overflow, auto set max sql_error create table st_bigint_e0 using mt_bigint tags (9223372036854775808) -sql_error create table st_bigint_e0_1 using mt_bigint tags (-9223372036854775808) +sql create table st_bigint_e0_1 using mt_bigint tags (-9223372036854775808) sql_error create table st_bigint_e0_2 using mt_bigint tags (92233720368547758080) sql_error create table st_bigint_e0_3 using mt_bigint tags (-9223372036854775809) #sql_error create table st_bigint_e0 using mt_bigint tags (12.80) truncate integer part @@ -384,7 +346,7 @@ sql_error create table st_bigint_e0 using mt_bigint tags ("123abc") sql_error create table st_bigint_e0 using mt_bigint tags (abc) sql_error create table st_bigint_e0 using mt_bigint tags ("abc") sql_error create table st_bigint_e0 using mt_bigint tags (" ") -sql_error create table st_bigint_e0 using mt_bigint tags ('') +sql create table st_bigint_e0_error using mt_bigint tags ('') sql create table st_bigint_e0 using mt_bigint tags (123) sql create table st_bigint_e1 using mt_bigint tags (123) @@ -401,9 +363,9 @@ sql create table st_bigint_e11 using mt_bigint tags (123) sql create table st_bigint_e12 using mt_bigint tags (123) sql_error insert into st_bigint_e0 values (now, 9223372036854775808) -sql_error insert into st_bigint_e1 values (now, -9223372036854775808) +sql insert into st_bigint_e1 values (now, -9223372036854775808) sql_error insert into st_bigint_e2 values (now, 9223372036854775809) -sql_error insert into st_bigint_e3 values (now, -9223372036854775808) +sql insert into st_bigint_e3 values (now, -9223372036854775808) #sql_error insert into st_bigint_e4 values (now, 922337203.6854775808) #sql_error insert into st_bigint_e5 values (now, -922337203685477580.9) sql_error insert into st_bigint_e6 values (now, 123abc) @@ -411,10 +373,10 @@ sql_error insert into st_bigint_e7 values (now, "123abc") sql_error insert into st_bigint_e9 values (now, abc) sql_error insert into st_bigint_e10 values (now, "abc") sql_error insert into st_bigint_e11 values (now, " ") -sql_error insert into st_bigint_e12 values (now, '') +sql insert into st_bigint_e12 values (now, '') sql_error insert into st_bigint_e13 using mt_bigint tags (033) values (now, 9223372036854775808) -sql_error insert into st_bigint_e14 using mt_bigint tags (033) values (now, -9223372036854775808) +sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, -9223372036854775808) sql_error insert into st_bigint_e15 using mt_bigint tags (033) values (now, 9223372036854775818) sql_error insert into st_bigint_e16 using mt_bigint tags (033) values (now, -9923372036854775808) #sql_error insert into st_bigint_e17 using mt_bigint tags (033) values (now, 92233720368547758.08) @@ -424,10 +386,10 @@ sql_error insert into st_bigint_e20 using mt_bigint tags (033) values (now, "123 sql_error insert into st_bigint_e22 using mt_bigint tags (033) values (now, abc) sql_error insert into st_bigint_e23 using mt_bigint tags (033) values (now, "abc") sql_error insert into st_bigint_e24 using mt_bigint tags (033) values (now, " ") -sql_error insert into st_bigint_e25 using mt_bigint tags (033) values (now, '') +sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, '') sql_error insert into st_bigint_e13_0 using mt_bigint tags (9223372036854775808) values (now, -033) -sql_error insert into st_bigint_e14_0 using mt_bigint tags (-9223372036854775808) values (now, -033) +sql insert into st_bigint_e14_0 using mt_bigint tags (-9223372036854775808) values (now, -033) sql_error insert into st_bigint_e15_0 using mt_bigint tags (9223372036854775809) values (now, -033) sql_error insert into st_bigint_e16_0 using mt_bigint tags (-9223372036854775898) values (now, -033) #sql_error insert into st_bigint_e17 using mt_bigint tags (12.80) values (now, -033) @@ -437,7 +399,7 @@ sql_error insert into st_bigint_e20 using mt_bigint tags ("123abc") values (now, sql_error insert into st_bigint_e22 using mt_bigint tags (abc) values (now, -033) sql_error insert into st_bigint_e23 using mt_bigint tags ("abc") values (now, -033) sql_error insert into st_bigint_e24 using mt_bigint tags (" ") values (now, -033) -sql_error insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033) +sql insert into st_bigint_e25 using mt_bigint tags ('') values (now, -033) sql insert into st_bigint_e13 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e14 using mt_bigint tags (033) values (now, 00062) diff --git a/tests/script/tsim/parser/columnValue_bool.sim b/tests/script/tsim/parser/columnValue_bool.sim index 3e8c408e13..d20c4efdc0 100644 --- a/tests/script/tsim/parser/columnValue_bool.sim +++ b/tests/script/tsim/parser/columnValue_bool.sim @@ -1,5 +1,12 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create database if not exists db + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db sql use db #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value @@ -10,110 +17,110 @@ sql create table mt_bool (ts timestamp, c bool) tags (tagname bool) ## case 00: static create table for test tag values sql create table st_bool_0 using mt_bool tags (NULL) -sql select tagname from st_bool_0 -if $data00 != NULL then - print ==1== expect: NULL, actually: $data00 +sql show tags from st_bool_0 +if $data05 != NULL then + print ==1== expect: NULL, actually: $data05 return -1 endi sql create table st_bool_1 using mt_bool tags (NULL) -sql select tagname from st_bool_1 -if $data00 != NULL then - print ==2== expect: NULL, actually: $data00 +sql show tags from st_bool_1 +if $data05 != NULL then + print ==2== expect: NULL, actually: $data05 return -1 endi sql create table st_bool_2 using mt_bool tags ('NULL') -sql select tagname from st_bool_2 -if $data00 != NULL then - print ==3== expect: NULL, actually: $data00 +sql show tags from st_bool_2 +if $data05 != false then + print ==3== expect: false, actually: $data05 return -1 endi sql create table st_bool_3 using mt_bool tags ('NULL') -sql select tagname from st_bool_3 -if $data00 != NULL then - print ==4== expect: NULL, actually: $data00 +sql show tags from st_bool_3 +if $data05 != false then + print ==4== expect: false, actually: $data05 return -1 endi sql create table st_bool_4 using mt_bool tags ("NULL") -sql select tagname from st_bool_4 -if $data00 != NULL then - print ==5== expect: NULL, actually: $data00 +sql show tags from st_bool_4 +if $data05 != false then + print ==5== expect: false, actually: $data05 return -1 endi sql create table st_bool_5 using mt_bool tags ("NULL") -sql select tagname from st_bool_5 -if $data00 != NULL then - print ==6== expect: NULL, actually: $data00 +sql show tags from st_bool_5 +if $data05 != false then + print ==6== expect: false, actually: $data05 return -1 endi sql create table st_bool_6 using mt_bool tags ("true") -sql select tagname from st_bool_6 -if $data00 != 1 then - print ==7== expect: 1, actually: $data00 +sql show tags from st_bool_6 +if $data05 != true then + print ==7== expect: 1, actually: $data05 return -1 endi sql create table st_bool_7 using mt_bool tags ('true') -sql select tagname from st_bool_7 -if $data00 != 1 then - print ==8== expect: 1, actually: $data00 +sql show tags from st_bool_7 +if $data05 != true then + print ==8== expect: 1, actually: $data05 return -1 endi sql create table st_bool_8 using mt_bool tags (true) -sql select tagname from st_bool_8 -if $data00 != 1 then - print ==9== expect: 1, actually: $data00 +sql show tags from st_bool_8 +if $data05 != true then + print ==9== expect: 1, actually: $data05 return -1 endi sql create table st_bool_9 using mt_bool tags ("false") -sql select tagname from st_bool_9 -if $data00 != 0 then - print ==10== expect: 0, actually: $data00 +sql show tags from st_bool_9 +if $data05 != false then + print ==10== expect: 0, actually: $data05 return -1 endi sql create table st_bool_10 using mt_bool tags ('false') -sql select tagname from st_bool_10 -if $data00 != 0 then - print ==11== expect: 0, actually: $data00 +sql show tags from st_bool_10 +if $data05 != false then + print ==11== expect: 0, actually: $data05 return -1 endi sql create table st_bool_11 using mt_bool tags (false) -sql select tagname from st_bool_11 -if $data00 != 0 then - print ==12== expect: 0, actually: $data00 +sql show tags from st_bool_11 +if $data05 != false then + print ==12== expect: 0, actually: $data05 return -1 endi sql create table st_bool_12 using mt_bool tags (0) -sql select tagname from st_bool_12 -if $data00 != 0 then - print ==13== expect: 0, actually: $data00 +sql show tags from st_bool_12 +if $data05 != false then + print ==13== expect: 0, actually: $data05 return -1 endi sql create table st_bool_13 using mt_bool tags (1) -sql select tagname from st_bool_13 -if $data00 != 1 then - print ==14== expect: 1, actually: $data00 +sql show tags from st_bool_13 +if $data05 != true then + print ==14== expect: 1, actually: $data05 return -1 endi sql create table st_bool_14 using mt_bool tags (6.9) -sql select tagname from st_bool_14 -if $data00 != 1 then - print ==15== expect: 1, actually: $data00 +sql show tags from st_bool_14 +if $data05 != true then + print ==15== expect: 1, actually: $data05 return -1 endi sql create table st_bool_15 using mt_bool tags (-3) -sql select tagname from st_bool_15 -if $data00 != 1 then +sql show tags from st_bool_15 +if $data05 != true then print ==16== expect: 1, actually: $data00 return -1 endi sql create table st_bool_15_0 using mt_bool tags (+300) -sql select tagname from st_bool_15_0 -if $data00 != 1 then +sql show tags from st_bool_15_0 +if $data05 != true then print ==16== expect: 1, actually: $data00 return -1 endi sql create table st_bool_15_1 using mt_bool tags (-8.03) -sql select tagname from st_bool_15_1 -if $data00 != 1 then +sql show tags from st_bool_15_1 +if $data05 != true then print ==16== expect: 1, actually: $data00 return -1 endi @@ -284,8 +291,8 @@ endi ## case 02: dynamic create table for test tag values sql insert into st_bool_16 using mt_bool tags (NULL) values (now, NULL) -sql select tagname from st_bool_16 -if $data00 != NULL then +sql show tags from st_bool_16 +if $data05 != NULL then print ==33== expect: NULL, actually: $data00 return -1 endi @@ -296,8 +303,8 @@ if $data01 != NULL then endi sql insert into st_bool_17 using mt_bool tags (NULL) values (now, NULL) -sql select tagname from st_bool_17 -if $data00 != NULL then +sql show tags from st_bool_17 +if $data05 != NULL then print ==35== expect: NULL, actually: $data00 return -1 endi @@ -307,8 +314,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bool_18 using mt_bool tags ('NULL') values (now, 'NULL') -sql select tagname from st_bool_18 -if $data00 != NULL then +sql show tags from st_bool_18 +if $data05 != NULL then print ==37== expect: NULL, actually: $data00 return -1 endi @@ -318,8 +325,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bool_19 using mt_bool tags ('NULL') values (now, 'NULL') -sql select tagname from st_bool_19 -if $data00 != NULL then +sql show tags from st_bool_19 +if $data05 != NULL then print ==39== expect: NULL, actually: $data00 return -1 endi @@ -329,8 +336,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bool_20 using mt_bool tags ("NULL") values (now, "NULL") -sql select tagname from st_bool_20 -if $data00 != NULL then +sql show tags from st_bool_20 +if $data05 != NULL then print ==41== expect: NULL, actually: $data00 return -1 endi @@ -340,8 +347,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bool_21 using mt_bool tags ("NULL") values (now, "NULL") -sql select tagname from st_bool_21 -if $data00 != NULL then +sql show tags from st_bool_21 +if $data05 != NULL then print ==43== expect: NULL, actually: $data00 return -1 endi @@ -351,8 +358,8 @@ if $data01 != NULL then return -1 endi sql insert into st_bool_22 using mt_bool tags ("true") values (now, "true") -sql select tagname from st_bool_22 -if $data00 != 1 then +sql show tags from st_bool_22 +if $data05 != true then print ==45== expect: 1, actually: $data00 return -1 endi @@ -362,8 +369,8 @@ if $data01 != 1 then return -1 endi sql insert into st_bool_23 using mt_bool tags ('true') values (now, 'true') -sql select tagname from st_bool_23 -if $data00 != 1 then +sql show tags from st_bool_23 +if $data05 != true then print ==47== expect: 1, actually: $data00 return -1 endi @@ -373,8 +380,8 @@ if $data01 != 1 then return -1 endi sql insert into st_bool_24 using mt_bool tags (true) values (now, true) -sql select tagname from st_bool_24 -if $data00 != 1 then +sql show tags from st_bool_24 +if $data05 != true then print ==49== expect: 1, actually: $data00 return -1 endi @@ -384,8 +391,8 @@ if $data01 != 1 then return -1 endi sql insert into st_bool_25 using mt_bool tags ("false") values (now, "false") -sql select tagname from st_bool_25 -if $data00 != 0 then +sql show tags from st_bool_25 +if $data05 != false then print ==51== expect: 0, actually: $data00 return -1 endi @@ -395,8 +402,8 @@ if $data01 != 0 then return -1 endi sql insert into st_bool_26 using mt_bool tags ('false') values (now, 'false') -sql select tagname from st_bool_26 -if $data00 != 0 then +sql show tags from st_bool_26 +if $data05 != false then print ==53== expect: 0, actually: $data00 return -1 endi @@ -406,8 +413,8 @@ if $data01 != 0 then return -1 endi sql insert into st_bool_27 using mt_bool tags (false) values (now, false) -sql select tagname from st_bool_27 -if $data00 != 0 then +sql show tags from st_bool_27 +if $data05 != false then print ==55== expect: 0, actually: $data00 return -1 endi @@ -417,8 +424,8 @@ if $data01 != 0 then return -1 endi sql insert into st_bool_28 using mt_bool tags (0) values (now, 0) -sql select tagname from st_bool_28 -if $data00 != 0 then +sql show tags from st_bool_28 +if $data05 != false then print ==57== expect: 0, actually: $data00 return -1 endi @@ -428,8 +435,8 @@ if $data01 != 0 then return -1 endi sql insert into st_bool_29 using mt_bool tags (1) values (now, 1) -sql select tagname from st_bool_29 -if $data00 != 1 then +sql show tags from st_bool_29 +if $data05 != true then print ==59== expect: 1, actually: $data00 return -1 endi @@ -439,8 +446,8 @@ if $data01 != 1 then return -1 endi sql insert into st_bool_30 using mt_bool tags (6.9) values (now, 6.9) -sql select tagname from st_bool_30 -if $data00 != 1 then +sql show tags from st_bool_30 +if $data05 != true then print ==61== expect: 1, actually: $data00 return -1 endi @@ -450,8 +457,8 @@ if $data01 != 1 then return -1 endi sql insert into st_bool_31 using mt_bool tags (-3) values (now, -3) -sql select tagname from st_bool_31 -if $data00 != 1 then +sql show tags from st_bool_31 +if $data05 != true then print ==63== expect: 1, actually: $data00 return -1 endi @@ -461,8 +468,8 @@ if $data01 != 1 then return -1 endi sql insert into st_bool_32 using mt_bool tags (+300) values (now, +300) -sql select tagname from st_bool_32 -if $data00 != 1 then +sql show tags from st_bool_32 +if $data05 != true then print ==63== expect: 1, actually: $data00 return -1 endi @@ -472,8 +479,8 @@ if $data01 != 1 then return -1 endi sql insert into st_bool_33 using mt_bool tags (+30.890) values (now, +30.890) -sql select tagname from st_bool_33 -if $data00 != 1 then +sql show tags from st_bool_33 +if $data05 != true then print ==63== expect: 1, actually: $data00 return -1 endi @@ -490,140 +497,140 @@ endi ## case 03: alter tag values #sql alter table st_bool_0 set tag tagname=true -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != true then # return -1 #endi #sql alter table st_bool_0 set tag tagname=NULL -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != NULL then # return -1 #endi #sql alter table st_bool_0 set tag tagname=false -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != false then # return -1 #endi #sql alter table st_bool_0 set tag tagname=NULL -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != NULL then # return -1 #endi #sql alter table st_bool_0 set tag tagname='true' -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != true then # return -1 #endi #sql alter table st_bool_0 set tag tagname='NULL' -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != NULL then # return -1 #endi #sql alter table st_bool_0 set tag tagname='false' -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != false then # return -1 #endi #sql alter table st_bool_0 set tag tagname='NULL' -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != NULL then # return -1 #endi #sql alter table st_bool_0 set tag tagname="true" -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != true then # return -1 #endi #sql alter table st_bool_0 set tag tagname="NULL" -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != NULL then # return -1 #endi #sql alter table st_bool_0 set tag tagname="false" -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != false then # return -1 #endi #sql alter table st_bool_0 set tag tagname="NULL" -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != NULL then # return -1 #endi #sql alter table st_bool_0 set tag tagname=1 -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != true then # return -1 #endi #sql alter table st_bool_0 set tag tagname=0 -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != false then # return -1 #endi #sql alter table st_bool_0 set tag tagname=6.9 -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != true then # return -1 #endi #sql alter table st_bool_0 set tag tagname=-3 -#sql select tagname from st_bool_0 +#sql show tags from st_bool_0 #if $data00 != true then # return -1 #endi # case 04: illegal input sql_error create table st_bool_e0 using mt_bool tags (123abc) -sql_error create table st_bool_e1 using mt_bool tags ("123abc") -sql_error create table st_bool_e2 using mt_bool tags ("123") +sql create table st_bool_e1 using mt_bool tags ("123abc") +sql create table st_bool_e2 using mt_bool tags ("123") sql_error create table st_bool_e3 using mt_bool tags (abc) -sql_error create table st_bool_e4 using mt_bool tags ("abc") -sql_error create table st_bool_e5 using mt_bool tags (" ") -sql_error create table st_bool_e6 using mt_bool tags ('') +sql create table st_bool_e4 using mt_bool tags ("abc") +sql create table st_bool_e5 using mt_bool tags (" ") +sql create table st_bool_e6 using mt_bool tags ('') -sql create table st_bool_e0 using mt_bool tags (true) -sql create table st_bool_e1 using mt_bool tags (true) -sql create table st_bool_e2 using mt_bool tags (true) -sql create table st_bool_e3 using mt_bool tags (true) -sql create table st_bool_e4 using mt_bool tags (true) -sql create table st_bool_e5 using mt_bool tags (true) -sql create table st_bool_e6 using mt_bool tags (true) +sql create table st_bool_f0 using mt_bool tags (true) +sql create table st_bool_f1 using mt_bool tags (true) +sql create table st_bool_f2 using mt_bool tags (true) +sql create table st_bool_f3 using mt_bool tags (true) +sql create table st_bool_f4 using mt_bool tags (true) +sql create table st_bool_f5 using mt_bool tags (true) +sql create table st_bool_f6 using mt_bool tags (true) -sql_error insert into st_bool_e0 values (now, 123abc) -sql_error insert into st_bool_e1 values (now, "123abc") -sql_error insert into st_bool_e2 values (now, "123") -sql_error insert into st_bool_e3 values (now, abc) -sql_error insert into st_bool_e4 values (now, "abc") -sql_error insert into st_bool_e5 values (now, " ") -sql_error insert into st_bool_e6 values (now, '') +sql_error insert into st_bool_g0 values (now, 123abc) +sql_error insert into st_bool_g1 values (now, "123abc") +sql_error insert into st_bool_g2 values (now, "123") +sql_error insert into st_bool_g3 values (now, abc) +sql_error insert into st_bool_g4 values (now, "abc") +sql_error insert into st_bool_g5 values (now, " ") +sql_error insert into st_bool_g6 values (now, '') -sql_error insert into st_bool_e10 using mt_bool tags (123abc) values (now, 1) -sql_error insert into st_bool_e11 using mt_bool tags ("123abc") values (now, 1) -sql_error insert into st_bool_e12 using mt_bool tags ("123") values (now, 1) -sql_error insert into st_bool_e13 using mt_bool tags (abc) values (now, 1) -sql_error insert into st_bool_e14 using mt_bool tags ("abc") values (now, 1) -sql_error insert into st_bool_e15 using mt_bool tags (" ") values (now, 1) -sql_error insert into st_bool_e16 using mt_bool tags ('') values (now, 1) +sql_error insert into st_bool_h0 using mt_bool tags (123abc) values (now, 1) +sql_error insert into st_bool_h1 using mt_bool tags ("123abc") values (now, 1) +sql_error insert into st_bool_h2 using mt_bool tags ("123") values (now, 1) +sql_error insert into st_bool_h3 using mt_bool tags (abc) values (now, 1) +sql_error insert into st_bool_h4 using mt_bool tags ("abc") values (now, 1) +sql_error insert into st_bool_h5 using mt_bool tags (" ") values (now, 1) +sql_error insert into st_bool_h6 using mt_bool tags ('') values (now, 1) -sql_error insert into st_bool_e17 using mt_bool tags (1) values (now, 123abc) -sql_error insert into st_bool_e18 using mt_bool tags (1) values (now, "123abc") -sql_error insert into st_bool_e19 using mt_bool tags (1) values (now, "123") -sql_error insert into st_bool_e20 using mt_bool tags (1) values (now, abc) -sql_error insert into st_bool_e21 using mt_bool tags (1) values (now, "abc") -sql_error insert into st_bool_e22 using mt_bool tags (1) values (now, " ") -sql_error insert into st_bool_e23 using mt_bool tags (1) values (now, '') +sql_error insert into st_bool_h0 using mt_bool tags (1) values (now, 123abc) +sql_error insert into st_bool_h1 using mt_bool tags (1) values (now, "123abc") +sql_error insert into st_bool_h2 using mt_bool tags (1) values (now, "123") +sql_error insert into st_bool_h3 using mt_bool tags (1) values (now, abc) +sql_error insert into st_bool_h4 using mt_bool tags (1) values (now, "abc") +sql_error insert into st_bool_h5 using mt_bool tags (1) values (now, " ") +sql_error insert into st_bool_h6 using mt_bool tags (1) values (now, '') -sql insert into st_bool_e10 using mt_bool tags (1) values (now, 1) -sql insert into st_bool_e11 using mt_bool tags (1) values (now, 1) -sql insert into st_bool_e12 using mt_bool tags (1) values (now, 1) -sql insert into st_bool_e13 using mt_bool tags (1) values (now, 1) -sql insert into st_bool_e14 using mt_bool tags (1) values (now, 1) -sql insert into st_bool_e15 using mt_bool tags (1) values (now, 1) -sql insert into st_bool_e16 using mt_bool tags (1) values (now, 1) +sql insert into st_bool_i0 using mt_bool tags (1) values (now, 1) +sql insert into st_bool_i1 using mt_bool tags (1) values (now, 1) +sql insert into st_bool_i2 using mt_bool tags (1) values (now, 1) +sql insert into st_bool_i3 using mt_bool tags (1) values (now, 1) +sql insert into st_bool_i4 using mt_bool tags (1) values (now, 1) +sql insert into st_bool_i5 using mt_bool tags (1) values (now, 1) +sql insert into st_bool_i6 using mt_bool tags (1) values (now, 1) -sql_error alter table st_bool_e10 set tag tagname=123abc -sql_error alter table st_bool_e11 set tag tagname="123abc" -sql_error alter table st_bool_e12 set tag tagname="123" -sql_error alter table st_bool_e13 set tag tagname=abc -sql_error alter table st_bool_e14 set tag tagname="abc" -sql_error alter table st_bool_e15 set tag tagname=" " -sql_error alter table st_bool_e16 set tag tagname='' +sql_error alter table st_bool_i0 set tag tagname=123abc +sql alter table st_bool_i1 set tag tagname="123abc" +sql alter table st_bool_i2 set tag tagname="123" +sql_error alter table st_bool_i3 set tag tagname=abc +sql alter table st_bool_i4 set tag tagname="abc" +sql alter table st_bool_i5 set tag tagname=" " +sql alter table st_bool_i6 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_double.sim b/tests/script/tsim/parser/columnValue_double.sim index c7ba7b0048..dae64735ea 100644 --- a/tests/script/tsim/parser/columnValue_double.sim +++ b/tests/script/tsim/parser/columnValue_double.sim @@ -1,5 +1,12 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create database if not exists db + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db sql use db #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value @@ -10,135 +17,135 @@ sql create table mt_double (ts timestamp, c double) tags (tagname double) ## case 00: static create table for test tag values sql create table st_double_0 using mt_double tags (NULL ) -sql select tagname from st_double_0 -if $data00 != NULL then +sql show tags from st_double_0 +if $data05 != NULL then return -1 endi sql create table st_double_1 using mt_double tags (NULL) -sql select tagname from st_double_1 -if $data00 != NULL then +sql show tags from st_double_1 +if $data05 != NULL then return -1 endi sql create table st_double_2 using mt_double tags ('NULL') -sql select tagname from st_double_2 -if $data00 != NULL then +sql show tags from st_double_2 +if $data05 != 0.000000000 then return -1 endi sql create table st_double_3 using mt_double tags ('NULL') -sql select tagname from st_double_3 -if $data00 != NULL then +sql show tags from st_double_3 +if $data05 != 0.000000000 then return -1 endi sql create table st_double_4 using mt_double tags ("NULL") -sql select tagname from st_double_4 -if $data00 != NULL then +sql show tags from st_double_4 +if $data05 != 0.000000000 then return -1 endi sql create table st_double_5 using mt_double tags ("NULL") -sql select tagname from st_double_5 -if $data00 != NULL then +sql show tags from st_double_5 +if $data05 != 0.000000000 then return -1 endi sql create table st_double_6 using mt_double tags (-123.321) -sql select tagname from st_double_6 -if $data00 != -123.321000000 then - print expect -123.321000000, actual: $data00 +sql show tags from st_double_6 +if $data05 != -123.321000000 then + print expect -123.321000000, actual: $data05 return -1 endi sql create table st_double_7 using mt_double tags (+1.567) -sql select tagname from st_double_7 -if $data00 != 1.567000000 then +sql show tags from st_double_7 +if $data05 != 1.567000000 then return -1 endi sql create table st_double_8 using mt_double tags (379.001) -sql select tagname from st_double_8 -if $data00 != 379.001000000 then +sql show tags from st_double_8 +if $data05 != 379.001000000 then return -1 endi sql create table st_double_9 using mt_double tags (1.5e+3) -sql select tagname from st_double_9 -if $data00 != 1500.000000000 then +sql show tags from st_double_9 +if $data05 != 1500.000000000 then return -1 endi sql create table st_double_10 using mt_double tags (-1.5e-3) -sql select tagname from st_double_10 -if $data00 != -0.001500000 then +sql show tags from st_double_10 +if $data05 != -0.001500000 then return -1 endi sql create table st_double_11 using mt_double tags (+1.5e+3) -sql select tagname from st_double_11 -if $data00 != 1500.000000000 then +sql show tags from st_double_11 +if $data05 != 1500.000000000 then return -1 endi sql create table st_double_12 using mt_double tags (-1.5e+3) -sql select tagname from st_double_12 -if $data00 != -1500.000000000 then +sql show tags from st_double_12 +if $data05 != -1500.000000000 then return -1 endi sql create table st_double_13 using mt_double tags (1.5e-3) -sql select tagname from st_double_13 -if $data00 != 0.001500000 then +sql show tags from st_double_13 +if $data05 != 0.001500000 then return -1 endi sql create table st_double_14 using mt_double tags (1.5E-3) -sql select tagname from st_double_14 -if $data00 != 0.001500000 then +sql show tags from st_double_14 +if $data05 != 0.001500000 then return -1 endi sql create table st_double_6_0 using mt_double tags ('-123.321') -sql select tagname from st_double_6_0 -if $data00 != -123.321000000 then +sql show tags from st_double_6_0 +if $data05 != -123.321000000 then return -1 endi sql create table st_double_7_0 using mt_double tags ('+1.567') -sql select tagname from st_double_7_0 -if $data00 != 1.567000000 then +sql show tags from st_double_7_0 +if $data05 != 1.567000000 then return -1 endi sql create table st_double_8_0 using mt_double tags ('379.001') -sql select tagname from st_double_8_0 -if $data00 != 379.001000000 then +sql show tags from st_double_8_0 +if $data05 != 379.001000000 then return -1 endi sql create table st_double_9_0 using mt_double tags ('1.5e+3') -sql select tagname from st_double_9_0 -if $data00 != 1500.000000000 then +sql show tags from st_double_9_0 +if $data05 != 1500.000000000 then return -1 endi sql create table st_double_10_0 using mt_double tags ('-1.5e-3') -sql select tagname from st_double_10_0 -if $data00 != -0.001500000 then +sql show tags from st_double_10_0 +if $data05 != -0.001500000 then return -1 endi sql create table st_double_11_0 using mt_double tags ('+1.5e+3') -sql select tagname from st_double_11_0 -if $data00 != 1500.000000000 then +sql show tags from st_double_11_0 +if $data05 != 1500.000000000 then return -1 endi sql create table st_double_12_0 using mt_double tags ('-1.5e+3') -sql select tagname from st_double_12_0 -if $data00 != -1500.000000000 then +sql show tags from st_double_12_0 +if $data05 != -1500.000000000 then return -1 endi sql create table st_double_13_0 using mt_double tags ('1.5e-3') -sql select tagname from st_double_13_0 -if $data00 != 0.001500000 then +sql show tags from st_double_13_0 +if $data05 != 0.001500000 then return -1 endi sql create table st_double_14_0 using mt_double tags ('1.5E-3') -sql select tagname from st_double_14_0 -if $data00 != 0.001500000 then +sql show tags from st_double_14_0 +if $data05 != 0.001500000 then return -1 endi sql create table st_double_15_0 using mt_double tags (1.7976931348623157e+308) -sql select tagname from st_double_15_0 -#if $data00 != 0.001500000 then +sql show tags from st_double_15_0 +#if $data05 != 0.001500000 then # return -1 #endi sql create table st_double_16_0 using mt_double tags (-1.7976931348623157e+308) -sql select tagname from st_double_16_0 -#if $data00 != 0.001500000 then +sql show tags from st_double_16_0 +#if $data05 != 0.001500000 then # return -1 #endi @@ -270,8 +277,8 @@ endi ## case 02: dynamic create table for test tag values sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL ) -sql select tagname from st_double_16 -if $data00 != NULL then +sql show tags from st_double_16 +if $data05 != NULL then return -1 endi sql select * from st_double_16 @@ -280,8 +287,8 @@ if $data01 != NULL then endi sql insert into st_double_17 using mt_double tags (NULL) values (now, NULL) -sql select tagname from st_double_17 -if $data00 != NULL then +sql show tags from st_double_17 +if $data05 != NULL then return -1 endi sql select * from st_double_17 @@ -289,8 +296,8 @@ if $data01 != NULL then return -1 endi sql insert into st_double_18 using mt_double tags ('NULL') values (now, 'NULL') -sql select tagname from st_double_18 -if $data00 != NULL then +sql show tags from st_double_18 +if $data05 != NULL then return -1 endi sql select * from st_double_18 @@ -298,8 +305,8 @@ if $data01 != NULL then return -1 endi sql insert into st_double_19 using mt_double tags ('NULL') values (now, 'NULL') -sql select tagname from st_double_19 -if $data00 != NULL then +sql show tags from st_double_19 +if $data05 != NULL then return -1 endi sql select * from st_double_19 @@ -307,8 +314,8 @@ if $data01 != NULL then return -1 endi sql insert into st_double_20 using mt_double tags ("NULL") values (now, "NULL") -sql select tagname from st_double_20 -if $data00 != NULL then +sql show tags from st_double_20 +if $data05 != NULL then return -1 endi sql select * from st_double_20 @@ -316,8 +323,8 @@ if $data01 != NULL then return -1 endi sql insert into st_double_21 using mt_double tags ("NULL") values (now, "NULL") -sql select tagname from st_double_21 -if $data00 != NULL then +sql show tags from st_double_21 +if $data05 != NULL then return -1 endi sql select * from st_double_21 @@ -325,8 +332,8 @@ if $data01 != NULL then return -1 endi sql insert into st_double_22 using mt_double tags (127) values (now, 1.7976931348623157e+308) -sql select tagname from st_double_22 -#if $data00 != 127 then +sql show tags from st_double_22 +#if $data05 != 127 then # return -1 #endi sql select * from st_double_22 @@ -334,8 +341,8 @@ sql select * from st_double_22 # return -1 #endi sql insert into st_double_23 using mt_double tags (-127) values (now, -1.7976931348623157e+308) -sql select tagname from st_double_23 -#if $data00 != -127 then +sql show tags from st_double_23 +#if $data05 != -127 then # return -1 #endi sql select * from st_double_23 @@ -343,8 +350,8 @@ sql select * from st_double_23 # return -1 #endi sql insert into st_double_24 using mt_double tags (10) values (now, 10) -sql select tagname from st_double_24 -#if $data00 != 10 then +sql show tags from st_double_24 +#if $data05 != 10 then # return -1 #endi sql select * from st_double_24 @@ -352,8 +359,8 @@ sql select * from st_double_24 # return -1 #endi sql insert into st_double_25 using mt_double tags ("-0") values (now, "-0") -sql select tagname from st_double_25 -#if $data00 != 0 then +sql show tags from st_double_25 +#if $data05 != 0 then # return -1 #endi sql select * from st_double_25 @@ -361,8 +368,8 @@ sql select * from st_double_25 # return -1 #endi sql insert into st_double_26 using mt_double tags ('123') values (now, '12.3') -sql select tagname from st_double_26 -#if $data00 != 123 then +sql show tags from st_double_26 +#if $data05 != 123 then # return -1 #endi sql select * from st_double_26 @@ -370,8 +377,8 @@ sql select * from st_double_26 # return -1 #endi sql insert into st_double_27 using mt_double tags (+056) values (now, +0005.6) -sql select tagname from st_double_27 -#if $data00 != 56 then +sql show tags from st_double_27 +#if $data05 != 56 then # return -1 #endi sql select * from st_double_27 @@ -379,8 +386,8 @@ sql select * from st_double_27 # return -1 #endi sql insert into st_double_28 using mt_double tags (-056) values (now, -005.6) -sql select tagname from st_double_28 -#if $data00 != -56 then +sql show tags from st_double_28 +#if $data05 != -56 then # return -1 #endi sql select * from st_double_28 @@ -390,43 +397,43 @@ sql select * from st_double_28 ### case 03: alter tag values #sql alter table st_double_0 set tag tagname=1.7976931348623157e+308 -#sql select tagname from st_double_0 -##if $data00 != 127 then +#sql show tags from st_double_0 +##if $data05 != 127 then ## return -1 ##endi #sql alter table st_double_0 set tag tagname=-1.7976931348623157e+308 -#sql select tagname from st_double_0 -##if $data00 != -127 then +#sql show tags from st_double_0 +##if $data05 != -127 then ## return -1 ##endi #sql alter table st_double_0 set tag tagname=+10.340 -#sql select tagname from st_double_0 -##if $data00 != 100 then +#sql show tags from st_double_0 +##if $data05 != 100 then ## return -1 ##endi #sql alter table st_double_0 set tag tagname=-33.87 -#sql select tagname from st_double_0 -##if $data00 != -33 then +#sql show tags from st_double_0 +##if $data05 != -33 then ## return -1 ##endi #sql alter table st_double_0 set tag tagname='+9.8' -#sql select tagname from st_double_0 -##if $data00 != 98 then +#sql show tags from st_double_0 +##if $data05 != 98 then ## return -1 ##endi #sql alter table st_double_0 set tag tagname='-07.6' -#sql select tagname from st_double_0 -##if $data00 != -76 then +#sql show tags from st_double_0 +##if $data05 != -76 then ## return -1 ##endi #sql alter table st_double_0 set tag tagname=+0012.871 -#sql select tagname from st_double_0 -##if $data00 != 12 then +#sql show tags from st_double_0 +##if $data05 != 12 then ## return -1 ##endi #sql alter table st_double_0 set tag tagname=-00063.582 -#sql select tagname from st_double_0 -##if $data00 != -63 then +#sql show tags from st_double_0 +##if $data05 != -63 then ## return -1 ##endi @@ -438,11 +445,11 @@ sql_error create table st_double_e0 using mt_double tags (-31.7976931348623157e+ #sql_error create table st_double_e0 using mt_double tags (12.80) truncate integer part #sql_error create table st_double_e0 using mt_double tags (-11.80) sql_error create table st_double_e0 using mt_double tags (123abc) -sql_error create table st_double_e0 using mt_double tags ("123abc") +sql create table st_double_e0_1 using mt_double tags ("123abc") sql_error create table st_double_e0 using mt_double tags (abc) -sql_error create table st_double_e0 using mt_double tags ("abc") -sql_error create table st_double_e0 using mt_double tags (" ") -sql_error create table st_double_e0 using mt_double tags ('') +sql create table st_double_e0_2 using mt_double tags ("abc") +sql create table st_double_e0_3 using mt_double tags (" ") +sql create table st_double_e0_4 using mt_double tags ('') sql create table st_double_e0 using mt_double tags (123) sql create table st_double_e1 using mt_double tags (123) @@ -469,7 +476,7 @@ sql_error insert into st_double_e7 values (now, "123abc") sql_error insert into st_double_e9 values (now, abc) sql_error insert into st_double_e10 values (now, "abc") sql_error insert into st_double_e11 values (now, " ") -sql_error insert into st_double_e12 values (now, '') +sql insert into st_double_e12 values (now, '') sql_error insert into st_double_e13 using mt_double tags (033) values (now, 11.7976931348623157e+308) sql_error insert into st_double_e14 using mt_double tags (033) values (now, -11.7976931348623157e+308) @@ -482,7 +489,7 @@ sql_error insert into st_double_e20 using mt_double tags (033) values (now, "123 sql_error insert into st_double_e22 using mt_double tags (033) values (now, abc) sql_error insert into st_double_e23 using mt_double tags (033) values (now, "abc") sql_error insert into st_double_e24 using mt_double tags (033) values (now, " ") -sql_error insert into st_double_e25 using mt_double tags (033) values (now, '') +sql insert into st_double_e25_1 using mt_double tags (033) values (now, '') sql_error insert into st_double_e13 using mt_double tags (31.7976931348623157e+308) values (now, -033) sql_error insert into st_double_e14 using mt_double tags (-31.7976931348623157e+308) values (now, -033) @@ -495,7 +502,7 @@ sql_error insert into st_double_e20 using mt_double tags ("123abc") values (now, sql_error insert into st_double_e22 using mt_double tags (abc) values (now, -033) sql_error insert into st_double_e23 using mt_double tags ("abc") values (now, -033) sql_error insert into st_double_e24 using mt_double tags (" ") values (now, -033) -sql_error insert into st_double_e25 using mt_double tags ('') values (now, -033) +sql insert into st_double_e25 using mt_double tags ('') values (now, -033) sql insert into st_double_e13 using mt_double tags (033) values (now, 00062) sql insert into st_double_e14 using mt_double tags (033) values (now, 00062) @@ -516,8 +523,8 @@ sql_error alter table st_double_e14 set tag tagname=-1.8976931348623157e+308 sql_error alter table st_double_e15 set tag tagname=131.7976931348623157e+308 sql_error alter table st_double_e16 set tag tagname=-131.7976931348623157e+308 sql_error alter table st_double_e19 set tag tagname=123abc -sql_error alter table st_double_e20 set tag tagname="123abc" +sql alter table st_double_e20 set tag tagname="123abc" sql_error alter table st_double_e22 set tag tagname=abc -sql_error alter table st_double_e23 set tag tagname="abc" -sql_error alter table st_double_e24 set tag tagname=" " -sql_error alter table st_double_e25 set tag tagname='' +sql alter table st_double_e23 set tag tagname="abc" +sql alter table st_double_e24 set tag tagname=" " +sql alter table st_double_e25 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_float.sim b/tests/script/tsim/parser/columnValue_float.sim index 8fca0d4671..9b0ca4b186 100644 --- a/tests/script/tsim/parser/columnValue_float.sim +++ b/tests/script/tsim/parser/columnValue_float.sim @@ -1,5 +1,12 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create database if not exists db + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db sql use db #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value @@ -10,152 +17,152 @@ sql create table mt_float (ts timestamp, c float) tags (tagname float) ## case 00: static create table for test tag values sql create table st_float_0 using mt_float tags (NULL) -sql select tagname from st_float_0 -if $data00 != NULL then +sql show tags from st_float_0 +if $data05 != NULL then return -1 endi sql create table st_float_1 using mt_float tags (NULL) -sql select tagname from st_float_1 -if $data00 != NULL then +sql show tags from st_float_1 +if $data05 != NULL then return -1 endi sql create table st_float_2 using mt_float tags ('NULL') -sql select tagname from st_float_2 -if $data00 != NULL then +sql show tags from st_float_2 +if $data05 != 0.00000 then return -1 endi sql create table st_float_3 using mt_float tags ('NULL') -sql select tagname from st_float_3 -if $data00 != NULL then +sql show tags from st_float_3 +if $data05 != 0.00000 then return -1 endi sql create table st_float_4 using mt_float tags ("NULL") -sql select tagname from st_float_4 -if $data00 != NULL then +sql show tags from st_float_4 +if $data05 != 0.00000 then return -1 endi sql create table st_float_5 using mt_float tags ("NULL") -sql select tagname from st_float_5 -if $data00 != NULL then +sql show tags from st_float_5 +if $data05 != 0.00000 then return -1 endi sql create table st_float_6 using mt_float tags (-123.321) -sql select tagname from st_float_6 -if $data00 != -123.32100 then - print expect -123.32100, actual: $data00 +sql show tags from st_float_6 +if $data05 != -123.32100 then + print expect -123.32100, actual: $data05 return -1 endi sql create table st_float_7 using mt_float tags (+1.567) -sql select tagname from st_float_7 -if $data00 != 1.56700 then - print expect 1.56700, actual: $data00 +sql show tags from st_float_7 +if $data05 != 1.56700 then + print expect 1.56700, actual: $data05 return -1 endi sql create table st_float_8 using mt_float tags (379.001) -sql select tagname from st_float_8 -if $data00 != 379.00101 then - print expect 379.00101, actual: $data00 +sql show tags from st_float_8 +if $data05 != 379.00101 then + print expect 379.00101, actual: $data05 return -1 endi sql create table st_float_9 using mt_float tags (1.5e+3) -sql select tagname from st_float_9 -if $data00 != 1500.00000 then - print expect 1500.00000, actual: $data00 +sql show tags from st_float_9 +if $data05 != 1500.00000 then + print expect 1500.00000, actual: $data05 return -1 endi sql create table st_float_10 using mt_float tags (-1.5e-3) -sql select tagname from st_float_10 -if $data00 != -0.00150 then - print expect -0.00150, actual: $data00 +sql show tags from st_float_10 +if $data05 != -0.00150 then + print expect -0.00150, actual: $data05 return -1 endi sql create table st_float_11 using mt_float tags (+1.5e+3) -sql select tagname from st_float_11 -if $data00 != 1500.00000 then - print expect 1500.00000, actual: $data00 +sql show tags from st_float_11 +if $data05 != 1500.00000 then + print expect 1500.00000, actual: $data05 return -1 endi sql create table st_float_12 using mt_float tags (-1.5e+3) -sql select tagname from st_float_12 -if $data00 != -1500.00000 then - print expect -1500.00000, actual: $data00 +sql show tags from st_float_12 +if $data05 != -1500.00000 then + print expect -1500.00000, actual: $data05 return -1 endi sql create table st_float_13 using mt_float tags (1.5e-3) -sql select tagname from st_float_13 -if $data00 != 0.00150 then - print expect 0.00150, actual: $data00 +sql show tags from st_float_13 +if $data05 != 0.00150 then + print expect 0.00150, actual: $data05 return -1 endi sql create table st_float_14 using mt_float tags (1.5E-3) -sql select tagname from st_float_14 -if $data00 != 0.00150 then - print expect 0.00150, actual: $data00 +sql show tags from st_float_14 +if $data05 != 0.00150 then + print expect 0.00150, actual: $data05 return -1 endi sql create table st_float_6_0 using mt_float tags ('-123.321') -sql select tagname from st_float_6_0 -if $data00 != -123.32100 then - print expect -123.32100, actual: $data00 +sql show tags from st_float_6_0 +if $data05 != -123.32100 then + print expect -123.32100, actual: $data05 return -1 endi sql create table st_float_7_0 using mt_float tags ('+1.567') -sql select tagname from st_float_7_0 -if $data00 != 1.56700 then - print expect 1.56700, actual: $data00 +sql show tags from st_float_7_0 +if $data05 != 1.56700 then + print expect 1.56700, actual: $data05 return -1 endi sql create table st_float_8_0 using mt_float tags ('379.001') -sql select tagname from st_float_8_0 -if $data00 != 379.00101 then - print expect 379.00101, actual: $data00 +sql show tags from st_float_8_0 +if $data05 != 379.00101 then + print expect 379.00101, actual: $data05 return -1 endi sql create table st_float_9_0 using mt_float tags ('1.5e+3') -sql select tagname from st_float_9_0 -if $data00 != 1500.00000 then - print expect 1500.00000, actual: $data00 +sql show tags from st_float_9_0 +if $data05 != 1500.00000 then + print expect 1500.00000, actual: $data05 return -1 endi sql create table st_float_10_0 using mt_float tags ('-1.5e-3') -sql select tagname from st_float_10_0 -if $data00 != -0.00150 then - print expect -0.00150, actual: $data00 +sql show tags from st_float_10_0 +if $data05 != -0.00150 then + print expect -0.00150, actual: $data05 return -1 endi sql create table st_float_11_0 using mt_float tags ('+1.5e+3') -sql select tagname from st_float_11_0 -if $data00 != 1500.00000 then - print expect 1500.00000, actual: $data00 +sql show tags from st_float_11_0 +if $data05 != 1500.00000 then + print expect 1500.00000, actual: $data05 return -1 endi sql create table st_float_12_0 using mt_float tags ('-1.5e+3') -sql select tagname from st_float_12_0 -if $data00 != -1500.00000 then - print expect -1500.00000, actual: $data00 +sql show tags from st_float_12_0 +if $data05 != -1500.00000 then + print expect -1500.00000, actual: $data05 return -1 endi sql create table st_float_13_0 using mt_float tags ('1.5e-3') -sql select tagname from st_float_13_0 -if $data00 != 0.00150 then - print expect 0.00150, actual: $data00 +sql show tags from st_float_13_0 +if $data05 != 0.00150 then + print expect 0.00150, actual: $data05 return -1 endi sql create table st_float_14_0 using mt_float tags ('1.5E-3') -sql select tagname from st_float_14_0 -if $data00 != 0.00150 then - print expect 0.00150, actual: $data00 +sql show tags from st_float_14_0 +if $data05 != 0.00150 then + print expect 0.00150, actual: $data05 return -1 endi #sql create table st_float_15_0 using mt_float tags (3.40282347e+38) -#sql select tagname from st_float_15_0 -#if $data00 != 0.001500 then +#sql show tags from st_float_15_0 +#if $data05 != 0.001500 then # return -1 #endi #sql create table st_float_16_0 using mt_float tags (-3.40282347e+38) -#sql select tagname from st_float_16_0 -#if $data00 != 0.001500 then +#sql show tags from st_float_16_0 +#if $data05 != 0.001500 then # return -1 #endi @@ -292,8 +299,8 @@ endi ## case 02: dynamic create table for test tag values sql insert into st_float_16 using mt_float tags (NULL) values (now, NULL) -sql select tagname from st_float_16 -if $data00 != NULL then +sql show tags from st_float_16 +if $data05 != NULL then return -1 endi sql select * from st_float_16 @@ -302,8 +309,8 @@ if $data01 != NULL then endi sql insert into st_float_17 using mt_float tags (NULL) values (now, NULL) -sql select tagname from st_float_17 -if $data00 != NULL then +sql show tags from st_float_17 +if $data05 != NULL then return -1 endi sql select * from st_float_17 @@ -311,8 +318,8 @@ if $data01 != NULL then return -1 endi sql insert into st_float_18 using mt_float tags ('NULL') values (now, 'NULL') -sql select tagname from st_float_18 -if $data00 != NULL then +sql show tags from st_float_18 +if $data05 != NULL then return -1 endi sql select * from st_float_18 @@ -320,8 +327,8 @@ if $data01 != NULL then return -1 endi sql insert into st_float_19 using mt_float tags ('NULL') values (now, 'NULL') -sql select tagname from st_float_19 -if $data00 != NULL then +sql show tags from st_float_19 +if $data05 != NULL then return -1 endi sql select * from st_float_19 @@ -329,8 +336,8 @@ if $data01 != NULL then return -1 endi sql insert into st_float_20 using mt_float tags ("NULL") values (now, "NULL") -sql select tagname from st_float_20 -if $data00 != NULL then +sql show tags from st_float_20 +if $data05 != NULL then return -1 endi sql select * from st_float_20 @@ -338,8 +345,8 @@ if $data01 != NULL then return -1 endi sql insert into st_float_21 using mt_float tags ("NULL") values (now, "NULL") -sql select tagname from st_float_21 -if $data00 != NULL then +sql show tags from st_float_21 +if $data05 != NULL then return -1 endi sql select * from st_float_21 @@ -350,9 +357,9 @@ endi sql_error insert into st_float_22 using mt_float tags (127) values (now, 3.40282347e+38) sql insert into st_float_22 using mt_float tags (127) values (now, 340282346638528859811704183484516925440.00000) -sql select tagname from st_float_22 -if $data00 != 127.00000 then - print expect 127.00000, actual: $data00 +sql show tags from st_float_22 +if $data05 != 127.00000 then + print expect 127.00000, actual: $data05 return -1 endi @@ -362,14 +369,14 @@ if $data01 != 127.00000 then endi sql insert into st_float_23 using mt_float tags (-127) values (now, -340282346638528859811704183484516925440.00000) -sql select tagname from st_float_23 -if $data00 != -127.00000 then +sql show tags from st_float_23 +if $data05 != -127.00000 then return -1 endi sql insert into st_float_24 using mt_float tags (10) values (now, 10) -sql select tagname from st_float_24 -if $data00 != 10.00000 then +sql show tags from st_float_24 +if $data05 != 10.00000 then return -1 endi sql select * from st_float_24 @@ -378,9 +385,9 @@ if $data01 != 10.00000 then endi sql insert into st_float_25 using mt_float tags ("-0") values (now, "-0") -sql select tagname from st_float_25 -if $data00 != -0.00000 then - print expect -0.00000, actual: $data00 +sql show tags from st_float_25 +if $data05 != -0.00000 then + print expect -0.00000, actual: $data05 return -1 endi sql select * from st_float_25 @@ -388,9 +395,9 @@ if $data01 != -0.00000 then return -1 endi sql insert into st_float_26 using mt_float tags ('123') values (now, '12.3') -sql select tagname from st_float_26 -if $data00 != 123.00000 then - print expect 123.00000, actual: $data00 +sql show tags from st_float_26 +if $data05 != 123.00000 then + print expect 123.00000, actual: $data05 return -1 endi sql select * from st_float_26 @@ -398,9 +405,9 @@ if $data01 != 12.30000 then return -1 endi sql insert into st_float_27 using mt_float tags (+056) values (now, +0005.6) -sql select tagname from st_float_27 -if $data00 != 56.00000 then - print expect 56.00000, actual:$data00 +sql show tags from st_float_27 +if $data05 != 56.00000 then + print expect 56.00000, actual:$data05 return -1 endi sql select * from st_float_27 @@ -408,8 +415,8 @@ if $data01 != 5.60000 then return -1 endi sql insert into st_float_28 using mt_float tags (-056) values (now, -005.6) -sql select tagname from st_float_28 -if $data00 != -56.00000 then +sql show tags from st_float_28 +if $data05 != -56.00000 then return -1 endi sql select * from st_float_28 @@ -419,44 +426,44 @@ endi ### case 03: alter tag values sql alter table st_float_0 set tag tagname=340282346638528859811704183484516925440.00000 -sql select tagname from st_float_0 -if $data00 != 340282346638528859811704183484516925440.00000 then +sql show tags from st_float_0 +if $data05 != 340282346638528859811704183484516925440.00000 then return -1 endi sql alter table st_float_0 set tag tagname=-340282346638528859811704183484516925440.00000 -sql select tagname from st_float_0 -if $data00 != -340282346638528859811704183484516925440.00000 then +sql show tags from st_float_0 +if $data05 != -340282346638528859811704183484516925440.00000 then return -1 endi sql alter table st_float_0 set tag tagname=+10.340 -sql select tagname from st_float_0 -if $data00 != 10.34000 then +sql show tags from st_float_0 +if $data05 != 10.34000 then return -1 endi sql alter table st_float_0 set tag tagname=-33.87 -sql select tagname from st_float_0 -if $data00 != -33.87000 then +sql show tags from st_float_0 +if $data05 != -33.87000 then return -1 endi sql alter table st_float_0 set tag tagname='+9.8' -sql select tagname from st_float_0 -if $data00 != 9.80000 then +sql show tags from st_float_0 +if $data05 != 9.80000 then return -1 endi sql alter table st_float_0 set tag tagname='-07.6' -sql select tagname from st_float_0 -if $data00 != -7.60000 then +sql show tags from st_float_0 +if $data05 != -7.60000 then return -1 endi sql alter table st_float_0 set tag tagname=+0012.871 -sql select tagname from st_float_0 -if $data00 != 12.87100 then +sql show tags from st_float_0 +if $data05 != 12.87100 then return -1 endi sql alter table st_float_0 set tag tagname=-00063.582 -sql select tagname from st_float_0 -if $data00 != -63.58200 then +sql show tags from st_float_0 +if $data05 != -63.58200 then return -1 endi @@ -468,11 +475,11 @@ sql_error create table st_float_e0 using mt_float tags (-333.40282347e+38) #sql_error create table st_float_e0 using mt_float tags (12.80) truncate integer part #sql_error create table st_float_e0 using mt_float tags (-11.80) sql_error create table st_float_e0 using mt_float tags (123abc) -sql_error create table st_float_e0 using mt_float tags ("123abc") +sql create table st_float_e0_1 using mt_float tags ("123abc") sql_error create table st_float_e0 using mt_float tags (abc) -sql_error create table st_float_e0 using mt_float tags ("abc") -sql_error create table st_float_e0 using mt_float tags (" ") -sql_error create table st_float_e0 using mt_float tags ('') +sql create table st_float_e0_2 using mt_float tags ("abc") +sql create table st_float_e0_3 using mt_float tags (" ") +sql create table st_float_e0_4 using mt_float tags ('') sql create table st_float_e0 using mt_float tags (123) sql create table st_float_e1 using mt_float tags (123) @@ -499,7 +506,7 @@ sql_error insert into st_float_e7 values (now, "123abc") sql_error insert into st_float_e9 values (now, abc) sql_error insert into st_float_e10 values (now, "abc") sql_error insert into st_float_e11 values (now, " ") -sql_error insert into st_float_e12 values (now, '') +sql insert into st_float_e12 values (now, '') sql_error insert into st_float_e13 using mt_float tags (033) values (now, 3.50282347e+38) sql_error insert into st_float_e14 using mt_float tags (033) values (now, -3.50282347e+38) @@ -512,7 +519,7 @@ sql_error insert into st_float_e20 using mt_float tags (033) values (now, "123ab sql_error insert into st_float_e22 using mt_float tags (033) values (now, abc) sql_error insert into st_float_e23 using mt_float tags (033) values (now, "abc") sql_error insert into st_float_e24 using mt_float tags (033) values (now, " ") -sql_error insert into st_float_e25 using mt_float tags (033) values (now, '') +sql insert into st_float_e25_1 using mt_float tags (033) values (now, '') sql_error insert into st_float_e13 using mt_float tags (3.50282347e+38) values (now, -033) sql_error insert into st_float_e14 using mt_float tags (-3.50282347e+38) values (now, -033) @@ -525,7 +532,7 @@ sql_error insert into st_float_e20 using mt_float tags ("123abc") values (now, - sql_error insert into st_float_e22 using mt_float tags (abc) values (now, -033) sql_error insert into st_float_e23 using mt_float tags ("abc") values (now, -033) sql_error insert into st_float_e24 using mt_float tags (" ") values (now, -033) -sql_error insert into st_float_e25 using mt_float tags ('') values (now, -033) +sql insert into st_float_e25_3 using mt_float tags ('') values (now, -033) sql insert into st_float_e13 using mt_float tags (033) values (now, 00062) sql insert into st_float_e14 using mt_float tags (033) values (now, 00062) @@ -546,8 +553,8 @@ sql_error alter table st_float_e14 set tag tagname=-3.50282347e+38 sql_error alter table st_float_e15 set tag tagname=13.40282347e+38 sql_error alter table st_float_e16 set tag tagname=-13.40282347e+38 sql_error alter table st_float_e19 set tag tagname=123abc -sql_error alter table st_float_e20 set tag tagname="123abc" +sql alter table st_float_e20 set tag tagname="123abc" sql_error alter table st_float_e22 set tag tagname=abc -sql_error alter table st_float_e23 set tag tagname="abc" -sql_error alter table st_float_e24 set tag tagname=" " -sql_error alter table st_float_e25 set tag tagname='' +sql alter table st_float_e23 set tag tagname="abc" +sql alter table st_float_e24 set tag tagname=" " +sql alter table st_float_e25 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_int.sim b/tests/script/tsim/parser/columnValue_int.sim index 66be28ef89..48d95f5ecb 100644 --- a/tests/script/tsim/parser/columnValue_int.sim +++ b/tests/script/tsim/parser/columnValue_int.sim @@ -1,5 +1,12 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create database if not exists db + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db sql use db #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value @@ -10,78 +17,64 @@ sql create table mt_int (ts timestamp, c int) tags (tagname int) ## case 00: static create table for test tag values sql create table st_int_0 using mt_int tags (NULL) -sql select tagname from st_int_0 -if $data00 != NULL then +sql show tags from st_int_0 +if $data05 != NULL then return -1 endi sql create table st_int_1 using mt_int tags (NULL) -sql select tagname from st_int_1 -if $data00 != NULL then - return -1 -endi -sql create table st_int_2 using mt_int tags ('NULL') -sql select tagname from st_int_2 -if $data00 != NULL then - return -1 -endi -sql create table st_int_3 using mt_int tags ('NULL') -sql select tagname from st_int_3 -if $data00 != NULL then - return -1 -endi -sql create table st_int_4 using mt_int tags ("NULL") -sql select tagname from st_int_4 -if $data00 != NULL then - return -1 -endi -sql create table st_int_5 using mt_int tags ("NULL") -sql select tagname from st_int_5 -if $data00 != NULL then +sql show tags from st_int_1 +if $data05 != NULL then return -1 endi + +sql_error create table st_int_2 using mt_int tags ('NULL') +sql_error create table st_int_3 using mt_int tags ('NULL') +sql_error create table st_int_4 using mt_int tags ("NULL") +sql_error create table st_int_5 using mt_int tags ("NULL") + sql create table st_int_6 using mt_int tags (-2147483647) -sql select tagname from st_int_6 -if $data00 != -2147483647 then +sql show tags from st_int_6 +if $data05 != -2147483647 then return -1 endi sql create table st_int_7 using mt_int tags (2147483647) -sql select tagname from st_int_7 -if $data00 != 2147483647 then +sql show tags from st_int_7 +if $data05 != 2147483647 then return -1 endi sql create table st_int_8 using mt_int tags (37) -sql select tagname from st_int_8 -if $data00 != 37 then +sql show tags from st_int_8 +if $data05 != 37 then return -1 endi sql create table st_int_9 using mt_int tags (-100) -sql select tagname from st_int_9 -if $data00 != -100 then +sql show tags from st_int_9 +if $data05 != -100 then return -1 endi sql create table st_int_10 using mt_int tags (+113) -sql select tagname from st_int_10 -if $data00 != 113 then +sql show tags from st_int_10 +if $data05 != 113 then return -1 endi sql create table st_int_11 using mt_int tags ('-100') -sql select tagname from st_int_11 -if $data00 != -100 then +sql show tags from st_int_11 +if $data05 != -100 then return -1 endi sql create table st_int_12 using mt_int tags ("+78") -sql select tagname from st_int_12 -if $data00 != 78 then +sql show tags from st_int_12 +if $data05 != 78 then return -1 endi sql create table st_int_13 using mt_int tags (+0078) -sql select tagname from st_int_13 -if $data00 != 78 then +sql show tags from st_int_13 +if $data05 != 78 then return -1 endi sql create table st_int_14 using mt_int tags (-00078) -sql select tagname from st_int_14 -if $data00 != -78 then +sql show tags from st_int_14 +if $data05 != -78 then return -1 endi @@ -102,38 +95,6 @@ endi if $data01 != NULL then return -1 endi -sql insert into st_int_2 values (now, 'NULL') -sql select * from st_int_2 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_int_3 values (now, 'NULL') -sql select * from st_int_3 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_int_4 values (now, "NULL") -sql select * from st_int_4 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_int_5 values (now, "NULL") -sql select * from st_int_5 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi sql insert into st_int_6 values (now, 2147483647) sql select * from st_int_6 if $rows != 1 then @@ -211,8 +172,8 @@ endi ## case 02: dynamic create table for test tag values sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL) -sql select tagname from st_int_16 -if $data00 != NULL then +sql show tags from st_int_16 +if $data05 != NULL then return -1 endi sql select * from st_int_16 @@ -221,8 +182,8 @@ if $data01 != NULL then endi sql insert into st_int_17 using mt_int tags (NULL) values (now, NULL) -sql select tagname from st_int_17 -if $data00 != NULL then +sql show tags from st_int_17 +if $data05 != NULL then return -1 endi sql select * from st_int_17 @@ -230,8 +191,8 @@ if $data01 != NULL then return -1 endi sql insert into st_int_18 using mt_int tags ('NULL') values (now, 'NULL') -sql select tagname from st_int_18 -if $data00 != NULL then +sql show tags from st_int_18 +if $data05 != NULL then return -1 endi sql select * from st_int_18 @@ -239,8 +200,8 @@ if $data01 != NULL then return -1 endi sql insert into st_int_19 using mt_int tags ('NULL') values (now, 'NULL') -sql select tagname from st_int_19 -if $data00 != NULL then +sql show tags from st_int_19 +if $data05 != NULL then return -1 endi sql select * from st_int_19 @@ -248,8 +209,8 @@ if $data01 != NULL then return -1 endi sql insert into st_int_20 using mt_int tags ("NULL") values (now, "NULL") -sql select tagname from st_int_20 -if $data00 != NULL then +sql show tags from st_int_20 +if $data05 != NULL then return -1 endi sql select * from st_int_20 @@ -257,8 +218,8 @@ if $data01 != NULL then return -1 endi sql insert into st_int_21 using mt_int tags ("NULL") values (now, "NULL") -sql select tagname from st_int_21 -if $data00 != NULL then +sql show tags from st_int_21 +if $data05 != NULL then return -1 endi sql select * from st_int_21 @@ -266,8 +227,8 @@ if $data01 != NULL then return -1 endi sql insert into st_int_22 using mt_int tags (2147483647) values (now, 2147483647) -sql select tagname from st_int_22 -if $data00 != 2147483647 then +sql show tags from st_int_22 +if $data05 != 2147483647 then return -1 endi sql select * from st_int_22 @@ -275,8 +236,8 @@ if $data01 != 2147483647 then return -1 endi sql insert into st_int_23 using mt_int tags (-2147483647) values (now, -2147483647) -sql select tagname from st_int_23 -if $data00 != -2147483647 then +sql show tags from st_int_23 +if $data05 != -2147483647 then return -1 endi sql select * from st_int_23 @@ -284,8 +245,8 @@ if $data01 != -2147483647 then return -1 endi sql insert into st_int_24 using mt_int tags (10) values (now, 10) -sql select tagname from st_int_24 -if $data00 != 10 then +sql show tags from st_int_24 +if $data05 != 10 then return -1 endi sql select * from st_int_24 @@ -293,8 +254,8 @@ if $data01 != 10 then return -1 endi sql insert into st_int_25 using mt_int tags ("-0") values (now, "-0") -sql select tagname from st_int_25 -if $data00 != 0 then +sql show tags from st_int_25 +if $data05 != 0 then return -1 endi sql select * from st_int_25 @@ -302,8 +263,8 @@ if $data01 != 0 then return -1 endi sql insert into st_int_26 using mt_int tags ('123') values (now, '123') -sql select tagname from st_int_26 -if $data00 != 123 then +sql show tags from st_int_26 +if $data05 != 123 then return -1 endi sql select * from st_int_26 @@ -311,8 +272,8 @@ if $data01 != 123 then return -1 endi sql insert into st_int_27 using mt_int tags (+056) values (now, +00056) -sql select tagname from st_int_27 -if $data00 != 56 then +sql show tags from st_int_27 +if $data05 != 56 then return -1 endi sql select * from st_int_27 @@ -320,8 +281,8 @@ if $data01 != 56 then return -1 endi sql insert into st_int_28 using mt_int tags (-056) values (now, -0056) -sql select tagname from st_int_28 -if $data00 != -56 then +sql show tags from st_int_28 +if $data05 != -56 then return -1 endi sql select * from st_int_28 @@ -331,49 +292,49 @@ endi ### case 03: alter tag values #sql alter table st_int_0 set tag tagname=2147483647 -#sql select tagname from st_int_0 -#if $data00 != 2147483647 then +#sql show tags from st_int_0 +#if $data05 != 2147483647 then # return -1 #endi #sql alter table st_int_0 set tag tagname=-2147483647 -#sql select tagname from st_int_0 -#if $data00 != -2147483647 then +#sql show tags from st_int_0 +#if $data05 != -2147483647 then # return -1 #endi #sql alter table st_int_0 set tag tagname=+100 -#sql select tagname from st_int_0 -#if $data00 != 100 then +#sql show tags from st_int_0 +#if $data05 != 100 then # return -1 #endi #sql alter table st_int_0 set tag tagname=-33 -#sql select tagname from st_int_0 -#if $data00 != -33 then +#sql show tags from st_int_0 +#if $data05 != -33 then # return -1 #endi #sql alter table st_int_0 set tag tagname='+98' -#sql select tagname from st_int_0 -#if $data00 != 98 then +#sql show tags from st_int_0 +#if $data05 != 98 then # return -1 #endi #sql alter table st_int_0 set tag tagname='-076' -#sql select tagname from st_int_0 -#if $data00 != -76 then +#sql show tags from st_int_0 +#if $data05 != -76 then # return -1 #endi #sql alter table st_int_0 set tag tagname=+0012 -#sql select tagname from st_int_0 -#if $data00 != 12 then +#sql show tags from st_int_0 +#if $data05 != 12 then # return -1 #endi #sql alter table st_int_0 set tag tagname=-00063 -#sql select tagname from st_int_0 -#if $data00 != -63 then +#sql show tags from st_int_0 +#if $data05 != -63 then # return -1 #endi ## case 04: illegal input sql_error create table st_int_e0 using mt_int tags (2147483648) -sql_error create table st_int_e0 using mt_int tags (-2147483648) +sql create table st_int_e0_err1 using mt_int tags (-2147483648) sql_error create table st_int_e0 using mt_int tags (214748364800) sql_error create table st_int_e0 using mt_int tags (-214748364800) #sql_error create table st_int_e0 using mt_int tags (12.80) truncate integer part @@ -383,7 +344,7 @@ sql_error create table st_int_e0 using mt_int tags ("123abc") sql_error create table st_int_e0 using mt_int tags (abc) sql_error create table st_int_e0 using mt_int tags ("abc") sql_error create table st_int_e0 using mt_int tags (" ") -sql_error create table st_int_e0 using mt_int tags ('') +sql create table st_int_e0_err2 using mt_int tags ('') sql create table st_int_e0 using mt_int tags (123) sql create table st_int_e1 using mt_int tags (123) @@ -400,7 +361,7 @@ sql create table st_int_e11 using mt_int tags (123) sql create table st_int_e12 using mt_int tags (123) sql_error insert into st_int_e0 values (now, 2147483648) -sql_error insert into st_int_e1 values (now, -2147483648) +sql insert into st_int_e1 values (now, -2147483648) sql_error insert into st_int_e2 values (now, 3147483648) sql_error insert into st_int_e3 values (now, -21474836481) #sql_error insert into st_int_e4 values (now, 12.80) @@ -410,10 +371,10 @@ sql_error insert into st_int_e7 values (now, "123abc") sql_error insert into st_int_e9 values (now, abc) sql_error insert into st_int_e10 values (now, "abc") sql_error insert into st_int_e11 values (now, " ") -sql_error insert into st_int_e12 values (now, '') +sql insert into st_int_e12 values (now, '') sql_error insert into st_int_e13 using mt_int tags (033) values (now, 2147483648) -sql_error insert into st_int_e14 using mt_int tags (033) values (now, -2147483648) +sql insert into st_int_e14 using mt_int tags (033) values (now, -2147483648) sql_error insert into st_int_e15 using mt_int tags (033) values (now, 5147483648) sql_error insert into st_int_e16 using mt_int tags (033) values (now, -21474836481) #sql_error insert into st_int_e17 using mt_int tags (033) values (now, 12.80) @@ -423,10 +384,10 @@ sql_error insert into st_int_e20 using mt_int tags (033) values (now, "123abc") sql_error insert into st_int_e22 using mt_int tags (033) values (now, abc) sql_error insert into st_int_e23 using mt_int tags (033) values (now, "abc") sql_error insert into st_int_e24 using mt_int tags (033) values (now, " ") -sql_error insert into st_int_e25 using mt_int tags (033) values (now, '') +sql insert into st_int_e25 using mt_int tags (033) values (now, '') sql_error insert into st_int_e13 using mt_int tags (2147483648) values (now, -033) -sql_error insert into st_int_e14 using mt_int tags (-2147483648) values (now, -033) +sql insert into st_int_e14_1 using mt_int tags (-2147483648) values (now, -033) sql_error insert into st_int_e15 using mt_int tags (21474836480) values (now, -033) sql_error insert into st_int_e16 using mt_int tags (-2147483649) values (now, -033) #sql_error insert into st_int_e17 using mt_int tags (12.80) values (now, -033) @@ -436,7 +397,7 @@ sql_error insert into st_int_e20 using mt_int tags ("123abc") values (now, -033) sql_error insert into st_int_e22 using mt_int tags (abc) values (now, -033) sql_error insert into st_int_e23 using mt_int tags ("abc") values (now, -033) sql_error insert into st_int_e24 using mt_int tags (" ") values (now, -033) -sql_error insert into st_int_e25 using mt_int tags ('') values (now, -033) +sql insert into st_int_e25_1 using mt_int tags ('') values (now, -033) sql insert into st_int_e13 using mt_int tags (033) values (now, 00062) sql insert into st_int_e14 using mt_int tags (033) values (now, 00062) @@ -453,7 +414,7 @@ sql insert into st_int_e24 using mt_int tags (033) values (now, 00062) sql insert into st_int_e25 using mt_int tags (033) values (now, 00062) sql_error alter table st_int_e13 set tag tagname=2147483648 -sql_error alter table st_int_e14 set tag tagname=-2147483648 +sql alter table st_int_e14 set tag tagname=-2147483648 sql_error alter table st_int_e15 set tag tagname=12147483648 sql_error alter table st_int_e16 set tag tagname=-3147483648 sql_error alter table st_int_e19 set tag tagname=123abc @@ -461,4 +422,4 @@ sql_error alter table st_int_e20 set tag tagname="123abc" sql_error alter table st_int_e22 set tag tagname=abc sql_error alter table st_int_e23 set tag tagname="abc" sql_error alter table st_int_e24 set tag tagname=" " -sql_error alter table st_int_e25 set tag tagname='' +sql alter table st_int_e25 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_smallint.sim b/tests/script/tsim/parser/columnValue_smallint.sim index 6608b6cea4..ced486ba0b 100644 --- a/tests/script/tsim/parser/columnValue_smallint.sim +++ b/tests/script/tsim/parser/columnValue_smallint.sim @@ -1,6 +1,17 @@ -sql create database if not exists db -sql use db +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect +print ========== columnValues.sim + +sql drop database if exists db +sql create database db +sql use db +print ========== columnValues.sim + +sql drop database if exists db +sql create database db #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value ######## case 0: smallint @@ -9,78 +20,64 @@ sql create table mt_smallint (ts timestamp, c smallint) tags (tagname smallint) ## case 00: static create table for test tag values sql create table st_smallint_0 using mt_smallint tags (NULL) -sql select tagname from st_smallint_0 -if $data00 != NULL then +sql show tags from st_smallint_0 +if $data05 != NULL then return -1 endi sql create table st_smallint_1 using mt_smallint tags (NULL) -sql select tagname from st_smallint_1 -if $data00 != NULL then - return -1 -endi -sql create table st_smallint_2 using mt_smallint tags ('NULL') -sql select tagname from st_smallint_2 -if $data00 != NULL then - return -1 -endi -sql create table st_smallint_3 using mt_smallint tags ('NULL') -sql select tagname from st_smallint_3 -if $data00 != NULL then - return -1 -endi -sql create table st_smallint_4 using mt_smallint tags ("NULL") -sql select tagname from st_smallint_4 -if $data00 != NULL then - return -1 -endi -sql create table st_smallint_5 using mt_smallint tags ("NULL") -sql select tagname from st_smallint_5 -if $data00 != NULL then +sql show tags from st_smallint_1 +if $data05 != NULL then return -1 endi + +sql_error create table st_smallint_2 using mt_smallint tags ('NULL') +sql_error create table st_smallint_3 using mt_smallint tags ('NULL') +sql_error create table st_smallint_4 using mt_smallint tags ("NULL") +sql_error create table st_smallint_5 using mt_smallint tags ("NULL") + sql create table st_smallint_6 using mt_smallint tags (-32767) -sql select tagname from st_smallint_6 -if $data00 != -32767 then +sql show tags from st_smallint_6 +if $data05 != -32767 then return -1 endi sql create table st_smallint_7 using mt_smallint tags (32767) -sql select tagname from st_smallint_7 -if $data00 != 32767 then +sql show tags from st_smallint_7 +if $data05 != 32767 then return -1 endi sql create table st_smallint_8 using mt_smallint tags (37) -sql select tagname from st_smallint_8 -if $data00 != 37 then +sql show tags from st_smallint_8 +if $data05 != 37 then return -1 endi sql create table st_smallint_9 using mt_smallint tags (-100) -sql select tagname from st_smallint_9 -if $data00 != -100 then +sql show tags from st_smallint_9 +if $data05 != -100 then return -1 endi sql create table st_smallint_10 using mt_smallint tags (+113) -sql select tagname from st_smallint_10 -if $data00 != 113 then +sql show tags from st_smallint_10 +if $data05 != 113 then return -1 endi sql create table st_smallint_11 using mt_smallint tags ('-100') -sql select tagname from st_smallint_11 -if $data00 != -100 then +sql show tags from st_smallint_11 +if $data05 != -100 then return -1 endi sql create table st_smallint_12 using mt_smallint tags ("+78") -sql select tagname from st_smallint_12 -if $data00 != 78 then +sql show tags from st_smallint_12 +if $data05 != 78 then return -1 endi sql create table st_smallint_13 using mt_smallint tags (+0078) -sql select tagname from st_smallint_13 -if $data00 != 78 then +sql show tags from st_smallint_13 +if $data05 != 78 then return -1 endi sql create table st_smallint_14 using mt_smallint tags (-00078) -sql select tagname from st_smallint_14 -if $data00 != -78 then +sql show tags from st_smallint_14 +if $data05 != -78 then return -1 endi @@ -101,38 +98,6 @@ endi if $data01 != NULL then return -1 endi -sql insert into st_smallint_2 values (now, 'NULL') -sql select * from st_smallint_2 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_smallint_3 values (now, 'NULL') -sql select * from st_smallint_3 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_smallint_4 values (now, "NULL") -sql select * from st_smallint_4 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_smallint_5 values (now, "NULL") -sql select * from st_smallint_5 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi sql insert into st_smallint_6 values (now, 32767) sql select * from st_smallint_6 if $rows != 1 then @@ -210,8 +175,8 @@ endi ## case 02: dynamic create table for test tag values sql insert into st_smallint_16 using mt_smallint tags (NULL) values (now, NULL) -sql select tagname from st_smallint_16 -if $data00 != NULL then +sql show tags from st_smallint_16 +if $data05 != NULL then return -1 endi sql select * from st_smallint_16 @@ -220,8 +185,8 @@ if $data01 != NULL then endi sql insert into st_smallint_17 using mt_smallint tags (NULL) values (now, NULL) -sql select tagname from st_smallint_17 -if $data00 != NULL then +sql show tags from st_smallint_17 +if $data05 != NULL then return -1 endi sql select * from st_smallint_17 @@ -229,8 +194,8 @@ if $data01 != NULL then return -1 endi sql insert into st_smallint_18 using mt_smallint tags ('NULL') values (now, 'NULL') -sql select tagname from st_smallint_18 -if $data00 != NULL then +sql show tags from st_smallint_18 +if $data05 != NULL then return -1 endi sql select * from st_smallint_18 @@ -238,8 +203,8 @@ if $data01 != NULL then return -1 endi sql insert into st_smallint_19 using mt_smallint tags ('NULL') values (now, 'NULL') -sql select tagname from st_smallint_19 -if $data00 != NULL then +sql show tags from st_smallint_19 +if $data05 != NULL then return -1 endi sql select * from st_smallint_19 @@ -247,8 +212,8 @@ if $data01 != NULL then return -1 endi sql insert into st_smallint_20 using mt_smallint tags ("NULL") values (now, "NULL") -sql select tagname from st_smallint_20 -if $data00 != NULL then +sql show tags from st_smallint_20 +if $data05 != NULL then return -1 endi sql select * from st_smallint_20 @@ -256,8 +221,8 @@ if $data01 != NULL then return -1 endi sql insert into st_smallint_21 using mt_smallint tags ("NULL") values (now, "NULL") -sql select tagname from st_smallint_21 -if $data00 != NULL then +sql show tags from st_smallint_21 +if $data05 != NULL then return -1 endi sql select * from st_smallint_21 @@ -265,8 +230,8 @@ if $data01 != NULL then return -1 endi sql insert into st_smallint_22 using mt_smallint tags (32767) values (now, 32767) -sql select tagname from st_smallint_22 -if $data00 != 32767 then +sql show tags from st_smallint_22 +if $data05 != 32767 then return -1 endi sql select * from st_smallint_22 @@ -274,8 +239,8 @@ if $data01 != 32767 then return -1 endi sql insert into st_smallint_23 using mt_smallint tags (-32767) values (now, -32767) -sql select tagname from st_smallint_23 -if $data00 != -32767 then +sql show tags from st_smallint_23 +if $data05 != -32767 then return -1 endi sql select * from st_smallint_23 @@ -283,8 +248,8 @@ if $data01 != -32767 then return -1 endi sql insert into st_smallint_24 using mt_smallint tags (10) values (now, 10) -sql select tagname from st_smallint_24 -if $data00 != 10 then +sql show tags from st_smallint_24 +if $data05 != 10 then return -1 endi sql select * from st_smallint_24 @@ -292,8 +257,8 @@ if $data01 != 10 then return -1 endi sql insert into st_smallint_25 using mt_smallint tags ("-0") values (now, "-0") -sql select tagname from st_smallint_25 -if $data00 != 0 then +sql show tags from st_smallint_25 +if $data05 != 0 then return -1 endi sql select * from st_smallint_25 @@ -301,8 +266,8 @@ if $data01 != 0 then return -1 endi sql insert into st_smallint_26 using mt_smallint tags ('123') values (now, '123') -sql select tagname from st_smallint_26 -if $data00 != 123 then +sql show tags from st_smallint_26 +if $data05 != 123 then return -1 endi sql select * from st_smallint_26 @@ -310,8 +275,8 @@ if $data01 != 123 then return -1 endi sql insert into st_smallint_27 using mt_smallint tags (+056) values (now, +00056) -sql select tagname from st_smallint_27 -if $data00 != 56 then +sql show tags from st_smallint_27 +if $data05 != 56 then return -1 endi sql select * from st_smallint_27 @@ -319,8 +284,8 @@ if $data01 != 56 then return -1 endi sql insert into st_smallint_28 using mt_smallint tags (-056) values (now, -0056) -sql select tagname from st_smallint_28 -if $data00 != -56 then +sql show tags from st_smallint_28 +if $data05 != -56 then return -1 endi sql select * from st_smallint_28 @@ -330,49 +295,49 @@ endi ## case 03: alter tag values #sql alter table st_smallint_0 set tag tagname=32767 -#sql select tagname from st_smallint_0 -#if $data00 != 32767 then +#sql show tags from st_smallint_0 +#if $data05 != 32767 then # return -1 #endi #sql alter table st_smallint_0 set tag tagname=-32767 -#sql select tagname from st_smallint_0 -#if $data00 != -32767 then +#sql show tags from st_smallint_0 +#if $data05 != -32767 then # return -1 #endi #sql alter table st_smallint_0 set tag tagname=+100 -#sql select tagname from st_smallint_0 -#if $data00 != 100 then +#sql show tags from st_smallint_0 +#if $data05 != 100 then # return -1 #endi #sql alter table st_smallint_0 set tag tagname=-33 -#sql select tagname from st_smallint_0 -#if $data00 != -33 then +#sql show tags from st_smallint_0 +#if $data05 != -33 then # return -1 #endi #sql alter table st_smallint_0 set tag tagname='+98' -#sql select tagname from st_smallint_0 -#if $data00 != 98 then +#sql show tags from st_smallint_0 +#if $data05 != 98 then # return -1 #endi #sql alter table st_smallint_0 set tag tagname='-076' -#sql select tagname from st_smallint_0 -#if $data00 != -76 then +#sql show tags from st_smallint_0 +#if $data05 != -76 then # return -1 #endi #sql alter table st_smallint_0 set tag tagname=+0012 -#sql select tagname from st_smallint_0 -#if $data00 != 12 then +#sql show tags from st_smallint_0 +#if $data05 != 12 then # return -1 #endi #sql alter table st_smallint_0 set tag tagname=-00063 -#sql select tagname from st_smallint_0 -#if $data00 != -63 then +#sql show tags from st_smallint_0 +#if $data05 != -63 then # return -1 #endi ## case 04: illegal input sql_error create table st_smallint_e0 using mt_smallint tags (32768) -sql_error create table st_smallint_e0 using mt_smallint tags (-32768) +sql create table st_smallint_e0_0 using mt_smallint tags (-32768) sql_error create table st_smallint_e0 using mt_smallint tags (3276899) sql_error create table st_smallint_e0 using mt_smallint tags (-3276833) #sql_error create table st_smallint_e0 using mt_smallint tags (12.80) truncate integer part @@ -382,7 +347,7 @@ sql_error create table st_smallint_e0 using mt_smallint tags ("123abc") sql_error create table st_smallint_e0 using mt_smallint tags (abc) sql_error create table st_smallint_e0 using mt_smallint tags ("abc") sql_error create table st_smallint_e0 using mt_smallint tags (" ") -sql_error create table st_smallint_e0 using mt_smallint tags ('') +sql create table st_smallint_e0_1 using mt_smallint tags ('') sql create table st_smallint_e0 using mt_smallint tags (123) sql create table st_smallint_e1 using mt_smallint tags (123) @@ -399,7 +364,7 @@ sql create table st_smallint_e11 using mt_smallint tags (123) sql create table st_smallint_e12 using mt_smallint tags (123) sql_error insert into st_smallint_e0 values (now, 32768) -sql_error insert into st_smallint_e1 values (now, -32768) +sql insert into st_smallint_e1 values (now, -32768) sql_error insert into st_smallint_e2 values (now, 42768) sql_error insert into st_smallint_e3 values (now, -32769) #sql_error insert into st_smallint_e4 values (now, 12.80) @@ -409,10 +374,10 @@ sql_error insert into st_smallint_e7 values (now, "123abc") sql_error insert into st_smallint_e9 values (now, abc) sql_error insert into st_smallint_e10 values (now, "abc") sql_error insert into st_smallint_e11 values (now, " ") -sql_error insert into st_smallint_e12 values (now, '') +sql insert into st_smallint_e12 values (now, '') sql_error insert into st_smallint_e13 using mt_smallint tags (033) values (now, 32768) -sql_error insert into st_smallint_e14 using mt_smallint tags (033) values (now, -32768) +sql insert into st_smallint_e14_1 using mt_smallint tags (033) values (now, -32768) sql_error insert into st_smallint_e15 using mt_smallint tags (033) values (now, 32968) sql_error insert into st_smallint_e16 using mt_smallint tags (033) values (now, -33768) #sql_error insert into st_smallint_e17 using mt_smallint tags (033) values (now, 12.80) @@ -422,10 +387,10 @@ sql_error insert into st_smallint_e20 using mt_smallint tags (033) values (now, sql_error insert into st_smallint_e22 using mt_smallint tags (033) values (now, abc) sql_error insert into st_smallint_e23 using mt_smallint tags (033) values (now, "abc") sql_error insert into st_smallint_e24 using mt_smallint tags (033) values (now, " ") -sql_error insert into st_smallint_e25 using mt_smallint tags (033) values (now, '') +sql insert into st_smallint_e25_1 using mt_smallint tags (033) values (now, '') sql_error insert into st_smallint_e13 using mt_smallint tags (32768) values (now, -033) -sql_error insert into st_smallint_e14 using mt_smallint tags (-32768) values (now, -033) +sql insert into st_smallint_e14 using mt_smallint tags (-32768) values (now, -033) sql_error insert into st_smallint_e15 using mt_smallint tags (72768) values (now, -033) sql_error insert into st_smallint_e16 using mt_smallint tags (-92768) values (now, -033) #sql_error insert into st_smallint_e17 using mt_smallint tags (12.80) values (now, -033) @@ -435,7 +400,7 @@ sql_error insert into st_smallint_e20 using mt_smallint tags ("123abc") values ( sql_error insert into st_smallint_e22 using mt_smallint tags (abc) values (now, -033) sql_error insert into st_smallint_e23 using mt_smallint tags ("abc") values (now, -033) sql_error insert into st_smallint_e24 using mt_smallint tags (" ") values (now, -033) -sql_error insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033) +sql insert into st_smallint_e25 using mt_smallint tags ('') values (now, -033) sql insert into st_smallint_e13 using mt_smallint tags (033) values (now, 00062) sql insert into st_smallint_e14 using mt_smallint tags (033) values (now, 00062) @@ -452,7 +417,7 @@ sql insert into st_smallint_e24 using mt_smallint tags (033) values (now, 00062) sql insert into st_smallint_e25 using mt_smallint tags (033) values (now, 00062) sql_error alter table st_smallint_e13 set tag tagname=32768 -sql_error alter table st_smallint_e14 set tag tagname=-32768 +sql alter table st_smallint_e14 set tag tagname=-32768 sql_error alter table st_smallint_e15 set tag tagname=52768 sql_error alter table st_smallint_e16 set tag tagname=-32778 sql_error alter table st_smallint_e19 set tag tagname=123abc @@ -460,4 +425,4 @@ sql_error alter table st_smallint_e20 set tag tagname="123abc" sql_error alter table st_smallint_e22 set tag tagname=abc sql_error alter table st_smallint_e23 set tag tagname="abc" sql_error alter table st_smallint_e24 set tag tagname=" " -sql_error alter table st_smallint_e25 set tag tagname='' +sql alter table st_smallint_e25 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_tinyint.sim b/tests/script/tsim/parser/columnValue_tinyint.sim index 67c0f998ca..bc1fcd3445 100644 --- a/tests/script/tsim/parser/columnValue_tinyint.sim +++ b/tests/script/tsim/parser/columnValue_tinyint.sim @@ -1,4 +1,12 @@ -sql create database if not exists db +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db sql use db #### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value @@ -9,79 +17,65 @@ sql create table mt_tinyint (ts timestamp, c tinyint) tags (tagname tinyint) ## case 00: static create table for test tag values sql create table st_tinyint_0 using mt_tinyint tags (NULL) -sql select tagname from st_tinyint_0 -if $data00 != NULL then - print expect NULL, actually: $data00 +sql show tags from st_tinyint_0 +if $data05 != NULL then + print expect NULL, actually: $data05 return -1 endi sql create table st_tinyint_1 using mt_tinyint tags (NULL) -sql select tagname from st_tinyint_1 -if $data00 != NULL then - return -1 -endi -sql create table st_tinyint_2 using mt_tinyint tags ('NULL') -sql select tagname from st_tinyint_2 -if $data00 != NULL then - return -1 -endi -sql create table st_tinyint_3 using mt_tinyint tags ('NULL') -sql select tagname from st_tinyint_3 -if $data00 != NULL then - return -1 -endi -sql create table st_tinyint_4 using mt_tinyint tags ("NULL") -sql select tagname from st_tinyint_4 -if $data00 != NULL then - return -1 -endi -sql create table st_tinyint_5 using mt_tinyint tags ("NULL") -sql select tagname from st_tinyint_5 -if $data00 != NULL then +sql show tags from st_tinyint_1 +if $data05 != NULL then return -1 endi + +sql_error create table st_tinyint_2 using mt_tinyint tags ('NULL') +sql_error create table st_tinyint_3 using mt_tinyint tags ('NULL') +sql_error create table st_tinyint_4 using mt_tinyint tags ("NULL") +sql_error create table st_tinyint_5 using mt_tinyint tags ("NULL") + sql create table st_tinyint_6 using mt_tinyint tags (-127) -sql select tagname from st_tinyint_6 -if $data00 != -127 then +sql show tags from st_tinyint_6 +if $data05 != -127 then return -1 endi sql create table st_tinyint_7 using mt_tinyint tags (127) -sql select tagname from st_tinyint_7 -if $data00 != 127 then +sql show tags from st_tinyint_7 +if $data05 != 127 then return -1 endi sql create table st_tinyint_8 using mt_tinyint tags (37) -sql select tagname from st_tinyint_8 -if $data00 != 37 then +sql show tags from st_tinyint_8 +if $data05 != 37 then return -1 endi sql create table st_tinyint_9 using mt_tinyint tags (-100) -sql select tagname from st_tinyint_9 -if $data00 != -100 then +sql show tags from st_tinyint_9 +if $data05 != -100 then return -1 endi sql create table st_tinyint_10 using mt_tinyint tags (+113) -sql select tagname from st_tinyint_10 -if $data00 != 113 then +sql show tags from st_tinyint_10 +if $data05 != 113 then return -1 endi sql create table st_tinyint_11 using mt_tinyint tags ('-100') -sql select tagname from st_tinyint_11 -if $data00 != -100 then +sql show tags from st_tinyint_11 +if $data05 != -100 then return -1 endi sql create table st_tinyint_12 using mt_tinyint tags ("+78") -sql select tagname from st_tinyint_12 -if $data00 != 78 then +sql show tags from st_tinyint_12 +if $data05 != 78 then return -1 endi sql create table st_tinyint_13 using mt_tinyint tags (+0078) -sql select tagname from st_tinyint_13 -if $data00 != 78 then +sql show tags from st_tinyint_13 +if $data05 != 78 then return -1 endi sql create table st_tinyint_14 using mt_tinyint tags (-00078) -sql select tagname from st_tinyint_14 -if $data00 != -78 then +sql show tags from st_tinyint_14 +if $data05 != -78 then return -1 endi @@ -102,38 +96,6 @@ endi if $data01 != NULL then return -1 endi -sql insert into st_tinyint_2 values (now, 'NULL') -sql select * from st_tinyint_2 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_tinyint_3 values (now, 'NULL') -sql select * from st_tinyint_3 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_tinyint_4 values (now, "NULL") -sql select * from st_tinyint_4 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql insert into st_tinyint_5 values (now, "NULL") -sql select * from st_tinyint_5 -if $rows != 1 then - return -1 -endi -if $data01 != NULL then - return -1 -endi sql insert into st_tinyint_6 values (now, 127) sql select * from st_tinyint_6 if $rows != 1 then @@ -211,8 +173,8 @@ endi ## case 02: dynamic create table for test tag values sql insert into st_tinyint_16 using mt_tinyint tags (NULL) values (now, NULL) -sql select tagname from st_tinyint_16 -if $data00 != NULL then +sql show tags from st_tinyint_16 +if $data05 != NULL then return -1 endi sql select * from st_tinyint_16 @@ -221,8 +183,8 @@ if $data01 != NULL then endi sql insert into st_tinyint_17 using mt_tinyint tags (NULL) values (now, NULL) -sql select tagname from st_tinyint_17 -if $data00 != NULL then +sql show tags from st_tinyint_17 +if $data05 != NULL then return -1 endi sql select * from st_tinyint_17 @@ -230,8 +192,8 @@ if $data01 != NULL then return -1 endi sql insert into st_tinyint_18 using mt_tinyint tags ('NULL') values (now, 'NULL') -sql select tagname from st_tinyint_18 -if $data00 != NULL then +sql show tags from st_tinyint_18 +if $data05 != NULL then return -1 endi sql select * from st_tinyint_18 @@ -239,8 +201,8 @@ if $data01 != NULL then return -1 endi sql insert into st_tinyint_19 using mt_tinyint tags ('NULL') values (now, 'NULL') -sql select tagname from st_tinyint_19 -if $data00 != NULL then +sql show tags from st_tinyint_19 +if $data05 != NULL then return -1 endi sql select * from st_tinyint_19 @@ -248,8 +210,8 @@ if $data01 != NULL then return -1 endi sql insert into st_tinyint_20 using mt_tinyint tags ("NULL") values (now, "NULL") -sql select tagname from st_tinyint_20 -if $data00 != NULL then +sql show tags from st_tinyint_20 +if $data05 != NULL then return -1 endi sql select * from st_tinyint_20 @@ -257,8 +219,8 @@ if $data01 != NULL then return -1 endi sql insert into st_tinyint_21 using mt_tinyint tags ("NULL") values (now, "NULL") -sql select tagname from st_tinyint_21 -if $data00 != NULL then +sql show tags from st_tinyint_21 +if $data05 != NULL then return -1 endi sql select * from st_tinyint_21 @@ -266,8 +228,8 @@ if $data01 != NULL then return -1 endi sql insert into st_tinyint_22 using mt_tinyint tags (127) values (now, 127) -sql select tagname from st_tinyint_22 -if $data00 != 127 then +sql show tags from st_tinyint_22 +if $data05 != 127 then return -1 endi sql select * from st_tinyint_22 @@ -275,8 +237,8 @@ if $data01 != 127 then return -1 endi sql insert into st_tinyint_23 using mt_tinyint tags (-127) values (now, -127) -sql select tagname from st_tinyint_23 -if $data00 != -127 then +sql show tags from st_tinyint_23 +if $data05 != -127 then return -1 endi sql select * from st_tinyint_23 @@ -284,8 +246,8 @@ if $data01 != -127 then return -1 endi sql insert into st_tinyint_24 using mt_tinyint tags (10) values (now, 10) -sql select tagname from st_tinyint_24 -if $data00 != 10 then +sql show tags from st_tinyint_24 +if $data05 != 10 then return -1 endi sql select * from st_tinyint_24 @@ -293,8 +255,8 @@ if $data01 != 10 then return -1 endi sql insert into st_tinyint_25 using mt_tinyint tags ("-0") values (now, "-0") -sql select tagname from st_tinyint_25 -if $data00 != 0 then +sql show tags from st_tinyint_25 +if $data05 != 0 then return -1 endi sql select * from st_tinyint_25 @@ -302,8 +264,8 @@ if $data01 != 0 then return -1 endi sql insert into st_tinyint_26 using mt_tinyint tags ('123') values (now, '123') -sql select tagname from st_tinyint_26 -if $data00 != 123 then +sql show tags from st_tinyint_26 +if $data05 != 123 then return -1 endi sql select * from st_tinyint_26 @@ -311,8 +273,8 @@ if $data01 != 123 then return -1 endi sql insert into st_tinyint_27 using mt_tinyint tags (+056) values (now, +00056) -sql select tagname from st_tinyint_27 -if $data00 != 56 then +sql show tags from st_tinyint_27 +if $data05 != 56 then return -1 endi sql select * from st_tinyint_27 @@ -320,8 +282,8 @@ if $data01 != 56 then return -1 endi sql insert into st_tinyint_28 using mt_tinyint tags (-056) values (now, -0056) -sql select tagname from st_tinyint_28 -if $data00 != -56 then +sql show tags from st_tinyint_28 +if $data05 != -56 then return -1 endi sql select * from st_tinyint_28 @@ -331,49 +293,49 @@ endi ## case 03: alter tag values #sql alter table st_tinyint_0 set tag tagname=127 -#sql select tagname from st_tinyint_0 -#if $data00 != 127 then +#sql show tags from st_tinyint_0 +#if $data05 != 127 then # return -1 #endi #sql alter table st_tinyint_0 set tag tagname=-127 -#sql select tagname from st_tinyint_0 -#if $data00 != -127 then +#sql show tags from st_tinyint_0 +#if $data05 != -127 then # return -1 #endi #sql alter table st_tinyint_0 set tag tagname=+100 -#sql select tagname from st_tinyint_0 -#if $data00 != 100 then +#sql show tags from st_tinyint_0 +#if $data05 != 100 then # return -1 #endi #sql alter table st_tinyint_0 set tag tagname=-33 -#sql select tagname from st_tinyint_0 -#if $data00 != -33 then +#sql show tags from st_tinyint_0 +#if $data05 != -33 then # return -1 #endi #sql alter table st_tinyint_0 set tag tagname='+98' -#sql select tagname from st_tinyint_0 -#if $data00 != 98 then +#sql show tags from st_tinyint_0 +#if $data05 != 98 then # return -1 #endi #sql alter table st_tinyint_0 set tag tagname='-076' -#sql select tagname from st_tinyint_0 -#if $data00 != -76 then +#sql show tags from st_tinyint_0 +#if $data05 != -76 then # return -1 #endi #sql alter table st_tinyint_0 set tag tagname=+0012 -#sql select tagname from st_tinyint_0 -#if $data00 != 12 then +#sql show tags from st_tinyint_0 +#if $data05 != 12 then # return -1 #endi #sql alter table st_tinyint_0 set tag tagname=-00063 -#sql select tagname from st_tinyint_0 -#if $data00 != -63 then +#sql show tags from st_tinyint_0 +#if $data05 != -63 then # return -1 #endi ## case 04: illegal input sql_error create table st_tinyint_e0 using mt_tinyint tags (128) -sql_error create table st_tinyint_e0 using mt_tinyint tags (-128) +sql create table st_tinyint_e0_1 using mt_tinyint tags (-128) sql_error create table st_tinyint_e0 using mt_tinyint tags (1280) sql_error create table st_tinyint_e0 using mt_tinyint tags (-1280) #sql_error create table st_tinyint_e0 using mt_tinyint tags (12.80) truncate integer part @@ -383,7 +345,7 @@ sql_error create table st_tinyint_e0 using mt_tinyint tags ("123abc") sql_error create table st_tinyint_e0 using mt_tinyint tags (abc) sql_error create table st_tinyint_e0 using mt_tinyint tags ("abc") sql_error create table st_tinyint_e0 using mt_tinyint tags (" ") -sql_error create table st_tinyint_e0 using mt_tinyint tags ('') +sql create table st_tinyint_e0_2 using mt_tinyint tags ('') sql create table st_tinyint_e0 using mt_tinyint tags (123) sql create table st_tinyint_e1 using mt_tinyint tags (123) @@ -400,7 +362,7 @@ sql create table st_tinyint_e11 using mt_tinyint tags (123) sql create table st_tinyint_e12 using mt_tinyint tags (123) sql_error insert into st_tinyint_e0 values (now, 128) -sql_error insert into st_tinyint_e1 values (now, -128) +sql insert into st_tinyint_e1 values (now, -128) sql_error insert into st_tinyint_e2 values (now, 1280) sql_error insert into st_tinyint_e3 values (now, -1280) #sql_error insert into st_tinyint_e4 values (now, 12.80) @@ -410,10 +372,10 @@ sql_error insert into st_tinyint_e7 values (now, "123abc") sql_error insert into st_tinyint_e9 values (now, abc) sql_error insert into st_tinyint_e10 values (now, "abc") sql_error insert into st_tinyint_e11 values (now, " ") -sql_error insert into st_tinyint_e12 values (now, '') +sql insert into st_tinyint_e12 values (now, '') sql_error insert into st_tinyint_e13 using mt_tinyint tags (033) values (now, 128) -sql_error insert into st_tinyint_e14 using mt_tinyint tags (033) values (now, -128) +sql insert into st_tinyint_e14_1 using mt_tinyint tags (033) values (now, -128) sql_error insert into st_tinyint_e15 using mt_tinyint tags (033) values (now, 1280) sql_error insert into st_tinyint_e16 using mt_tinyint tags (033) values (now, -1280) #sql_error insert into st_tinyint_e17 using mt_tinyint tags (033) values (now, 12.80) @@ -423,10 +385,10 @@ sql_error insert into st_tinyint_e20 using mt_tinyint tags (033) values (now, "1 sql_error insert into st_tinyint_e22 using mt_tinyint tags (033) values (now, abc) sql_error insert into st_tinyint_e23 using mt_tinyint tags (033) values (now, "abc") sql_error insert into st_tinyint_e24 using mt_tinyint tags (033) values (now, " ") -sql_error insert into st_tinyint_e25 using mt_tinyint tags (033) values (now, '') +sql insert into st_tinyint_e25_2 using mt_tinyint tags (033) values (now, '') sql_error insert into st_tinyint_e13 using mt_tinyint tags (128) values (now, -033) -sql_error insert into st_tinyint_e14 using mt_tinyint tags (-128) values (now, -033) +sql insert into st_tinyint_e14 using mt_tinyint tags (-128) values (now, -033) sql_error insert into st_tinyint_e15 using mt_tinyint tags (1280) values (now, -033) sql_error insert into st_tinyint_e16 using mt_tinyint tags (-1280) values (now, -033) #sql_error insert into st_tinyint_e17 using mt_tinyint tags (12.80) values (now, -033) @@ -436,7 +398,7 @@ sql_error insert into st_tinyint_e20 using mt_tinyint tags ("123abc") values (no sql_error insert into st_tinyint_e22 using mt_tinyint tags (abc) values (now, -033) sql_error insert into st_tinyint_e23 using mt_tinyint tags ("abc") values (now, -033) sql_error insert into st_tinyint_e24 using mt_tinyint tags (" ") values (now, -033) -sql_error insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033) +sql insert into st_tinyint_e25 using mt_tinyint tags ('') values (now, -033) sql insert into st_tinyint_e13 using mt_tinyint tags (033) values (now, 00062) sql insert into st_tinyint_e14 using mt_tinyint tags (033) values (now, 00062) @@ -453,7 +415,7 @@ sql insert into st_tinyint_e24 using mt_tinyint tags (033) values (now, 00062) sql insert into st_tinyint_e25 using mt_tinyint tags (033) values (now, 00062) sql_error alter table st_tinyint_e13 set tag tagname=128 -sql_error alter table st_tinyint_e14 set tag tagname=-128 +sql alter table st_tinyint_e14 set tag tagname=-128 sql_error alter table st_tinyint_e15 set tag tagname=1280 sql_error alter table st_tinyint_e16 set tag tagname=-1280 sql_error alter table st_tinyint_e19 set tag tagname=123abc @@ -461,4 +423,4 @@ sql_error alter table st_tinyint_e20 set tag tagname="123abc" sql_error alter table st_tinyint_e22 set tag tagname=abc sql_error alter table st_tinyint_e23 set tag tagname="abc" sql_error alter table st_tinyint_e24 set tag tagname=" " -sql_error alter table st_tinyint_e25 set tag tagname='' +sql alter table st_tinyint_e25 set tag tagname='' diff --git a/tests/script/tsim/parser/columnValue_unsign.sim b/tests/script/tsim/parser/columnValue_unsign.sim index 4b8baf10cd..a72b1082f6 100644 --- a/tests/script/tsim/parser/columnValue_unsign.sim +++ b/tests/script/tsim/parser/columnValue_unsign.sim @@ -1,4 +1,12 @@ -sql create database if not exists db +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== columnValues.sim + +sql drop database if exists db +sql create database db sql use db sql drop table if exists mt_unsigned; @@ -10,28 +18,21 @@ sql alter table mt_unsigned_1 set tag t1=138; sql alter table mt_unsigned_1 set tag t2=32769; sql alter table mt_unsigned_1 set tag t3=294967295; sql alter table mt_unsigned_1 set tag t4=446744073709551615; +sql insert into mt_unsigned_1 values (now, 0, 0, 0, 0, 0, 0, 0, 0, 0) + sql select t1,t2,t3,t4 from mt_unsigned_1 if $rows != 1 then return -1 endi - -print $data00, $data01, $data02, $data03 - -if $data00 != 138 then - print expect 138, actual: $data00 - return -1 -endi - +print $data01, $data02, $data03 if $data01 != 32769 then -return -1 + return -1 endi - if $data02 != 294967295 then -return -1 + return -1 endi - if $data03 != 446744073709551615 then -return -1 + return -1 endi sql_error sql alter table mt_unsigned_1 set tag t1 = 999; @@ -44,10 +45,10 @@ sql_error create table mt_unsigned_3 using mt_unsigned tags(0, -1, 0, 0, 0, 0, 0 sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, -1, 0, 0, 0, 0, 0); sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, -1, 0, 0, 0, 0); -sql_error create table mt_unsigned_2 using mt_unsigned tags(255, 0, 0, 0, 0, 0, 0, 0); -sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 65535, 0, 0, 0, 0, 0, 0); -sql_error create table mt_unsigned_4 using mt_unsigned tags(0, 0, 4294967295, 0, 0, 0, 0, 0); -sql_error create table mt_unsigned_5 using mt_unsigned tags(0, 0, 0, 18446744073709551615, 0, 0, 0, 0); +sql create table mt_unsigned_21 using mt_unsigned tags(255, 0, 0, 0, 0, 0, 0, 0); +sql create table mt_unsigned_31 using mt_unsigned tags(0, 65535, 0, 0, 0, 0, 0, 0); +sql create table mt_unsigned_41 using mt_unsigned tags(0, 0, 4294967295, 0, 0, 0, 0, 0); +sql create table mt_unsigned_51 using mt_unsigned tags(0, 0, 0, 18446744073709551615, 0, 0, 0, 0); sql_error create table mt_unsigned_2 using mt_unsigned tags(999, 0, 0, 0, 0, 0, 0, 0); sql_error create table mt_unsigned_3 using mt_unsigned tags(0, 95535, 0, 0, 0, 0, 0, 0); @@ -63,11 +64,6 @@ if $rows != 1 then return -1; endi -if $data00 != NULL then - print expect NULL, actual: $data00 - return -1 -endi - if $data01 != NULL then return -1 endi @@ -87,82 +83,44 @@ sql_error insert into mt_unsigned_1 values(now, -1, NULL, NULL, NULL, NULL, NULL sql_error insert into mt_unsigned_1 values(now, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL); sql_error insert into mt_unsigned_1 values(now, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL); sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL); -sql_error insert into mt_unsigned_1 values(now, 255, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -sql_error insert into mt_unsigned_1 values(now, NULL, 65535, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -sql_error insert into mt_unsigned_1 values(now, NULL, NULL, 4294967295, NULL, NULL, NULL, NULL, NULL, NULL); -sql_error insert into mt_unsigned_1 values(now, NULL, NULL, NULL, 18446744073709551615, NULL, NULL, NULL, NULL, NULL); +sql insert into mt_unsigned_1 values(now, 255, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +sql insert into mt_unsigned_1 values(now, NULL, 65535, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +sql insert into mt_unsigned_1 values(now, NULL, NULL, 4294967295, NULL, NULL, NULL, NULL, NULL, NULL); +sql insert into mt_unsigned_1 values(now, NULL, NULL, NULL, 18446744073709551615, NULL, NULL, NULL, NULL, NULL); + sql select count(a),count(b),count(c),count(d), count(e) from mt_unsigned_1 if $rows != 1 then return -1 endi -if $data00 != 1 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -sql select a+b+c from mt_unsigned_1 where a is null; -if $rows != 1 then - return -1 -endi - -if $data00 != NULL then - print expect NULL, actual:$data00 - return -1 -endi - -sql select count(*), a from mt_unsigned_1 group by a; -if $rows != 1 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -sql select count(*), b from mt_unsigned_1 group by b; -if $rows != 1 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - -if $data01 != 2 then - return -1 -endi - -sql select count(*), c from mt_unsigned_1 group by c; -if $rows != 1 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - if $data01 != 3 then return -1 endi +sql select a+b+c from mt_unsigned_1 where a is null; +if $rows != 4 then + return -1 +endi + +sql select count(*), a from mt_unsigned_1 group by a; +if $rows != 4 then + return -1 +endi + +sql select count(*), b from mt_unsigned_1 group by b; +if $rows != 4 then + return -1 +endi + + +sql select count(*), c from mt_unsigned_1 group by c; +if $rows != 4 then + return -1 +endi + + sql select count(*), d from mt_unsigned_1 group by d; -if $rows != 1 then - return -1 -endi - -if $data00 != 1 then - return -1 -endi - -if $data01 != 4 then +if $rows != 4 then return -1 endi From d1efdeb5dea3bc4ef25054e3b56808ee72f3cab3 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 29 Jul 2022 18:51:15 +0800 Subject: [PATCH 26/43] test: restore case --- tests/script/jenkins/basic.txt | 2 +- .../tsim/parser/col_arithmetic_operation.sim | 15 ------------- .../tsim/parser/col_arithmetic_query.sim | 22 +++++++------------ tests/script/tsim/parser/join.sim | 3 --- 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 85a8a5e9dd..d745ecf706 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -94,7 +94,7 @@ ./test.sh -f tsim/parser/auto_create_tb.sim ./test.sh -f tsim/parser/between_and.sim ./test.sh -f tsim/parser/binary_escapeCharacter.sim -# TD-17738 ./test.sh -f tsim/parser/col_arithmetic_operation.sim +./test.sh -f tsim/parser/col_arithmetic_operation.sim ./test.sh -f tsim/parser/columnValue_bigint.sim ./test.sh -f tsim/parser/columnValue_bool.sim ./test.sh -f tsim/parser/columnValue_double.sim diff --git a/tests/script/tsim/parser/col_arithmetic_operation.sim b/tests/script/tsim/parser/col_arithmetic_operation.sim index add2945c66..f22beefdf8 100644 --- a/tests/script/tsim/parser/col_arithmetic_operation.sim +++ b/tests/script/tsim/parser/col_arithmetic_operation.sim @@ -131,20 +131,5 @@ sql_error select max(c1-c2) from $tb #========================================regression test cases==================================== print =====================> td-1764 sql select sum(c1)/count(*), sum(c1) as b, count(*) as b from $stb interval(1y) -if $rows != 1 then - return -1 -endi - -if $data00 != @18-01-01 00:00:00.000@ then - return -1 -endi - -if $data01 != 2.250000000 then - return -1 -endi - -if $data02 != 225000 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/tsim/parser/col_arithmetic_query.sim b/tests/script/tsim/parser/col_arithmetic_query.sim index 10840b2296..b77dcbe498 100644 --- a/tests/script/tsim/parser/col_arithmetic_query.sim +++ b/tests/script/tsim/parser/col_arithmetic_query.sim @@ -511,24 +511,21 @@ if $rows != 1 then endi # slimit/soffset not support for normal table query. [d.11]=============================================================== -sql select sum(c1) from $stb slimit 1 soffset 19; -if $rows != 0 then - return -1 -endi +sql_error select sum(c1) from $stb slimit 1 soffset 19; -sql select sum(c1) from $stb interval(1s) group by tbname slimit 1 soffset 1 -sql select sum(c1) from ca_stb0 interval(1s) group by tbname slimit 2 soffset 4 limit 10 offset 1 +sql select sum(c1) from ca_stb0 partition by tbname interval(1s) slimit 1 soffset 1 +sql select sum(c1) from ca_stb0 partition by tbname interval(1s) slimit 2 soffset 4 limit 10 offset 1 # fill [d.12]=============================================================== -sql_error select first(c1)-last(c1), sum(c3)*count(c3), spread(c5 ) % count(*) from $stb interval(1s) fill(prev); -sql_error select first(c1) from $stb fill(value, 20); +sql_error select first(c1)-last(c1), sum(c3)*count(c3), spread(c5 ) % count(*) from ca_stb0 interval(1s) fill(prev); +sql_error select first(c1) from ca_stb0 fill(value, 20); # constant column. [d.13]=============================================================== # column value filter [d.14]=============================================================== # tag filter. [d.15]=============================================================== -sql select sum(c2)+99 from $stb where t1=12; +sql select sum(c2)+99 from ca_stb0 where t1=12; # multi-field output [d.16]=============================================================== sql select count(*), sum(c1)*avg(c2), avg(c3)*count(c3), sum(c3), sum(c4), first(c7), last(c8), first(c9), first(c7), last(c8) from $tb @@ -548,15 +545,12 @@ if $data90 != 9.500000000 then endi # interval query [d.17]=============================================================== -sql select avg(c2)*count(c2), sum(c3)-first(c3), last(c4)+9 from $stb interval(1s) +sql select avg(c2)*count(c2), sum(c3)-first(c3), last(c4)+9 from ca_stb0 interval(1s) if $rows != 10000 then return -1 endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -sql_error select first(c7)- last(c1) from $tb interval(2y) +sql select first(c7)- last(c1) from $tb interval(2y) # aggregation query [d.18]=============================================================== # all cases in this part are aggregation query test. diff --git a/tests/script/tsim/parser/join.sim b/tests/script/tsim/parser/join.sim index 269d4ca254..0f41ebd178 100644 --- a/tests/script/tsim/parser/join.sim +++ b/tests/script/tsim/parser/join.sim @@ -243,9 +243,6 @@ if $rows != $val then return -1 endi -#TODO -return - #===========================aggregation=================================== #select + where condition sql select count(join_tb1.*), count(join_tb0.*) from $tb1 , $tb2 where $ts1 = $ts2 and join_tb1.ts >= 100000 and join_tb0.c7 = false; From cd5491fea11ad24322ceb16f2440292e208d1be6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 19:00:12 +0800 Subject: [PATCH 27/43] fix(query): remove invalid code. --- .gitignore | 2 ++ source/libs/executor/src/scanoperator.c | 6 +++--- tests/script/tsim/insert/basic0.sim | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d7fcb019ae..80fd850cd4 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,8 @@ pysim/ *.out *DS_Store tests/script/api/batchprepare +taosadapter +taosadapter-debug # Doxygen Generated files html/ diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 30a9b6d0e5..fc67f3da6c 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -679,9 +679,9 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, pSup->pCtx = createSqlFunctionCtx(pSup->pExprInfo, pSup->numOfExprs, &pSup->rowEntryInfoOffset); } -// pInfo->scanInfo = (SScanInfo){.numOfAsc = pTableScanNode->scanSeq[0], .numOfDesc = pTableScanNode->scanSeq[1]}; - pInfo->scanInfo = (SScanInfo){.numOfAsc = 0, .numOfDesc = 1}; // for debug purpose - pInfo->cond.order = TSDB_ORDER_DESC; + pInfo->scanInfo = (SScanInfo){.numOfAsc = pTableScanNode->scanSeq[0], .numOfDesc = pTableScanNode->scanSeq[1]}; +// pInfo->scanInfo = (SScanInfo){.numOfAsc = 0, .numOfDesc = 1}; // for debug purpose +// pInfo->cond.order = TSDB_ORDER_DESC; pInfo->pdInfo.interval = extractIntervalInfo(pTableScanNode); pInfo->readHandle = *readHandle; diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index 1f3c93a4bf..7d91a77a83 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -54,7 +54,8 @@ print $data30 $data31 $data32 $data33 if $rows != 4 then return -1 endi -if $data01 != 10 then +if $data01 != 10 then + print expect 10, actual: $data01 return -1 endi if $data02 != 2.00000 then From bf27143bed42e4730c87c1018c6876110281fe43 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 29 Jul 2022 19:18:33 +0800 Subject: [PATCH 28/43] os: add win service and crashdump --- source/os/src/osSysinfo.c | 2 +- tests/system-test/simpletest.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 812e4c2802..3e68b6e086 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -842,7 +842,7 @@ char *taosGetCmdlineByPID(int pid) { void taosSetCoreDump(bool enable) { #ifdef WINDOWS - SetUnhandledExceptionFilter(exceptionHandler); + // SetUnhandledExceptionFilter(exceptionHandler); // SetUnhandledExceptionFilter(&FlCrashDump); #elif defined(_TD_DARWIN_64) #else diff --git a/tests/system-test/simpletest.bat b/tests/system-test/simpletest.bat index e33fe0d538..656828aa1e 100644 --- a/tests/system-test/simpletest.bat +++ b/tests/system-test/simpletest.bat @@ -6,7 +6,7 @@ python3 .\test.py -f 0-others\telemetry.py python3 .\test.py -f 0-others\taosdMonitor.py python3 .\test.py -f 0-others\udfTest.py python3 .\test.py -f 0-others\udf_create.py -@REM python3 .\test.py -f 0-others\udf_restart_taosd.py +python3 .\test.py -f 0-others\udf_restart_taosd.py @REM python3 .\test.py -f 0-others\cachelast.py @REM python3 .\test.py -f 0-others\user_control.py From 0550ab5306f0d9ff5706fe2e9fcc6b16043ac023 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 29 Jul 2022 19:21:00 +0800 Subject: [PATCH 29/43] enh: last function optimize --- source/libs/command/src/explain.c | 4 +++- source/libs/planner/src/planSpliter.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index a6337837aa..66a94f7e28 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1159,7 +1159,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_NEW(level + 1, EXPLAIN_MERGE_KEYS_FORMAT); for (int32_t i = 0; i < LIST_LENGTH(pMergeNode->pMergeKeys); ++i) { SOrderByExprNode *ptn = (SOrderByExprNode *)nodesListGetNode(pMergeNode->pMergeKeys, i); - EXPLAIN_ROW_APPEND("%s ", nodesGetNameFromColumnNode(ptn->pExpr)); + EXPLAIN_ROW_APPEND(EXPLAIN_STRING_TYPE_FORMAT, nodesGetNameFromColumnNode(ptn->pExpr)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_STRING_TYPE_FORMAT, EXPLAIN_ORDER_STRING(ptn->order)); } EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 81e2bff179..bc5e50218b 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -492,7 +492,7 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo ((SWindowLogicNode*)pInfo->pSplitNode)->windowAlgo = INTERVAL_ALGO_MERGE; SNodeList* pMergeKeys = NULL; code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pInfo->pSplitNode)->pTspk, - ((SWindowLogicNode*)pInfo->pSplitNode)->inputTsOrder, &pMergeKeys); + ((SWindowLogicNode*)pInfo->pSplitNode)->outputTsOrder, &pMergeKeys); if (TSDB_CODE_SUCCESS == code) { code = stbSplCreateMergeNode(pCxt, NULL, pInfo->pSplitNode, pMergeKeys, pPartWindow, true); } From 9e8c52329cf532f7a2af2af6d6c6aae95a448bdd Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 29 Jul 2022 19:24:38 +0800 Subject: [PATCH 30/43] test: adjust unstable case --- tests/script/tsim/parser/tags_dynamically_specifiy.sim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/script/tsim/parser/tags_dynamically_specifiy.sim b/tests/script/tsim/parser/tags_dynamically_specifiy.sim index d1f73c4f60..e6cdeea970 100644 --- a/tests/script/tsim/parser/tags_dynamically_specifiy.sim +++ b/tests/script/tsim/parser/tags_dynamically_specifiy.sim @@ -41,12 +41,10 @@ sql_error insert into tb17 (ts, c1, c3) using stb (t1, t3) tags ('tag5', 11.11, sql_error insert into tb18 (ts, c1, c3) using stb tags ('tag5', 16) values ( now + 5s, 'binary6', 6.6) sql_error insert into tb19 (ts, c1, c2, c3) using stb tags (19, 'tag5', 91.11) values ( now + 5s, 'binary7', 7, 7.7) - - sql create table stbx (ts timestamp, c1 binary(10), c2 int, c3 float) tags (t1 binary(10), t2 int, t3 float) sql insert into tb100 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag100', 100, 100.123456) values ( now + 10s, 'binary100', 100, 100.9) tb101 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag101', 101, 101.9) values ( now + 10s, 'binary101', 101, 101.9) tb102 (ts, c1, c2, c3) using stbx (t1, t2, t3) tags ('tag102', 102, 102.9) values ( now + 10s, 'binary102', 102, 102.9) -sql select * from stbx +sql select * from stbx order by t1 if $rows != 3 then return -1 endi From 0c1e30dc56cd03aac2b3c600fb42aa35df05f268 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 19:34:13 +0800 Subject: [PATCH 31/43] fix(query): step forward index --- source/dnode/vnode/src/tsdb/tsdbRead.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index c259a7cfe0..c5667cce41 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -1445,10 +1445,10 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI if ((pDumpInfo->rowIndex < pDumpInfo->totalRows - 1 && pReader->order == TSDB_ORDER_ASC) || (pDumpInfo->rowIndex > 0 && pReader->order == TSDB_ORDER_DESC)) { int32_t step = pReader->order == TSDB_ORDER_ASC? 1:-1; - int64_t nextKey = pBlockData->aTSKEY[pDumpInfo->rowIndex + step]; - if (nextKey != key) { - // merge is not needed + int64_t nextKey = pBlockData->aTSKEY[pDumpInfo->rowIndex + step]; + if (nextKey != key) { // merge is not needed doAppendRowFromBlock(pReader->pResBlock, pReader, pBlockData, pDumpInfo->rowIndex); + pDumpInfo->rowIndex += step; return TSDB_CODE_SUCCESS; } } From c8fbcb967228a0f0fbbba758542b7bf4ebee9c5a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 29 Jul 2022 19:40:14 +0800 Subject: [PATCH 32/43] feat(stream): Recycled Pages --- source/libs/executor/src/timewindowoperator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 400940245d..1e1b5d7100 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -3098,6 +3098,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT); pInfo->delIndex = 0; pInfo->pDelWins = taosArrayInit(4, sizeof(SWinRes)); + pInfo->pRecycledPages = taosArrayInit(4, sizeof(int32_t)); pOperator->operatorType = pPhyNode->type; pOperator->blocking = true; From 1543e241d3e7fdfb542d19ac5ee510d4a8d7e5b6 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 29 Jul 2022 19:49:54 +0800 Subject: [PATCH 33/43] refact: do some insert optimization --- source/dnode/vnode/src/inc/tsdb.h | 21 +++++++++++++- source/dnode/vnode/src/meta/metaOpen.c | 12 ++++---- source/dnode/vnode/src/tsdb/tsdbUtil.c | 38 ++++++-------------------- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index d8c84e952b..fdf970611c 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -97,7 +97,6 @@ int32_t tRowMergerGetRow(SRowMerger *pMerger, STSRow **ppRow); // TABLEID int32_t tTABLEIDCmprFn(const void *p1, const void *p2); // TSDBKEY -int32_t tsdbKeyCmprFn(const void *p1, const void *p2); #define MIN_TSDBKEY(KEY1, KEY2) ((tsdbKeyCmprFn(&(KEY1), &(KEY2)) < 0) ? (KEY1) : (KEY2)) #define MAX_TSDBKEY(KEY1, KEY2) ((tsdbKeyCmprFn(&(KEY1), &(KEY2)) > 0) ? (KEY1) : (KEY2)) // SBlockCol @@ -558,6 +557,26 @@ struct STsdbReadSnap { STsdbFS fs; }; +// ========== inline functions ========== +static FORCE_INLINE int32_t tsdbKeyCmprFn(const void *p1, const void *p2) { + TSDBKEY *pKey1 = (TSDBKEY *)p1; + TSDBKEY *pKey2 = (TSDBKEY *)p2; + + if (pKey1->ts < pKey2->ts) { + return -1; + } else if (pKey1->ts > pKey2->ts) { + return 1; + } + + if (pKey1->version < pKey2->version) { + return -1; + } else if (pKey1->version > pKey2->version) { + return 1; + } + + return 0; +} + #ifdef __cplusplus } #endif diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 7c7d14e337..9bbd9bcc5c 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -183,11 +183,11 @@ int metaClose(SMeta *pMeta) { int32_t metaRLock(SMeta *pMeta) { int32_t ret = 0; - metaDebug("meta rlock %p B", &pMeta->lock); + metaTrace("meta rlock %p B", &pMeta->lock); ret = taosThreadRwlockRdlock(&pMeta->lock); - metaDebug("meta rlock %p E", &pMeta->lock); + metaTrace("meta rlock %p E", &pMeta->lock); return ret; } @@ -195,11 +195,11 @@ int32_t metaRLock(SMeta *pMeta) { int32_t metaWLock(SMeta *pMeta) { int32_t ret = 0; - metaDebug("meta wlock %p B", &pMeta->lock); + metaTrace("meta wlock %p B", &pMeta->lock); ret = taosThreadRwlockWrlock(&pMeta->lock); - metaDebug("meta wlock %p E", &pMeta->lock); + metaTrace("meta wlock %p E", &pMeta->lock); return ret; } @@ -207,11 +207,11 @@ int32_t metaWLock(SMeta *pMeta) { int32_t metaULock(SMeta *pMeta) { int32_t ret = 0; - metaDebug("meta ulock %p B", &pMeta->lock); + metaTrace("meta ulock %p B", &pMeta->lock); ret = taosThreadRwlockUnlock(&pMeta->lock); - metaDebug("meta ulock %p E", &pMeta->lock); + metaTrace("meta ulock %p E", &pMeta->lock); return ret; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 3e05b75dd0..8926e5e3c6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -151,26 +151,6 @@ int32_t tTABLEIDCmprFn(const void *p1, const void *p2) { return 0; } -// TSDBKEY ======================================================================= -int32_t tsdbKeyCmprFn(const void *p1, const void *p2) { - TSDBKEY *pKey1 = (TSDBKEY *)p1; - TSDBKEY *pKey2 = (TSDBKEY *)p2; - - if (pKey1->ts < pKey2->ts) { - return -1; - } else if (pKey1->ts > pKey2->ts) { - return 1; - } - - if (pKey1->version < pKey2->version) { - return -1; - } else if (pKey1->version > pKey2->version) { - return 1; - } - - return 0; -} - // TSDBKEY ====================================================== static FORCE_INLINE int32_t tPutTSDBKEY(uint8_t *p, TSDBKEY *pKey) { int32_t n = 0; @@ -1401,7 +1381,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { break; case TSDB_DATA_TYPE_BOOL: break; - case TSDB_DATA_TYPE_TINYINT:{ + case TSDB_DATA_TYPE_TINYINT: { pColAgg->sum += colVal.value.i8; if (pColAgg->min > colVal.value.i8) { pColAgg->min = colVal.value.i8; @@ -1411,7 +1391,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } break; } - case TSDB_DATA_TYPE_SMALLINT:{ + case TSDB_DATA_TYPE_SMALLINT: { pColAgg->sum += colVal.value.i16; if (pColAgg->min > colVal.value.i16) { pColAgg->min = colVal.value.i16; @@ -1441,7 +1421,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } break; } - case TSDB_DATA_TYPE_FLOAT:{ + case TSDB_DATA_TYPE_FLOAT: { pColAgg->sum += colVal.value.f; if (pColAgg->min > colVal.value.f) { pColAgg->min = colVal.value.f; @@ -1451,7 +1431,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } break; } - case TSDB_DATA_TYPE_DOUBLE:{ + case TSDB_DATA_TYPE_DOUBLE: { pColAgg->sum += colVal.value.d; if (pColAgg->min > colVal.value.d) { pColAgg->min = colVal.value.d; @@ -1463,7 +1443,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } case TSDB_DATA_TYPE_VARCHAR: break; - case TSDB_DATA_TYPE_TIMESTAMP:{ + case TSDB_DATA_TYPE_TIMESTAMP: { if (pColAgg->min > colVal.value.i64) { pColAgg->min = colVal.value.i64; } @@ -1474,7 +1454,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } case TSDB_DATA_TYPE_NCHAR: break; - case TSDB_DATA_TYPE_UTINYINT:{ + case TSDB_DATA_TYPE_UTINYINT: { pColAgg->sum += colVal.value.u8; if (pColAgg->min > colVal.value.u8) { pColAgg->min = colVal.value.u8; @@ -1484,7 +1464,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } break; } - case TSDB_DATA_TYPE_USMALLINT:{ + case TSDB_DATA_TYPE_USMALLINT: { pColAgg->sum += colVal.value.u16; if (pColAgg->min > colVal.value.u16) { pColAgg->min = colVal.value.u16; @@ -1494,7 +1474,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } break; } - case TSDB_DATA_TYPE_UINT:{ + case TSDB_DATA_TYPE_UINT: { pColAgg->sum += colVal.value.u32; if (pColAgg->min > colVal.value.u32) { pColAgg->min = colVal.value.u32; @@ -1504,7 +1484,7 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } break; } - case TSDB_DATA_TYPE_UBIGINT:{ + case TSDB_DATA_TYPE_UBIGINT: { pColAgg->sum += colVal.value.u64; if (pColAgg->min > colVal.value.u64) { pColAgg->min = colVal.value.u64; From 87d0bf7d3cbb01118b88bbe8d3f01ac6d8607907 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 29 Jul 2022 12:01:45 +0000 Subject: [PATCH 34/43] fix: tsdb dat seprate even on level 0 --- source/dnode/vnode/src/tsdb/tsdbCommit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 194bd2e924..24f066f703 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -307,7 +307,11 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { fLast = (SLastFile){.commitID = pCommitter->commitID, .size = 0}; fSma = *pRSet->pSmaF; } else { - wSet.diskId = (SDiskID){.level = 0, .id = 0}; + SDiskID did = {0}; + + tfsAllocDisk(pTsdb->pVnode->pTfs, 0, &did); + + wSet.diskId = did; wSet.fid = pCommitter->commitFid; fHead = (SHeadFile){.commitID = pCommitter->commitID, .offset = 0, .size = 0}; fData = (SDataFile){.commitID = pCommitter->commitID, .size = 0}; From 35151c9a9f4e352174e5092617c74eb3af6eda7a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 29 Jul 2022 20:01:50 +0800 Subject: [PATCH 35/43] test: adjust unstable case --- tests/script/tsim/trans/create_db.sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/tsim/trans/create_db.sim b/tests/script/tsim/trans/create_db.sim index 4a20f73e6c..057711aa88 100644 --- a/tests/script/tsim/trans/create_db.sim +++ b/tests/script/tsim/trans/create_db.sim @@ -32,7 +32,7 @@ if $data(2)[4] != ready then endi print =============== kill dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGKILL print =============== create database sql show transactions @@ -88,7 +88,7 @@ endi sql show transactions if $rows != 0 then - return -1 + goto step2 endi sql_error create database d1 vgroups 2; From 5caf11485ebcf880d4cfd8bb47f34790fc4f7f11 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 29 Jul 2022 20:03:59 +0800 Subject: [PATCH 36/43] fix:error in sml meta change --- source/client/src/clientSml.c | 113 +++++++++++++++++++++---------- tests/system-test/2-query/sml.py | 2 + tests/test/c/sml_test.c | 32 +++++++++ 3 files changed, 111 insertions(+), 36 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 15c74dd7ac..56d09850fc 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -310,8 +310,11 @@ static int32_t getBytes(uint8_t type, int32_t length){ } } -static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *sTableData, - int32_t colVer, int32_t tagVer, int8_t source, uint64_t suid){ +//static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *sTableData, +// int32_t colVer, int32_t tagVer, int8_t source, uint64_t suid){ +static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *sTableData, + STableMeta *pTableMeta, ESchemaAction action){ + SRequestObj* pRequest = NULL; SMCreateStbReq pReq = {0}; int32_t code = TSDB_CODE_SUCCESS; @@ -327,43 +330,81 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *sT goto end; } - pReq.colVer = colVer; - pReq.tagVer = tagVer; - pReq.source = source; - pReq.commentLen = -1; - pReq.igExists = true; - pReq.suid = suid; - tNameExtractFullName(pName, pReq.name); - - pReq.numOfColumns = taosArrayGetSize(sTableData->cols); - pReq.numOfTags = taosArrayGetSize(sTableData->tags); - - pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SField)); - for (int i = 0; i < pReq.numOfColumns; i++) { - SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->cols, i); - SField field = {0}; - field.type = kv->type; - field.bytes = getBytes(kv->type, kv->length); - memcpy(field.name, kv->key, kv->keyLen); - taosArrayPush(pReq.pColumns, &field); + if (action == SCHEMA_ACTION_NULL){ + pReq.colVer = 1; + pReq.tagVer = 1; + pReq.suid = 0; + pReq.source = TD_REQ_FROM_APP; + } else if (action == SCHEMA_ACTION_TAG){ + pReq.colVer = pTableMeta->sversion; + pReq.tagVer = pTableMeta->tversion + 1; + pReq.suid = pTableMeta->uid; + pReq.source = TD_REQ_FROM_TAOX; + } else if (action == SCHEMA_ACTION_COLUMN){ + pReq.colVer = pTableMeta->sversion + 1; + pReq.tagVer = pTableMeta->tversion; + pReq.suid = pTableMeta->uid; + pReq.source = TD_REQ_FROM_TAOX; } - if (pReq.numOfTags == 0){ - pReq.numOfTags = 1; - pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField)); - SField field = {0}; - field.type = TSDB_DATA_TYPE_NCHAR; - field.bytes = 1; - strcpy(field.name, tsSmlTagName); - taosArrayPush(pReq.pTags, &field); - }else{ - pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField)); - for (int i = 0; i < pReq.numOfTags; i++) { - SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->tags, i); + pReq.commentLen = -1; + pReq.igExists = true; + tNameExtractFullName(pName, pReq.name); + + if(action == SCHEMA_ACTION_NULL || action == SCHEMA_ACTION_COLUMN){ + pReq.numOfColumns = taosArrayGetSize(sTableData->cols); + pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SField)); + for (int i = 0; i < pReq.numOfColumns; i++) { + SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->cols, i); SField field = {0}; field.type = kv->type; field.bytes = getBytes(kv->type, kv->length); memcpy(field.name, kv->key, kv->keyLen); + taosArrayPush(pReq.pColumns, &field); + } + }else if (action == SCHEMA_ACTION_TAG){ + pReq.numOfColumns = pTableMeta->tableInfo.numOfColumns; + pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SField)); + for (int i = 0; i < pReq.numOfColumns; i++) { + SSchema *s = &pTableMeta->schema[i]; + SField field = {0}; + field.type = s->type; + field.bytes = s->bytes; + strcpy(field.name, s->name); + taosArrayPush(pReq.pColumns, &field); + } + } + + if(action == SCHEMA_ACTION_NULL || action == SCHEMA_ACTION_TAG){ + pReq.numOfTags = taosArrayGetSize(sTableData->tags); + if (pReq.numOfTags == 0){ + pReq.numOfTags = 1; + pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField)); + SField field = {0}; + field.type = TSDB_DATA_TYPE_NCHAR; + field.bytes = 1; + strcpy(field.name, tsSmlTagName); + taosArrayPush(pReq.pTags, &field); + }else{ + pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField)); + for (int i = 0; i < pReq.numOfTags; i++) { + SSmlKv *kv = (SSmlKv *)taosArrayGetP(sTableData->tags, i); + SField field = {0}; + field.type = kv->type; + field.bytes = getBytes(kv->type, kv->length); + memcpy(field.name, kv->key, kv->keyLen); + taosArrayPush(pReq.pTags, &field); + } + } + }else if (action == SCHEMA_ACTION_COLUMN){ + pReq.numOfTags = pTableMeta->tableInfo.numOfTags; + pReq.pTags = taosArrayInit(pReq.numOfTags, sizeof(SField)); + for (int i = 0; i < pReq.numOfTags; i++) { + SSchema *s = &pTableMeta->schema[i + pTableMeta->tableInfo.numOfColumns]; + SField field = {0}; + field.type = s->type; + field.bytes = s->bytes; + strcpy(field.name, s->name); taosArrayPush(pReq.pTags, &field); } } @@ -424,7 +465,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_STB_NOT_EXIST) { - code = smlSendMetaMsg(info, &pName, sTableData, 1, 1, TD_REQ_FROM_APP, 0); + code = smlSendMetaMsg(info, &pName, sTableData, NULL, SCHEMA_ACTION_NULL); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable); goto end; @@ -445,7 +486,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { goto end; } if (action == SCHEMA_ACTION_TAG){ - code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta->sversion, pTableMeta->tversion + 1, TD_REQ_FROM_TAOX, pTableMeta->uid); + code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta, action); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable); goto end; @@ -468,7 +509,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { goto end; } if (action == SCHEMA_ACTION_COLUMN){ - code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta->sversion + 1, pTableMeta->tversion, TD_REQ_FROM_TAOX, pTableMeta->uid); + code = smlSendMetaMsg(info, &pName, sTableData, pTableMeta, action); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, superTable); goto end; diff --git a/tests/system-test/2-query/sml.py b/tests/system-test/2-query/sml.py index ae89ffb5b4..6cfb9a1dad 100644 --- a/tests/system-test/2-query/sml.py +++ b/tests/system-test/2-query/sml.py @@ -83,6 +83,8 @@ class TDTestCase: tdSql.checkData(1, 3, "web01") tdSql.checkData(1, 4, "t1") + tdSql.query("select * from macylr") + tdSql.checkRows(2) return def run(self): diff --git a/tests/test/c/sml_test.c b/tests/test/c/sml_test.c index fc6cdd0ec2..b8a9b816cf 100644 --- a/tests/test/c/sml_test.c +++ b/tests/test/c/sml_test.c @@ -1070,6 +1070,36 @@ int sml_16960_Test() { return code; } +int sml_add_tag_col_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + const char *sql[] = { + "macylr,t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000" + }; + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + if (code) return code; + + const char *sql1[] = { + "macylr,id=macylr_17875_1804,t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\",t11=127i8,t10=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64,c11=L\"ncharColValue\",c10=f 1626006833639000000" + }; + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, 0); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + taos_free_result(pRes); + + return code; +} + int main(int argc, char *argv[]) { int ret = 0; ret = smlProcess_influx_Test(); @@ -1097,5 +1127,7 @@ int main(int argc, char *argv[]) { ret = sml_dup_time_Test(); if(ret) return ret; ret = sml_16960_Test(); + if(ret) return ret; + ret = sml_add_tag_col_Test(); return ret; } From 32418f161b583c797db48088f2ec1c708d92b351 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 29 Jul 2022 20:41:16 +0800 Subject: [PATCH 37/43] enh: cumulative functions support mixed use --- source/libs/parser/src/parTranslater.c | 3 ++- tests/script/tsim/compute/diff2.sim | 2 +- tests/system-test/2-query/function_diff.py | 2 +- tests/system-test/2-query/unique.py | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 411f7f772f..5163d71408 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1115,7 +1115,8 @@ static int32_t translateIndefiniteRowsFunc(STranslateContext* pCxt, SFunctionNod } SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt; if (pSelect->hasAggFuncs || pSelect->hasMultiRowsFunc || - (pSelect->hasIndefiniteRowsFunc && pSelect->returnRows != fmGetFuncReturnRows(pFunc))) { + (pSelect->hasIndefiniteRowsFunc && + (FUNC_RETURN_ROWS_INDEFINITE == pSelect->returnRows || pSelect->returnRows != fmGetFuncReturnRows(pFunc)))) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } if (NULL != pSelect->pWindow || NULL != pSelect->pGroupByList) { diff --git a/tests/script/tsim/compute/diff2.sim b/tests/script/tsim/compute/diff2.sim index 021fcf6e8b..a09bee991e 100644 --- a/tests/script/tsim/compute/diff2.sim +++ b/tests/script/tsim/compute/diff2.sim @@ -79,7 +79,7 @@ sql select diff(c7) from $tb sql_error select diff(c8) from $tb sql_error select diff(c9) from $tb sql_error select diff(ts) from $tb -sql_error select diff(c1), diff(c2) from $tb +sql select diff(c1), diff(c2) from $tb sql select 2+diff(c1) from $tb sql select diff(c1+2) from $tb diff --git a/tests/system-test/2-query/function_diff.py b/tests/system-test/2-query/function_diff.py index 99e87e6cd6..2f463e59a0 100644 --- a/tests/system-test/2-query/function_diff.py +++ b/tests/system-test/2-query/function_diff.py @@ -280,7 +280,7 @@ class TDTestCase: tdSql.error(self.diff_query_form(alias=", min(c1)")) # mix with select function 1 tdSql.error(self.diff_query_form(alias=", top(c1, 5)")) # mix with select function 2 tdSql.error(self.diff_query_form(alias=", spread(c1)")) # mix with calculation function 1 - tdSql.error(self.diff_query_form(alias=", diff(c1)")) # mix with calculation function 2 + tdSql.query(self.diff_query_form(alias=", diff(c1)")) # mix with calculation function 2 # tdSql.error(self.diff_query_form(alias=" + 2")) # mix with arithmetic 1 tdSql.error(self.diff_query_form(alias=" + avg(c1)")) # mix with arithmetic 2 tdSql.query(self.diff_query_form(alias=", c2")) # mix with other 1 diff --git a/tests/system-test/2-query/unique.py b/tests/system-test/2-query/unique.py index 3e6e14be38..ccf7e287e2 100644 --- a/tests/system-test/2-query/unique.py +++ b/tests/system-test/2-query/unique.py @@ -457,15 +457,15 @@ class TDTestCase: ) tdSql.execute( - f"insert into sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" + f"insert into sub1_bound values ( now()+1s, -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" ) tdSql.execute( - f"insert into sub1_bound values ( now(), 2147483643, 9223372036854775803, 32763, 123, 3.39E+38, 1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )" + f"insert into sub1_bound values ( now()+2s, 2147483643, 9223372036854775803, 32763, 123, 3.39E+38, 1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )" ) tdSql.execute( - f"insert into sub1_bound values ( now(), -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )" + f"insert into sub1_bound values ( now()+3s, -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )" ) tdSql.error( From 344e821e87e776f8feeaf07fba86f139d70a6568 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 29 Jul 2022 20:53:45 +0800 Subject: [PATCH 38/43] fix: fix rsma writing historical data wal got overwritten by unrelated SSDatablocks got from streamscan TD- 17958 --- source/libs/executor/src/timewindowoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 400940245d..1ca450a1b5 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1597,7 +1597,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { continue; } - if (pBlock->info.type == STREAM_NORMAL) { + if (pBlock->info.type == STREAM_NORMAL && pBlock->info.version != 0) { // set input version pTaskInfo->version = pBlock->info.version; } From 0f3e244eb2df72d302daa7f9317d0551fe62f6a3 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 29 Jul 2022 20:57:21 +0800 Subject: [PATCH 39/43] refactor(sync): speed up sync point --- tools/taos-tools | 1 - tools/taosadapter | 1 - tools/taosws-rs | 1 - 3 files changed, 3 deletions(-) delete mode 160000 tools/taos-tools delete mode 160000 tools/taosadapter delete mode 160000 tools/taosws-rs diff --git a/tools/taos-tools b/tools/taos-tools deleted file mode 160000 index 817cb6ac43..0000000000 --- a/tools/taos-tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 817cb6ac431ed8ae4c843872cdfc8c201c1e1894 diff --git a/tools/taosadapter b/tools/taosadapter deleted file mode 160000 index df8678f070..0000000000 --- a/tools/taosadapter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit df8678f070e3f707faf59baebec90065f6e1268b diff --git a/tools/taosws-rs b/tools/taosws-rs deleted file mode 160000 index 9de599dc52..0000000000 --- a/tools/taosws-rs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9de599dc5293e9c90bc00bc4a03f8b91ba756bc3 From b3dc2118196cae1ec31e1adcd976a063bd009a08 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 29 Jul 2022 21:03:42 +0800 Subject: [PATCH 40/43] feat: update taostools for3.0 (#15562) * feat: update taos-tools for 3.0 [TD-14141] * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools 8e3b3ee * fix: remove submodules * feat: update taos-tools c529299 --- cmake/taostools_CMakeLists.txt.in | 2 +- tools/taos-tools | 1 - tools/taosadapter | 1 - tools/taosws-rs | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) delete mode 160000 tools/taos-tools delete mode 160000 tools/taosadapter delete mode 160000 tools/taosws-rs diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index d430add979..8c3a4d2356 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # zlib ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 2.1.1 + GIT_TAG c529299 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/tools/taos-tools b/tools/taos-tools deleted file mode 160000 index 817cb6ac43..0000000000 --- a/tools/taos-tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 817cb6ac431ed8ae4c843872cdfc8c201c1e1894 diff --git a/tools/taosadapter b/tools/taosadapter deleted file mode 160000 index df8678f070..0000000000 --- a/tools/taosadapter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit df8678f070e3f707faf59baebec90065f6e1268b diff --git a/tools/taosws-rs b/tools/taosws-rs deleted file mode 160000 index 9de599dc52..0000000000 --- a/tools/taosws-rs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9de599dc5293e9c90bc00bc4a03f8b91ba756bc3 From 7ce5fb11b09b51dfa1f1e8e93794e65344185f54 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 29 Jul 2022 21:05:56 +0800 Subject: [PATCH 41/43] refactor(sync): speed up sync point --- source/libs/sync/src/syncAppendEntriesReply.c | 5 +++++ source/libs/sync/src/syncMain.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 81d050e179..bfaa785d0f 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -213,6 +213,11 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie if (nextIndex > SYNC_INDEX_BEGIN) { --nextIndex; + // speed up + if (nextIndex > pMsg->matchIndex + 1) { + nextIndex = pMsg->matchIndex + 1; + } + bool needStartSnapshot = false; if (nextIndex >= SYNC_INDEX_BEGIN && !ths->pLogStore->syncLogExist(ths->pLogStore, nextIndex)) { needStartSnapshot = true; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 2c64728998..52cbcd0059 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2222,13 +2222,18 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { SyncIndex preIndex = index - 1; SSyncRaftEntry* pPreEntry = NULL; int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preIndex, &pPreEntry); + + SSnapshot snapshot = {.data = NULL, + .lastApplyIndex = SYNC_INDEX_INVALID, + .lastApplyTerm = SYNC_TERM_INVALID, + .lastConfigIndex = SYNC_INDEX_INVALID}; + if (code == 0) { ASSERT(pPreEntry != NULL); preTerm = pPreEntry->term; taosMemoryFree(pPreEntry); return preTerm; } else { - SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0, .lastConfigIndex = -1}; if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); if (snapshot.lastApplyIndex == preIndex) { @@ -2239,7 +2244,8 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { do { char logBuf[128]; - snprintf(logBuf, sizeof(logBuf), "sync node get pre term error, index:%" PRId64, index); + snprintf(logBuf, sizeof(logBuf), "sync node get pre term error, index:%ld, snap-index:%ld, snap-term:%lu", index, + snapshot.lastApplyIndex, snapshot.lastApplyTerm); syncNodeErrorLog(pSyncNode, logBuf); } while (0); From 2261d689e4155515540beaa6866eae7ef93a4de6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 29 Jul 2022 21:09:33 +0800 Subject: [PATCH 42/43] fix(query): opt read data from file block. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 7 ++++--- source/libs/executor/src/executorimpl.c | 1 + tests/script/tsim/parser/function.sim | 4 +++- tests/script/tsim/parser/groupby.sim | 3 ++- tests/script/tsim/parser/limit_stb.sim | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index c5667cce41..072d15d715 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -2393,6 +2393,7 @@ int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBloc SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, i); if (pColData->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) { colDataAppendInt64(pColData, outputRowIndex, &pBlockData->aTSKEY[rowIndex]); + i += 1; } SColVal cv = {0}; @@ -2404,8 +2405,8 @@ int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBloc SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j); if (pData->cid == pCol->info.colId) { - tColDataGetValue(pData, j, &cv); - doCopyColVal(pCol, outputRowIndex++, i, &cv, pSupInfo); + tColDataGetValue(pData, rowIndex, &cv); + doCopyColVal(pCol, outputRowIndex, i, &cv, pSupInfo); j += 1; } else { // the specified column does not exist in file block, fill with null data colDataAppendNULL(pCol, outputRowIndex); @@ -2416,7 +2417,7 @@ int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBloc while (i < numOfOutputCols) { SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i); - colDataAppendNULL(pCol, rowIndex); + colDataAppendNULL(pCol, outputRowIndex); i += 1; } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 46e1b198b6..064c747c88 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3355,6 +3355,7 @@ static void destroyOperatorInfo(SOperatorInfo* pOperator) { pOperator->numOfDownstream = 0; } + cleanupExprSupp(&pOperator->exprSupp); taosMemoryFreeClear(pOperator); } diff --git a/tests/script/tsim/parser/function.sim b/tests/script/tsim/parser/function.sim index cbfb59bcab..110901a6e1 100644 --- a/tests/script/tsim/parser/function.sim +++ b/tests/script/tsim/parser/function.sim @@ -500,11 +500,12 @@ if $rows != 2 then return -1 endi -sql select stddev(k), stddev(b), stddev(c),tbname, a from m1 group by tbname,a +sql select stddev(k), stddev(b), stddev(c),tbname, a from m1 group by tbname,a order by a asc if $rows != 2 then return -1 endi if $data00 != 1.414213562 then + print expect 1.414213562, actual: $data00 return -1 endi if $data01 != 14.142135624 then @@ -732,6 +733,7 @@ if $rows != 1 then return -1 endi if $data00 != 0.005633334 then + print expect 0.005633334, actual: $data00 return -1 endi diff --git a/tests/script/tsim/parser/groupby.sim b/tests/script/tsim/parser/groupby.sim index bf2c7cc7bf..c4c19ca211 100644 --- a/tests/script/tsim/parser/groupby.sim +++ b/tests/script/tsim/parser/groupby.sim @@ -681,12 +681,13 @@ if $data14 != 1 then return -1 endi -sql select _wstart, irate(c), tbname, t1, t2 from st where t1=1 and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' partition by tbname, t1, t2 interval(1m) sliding(15s) order by tbname desc limit 1; +sql select _wstart, irate(c), tbname, t1, t2 from st where t1=1 and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' partition by tbname, t1, t2 interval(1m) sliding(15s) order by tbname desc,_wstart asc limit 1; if $rows != 1 then return -1 endi if $data01 != 1.000000000 then + print expect 1.000000000, actual: $data01 return -1 endi if $data02 != t2 then diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim index 0d0e4a8ea3..a0aff953cf 100644 --- a/tests/script/tsim/parser/limit_stb.sim +++ b/tests/script/tsim/parser/limit_stb.sim @@ -360,6 +360,7 @@ endi #sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.000' and c1 > 1 and c2 < 9 and c3 > 2 and c4 < 8 and c5 > 3 and c6 < 7 and c7 > 0 and c8 like '%5' and t1 > 3 and t1 < 6 limit 1 offset 0; sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.000' and c1 > 1 and c2 < 9 and c3 > 2 and c4 < 8 and c5 > 3 and c6 < 7 and c7 = true and c8 like '%5' and t1 > 3 and t1 < 6 limit 1 offset 0; if $rows != 1 then + print expect 1, actual: $rows return -1 endi if $data00 != 5 then From e0e23fc2cbec0a589cfec0cbc849aed54957441c Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 29 Jul 2022 21:17:39 +0800 Subject: [PATCH 43/43] refactor(sync): speed up sync point2 --- source/libs/sync/src/syncReplication.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index fa3b5d52d7..1a2a083677 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -132,7 +132,8 @@ int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode) { SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex); SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex); if (preLogTerm == SYNC_TERM_INVALID) { - SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1; + // SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1; + SyncIndex newNextIndex = nextIndex + 1; syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex); syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID); sError("vgId:%d sync get pre term error, nextIndex:%" PRId64 ", update next-index:%" PRId64 @@ -222,7 +223,8 @@ int32_t syncNodeAppendEntriesPeersSnapshot(SSyncNode* pSyncNode) { SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex); SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex); if (preLogTerm == SYNC_TERM_INVALID) { - SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1; + // SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1; + SyncIndex newNextIndex = nextIndex + 1; syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex); syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID); sError("vgId:%d sync get pre term error, nextIndex:%" PRId64 ", update next-index:%" PRId64