From c017e4387f49b039ba2e4529df4505d974527025 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 11 Aug 2022 16:17:38 +0800 Subject: [PATCH 1/5] fix(query): forbid interp in super table query TD-18331 --- include/libs/function/functionMgt.h | 1 + source/libs/function/inc/functionMgtInt.h | 1 + source/libs/function/src/builtins.c | 3 ++- source/libs/function/src/functionMgt.c | 2 ++ source/libs/parser/src/parTranslater.c | 22 ++++++++++++++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 479432eebe..741b0fddeb 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -199,6 +199,7 @@ bool fmIsUserDefinedFunc(int32_t funcId); bool fmIsDistExecFunc(int32_t funcId); bool fmIsForbidFillFunc(int32_t funcId); bool fmIsForbidStreamFunc(int32_t funcId); +bool fmIsForbidSuperTableFunc(int32_t funcId); bool fmIsIntervalInterpoFunc(int32_t funcId); bool fmIsInterpFunc(int32_t funcId); bool fmIsLastRowFunc(int32_t funcId); diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index 10cc20403c..37208c4723 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -49,6 +49,7 @@ extern "C" { #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_FORBID_STABLE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(23) #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 42df5cacfe..95267e5f58 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2287,7 +2287,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "interp", .type = FUNCTION_TYPE_INTERP, - .classification = FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | + FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_STABLE_FUNC, .translateFunc = translateInterp, .getEnvFunc = getSelectivityFuncEnv, .initFunc = functionSetup, diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 4f61b750d3..152a970c48 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -212,6 +212,8 @@ bool fmIsKeepOrderFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, F bool fmIsCumulativeFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_CUMULATIVE_FUNC); } +bool fmIsForbidSuperTableFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_FORBID_STABLE_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 5c49a6e0ab..4743a9aa9a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1270,6 +1270,25 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p return TSDB_CODE_SUCCESS; } +static int32_t translateForbidSuperTableFunc(STranslateContext* pCxt, SFunctionNode* pFunc) { + if (!fmIsForbidSuperTableFunc(pFunc->funcId)) { + return TSDB_CODE_SUCCESS; + } + if (!isSelectStmt(pCxt->pCurrStmt)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, + "%s is only supported in single table query", pFunc->functionName); + } + SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt; + SNode* pTable = pSelect->pFromTable; + if ((NULL != pTable && (QUERY_NODE_REAL_TABLE != nodeType(pTable) || + (TSDB_CHILD_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType && + TSDB_NORMAL_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType)))) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, + "%s is only supported in single table query", pFunc->functionName); + } + return TSDB_CODE_SUCCESS; +} + static bool isStar(SNode* pNode) { return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); @@ -1426,6 +1445,9 @@ static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) { static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* pFunc) { int32_t code = translateAggFunc(pCxt, pFunc); + if (TSDB_CODE_SUCCESS == code) { + code = translateForbidSuperTableFunc(pCxt, pFunc); + } if (TSDB_CODE_SUCCESS == code) { code = translateScanPseudoColumnFunc(pCxt, pFunc); } From 54cf2f7c275e4b864c33be2218d85589cf907c70 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 11 Aug 2022 16:21:31 +0800 Subject: [PATCH 2/5] fix test cases --- tests/system-test/99-TDcase/TD-15517.py | 92 +++++++++--------- tests/system-test/99-TDcase/TD-15554.py | 122 ++++++++++++------------ tests/system-test/99-TDcase/TD-15557.py | 58 +++++------ tests/system-test/99-TDcase/TD-15563.py | 62 ++++++------ 4 files changed, 167 insertions(+), 167 deletions(-) diff --git a/tests/system-test/99-TDcase/TD-15517.py b/tests/system-test/99-TDcase/TD-15517.py index ebab6617c2..99ca02aab7 100644 --- a/tests/system-test/99-TDcase/TD-15517.py +++ b/tests/system-test/99-TDcase/TD-15517.py @@ -50,7 +50,7 @@ class TDTestCase: return cur def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum,rowsPerTbl): - tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) + tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) tsql.execute("use %s" %dbName) tsql.execute("create table %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName) pre_create = "create table" @@ -63,7 +63,7 @@ class TDTestCase: sql = pre_create if sql != pre_create: tsql.execute(sql) - + tdLog.debug("complete to create database[%s], stable[%s] and %d child tables" %(dbName, stbName, ctbNum)) return @@ -90,7 +90,7 @@ class TDTestCase: tsql.execute(sql) tdLog.debug("insert data ............ [OK]") return - + def prepareEnv(self, **parameterDict): print ("input parameters:") print (parameterDict) @@ -109,9 +109,9 @@ class TDTestCase: parameterDict["ctbNum"],\ parameterDict["rowsPerTbl"],\ parameterDict["batchNum"],\ - parameterDict["startTs"]) - return - + parameterDict["startTs"]) + return + def run(self): tdSql.prepare() @@ -138,22 +138,22 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() time.sleep(2) - + # wait stb ready while 1: - tdSql.query("show %s.stables"%parameterDict['dbName']) - if tdSql.getRows() == 1: + tdSql.query("show %s.stables"%parameterDict['dbName']) + if tdSql.getRows() == 1: break else: time.sleep(1) tdLog.info("create topics from super table") topicFromStb = 'topic_stb_column' - topicFromCtb = 'topic_ctb_column' - + topicFromCtb = 'topic_ctb_column' + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb, parameterDict['dbName'], parameterDict['stbName'])) tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s_0" %(topicFromCtb, parameterDict['dbName'], parameterDict['stbName'])) - + time.sleep(1) tdSql.query("show topics") #tdSql.checkRows(2) @@ -161,15 +161,15 @@ class TDTestCase: topic2 = tdSql.getData(1 , 0) print (topic1) print (topic2) - + print (topicFromStb) print (topicFromCtb) #tdLog.info("show topics: %s, %s"%topic1, topic2) #if topic1 != topicFromStb or topic1 != topicFromCtb: - # tdLog.exit("topic error1") + # tdLog.exit("topic error1") #if topic2 != topicFromStb or topic2 != topicFromCtb: - # tdLog.exit("topic error2") - + # tdLog.exit("topic error2") + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)") @@ -187,7 +187,7 @@ class TDTestCase: sql = "insert into consumeinfo values " sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectmsgcnt1, ifcheckdata) tdSql.query(sql) - + tdLog.info("check stb if there are data") while 1: tdSql.query("select count(*) from %s"%parameterDict["stbName"]) @@ -198,21 +198,21 @@ class TDTestCase: break else: time.sleep(1) - + tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 showRow = 1 - + shellCmd = 'nohup ' + buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) - shellCmd += "> /dev/null 2>&1 &" + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) + shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) - os.system(shellCmd) + os.system(shellCmd) # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from consumeresult") @@ -223,17 +223,17 @@ class TDTestCase: time.sleep(5) expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] - + tdSql.checkData(0 , 1, consumerId) tdSql.checkData(0 , 2, expectmsgcnt) tdSql.checkData(0 , 3, expectrowcnt) tdSql.query("drop topic %s"%topicFromStb) tdSql.query("drop topic %s"%topicFromCtb) - + # ============================================================================== tdLog.printNoPrefix("======== test scenario 2: add child table with consuming ") - tdLog.info(" clean database") + tdLog.info(" clean database") # create and start thread parameterDict = {'cfg': '', \ 'dbName': 'db2', \ @@ -247,21 +247,21 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() - + # wait db ready while 1: tdSql.query("show databases") - if tdSql.getRows() == 4: - print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),) + if tdSql.getRows() == 4: + print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),) break else: time.sleep(1) - + tdSql.query("use %s"%parameterDict['dbName']) # wait stb ready while 1: tdSql.query("show %s.stables"%parameterDict['dbName']) - if tdSql.getRows() == 1: + if tdSql.getRows() == 1: break else: time.sleep(1) @@ -269,25 +269,25 @@ class TDTestCase: tdLog.info("create topics from super table") topicFromStb = 'topic_stb_column2' topicFromCtb = 'topic_ctb_column2' - + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb, parameterDict['dbName'], parameterDict['stbName'])) tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s_0" %(topicFromCtb, parameterDict['dbName'], parameterDict['stbName'])) - + time.sleep(1) tdSql.query("show topics") topic1 = tdSql.getData(0 , 0) topic2 = tdSql.getData(1 , 0) print (topic1) print (topic2) - + print (topicFromStb) print (topicFromCtb) #tdLog.info("show topics: %s, %s"%topic1, topic2) #if topic1 != topicFromStb or topic1 != topicFromCtb: - # tdLog.exit("topic error1") + # tdLog.exit("topic error1") #if topic2 != topicFromStb or topic2 != topicFromCtb: - # tdLog.exit("topic error2") - + # tdLog.exit("topic error2") + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)"%cdbName) @@ -305,7 +305,7 @@ class TDTestCase: sql = "insert into consumeinfo values " sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectmsgcnt1, ifcheckdata) tdSql.query(sql) - + tdLog.info("check stb if there are data") while 1: tdSql.query("select count(*) from %s"%parameterDict["stbName"]) @@ -316,17 +316,17 @@ class TDTestCase: break else: time.sleep(1) - + tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 showRow = 1 - + shellCmd = 'nohup ' + buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) - shellCmd += "> /dev/null 2>&1 &" + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) + shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) - os.system(shellCmd) + os.system(shellCmd) # create new child table and insert data newCtbName = 'newctb' @@ -340,7 +340,7 @@ class TDTestCase: # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from consumeresult") @@ -352,12 +352,12 @@ class TDTestCase: expectmsgcnt += rowsOfNewCtb expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] + rowsOfNewCtb - + tdSql.checkData(0 , 1, consumerId) tdSql.checkData(0 , 2, expectmsgcnt) tdSql.checkData(0 , 3, expectrowcnt) - + # ============================================================================== tdLog.printNoPrefix("======== test scenario 3: ") diff --git a/tests/system-test/99-TDcase/TD-15554.py b/tests/system-test/99-TDcase/TD-15554.py index d97dd8c187..4012696dc7 100644 --- a/tests/system-test/99-TDcase/TD-15554.py +++ b/tests/system-test/99-TDcase/TD-15554.py @@ -49,7 +49,7 @@ class TDTestCase: return cur def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum,rowsPerTbl): - tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) + tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) tsql.execute("use %s" %dbName) tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName) pre_create = "create table" @@ -62,7 +62,7 @@ class TDTestCase: sql = pre_create if sql != pre_create: tsql.execute(sql) - + tdLog.debug("complete to create database[%s], stable[%s] and %d child tables" %(dbName, stbName, ctbNum)) return @@ -89,7 +89,7 @@ class TDTestCase: tsql.execute(sql) tdLog.debug("insert data ............ [OK]") return - + def prepareEnv(self, **parameterDict): print ("input parameters:") print (parameterDict) @@ -108,7 +108,7 @@ class TDTestCase: parameterDict["ctbNum"],\ parameterDict["rowsPerTbl"],\ parameterDict["batchNum"],\ - parameterDict["startTs"]) + parameterDict["startTs"]) return @@ -128,34 +128,34 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() time.sleep(2) - + # wait stb ready while 1: - tdSql.query("show %s.stables"%parameterDict['dbName']) - if tdSql.getRows() == 1: + tdSql.query("show %s.stables"%parameterDict['dbName']) + if tdSql.getRows() == 1: break else: time.sleep(1) tdLog.info("create topics from super table") topicFromStb = 'topic_stb_column' - topicFromCtb = 'topic_ctb_column' - + topicFromCtb = 'topic_ctb_column' + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb, parameterDict['dbName'], parameterDict['stbName'])) tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s_0" %(topicFromCtb, parameterDict['dbName'], parameterDict['stbName'])) - + time.sleep(1) tdSql.query("show topics") #tdSql.checkRows(2) topic1 = tdSql.getData(0 , 0) topic2 = tdSql.getData(1 , 0) - + tdLog.info("show topics: %s, %s"%(topic1, topic2)) if topic1 != topicFromStb and topic1 != topicFromCtb: - tdLog.exit("topic error1") + tdLog.exit("topic error1") if topic2 != topicFromStb and topic2 != topicFromCtb: - tdLog.exit("topic error2") - + tdLog.exit("topic error2") + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)") @@ -172,7 +172,7 @@ class TDTestCase: sql = "insert into consumeinfo values " sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) tdSql.query(sql) - + tdLog.info("check stb if there are data") while 1: tdSql.query("select count(*) from %s"%parameterDict["stbName"]) @@ -183,21 +183,21 @@ class TDTestCase: break else: time.sleep(1) - + tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 showRow = 1 - + shellCmd = 'nohup ' + buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) - shellCmd += "> /dev/null 2>&1 &" + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) + shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) - os.system(shellCmd) + os.system(shellCmd) # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from consumeresult") @@ -217,7 +217,7 @@ class TDTestCase: tdSql.query("drop topic %s"%topicFromCtb) tdLog.printNoPrefix("======== test case 1 end ...... ") - + def tmqCase2(self, cfgPath, buildPath): tdLog.printNoPrefix("======== test case 2: add child table with consuming ") # create and start thread @@ -233,21 +233,21 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() - + # wait db ready while 1: tdSql.query("show databases") - if tdSql.getRows() == 4: - print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),) + if tdSql.getRows() == 4: + print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),) break else: time.sleep(1) - + tdSql.query("use %s"%parameterDict['dbName']) # wait stb ready while 1: tdSql.query("show %s.stables"%parameterDict['dbName']) - if tdSql.getRows() == 1: + if tdSql.getRows() == 1: break else: time.sleep(1) @@ -255,20 +255,20 @@ class TDTestCase: tdLog.info("create topics from super table") topicFromStb = 'topic_stb_column2' topicFromCtb = 'topic_ctb_column2' - + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb, parameterDict['dbName'], parameterDict['stbName'])) tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s_0" %(topicFromCtb, parameterDict['dbName'], parameterDict['stbName'])) - + time.sleep(1) tdSql.query("show topics") topic1 = tdSql.getData(0 , 0) topic2 = tdSql.getData(1 , 0) tdLog.info("show topics: %s, %s"%(topic1, topic2)) if topic1 != topicFromStb and topic1 != topicFromCtb: - tdLog.exit("topic error1") + tdLog.exit("topic error1") if topic2 != topicFromStb and topic2 != topicFromCtb: - tdLog.exit("topic error2") - + tdLog.exit("topic error2") + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)"%cdbName) @@ -286,7 +286,7 @@ class TDTestCase: sql = "insert into consumeinfo values " sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) tdSql.query(sql) - + tdLog.info("check stb if there are data") while 1: tdSql.query("select count(*) from %s"%parameterDict["stbName"]) @@ -297,17 +297,17 @@ class TDTestCase: break else: time.sleep(1) - + tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 showRow = 1 - + shellCmd = 'nohup ' + buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) - shellCmd += "> /dev/null 2>&1 &" + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) + shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) - os.system(shellCmd) + os.system(shellCmd) # create new child table and insert data newCtbName = 'newctb' @@ -320,7 +320,7 @@ class TDTestCase: # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from consumeresult") @@ -332,7 +332,7 @@ class TDTestCase: tdSql.checkData(0 , 1, consumerId) tdSql.checkData(0 , 3, expectrowcnt) - + tdSql.query("drop topic %s"%topicFromStb) tdSql.query("drop topic %s"%topicFromCtb) @@ -355,25 +355,25 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() - + # wait db ready while 1: tdSql.query("show databases") - if tdSql.getRows() == 4: - print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),) + if tdSql.getRows() == 4: + print (tdSql.getData(0,0), tdSql.getData(1,0),tdSql.getData(2,0),) break else: time.sleep(1) - + tdSql.query("use %s"%parameterDict['dbName']) # wait stb ready while 1: tdSql.query("show %s.stables"%parameterDict['dbName']) - if tdSql.getRows() == 1: + if tdSql.getRows() == 1: break else: time.sleep(1) - + tdLog.info("create stable2 for the seconde topic") parameterDict2 = {'cfg': '', \ 'dbName': 'db3', \ @@ -385,23 +385,23 @@ class TDTestCase: 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict2['cfg'] = cfgPath tdSql.execute("create stable if not exists %s.%s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%(parameterDict2['dbName'], parameterDict2['stbName'])) - + tdLog.info("create topics from super table") topicFromStb = 'topic_stb_column3' topicFromStb2 = 'topic_stb_column32' - + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb, parameterDict['dbName'], parameterDict['stbName'])) tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb2, parameterDict2['dbName'], parameterDict2['stbName'])) - + tdSql.query("show topics") topic1 = tdSql.getData(0 , 0) topic2 = tdSql.getData(1 , 0) tdLog.info("show topics: %s, %s"%(topic1, topic2)) if topic1 != topicFromStb and topic1 != topicFromStb2: - tdLog.exit("topic error1") + tdLog.exit("topic error1") if topic2 != topicFromStb and topic2 != topicFromStb2: - tdLog.exit("topic error2") - + tdLog.exit("topic error2") + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)"%cdbName) @@ -418,7 +418,7 @@ class TDTestCase: sql = "insert into consumeinfo values " sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) tdSql.query(sql) - + tdLog.info("check stb if there are data") while 1: tdSql.query("select count(*) from %s"%parameterDict["stbName"]) @@ -429,17 +429,17 @@ class TDTestCase: break else: time.sleep(1) - + tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 showRow = 1 - + shellCmd = 'nohup ' + buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) - shellCmd += "> /dev/null 2>&1 &" + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, parameterDict["dbName"], showMsg, showRow, cdbName) + shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) - os.system(shellCmd) + os.system(shellCmd) # start the second thread to create new child table and insert data prepareEnvThread2 = threading.Thread(target=self.prepareEnv, kwargs=parameterDict2) @@ -448,7 +448,7 @@ class TDTestCase: # wait for data ready prepareEnvThread.join() prepareEnvThread2.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from consumeresult") @@ -460,7 +460,7 @@ class TDTestCase: tdSql.checkData(0 , 1, consumerId) tdSql.checkData(0 , 3, expectrowcnt) - + tdSql.query("drop topic %s"%topicFromStb) tdSql.query("drop topic %s"%topicFromStb2) @@ -478,7 +478,7 @@ class TDTestCase: tdLog.info("cfgPath: %s" % cfgPath) #self.tmqCase1(cfgPath, buildPath) - #self.tmqCase2(cfgPath, buildPath) + #self.tmqCase2(cfgPath, buildPath) self.tmqCase3(cfgPath, buildPath) def stop(self): diff --git a/tests/system-test/99-TDcase/TD-15557.py b/tests/system-test/99-TDcase/TD-15557.py index 7a282e3176..243a0a4d7e 100644 --- a/tests/system-test/99-TDcase/TD-15557.py +++ b/tests/system-test/99-TDcase/TD-15557.py @@ -55,15 +55,15 @@ class TDTestCase: logFile = cfgPath + '/../log/valgrind-tmq.log' shellCmd = 'nohup valgrind --log-file=' + logFile shellCmd += '--tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all --num-callers=20 -v --workaround-gcc296-bugs=yes ' - + shellCmd += buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) - shellCmd += "> /dev/null 2>&1 &" + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) + shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) os.system(shellCmd) def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum,rowsPerTbl): - tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) + tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) tsql.execute("use %s" %dbName) tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName) pre_create = "create table" @@ -76,8 +76,8 @@ class TDTestCase: sql = pre_create if sql != pre_create: tsql.execute(sql) - - event.set() + + event.set() tdLog.debug("complete to create database[%s], stable[%s] and %d child tables" %(dbName, stbName, ctbNum)) return @@ -104,7 +104,7 @@ class TDTestCase: tsql.execute(sql) tdLog.debug("insert data ............ [OK]") return - + def prepareEnv(self, **parameterDict): print ("input parameters:") print (parameterDict) @@ -123,7 +123,7 @@ class TDTestCase: parameterDict["ctbNum"],\ parameterDict["rowsPerTbl"],\ parameterDict["batchNum"],\ - parameterDict["startTs"]) + parameterDict["startTs"]) return def tmqCase1(self, cfgPath, buildPath): @@ -144,12 +144,12 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() - + tdLog.info("create topics from db") topicName1 = 'topic_db1' - + tdSql.execute("create topic %s as %s" %(topicName1, parameterDict['dbName'])) - + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)"%cdbName) @@ -166,20 +166,20 @@ class TDTestCase: sql = "insert into %s.consumeinfo values "%cdbName sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) tdSql.query(sql) - + event.wait() tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 showRow = 1 - + valgrind = 1 self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow, cdbName,valgrind) # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from %s.consumeresult"%cdbName) @@ -217,12 +217,12 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() - + tdLog.info("create topics from db") topicName1 = 'topic_db1' - + tdSql.execute("create topic %s as %s" %(topicName1, parameterDict['dbName'])) - + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)"%cdbName) @@ -239,25 +239,25 @@ class TDTestCase: sql = "insert into %s.consumeinfo values "%cdbName sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) tdSql.query(sql) - + consumerId = 1 sql = "insert into %s.consumeinfo values "%cdbName sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) tdSql.query(sql) - + event.wait() tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 showRow = 1 - + valgrind = 1 self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow, cdbName,valgrind) # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from %s.consumeresult"%cdbName) @@ -317,9 +317,9 @@ class TDTestCase: tdLog.info("create topics from db") topicName1 = 'topic_db1' - + tdSql.execute("create topic %s as %s" %(topicName1, parameterDict['dbName'])) - + tdLog.info("create consume info table and consume result table") cdbName = parameterDict["dbName"] tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)"%cdbName) @@ -336,25 +336,25 @@ class TDTestCase: sql = "insert into %s.consumeinfo values "%cdbName sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) tdSql.query(sql) - + # consumerId = 1 # sql = "insert into %s.consumeinfo values "%cdbName # sql += "(now, %d, '%s', '%s', %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata) # tdSql.query(sql) - + event.wait() tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 - showRow = 1 + showRow = 1 valgrind = 1 self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow, cdbName,valgrind) # wait for data ready - prepareEnvThread.join() + prepareEnvThread.join() prepareEnvThread2.join() - + tdLog.info("insert process end, and start to check consume result") while 1: tdSql.query("select * from %s.consumeresult"%cdbName) @@ -392,7 +392,7 @@ class TDTestCase: tdLog.info("cfgPath: %s" % cfgPath) self.tmqCase1(cfgPath, buildPath) - #self.tmqCase2(cfgPath, buildPath) + #self.tmqCase2(cfgPath, buildPath) #self.tmqCase3(cfgPath, buildPath) def stop(self): diff --git a/tests/system-test/99-TDcase/TD-15563.py b/tests/system-test/99-TDcase/TD-15563.py index ca182820d5..74b5472d89 100644 --- a/tests/system-test/99-TDcase/TD-15563.py +++ b/tests/system-test/99-TDcase/TD-15563.py @@ -49,7 +49,7 @@ class TDTestCase: print(cur) return cur - def initConsumerTable(self,cdbName='cdb'): + def initConsumerTable(self,cdbName='cdb'): tdLog.info("create consume database, and consume info table, and consume result table") tdSql.query("create database if not exists %s vgroups 1"%(cdbName)) tdSql.query("drop table if exists %s.consumeinfo "%(cdbName)) @@ -58,7 +58,7 @@ class TDTestCase: tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"%cdbName) tdSql.query("create table %s.consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)"%cdbName) - def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): + def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): sql = "insert into %s.consumeinfo values "%cdbName sql += "(now, %d, '%s', '%s', %d, %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) tdLog.info("consume info sql: %s"%sql) @@ -73,11 +73,11 @@ class TDTestCase: break else: time.sleep(5) - + for i in range(expectRows): tdLog.info ("consume id: %d, consume msgs: %d, consume rows: %d"%(tdSql.getData(i , 1), tdSql.getData(i , 2), tdSql.getData(i , 3))) resultList.append(tdSql.getData(i , 3)) - + return resultList def startTmqSimProcess(self,buildPath,cfgPath,pollDelay,dbName,showMsg=1,showRow=1,cdbName='cdb',valgrind=0): @@ -86,15 +86,15 @@ class TDTestCase: logFile = cfgPath + '/../log/valgrind-tmq.log' shellCmd = 'nohup valgrind --log-file=' + logFile shellCmd += '--tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all --num-callers=20 -v --workaround-gcc296-bugs=yes ' - + shellCmd += buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) os.system(shellCmd) def create_tables(self,tsql, dbName,vgroups,stbName,ctbNum,rowsPerTbl): - tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) + tsql.execute("create database if not exists %s vgroups %d"%(dbName, vgroups)) tsql.execute("use %s" %dbName) tsql.execute("create table if not exists %s (ts timestamp, c1 bigint, c2 binary(16)) tags(t1 int)"%stbName) pre_create = "create table" @@ -107,8 +107,8 @@ class TDTestCase: sql = pre_create if sql != pre_create: tsql.execute(sql) - - event.set() + + event.set() tdLog.debug("complete to create database[%s], stable[%s] and %d child tables" %(dbName, stbName, ctbNum)) return @@ -137,7 +137,7 @@ class TDTestCase: tsql.execute(sql) tdLog.debug("insert data ............ [OK]") return - + def prepareEnv(self, **parameterDict): print ("input parameters:") print (parameterDict) @@ -156,7 +156,7 @@ class TDTestCase: parameterDict["ctbNum"],\ parameterDict["rowsPerTbl"],\ parameterDict["batchNum"],\ - parameterDict["startTs"]) + parameterDict["startTs"]) return def tmqCase1(self, cfgPath, buildPath): @@ -179,10 +179,10 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() - + tdLog.info("create topics from db") topicName1 = 'topic_db1' - + tdSql.execute("create topic %s as %s" %(topicName1, parameterDict['dbName'])) consumerId = 0 expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] @@ -194,7 +194,7 @@ class TDTestCase: auto.commit.interval.ms:6000,\ auto.offset.reset:earliest' self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - + event.wait() tdLog.info("start consume processor") @@ -205,14 +205,14 @@ class TDTestCase: # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") expectRows = 1 resultList = self.selectConsumeResult(expectRows) totalConsumeRows = 0 for i in range(expectRows): totalConsumeRows += resultList[i] - + if totalConsumeRows != expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") @@ -241,12 +241,12 @@ class TDTestCase: prepareEnvThread = threading.Thread(target=self.prepareEnv, kwargs=parameterDict) prepareEnvThread.start() - + tdLog.info("create topics from db") topicName1 = 'topic_db1' - + tdSql.execute("create topic %s as %s" %(topicName1, parameterDict['dbName'])) - + consumerId = 0 expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] topicList = topicName1 @@ -260,25 +260,25 @@ class TDTestCase: consumerId = 1 self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - + event.wait() tdLog.info("start consume processor") pollDelay = 5 showMsg = 1 - showRow = 1 + showRow = 1 self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow) # wait for data ready prepareEnvThread.join() - + tdLog.info("insert process end, and start to check consume result") expectRows = 2 resultList = self.selectConsumeResult(expectRows) totalConsumeRows = 0 for i in range(expectRows): totalConsumeRows += resultList[i] - + if totalConsumeRows != expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") @@ -323,9 +323,9 @@ class TDTestCase: tdLog.info("create topics from db") topicName1 = 'topic_db1' - + tdSql.execute("create topic %s as %s" %(topicName1, parameterDict['dbName'])) - + consumerId = 0 expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] + parameterDict2["rowsPerTbl"] * parameterDict2["ctbNum"] topicList = topicName1 @@ -336,10 +336,10 @@ class TDTestCase: auto.commit.interval.ms:6000,\ auto.offset.reset:earliest' self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - + # consumerId = 1 # self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - + event.wait() tdLog.info("start consume processor") @@ -349,16 +349,16 @@ class TDTestCase: self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow) # wait for data ready - prepareEnvThread.join() + prepareEnvThread.join() prepareEnvThread2.join() - + tdLog.info("insert process end, and start to check consume result") expectRows = 1 resultList = self.selectConsumeResult(expectRows) totalConsumeRows = 0 for i in range(expectRows): totalConsumeRows += resultList[i] - + if totalConsumeRows != expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") @@ -379,7 +379,7 @@ class TDTestCase: tdLog.info("cfgPath: %s" % cfgPath) self.tmqCase1(cfgPath, buildPath) - #self.tmqCase2(cfgPath, buildPath) + #self.tmqCase2(cfgPath, buildPath) self.tmqCase3(cfgPath, buildPath) def stop(self): From 139136bc9889b1d8738d2a254609abd25ce95420 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 11 Aug 2022 16:21:31 +0800 Subject: [PATCH 3/5] fix test cases --- tests/system-test/99-TDcase/TD-16025.py | 54 ++++++++++++------------- tests/system-test/99-TDcase/TD-16821.py | 30 +++++++------- tests/system-test/99-TDcase/TD-17255.py | 42 +++++++++---------- tests/system-test/99-TDcase/TD-17699.py | 26 ++++++------ 4 files changed, 76 insertions(+), 76 deletions(-) diff --git a/tests/system-test/99-TDcase/TD-16025.py b/tests/system-test/99-TDcase/TD-16025.py index 6016b56192..4cf94f5daf 100644 --- a/tests/system-test/99-TDcase/TD-16025.py +++ b/tests/system-test/99-TDcase/TD-16025.py @@ -56,7 +56,7 @@ class TDTestCase: print(cur) return cur - def initConsumerTable(self,cdbName='cdb'): + def initConsumerTable(self,cdbName='cdb'): tdLog.info("create consume database, and consume info table, and consume result table") tdSql.query("create database if not exists %s vgroups 1"%(cdbName)) tdSql.query("drop table if exists %s.consumeinfo "%(cdbName)) @@ -65,12 +65,12 @@ class TDTestCase: tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"%cdbName) tdSql.query("create table %s.consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)"%cdbName) - def initConsumerInfoTable(self,cdbName='cdb'): + def initConsumerInfoTable(self,cdbName='cdb'): tdLog.info("drop consumeinfo table") tdSql.query("drop table if exists %s.consumeinfo "%(cdbName)) tdSql.query("create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"%cdbName) - def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): + def insertConsumerInfo(self,consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifmanualcommit,cdbName='cdb'): sql = "insert into %s.consumeinfo values "%cdbName sql += "(now, %d, '%s', '%s', %d, %d, %d)"%(consumerId, topicList, keyList, expectrowcnt, ifcheckdata, ifmanualcommit) tdLog.info("consume info sql: %s"%sql) @@ -85,11 +85,11 @@ class TDTestCase: break else: time.sleep(5) - + for i in range(expectRows): tdLog.info ("consume id: %d, consume msgs: %d, consume rows: %d"%(tdSql.getData(i , 1), tdSql.getData(i , 2), tdSql.getData(i , 3))) resultList.append(tdSql.getData(i , 3)) - + return resultList def startTmqSimProcess(self,buildPath,cfgPath,pollDelay,dbName,showMsg=1,showRow=1,cdbName='cdb',valgrind=0): @@ -98,9 +98,9 @@ class TDTestCase: logFile = cfgPath + '/../log/valgrind-tmq.log' shellCmd = 'nohup valgrind --log-file=' + logFile shellCmd += '--tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all --num-callers=20 -v --workaround-gcc296-bugs=yes ' - + shellCmd += buildPath + '/build/bin/tmq_sim -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) + shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) os.system(shellCmd) @@ -130,7 +130,7 @@ class TDTestCase: sql = pre_create if sql != pre_create: tsql.execute(sql) - + tdLog.debug("complete to create %d child tables in %s.%s" %(ctbNum, dbName, stbName)) return @@ -149,7 +149,7 @@ class TDTestCase: ctbDict[i] = 0 #tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows)) - rowsOfCtb = 0 + rowsOfCtb = 0 while rowsOfCtb < rowsPerTbl: for i in range(ctbNum): sql += " %s.%s_%d values "%(dbName,ctbPrefix,i) @@ -176,7 +176,7 @@ class TDTestCase: startTs = int(round(t * 1000)) #tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows)) - rowsOfSql = 0 + rowsOfSql = 0 for i in range(ctbNum): sql += " %s_%d values "%(ctbPrefix,i) for j in range(rowsPerTbl): @@ -207,7 +207,7 @@ class TDTestCase: startTs = int(round(t * 1000)) #tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows)) - rowsOfSql = 0 + rowsOfSql = 0 for i in range(ctbNum): sql += " %s.%s_%d using %s.%s tags (%d) values "%(dbName,ctbPrefix,i,dbName,stbName,i) for j in range(rowsPerTbl): @@ -226,8 +226,8 @@ class TDTestCase: tsql.execute(sql) tdLog.debug("insert data ............ [OK]") return - - def prepareEnv(self, **parameterDict): + + def prepareEnv(self, **parameterDict): # create new connector for my thread tsql=self.newcur(parameterDict['cfg'], 'localhost', 6030) @@ -246,8 +246,8 @@ class TDTestCase: return def tmqCase1(self, cfgPath, buildPath): - tdLog.printNoPrefix("======== test case 1: ") - + tdLog.printNoPrefix("======== test case 1: ") + self.initConsumerTable() # create and start thread @@ -264,7 +264,7 @@ class TDTestCase: 'batchNum': 23, \ 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 parameterDict['cfg'] = cfgPath - + self.create_database(tdSql, parameterDict["dbName"]) self.create_stable(tdSql, parameterDict["dbName"], parameterDict["stbName"]) self.create_ctables(tdSql, parameterDict["dbName"], parameterDict["stbName"], parameterDict["ctbPrefix"], parameterDict["ctbNum"]) @@ -272,7 +272,7 @@ class TDTestCase: tdLog.info("create topics from stb1") topicFromStb1 = 'topic_stb1' - + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, parameterDict['dbName'], parameterDict['stbName'])) consumerId = 0 expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] @@ -303,7 +303,7 @@ class TDTestCase: totalConsumeRows = 0 for i in range(expectRows): totalConsumeRows += resultList[i] - + if totalConsumeRows != expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") @@ -313,8 +313,8 @@ class TDTestCase: tdLog.printNoPrefix("======== test case 1 end ...... ") def tmqCase2(self, cfgPath, buildPath): - tdLog.printNoPrefix("======== test case 2: ") - + tdLog.printNoPrefix("======== test case 2: ") + self.initConsumerTable() # create and start thread @@ -339,7 +339,7 @@ class TDTestCase: tdLog.info("create topics from stb1") topicFromStb1 = 'topic_stb1' - + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, parameterDict['dbName'], parameterDict['stbName'])) consumerId = 0 expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] * 2 @@ -373,7 +373,7 @@ class TDTestCase: totalConsumeRows = 0 for i in range(expectRows): totalConsumeRows += resultList[i] - + if totalConsumeRows != expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") @@ -387,8 +387,8 @@ class TDTestCase: # 自动建表完成数据插入,启动消费 def tmqCase3(self, cfgPath, buildPath): - tdLog.printNoPrefix("======== test case 3: ") - + tdLog.printNoPrefix("======== test case 3: ") + self.initConsumerTable() # create and start thread @@ -414,7 +414,7 @@ class TDTestCase: tdLog.info("create topics from stb1") topicFromStb1 = 'topic_stb1' - + tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, parameterDict['dbName'], parameterDict['stbName'])) consumerId = 0 expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] @@ -444,7 +444,7 @@ class TDTestCase: totalConsumeRows = 0 for i in range(expectRows): totalConsumeRows += resultList[i] - + if totalConsumeRows != expectrowcnt: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt)) tdLog.exit("tmq consume rows error!") @@ -466,7 +466,7 @@ class TDTestCase: tdLog.info("cfgPath: %s" % cfgPath) # self.tmqCase1(cfgPath, buildPath) - # self.tmqCase2(cfgPath, buildPath) + # self.tmqCase2(cfgPath, buildPath) self.tmqCase3(cfgPath, buildPath) # self.tmqCase4(cfgPath, buildPath) # self.tmqCase5(cfgPath, buildPath) diff --git a/tests/system-test/99-TDcase/TD-16821.py b/tests/system-test/99-TDcase/TD-16821.py index ef74515792..31c1c34485 100644 --- a/tests/system-test/99-TDcase/TD-16821.py +++ b/tests/system-test/99-TDcase/TD-16821.py @@ -27,26 +27,26 @@ class TDTestCase: cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) tdLog.info(cmdStr) os.system(cmdStr) - + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) consumeFile = open(consumeRowsFile, mode='r') queryFile = open(dstFile, mode='r') - + # skip first line for it is schema queryFile.readline() while True: dst = queryFile.readline() src = consumeFile.readline() - + if dst: if dst != src: tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) else: break - return + return def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") @@ -78,7 +78,7 @@ class TDTestCase: tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) tdLog.info("insert data") tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) - + tdLog.info("create topics from stb with filter") # queryString = "select ts, log(c1), ceil(pow(c1,3)) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) # queryString = "select ts, c1, c2 from %s.%s" %(paraDict['dbName'], paraDict['stbName']) @@ -88,7 +88,7 @@ class TDTestCase: tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) # queryString = 'select * from %s.%s'%(paraDict["dbName"],paraDict["stbName"]) - tdSql.query(queryString) + tdSql.query(queryString) expectRowsList.append(tdSql.getRows()) # init consume info, and start tmq_sim, then check consume result @@ -104,15 +104,15 @@ class TDTestCase: tdLog.info("start consume processor") tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) - tdLog.info("wait the consume result") + tdLog.info("wait the consume result") expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) - + if expectRowsList[0] != resultList[0]: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("0 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + self.checkFileContent(consumerId, queryString) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() @@ -121,7 +121,7 @@ class TDTestCase: sqlString = "create topic %s as %s" %(topicNameList[1], queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) - tdSql.query(queryString) + tdSql.query(queryString) expectRowsList.append(tdSql.getRows()) consumerId = 1 @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info("start consume processor") tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) - tdLog.info("wait the consume result") + tdLog.info("wait the consume result") expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) if expectRowsList[1] != resultList[0]: @@ -147,8 +147,8 @@ class TDTestCase: sqlString = "create topic %s as %s" %(topicNameList[2], queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) - tdSql.query(queryString) - expectRowsList.append(tdSql.getRows()) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) consumerId = 2 topicList = topicNameList[2] @@ -157,7 +157,7 @@ class TDTestCase: tdLog.info("start consume processor") tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) - tdLog.info("wait the consume result") + tdLog.info("wait the consume result") expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) # if expectRowsList[2] != resultList[0]: @@ -166,7 +166,7 @@ class TDTestCase: # self.checkFileContent(consumerId, queryString) - time.sleep(10) + time.sleep(10) for i in range(len(topicNameList)): tdSql.query("drop topic %s"%topicNameList[i]) diff --git a/tests/system-test/99-TDcase/TD-17255.py b/tests/system-test/99-TDcase/TD-17255.py index 28a1a1fd4a..5d18fee8d2 100644 --- a/tests/system-test/99-TDcase/TD-17255.py +++ b/tests/system-test/99-TDcase/TD-17255.py @@ -19,7 +19,7 @@ class TDTestCase: self.vgroups = 2 self.ctbNum = 100 self.rowsPerTbl = 10000 - + def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor(), False) @@ -49,7 +49,7 @@ class TDTestCase: paraDict['vgroups'] = self.vgroups paraDict['ctbNum'] = self.ctbNum paraDict['rowsPerTbl'] = self.rowsPerTbl - + tmqCom.initConsumerTable() tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) tdLog.info("create stb") @@ -61,7 +61,7 @@ class TDTestCase: tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) - + tdLog.info("restart taosd to ensure that the data falls into the disk") # tdDnodes.stop(1) # tdDnodes.start(1) @@ -93,7 +93,7 @@ class TDTestCase: # paraDict['vgroups'] = self.vgroups # paraDict['ctbNum'] = self.ctbNum # paraDict['rowsPerTbl'] = self.rowsPerTbl - + tmqCom.initConsumerTable() tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) tdLog.info("create stb") @@ -107,12 +107,12 @@ class TDTestCase: startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) tdLog.info("create topics from stb1") - topicFromStb1 = 'topic_stb1' + topicFromStb1 = 'topic_stb1' queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) sqlString = "create topic %s as %s" %(topicFromStb1, queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) - + consumerId = 0 expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] topicList = topicFromStb1 @@ -126,7 +126,7 @@ class TDTestCase: tdLog.info("start consume processor") tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) - + # time.sleep(3) tmqCom.getStartCommitNotifyFromTmqsim() tdLog.info("================= restart dnode ===========================") @@ -143,7 +143,7 @@ class TDTestCase: tdSql.query(queryString) totalRowsInserted = tdSql.getRows() - + if totalConsumeRows != totalRowsInserted: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, totalRowsInserted)) tdLog.exit("tmq consume rows error!") @@ -153,7 +153,7 @@ class TDTestCase: tdLog.printNoPrefix("======== test case 1 end ...... ") def tmqCase2(self): - tdLog.printNoPrefix("======== test case 2: ") + tdLog.printNoPrefix("======== test case 2: ") paraDict = {'dbName': 'dbt', 'dropFlag': 1, 'event': '', @@ -177,7 +177,7 @@ class TDTestCase: # paraDict['vgroups'] = self.vgroups # paraDict['ctbNum'] = self.ctbNum # paraDict['rowsPerTbl'] = self.rowsPerTbl - + tmqCom.initConsumerTable() tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) tdLog.info("create stb") @@ -190,12 +190,12 @@ class TDTestCase: ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) tdLog.info("create topics from stb1") - topicFromStb1 = 'topic_stb1' + topicFromStb1 = 'topic_stb1' queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) sqlString = "create topic %s as %s" %(topicFromStb1, queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) - + consumerId = 0 expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 topicList = topicFromStb1 @@ -212,7 +212,7 @@ class TDTestCase: tdLog.info("create some new child table and insert data ") tmqCom.insert_data_with_autoCreateTbl(tdSql,paraDict["dbName"],paraDict["stbName"],"ctb",paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"]) - + tmqCom.getStartCommitNotifyFromTmqsim() tdLog.info("================= restart dnode ===========================") tdDnodes.stop(1) @@ -228,7 +228,7 @@ class TDTestCase: tdSql.query(queryString) totalRowsInserted = tdSql.getRows() - + if totalConsumeRows != totalRowsInserted: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, totalRowsInserted)) tdLog.exit("tmq consume rows error!") @@ -239,7 +239,7 @@ class TDTestCase: # 自动建表完成数据插入,启动消费 def tmqCase3(self): - tdLog.printNoPrefix("======== test case 3: ") + tdLog.printNoPrefix("======== test case 3: ") paraDict = {'dbName': 'dbt', 'dropFlag': 1, 'event': '', @@ -263,7 +263,7 @@ class TDTestCase: paraDict['vgroups'] = self.vgroups paraDict['ctbNum'] = self.ctbNum paraDict['rowsPerTbl'] = self.rowsPerTbl - + tmqCom.initConsumerTable() tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) tdLog.info("create stb") @@ -272,12 +272,12 @@ class TDTestCase: tmqCom.insert_data_with_autoCreateTbl(tdSql,paraDict["dbName"],paraDict["stbName"],"ctb",paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"]) tdLog.info("create topics from stb1") - topicFromStb1 = 'topic_stb1' + topicFromStb1 = 'topic_stb1' queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) sqlString = "create topic %s as %s" %(topicFromStb1, queryString) tdLog.info("create topic sql: %s"%sqlString) - tdSql.execute(sqlString) - + tdSql.execute(sqlString) + consumerId = 0 expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] topicList = topicFromStb1 @@ -306,7 +306,7 @@ class TDTestCase: tdSql.query(queryString) totalRowsInserted = tdSql.getRows() - + if totalConsumeRows != totalRowsInserted: tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, totalRowsInserted)) tdLog.exit("tmq consume rows error!") @@ -320,7 +320,7 @@ class TDTestCase: tdSql.prepare() self.tmqCase1() - self.tmqCase2() + self.tmqCase2() self.tmqCase3() def stop(self): diff --git a/tests/system-test/99-TDcase/TD-17699.py b/tests/system-test/99-TDcase/TD-17699.py index cf5e7797ec..40650e4b92 100644 --- a/tests/system-test/99-TDcase/TD-17699.py +++ b/tests/system-test/99-TDcase/TD-17699.py @@ -48,7 +48,7 @@ class TDTestCase: pollDelay = 20 showMsg = 1 - showRow = 1 + showRow = 1 hostname = socket.gethostname() @@ -60,7 +60,7 @@ class TDTestCase: def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") tdLog.info("step 1: create database, stb, ctb and insert data") - + tmqCom.initConsumerTable(self.cdbName) tdCom.create_database(tdSql,self.paraDict["dbName"],self.paraDict["dropFlag"]) @@ -70,37 +70,37 @@ class TDTestCase: tdCom.create_ctable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],tag_elm_list=self.paraDict['tagSchema'],count=self.paraDict["ctbNum"],default_ctbname_prefix=self.paraDict["ctbPrefix"]) tmqCom.insert_data_2(tdSql,self.paraDict["dbName"],self.paraDict["ctbPrefix"],self.paraDict["ctbNum"],self.paraDict["rowsPerTbl"],self.paraDict["batchNum"],self.paraDict["startTs"],self.paraDict["ctbStartIdx"]) # pThread1 = tmqCom.asyncInsertData(paraDict=self.paraDict) - + self.paraDict["stbName"] = 'stb2' self.paraDict["ctbPrefix"] = 'newctb' self.paraDict["batchNum"] = 1000 tdCom.create_stable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],column_elm_list=self.paraDict["colSchema"],tag_elm_list=self.paraDict["tagSchema"],count=1, default_stbname_prefix=self.paraDict["stbName"]) tdCom.create_ctable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],tag_elm_list=self.paraDict['tagSchema'],count=self.paraDict["ctbNum"],default_ctbname_prefix=self.paraDict["ctbPrefix"]) # tmqCom.insert_data_2(tdSql,self.paraDict["dbName"],self.paraDict["ctbPrefix"],self.paraDict["ctbNum"],self.paraDict["rowsPerTbl"],self.paraDict["batchNum"],self.paraDict["startTs"],self.paraDict["ctbStartIdx"]) - pThread2 = tmqCom.asyncInsertData(paraDict=self.paraDict) + pThread2 = tmqCom.asyncInsertData(paraDict=self.paraDict) tdLog.info("create topics from db") - topicName1 = 'UpperCasetopic_%s'%(self.paraDict['dbName']) + topicName1 = 'UpperCasetopic_%s'%(self.paraDict['dbName']) tdSql.execute("create topic %s as database %s" %(topicName1, self.paraDict['dbName'])) - + topicList = topicName1 + ',' +topicName1 keyList = '%s,%s,%s,%s'%(self.groupId,self.autoCommit,self.autoCommitInterval,self.autoOffset) self.expectrowcnt = self.paraDict["rowsPerTbl"] * self.paraDict["ctbNum"] * 2 tmqCom.insertConsumerInfo(self.consumerId, self.expectrowcnt,topicList,keyList,self.ifcheckdata,self.ifManualCommit) - - tdLog.info("start consume processor") + + tdLog.info("start consume processor") # tmqCom.startTmqSimProcess(self.pollDelay,self.paraDict["dbName"],self.showMsg, self.showRow,self.cdbName) tmqCom.startTmqSimProcess(pollDelay=self.pollDelay,dbName=self.paraDict["dbName"],showMsg=self.showMsg, showRow=self.showRow,snapshot=self.paraDict['snapshot']) - tmqCom.getStartConsumeNotifyFromTmqsim() + tmqCom.getStartConsumeNotifyFromTmqsim() tdLog.info("drop one stable") - self.paraDict["stbName"] = 'stb1' - tdSql.execute("drop table %s.%s" %(self.paraDict['dbName'], self.paraDict['stbName'])) + self.paraDict["stbName"] = 'stb1' + tdSql.execute("drop table %s.%s" %(self.paraDict['dbName'], self.paraDict['stbName'])) dropTblNum = int(self.paraDict["ctbNum"] / 4) tmqCom.drop_ctable(tdSql, dbname=self.paraDict['dbName'], count=dropTblNum, default_ctbname_prefix=self.paraDict["ctbPrefix"]) # pThread2.join() - + tdLog.info("wait result from consumer, then check it") expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) @@ -108,7 +108,7 @@ class TDTestCase: totalConsumeRows = 0 for i in range(expectRows): totalConsumeRows += resultList[i] - + if not (totalConsumeRows >= self.expectrowcnt*3/8 and totalConsumeRows <= self.expectrowcnt): tdLog.info("act consume rows: %d, expect consume rows: between %d and %d"%(totalConsumeRows, self.expectrowcnt/2, self.expectrowcnt)) tdLog.exit("tmq consume rows error!") From 72d680223154c4fceb942f8f1a5936bd981c86a0 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 11 Aug 2022 16:21:31 +0800 Subject: [PATCH 4/5] fix test cases --- tests/script/tsim/sma/drop_sma.sim | 24 +++++++++---------- .../script/tsim/sma/rsmaCreateInsertQuery.sim | 8 +++---- .../tsim/sma/rsmaPersistenceRecovery.sim | 6 ++--- .../script/tsim/sma/tsmaCreateInsertQuery.sim | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/script/tsim/sma/drop_sma.sim b/tests/script/tsim/sma/drop_sma.sim index 78f86f6e19..2b4c292284 100644 --- a/tests/script/tsim/sma/drop_sma.sim +++ b/tests/script/tsim/sma/drop_sma.sim @@ -52,21 +52,21 @@ sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) in print --> show sma sql show indexes from stb from d1; -if $rows != 1 then +if $rows != 1 then return -1 endi -if $data[0][0] != sma_index_name1 then +if $data[0][0] != sma_index_name1 then return -1 endi -if $data[0][1] != d1 then +if $data[0][1] != d1 then return -1 endi -if $data[0][2] != stb then +if $data[0][2] != stb then return -1 endi print --> drop stb -sql drop table stb; +sql drop table stb; print ========== step4 repeat @@ -78,23 +78,23 @@ sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) in print --> show sma sql show indexes from stb from d1; -if $rows != 1 then +if $rows != 1 then return -1 endi -if $data[0][0] != sma_index_name1 then +if $data[0][0] != sma_index_name1 then return -1 endi -if $data[0][1] != d1 then +if $data[0][1] != d1 then return -1 endi -if $data[0][2] != stb then +if $data[0][2] != stb then return -1 endi print --> drop stb -sql drop table stb; +sql drop table stb; -print ========== step5 +print ========== step5 sql drop database if exists db; sql create database db duration 300; sql use db; @@ -149,4 +149,4 @@ sql DROP INDEX sma_index_3 ; system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode4 -s stop -x SIGINT diff --git a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim index 86bdbdcded..04cf09715c 100644 --- a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim +++ b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim @@ -12,7 +12,7 @@ print =============== create super table and register rsma sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min); sql show stables -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -20,7 +20,7 @@ print =============== create child table sql create table ct1 using stb tags("BeiJing", "ChaoYang"); sql show tables -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -119,7 +119,7 @@ endi print =============== select * from retention level 0 from file sql select * from ct1 where ts > now-3d; -print $data00 $data01 +print $data00 $data01 print $data10 $data11 print $data20 $data21 if $rows < 1 then @@ -132,4 +132,4 @@ if $data01 != 10 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim index 405d22ebdd..f53cd45d48 100644 --- a/tests/script/tsim/sma/rsmaPersistenceRecovery.sim +++ b/tests/script/tsim/sma/rsmaPersistenceRecovery.sim @@ -12,7 +12,7 @@ print =============== create super table and register rsma sql create table if not exists stb (ts timestamp, c1 int, c2 float) tags (city binary(20),district binary(20)) rollup(max) max_delay 5s,5s watermark 2s,3s; sql show stables -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -20,7 +20,7 @@ print =============== create child table sql create table ct1 using stb tags("BeiJing", "ChaoYang"); sql show tables -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -234,4 +234,4 @@ endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim index e3b38d415c..cc1d507df2 100644 --- a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim +++ b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim @@ -12,7 +12,7 @@ print =============== create super table, include column type for count/sum/min/ sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) sql show stables -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -20,7 +20,7 @@ print =============== create child table sql create table ct1 using stb tags(1000) sql show tables -if $rows != 1 then +if $rows != 1 then return -1 endi From 19ab8ba58c26472ddd39d7a4ae90e3d886c22f53 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 11 Aug 2022 16:21:31 +0800 Subject: [PATCH 5/5] fix test cases --- tests/script/tsim/parser/README.txt | 2 +- tests/script/tsim/parser/alter.sim | 28 +- .../parser/alter__for_community_version.sim | 26 +- tests/script/tsim/parser/alter_stable.sim | 2 +- tests/script/tsim/parser/auto_create_tb.sim | 12 +- .../tsim/parser/auto_create_tb_drop_tb.sim | 12 +- tests/script/tsim/parser/between_and.sim | 38 +- .../script/tsim/parser/columnValue_bigint.sim | 102 +- tests/script/tsim/parser/columnValue_bool.sim | 96 +- .../script/tsim/parser/columnValue_double.sim | 124 +- .../script/tsim/parser/columnValue_float.sim | 104 +- tests/script/tsim/parser/columnValue_int.sim | 120 +- .../tsim/parser/columnValue_smallint.sim | 122 +- .../tsim/parser/columnValue_tinyint.sim | 122 +- tests/script/tsim/parser/commit.sim | 14 +- tests/script/tsim/parser/condition.sim | 4 +- tests/script/tsim/parser/create_db.sim | 36 +- tests/script/tsim/parser/create_mt.sim | 18 +- tests/script/tsim/parser/create_tb.sim | 36 +- .../tsim/parser/create_tb_with_tag_name.sim | 48 +- tests/script/tsim/parser/dbtbnameValidate.sim | 8 +- tests/script/tsim/parser/distinct.sim | 10 +- tests/script/tsim/parser/fill.sim | 156 +-- tests/script/tsim/parser/fill_stb.sim | 44 +- tests/script/tsim/parser/fill_us.sim | 170 +-- tests/script/tsim/parser/first_last.sim | 12 +- tests/script/tsim/parser/first_last_query.sim | 34 +- .../tsim/parser/fourArithmetic-basic.sim | 22 +- tests/script/tsim/parser/function.sim | 10 +- tests/script/tsim/parser/groupby-basic.sim | 12 +- tests/script/tsim/parser/groupby.sim | 8 +- tests/script/tsim/parser/having.sim | 476 ++++---- tests/script/tsim/parser/having_child.sim | 460 ++++---- tests/script/tsim/parser/import.sim | 4 +- tests/script/tsim/parser/import_commit1.sim | 12 +- tests/script/tsim/parser/import_commit2.sim | 12 +- tests/script/tsim/parser/import_commit3.sim | 12 +- tests/script/tsim/parser/insert_tb.sim | 8 +- tests/script/tsim/parser/interp.sim | 8 +- tests/script/tsim/parser/join_multitables.sim | 1022 ++++++++--------- tests/script/tsim/parser/join_multivnode.sim | 4 +- tests/script/tsim/parser/last_cache.sim | 2 +- tests/script/tsim/parser/last_cache_query.sim | 160 +-- tests/script/tsim/parser/last_groupby.sim | 38 +- tests/script/tsim/parser/lastrow.sim | 8 +- tests/script/tsim/parser/lastrow_query.sim | 16 +- tests/script/tsim/parser/like.sim | 10 +- tests/script/tsim/parser/limit.sim | 10 +- tests/script/tsim/parser/limit1.sim | 6 +- tests/script/tsim/parser/limit1_stb.sim | 6 +- tests/script/tsim/parser/limit1_tb.sim | 8 +- tests/script/tsim/parser/limit2.sim | 12 +- tests/script/tsim/parser/limit2_query.sim | 4 +- tests/script/tsim/parser/limit_stb.sim | 4 +- tests/script/tsim/parser/limit_tb.sim | 8 +- tests/script/tsim/parser/mixed_blocks.sim | 14 +- tests/script/tsim/parser/nchar.sim | 58 +- tests/script/tsim/parser/nestquery.sim | 2 +- tests/script/tsim/parser/null_char.sim | 4 +- tests/script/tsim/parser/precision_ns.sim | 16 +- tests/script/tsim/parser/regex.sim | 6 +- tests/script/tsim/parser/selectResNum.sim | 50 +- .../tsim/parser/select_across_vnodes.sim | 14 +- .../tsim/parser/select_distinct_tag.sim | 6 +- tests/script/tsim/parser/select_with_tags.sim | 14 +- tests/script/tsim/parser/set_tag_vals.sim | 12 +- tests/script/tsim/parser/slimit.sim | 22 +- tests/script/tsim/parser/slimit1.sim | 4 +- tests/script/tsim/parser/slimit1_query.sim | 8 +- .../script/tsim/parser/slimit_alter_tags.sim | 4 +- tests/script/tsim/parser/slimit_query.sim | 8 +- tests/script/tsim/parser/stableOp.sim | 4 +- .../tsim/parser/tags_dynamically_specifiy.sim | 2 +- tests/script/tsim/parser/tags_filter.sim | 6 +- tests/script/tsim/parser/tbnameIn.sim | 14 +- tests/script/tsim/parser/tbnameIn_query.sim | 6 +- tests/script/tsim/parser/timestamp.sim | 8 +- tests/script/tsim/parser/timestamp_query.sim | 2 +- tests/script/tsim/parser/top_groupby.sim | 2 +- tests/script/tsim/parser/where.sim | 6 +- 80 files changed, 2077 insertions(+), 2077 deletions(-) diff --git a/tests/script/tsim/parser/README.txt b/tests/script/tsim/parser/README.txt index 1072976380..4fcbcf55b1 100644 --- a/tests/script/tsim/parser/README.txt +++ b/tests/script/tsim/parser/README.txt @@ -2,7 +2,7 @@ This file contains a brief info about the parser test scripts directory. The directory contains scripts for TDengine parser testing, mainly focus on syntax parsing and datatype support. The tests are organized in the way database languages are catagorized. -DML: +DML: { SELECT INSERT diff --git a/tests/script/tsim/parser/alter.sim b/tests/script/tsim/parser/alter.sim index 499d4d302b..13967f7286 100644 --- a/tests/script/tsim/parser/alter.sim +++ b/tests/script/tsim/parser/alter.sim @@ -40,7 +40,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 30240m,30240m,30240m then +if $data27 != 30240m,30240m,30240m then return -1 endi sql alter database $db keep 11,12 @@ -48,7 +48,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 15840m,17280m,17280m then +if $data27 != 15840m,17280m,17280m then return -1 endi sql alter database $db keep 20,20,20 @@ -56,7 +56,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 28800m,28800m,28800m then +if $data27 != 28800m,28800m,28800m then return -1 endi sql alter database $db keep 10,10,10 @@ -64,7 +64,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 14400m,14400m,14400m then +if $data27 != 14400m,14400m,14400m then return -1 endi sql alter database $db keep 10,10,11 @@ -72,7 +72,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 14400m,14400m,15840m then +if $data27 != 14400m,14400m,15840m then return -1 endi sql alter database $db keep 11,12,13 @@ -80,7 +80,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 15840m,17280m,18720m then +if $data27 != 15840m,17280m,18720m then return -1 endi sql alter database $db keep 365000,365000,365000 @@ -88,7 +88,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 525600000m,525600000m,525600000m then +if $data27 != 525600000m,525600000m,525600000m then return -1 endi @@ -100,11 +100,11 @@ if $rows != 1 then return -1 endi sql alter table tb drop column c3 -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $data01 != 1 then return -1 endi -if $data02 != 1 then +if $data02 != 1 then return -1 endi if $data03 != null then @@ -136,10 +136,10 @@ sql create table tb using mt tags(1) sql insert into tb values (now, 1, 1, 1) sql alter table mt drop column c3 sql select * from tb order by ts desc -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data02 != 1 then +if $data02 != 1 then return -1 endi if $data03 != null then @@ -243,7 +243,7 @@ if $data02 != null then endi sql alter table mt add column c2 int sql insert into tb (ts, c2) values (now, 3) -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $data02 != 3 then return -1 endi @@ -268,7 +268,7 @@ if $data02 != insert then return -1 endi sql alter table mt add column c3 nchar(4) -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $data03 != NULL then return -1 endi @@ -283,7 +283,7 @@ sql insert into tb(ts, c1, c3) using mt(t1) tags(123) values('2018-11-01 16:29:5 sql insert into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3) sql import into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3) sql import into tb values ('2018-11-01 16:39:58.000', 2, 'import', 3) -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $rows != 4 then return -1 endi diff --git a/tests/script/tsim/parser/alter__for_community_version.sim b/tests/script/tsim/parser/alter__for_community_version.sim index 9a960e21c2..5dc7d379ef 100644 --- a/tests/script/tsim/parser/alter__for_community_version.sim +++ b/tests/script/tsim/parser/alter__for_community_version.sim @@ -23,7 +23,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 28800m,28800m,28800m then +if $data27 != 28800m,28800m,28800m then return -1 endi @@ -49,7 +49,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 28800m,28800m,28800m then +if $data27 != 28800m,28800m,28800m then return -1 endi sql alter database $db keep 10 @@ -57,7 +57,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 14400m,14400m,14400m then +if $data27 != 14400m,14400m,14400m then return -1 endi sql alter database $db keep 11 @@ -65,7 +65,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 15840m,15840m,15840m then +if $data27 != 15840m,15840m,15840m then return -1 endi sql alter database $db keep 13 @@ -73,7 +73,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 18720m,18720m,18720m then +if $data27 != 18720m,18720m,18720m then return -1 endi sql alter database $db keep 365000 @@ -81,7 +81,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 525600000m,525600000m,525600000m then +if $data27 != 525600000m,525600000m,525600000m then return -1 endi @@ -94,11 +94,11 @@ if $rows != 1 then return -1 endi sql alter table tb drop column c3 -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $data01 != 1 then return -1 endi -if $data02 != 1 then +if $data02 != 1 then return -1 endi if $data03 != null then @@ -130,10 +130,10 @@ sql create table tb using mt tags(1) sql insert into tb values (now, 1, 1, 1) sql alter table mt drop column c3 sql select * from tb order by ts desc -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data02 != 1 then +if $data02 != 1 then return -1 endi if $data03 != null then @@ -231,7 +231,7 @@ if $data02 != null then endi sql alter table mt add column c2 int sql insert into tb (ts, c2) values (now, 3) -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $data02 != 3 then return -1 endi @@ -255,7 +255,7 @@ if $data02 != insert then return -1 endi sql alter table mt add column c3 nchar(4) -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $data03 != NULL then return -1 endi @@ -270,7 +270,7 @@ sql insert into tb(ts, c1, c3) using mt(t1) tags(123) values('2018-11-01 16:29:5 sql insert into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3) sql import into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3) sql import into tb values ('2018-11-01 16:39:58.000', 2, 'import', 3) -sql select * from tb order by ts desc +sql select * from tb order by ts desc if $rows != 4 then return -1 endi diff --git a/tests/script/tsim/parser/alter_stable.sim b/tests/script/tsim/parser/alter_stable.sim index 8659d92f7e..b6e1a751b9 100644 --- a/tests/script/tsim/parser/alter_stable.sim +++ b/tests/script/tsim/parser/alter_stable.sim @@ -35,7 +35,7 @@ sql alter table tb1 set tag len = 379 # case TD-5594 sql create stable st5520(ts timestamp, f int) tags(t0 bool, t1 nchar(4093), t2 nchar(1)) sql alter stable st5520 modify tag t2 nchar(2); -# test end +# test end sql drop database $db system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/auto_create_tb.sim b/tests/script/tsim/parser/auto_create_tb.sim index 3a64b79239..faf573f949 100644 --- a/tests/script/tsim/parser/auto_create_tb.sim +++ b/tests/script/tsim/parser/auto_create_tb.sim @@ -30,12 +30,12 @@ sql show stables if $rows != 1 then return -1 endi -if $data00 != $stb then +if $data00 != $stb then return -1 endi ### create table on the fly -sql insert into tb1 using $stb tags (1) values ( $ts0 , 1,1,1,1,'bin',1,1,1,'涛思数据') +sql insert into tb1 using $stb tags (1) values ( $ts0 , 1,1,1,1,'bin',1,1,1,'涛思数据') sql select * from tb1 if $rows != 1 then return -1 @@ -184,7 +184,7 @@ if $data(3)[8] != 涛思数据3 then return -1 endi -sql select t1, count(*), first(c9) from $stb partition by t1 order by t1 asc slimit 3 +sql select t1, count(*), first(c9) from $stb partition by t1 order by t1 asc slimit 3 if $rows != 3 then return -1 endi @@ -251,7 +251,7 @@ if $data(3)[8] != 涛思数据3 then return -1 endi -sql select t1, count(*), first(c9) from $stb partition by t1 order by t1 asc slimit 3 +sql select t1, count(*), first(c9) from $stb partition by t1 order by t1 asc slimit 3 if $rows != 3 then return -1 endi @@ -290,7 +290,7 @@ endi #sql drop database $db #sql show databases -#if $rows != 0 then +#if $rows != 0 then # return -1 #endi @@ -305,4 +305,4 @@ if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/auto_create_tb_drop_tb.sim b/tests/script/tsim/parser/auto_create_tb_drop_tb.sim index 0cff016b5f..f2af68440f 100644 --- a/tests/script/tsim/parser/auto_create_tb_drop_tb.sim +++ b/tests/script/tsim/parser/auto_create_tb_drop_tb.sim @@ -37,9 +37,9 @@ while $t < $tbNum while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - sql insert into $tbname using $stb tags( $t1 ) values ( $ts , $x ) + sql insert into $tbname using $stb tags( $t1 ) values ( $ts , $x ) $x = $x + 1 - endw + endw $t = $t + 1 $x = 0 endw @@ -47,11 +47,11 @@ print ====== tables created sql drop table tb2 $x = 0 -while $x < $rowNum +while $x < $rowNum $ts = $ts + $delta $t1 = 'tb . $t $t1 = $t1 . ' - sql insert into tb1 using $stb tags( $t1 ) values ( $ts , $x ) + sql insert into tb1 using $stb tags( $t1 ) values ( $ts , $x ) $x = $x + 1 endw @@ -62,7 +62,7 @@ $x = 0 while $x < 100 $ts = $ts + $delta sql insert into tb2 using stb0 tags('tb2') values ( $ts , 1) - sql select * from tb2 + sql select * from tb2 $res = $x + 1 if $rows != $res then return -1 @@ -74,4 +74,4 @@ while $x < 100 print loop $x endw -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/between_and.sim b/tests/script/tsim/parser/between_and.sim index aa9944d9a4..74ec1e4962 100644 --- a/tests/script/tsim/parser/between_and.sim +++ b/tests/script/tsim/parser/between_and.sim @@ -13,7 +13,7 @@ sql create table tb1 using st2 tags (1,1.0,"1",1.0,1,1,"1"); sql create table tb2 using st2 tags (2,2.0,"2",2.0,2,2,"2"); sql create table tb3 using st2 tags (3,3.0,"3",3.0,3,3,"3"); sql create table tb4 using st2 tags (4,4.0,"4",4.0,4,4,"4"); - + sql insert into tb1 values (now-200s,1,1.0,1.0,1,1,1,true,"1","1") sql insert into tb1 values (now-100s,2,2.0,2.0,2,2,2,true,"2","2") sql insert into tb1 values (now,3,3.0,3.0,3,3,3,true,"3","3") @@ -47,16 +47,16 @@ sql select tbname, id2 from st2 where id2 between 0.0 and 3.0; if $rows != 7 then return -1 endi -if $data(tb2)[0] != tb2 then +if $data(tb2)[0] != tb2 then return -1 endi -if $data(tb2)[1] != 2.00000 then +if $data(tb2)[1] != 2.00000 then return -1 endi -if $data(tb3)[0] != tb3 then +if $data(tb3)[0] != tb3 then return -1 endi -if $data(tb3)[1] != 3.00000 then +if $data(tb3)[1] != 3.00000 then return -1 endi @@ -64,16 +64,16 @@ sql select tbname, id4 from st2 where id2 between 2.0 and 3.0; if $rows != 2 then return -1 endi -if $data(tb2)[0] != tb2 then +if $data(tb2)[0] != tb2 then return -1 endi -if $data(tb2)[1] != 2.000000000 then +if $data(tb2)[1] != 2.000000000 then return -1 endi -if $data(tb3)[0] != tb3 then +if $data(tb3)[0] != tb3 then return -1 endi -if $data(tb3)[1] != 3.000000000 then +if $data(tb3)[1] != 3.000000000 then return -1 endi @@ -81,16 +81,16 @@ sql select tbname, id5 from st2 where id5 between 2.0 and 3.0; if $rows != 2 then return -1 endi -if $data(tb2)[0] != tb2 then +if $data(tb2)[0] != tb2 then return -1 endi -if $data(tb2)[1] != 2 then +if $data(tb2)[1] != 2 then return -1 endi -if $data(tb3)[0] != tb3 then +if $data(tb3)[0] != tb3 then return -1 endi -if $data(tb3)[1] != 3 then +if $data(tb3)[1] != 3 then return -1 endi @@ -98,16 +98,16 @@ sql select tbname,id6 from st2 where id6 between 2.0 and 3.0; if $rows != 2 then return -1 endi -if $data(tb2)[0] != tb2 then +if $data(tb2)[0] != tb2 then return -1 endi -if $data(tb2)[1] != 2 then +if $data(tb2)[1] != 2 then return -1 endi -if $data(tb3)[0] != tb3 then +if $data(tb3)[0] != tb3 then return -1 endi -if $data(tb3)[1] != 3 then +if $data(tb3)[1] != 3 then return -1 endi @@ -115,10 +115,10 @@ sql select * from st2 where f1 between 2 and 3 and f2 between 2.0 and 3.0 and f3 if $rows != 2 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data11 != 3 then +if $data11 != 3 then return -1 endi diff --git a/tests/script/tsim/parser/columnValue_bigint.sim b/tests/script/tsim/parser/columnValue_bigint.sim index a196c61684..2cf0151a05 100644 --- a/tests/script/tsim/parser/columnValue_bigint.sim +++ b/tests/script/tsim/parser/columnValue_bigint.sim @@ -12,7 +12,7 @@ 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 ######## case 0: bigint -print ========== bigint +print ========== bigint sql create table mt_bigint (ts timestamp, c bigint) tags (tagname bigint) ## case 00: static create table for test tag values @@ -86,7 +86,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_bigint_1 values (now, NULL) sql select * from st_bigint_1 if $rows != 1 then @@ -94,7 +94,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_bigint_6 values (now, 9223372036854775807) sql select * from st_bigint_6 @@ -103,7 +103,7 @@ if $rows != 1 then endi if $data01 != 9223372036854775807 then return -1 -endi +endi sql insert into st_bigint_7 values (now, -9223372036854775807) sql select * from st_bigint_7 if $rows != 1 then @@ -111,15 +111,15 @@ if $rows != 1 then endi if $data01 != -9223372036854775807 then return -1 -endi -sql insert into st_bigint_8 values (now, +100) +endi +sql insert into st_bigint_8 values (now, +100) sql select * from st_bigint_8 if $rows != 1 then return -1 endi if $data01 != 100 then return -1 -endi +endi sql insert into st_bigint_9 values (now, "-098") sql select * from st_bigint_9 if $rows != 1 then @@ -127,7 +127,7 @@ if $rows != 1 then endi if $data01 != -98 then return -1 -endi +endi sql insert into st_bigint_10 values (now, '0') sql select * from st_bigint_10 if $rows != 1 then @@ -135,15 +135,15 @@ if $rows != 1 then endi if $data01 != 0 then return -1 -endi -sql insert into st_bigint_11 values (now, -0) +endi +sql insert into st_bigint_11 values (now, -0) sql select * from st_bigint_11 if $rows != 1 then return -1 endi if $data01 != 0 then return -1 -endi +endi sql insert into st_bigint_12 values (now, "+056") sql select * from st_bigint_12 if $rows != 1 then @@ -151,7 +151,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_bigint_13 values (now, +056) sql select * from st_bigint_13 @@ -160,7 +160,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_bigint_14 values (now, -056) sql select * from st_bigint_14 @@ -169,7 +169,7 @@ if $rows != 1 then endi if $data01 != -56 then return -1 -endi +endi ## case 02: dynamic create table for test tag values sql insert into st_bigint_16 using mt_bigint tags (NULL) values (now, NULL) @@ -181,7 +181,7 @@ sql select * from st_bigint_16 if $data01 != NULL then return -1 endi - + sql insert into st_bigint_17 using mt_bigint tags (NULL) values (now, NULL) sql show tags from st_bigint_17 if $data05 != NULL then @@ -190,7 +190,7 @@ endi sql select * from st_bigint_17 if $data01 != NULL then return -1 -endi +endi sql insert into st_bigint_18 using mt_bigint tags ('NULL') values (now, 'NULL') sql show tags from st_bigint_18 if $data05 != NULL then @@ -235,7 +235,7 @@ endi sql select * from st_bigint_22 if $data01 != 9223372036854775807 then return -1 -endi +endi sql insert into st_bigint_23 using mt_bigint tags (-9223372036854775807) values (now, -9223372036854775807) sql show tags from st_bigint_23 if $data05 != -9223372036854775807 then @@ -244,7 +244,7 @@ endi sql select * from st_bigint_23 if $data01 != -9223372036854775807 then return -1 -endi +endi sql insert into st_bigint_24 using mt_bigint tags (10) values (now, 10) sql show tags from st_bigint_24 if $data05 != 10 then @@ -253,7 +253,7 @@ endi sql select * from st_bigint_24 if $data01 != 10 then return -1 -endi +endi sql insert into st_bigint_25 using mt_bigint tags ("-0") values (now, "-0") sql show tags from st_bigint_25 if $data05 != 0 then @@ -262,7 +262,7 @@ endi sql select * from st_bigint_25 if $data01 != 0 then return -1 -endi +endi sql insert into st_bigint_26 using mt_bigint tags ('123') values (now, '123') sql show tags from st_bigint_26 if $data05 != 123 then @@ -271,7 +271,7 @@ endi sql select * from st_bigint_26 if $data01 != 123 then return -1 -endi +endi sql insert into st_bigint_27 using mt_bigint tags (+056) values (now, +00056) sql show tags from st_bigint_27 if $data05 != 56 then @@ -280,7 +280,7 @@ endi sql select * from st_bigint_27 if $data01 != 56 then return -1 -endi +endi sql insert into st_bigint_28 using mt_bigint tags (-056) values (now, -0056) sql show tags from st_bigint_28 if $data05 != -56 then @@ -289,7 +289,7 @@ endi sql select * from st_bigint_28 if $data01 != -56 then return -1 -endi +endi ### case 03: alter tag values #sql alter table st_bigint_0 set tag tagname=9223372036854775807 @@ -341,12 +341,12 @@ 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 #sql_error create table st_bigint_e0 using mt_bigint tags (-11.80) -sql_error create table st_bigint_e0 using mt_bigint tags (123abc) +sql_error create table st_bigint_e0 using mt_bigint tags (123abc) 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 create table st_bigint_e0_error using mt_bigint tags ('') +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 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) @@ -362,31 +362,31 @@ sql create table st_bigint_e10 using mt_bigint tags (123) 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 insert into st_bigint_e1 values (now, -9223372036854775808) -sql_error insert into st_bigint_e2 values (now, 9223372036854775809) -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) +sql_error insert into st_bigint_e0 values (now, 9223372036854775808) +sql insert into st_bigint_e1 values (now, -9223372036854775808) +sql_error insert into st_bigint_e2 values (now, 9223372036854775809) +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) 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 insert into st_bigint_e12 values (now, '') +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 insert into st_bigint_e12 values (now, '') -sql_error insert into st_bigint_e13 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) -#sql_error insert into st_bigint_e18 using mt_bigint tags (033) values (now, -92233720368547.75808) -sql_error insert into st_bigint_e19 using mt_bigint tags (033) values (now, 123abc) +sql_error insert into st_bigint_e13 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) +#sql_error insert into st_bigint_e18 using mt_bigint tags (033) values (now, -92233720368547.75808) +sql_error insert into st_bigint_e19 using mt_bigint tags (033) values (now, 123abc) sql_error insert into st_bigint_e20 using mt_bigint tags (033) values (now, "123abc") -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 insert into st_bigint_e25 using mt_bigint tags (033) values (now, '') +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 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 insert into st_bigint_e14_0 using mt_bigint tags (-9223372036854775808) values (now, -033) @@ -426,4 +426,4 @@ sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, 00062) #sql_error alter table st_bigint_e24 set tag tagname=" " #sql_error alter table st_bigint_e25 set tag tagname='' -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_bool.sim b/tests/script/tsim/parser/columnValue_bool.sim index ffdb095cee..ad4232d884 100644 --- a/tests/script/tsim/parser/columnValue_bool.sim +++ b/tests/script/tsim/parser/columnValue_bool.sim @@ -12,7 +12,7 @@ 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 ######## case 0: bool -print ========== bool +print ========== bool sql create table mt_bool (ts timestamp, c bool) tags (tagname bool) ## case 00: static create table for test tag values @@ -134,7 +134,7 @@ endi if $data01 != NULL then print ==17== expect: NULL, actually: $data01 return -1 -endi +endi sql insert into st_bool_1 values (now, NULL) sql select * from st_bool_1 if $rows != 1 then @@ -143,7 +143,7 @@ endi if $data01 != NULL then print ==18== expect: NULL, actually: $data01 return -1 -endi +endi sql insert into st_bool_2 values (now, 'NULL') sql select * from st_bool_2 if $rows != 1 then @@ -188,7 +188,7 @@ endi if $data01 != 1 then print ==23== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_7 values (now, 'true') sql select * from st_bool_7 if $rows != 1 then @@ -197,8 +197,8 @@ endi if $data01 != 1 then print ==24== expect: 1, actually: $data01 return -1 -endi -sql insert into st_bool_8 values (now, true) +endi +sql insert into st_bool_8 values (now, true) sql select * from st_bool_8 if $rows != 1 then return -1 @@ -206,7 +206,7 @@ endi if $data01 != 1 then print ==25== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_9 values (now, "false") sql select * from st_bool_9 if $rows != 1 then @@ -215,7 +215,7 @@ endi if $data01 != 0 then print ==26== expect: false, actually: $data01 return -1 -endi +endi sql insert into st_bool_10 values (now, 'false') sql select * from st_bool_10 if $rows != 1 then @@ -224,8 +224,8 @@ endi if $data01 != 0 then print ==27== expect: false, actually: $data01 return -1 -endi -sql insert into st_bool_11 values (now, false) +endi +sql insert into st_bool_11 values (now, false) sql select * from st_bool_11 if $rows != 1 then return -1 @@ -233,7 +233,7 @@ endi if $data01 != 0 then print ==28== expect: false, actually: $data01 return -1 -endi +endi sql insert into st_bool_12 values (now, 0) sql select * from st_bool_12 if $rows != 1 then @@ -242,7 +242,7 @@ endi if $data01 != 0 then print ==29== expect: false, actually: $data01 return -1 -endi +endi sql insert into st_bool_13 values (now, 1) sql select * from st_bool_13 if $rows != 1 then @@ -251,7 +251,7 @@ endi if $data01 != 1 then print ==30== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_14 values (now, 6.9) sql select * from st_bool_14 if $rows != 1 then @@ -260,8 +260,8 @@ endi if $data01 != 1 then print ==31== expect: 1, actually: $data01 return -1 -endi -sql insert into st_bool_15 values (now, -3) +endi +sql insert into st_bool_15 values (now, -3) sql select * from st_bool_15 if $rows != 1 then return -1 @@ -269,8 +269,8 @@ endi if $data01 != 1 then print ==32== expect: true, actually: $data01 return -1 -endi -sql insert into st_bool_15_0 values (now, +300) +endi +sql insert into st_bool_15_0 values (now, +300) sql select * from st_bool_15_0 if $rows != 1 then return -1 @@ -278,8 +278,8 @@ endi if $data01 != 1 then print ==32== expect: true, actually: $data01 return -1 -endi -sql insert into st_bool_15_1 values (now, -3.15) +endi +sql insert into st_bool_15_1 values (now, -3.15) sql select * from st_bool_15_1 if $rows != 1 then return -1 @@ -287,7 +287,7 @@ endi if $data01 != 1 then print ==32== expect: true, actually: $data01 return -1 -endi +endi ## case 02: dynamic create table for test tag values sql insert into st_bool_16 using mt_bool tags (NULL) values (now, NULL) @@ -301,7 +301,7 @@ if $data01 != NULL then print ==34== expect: NULL, actually: $data01 return -1 endi - + sql insert into st_bool_17 using mt_bool tags (NULL) values (now, NULL) sql show tags from st_bool_17 if $data05 != NULL then @@ -312,7 +312,7 @@ sql select * from st_bool_17 if $data01 != NULL then print ==36== expect: NULL, actually: $data01 return -1 -endi +endi sql insert into st_bool_18 using mt_bool tags ('NULL') values (now, 'NULL') sql show tags from st_bool_18 if $data05 != NULL then @@ -367,7 +367,7 @@ sql select * from st_bool_22 if $data01 != 1 then print ==46== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_23 using mt_bool tags ('true') values (now, 'true') sql show tags from st_bool_23 if $data05 != true then @@ -378,7 +378,7 @@ sql select * from st_bool_23 if $data01 != 1 then print ==48== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_24 using mt_bool tags (true) values (now, true) sql show tags from st_bool_24 if $data05 != true then @@ -389,7 +389,7 @@ sql select * from st_bool_24 if $data01 != 1 then print ==50== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_25 using mt_bool tags ("false") values (now, "false") sql show tags from st_bool_25 if $data05 != false then @@ -400,7 +400,7 @@ sql select * from st_bool_25 if $data01 != 0 then print ==52== expect: 0, actually: $data01 return -1 -endi +endi sql insert into st_bool_26 using mt_bool tags ('false') values (now, 'false') sql show tags from st_bool_26 if $data05 != false then @@ -411,7 +411,7 @@ sql select * from st_bool_26 if $data01 != 0 then print ==54== expect: 0, actually: $data01 return -1 -endi +endi sql insert into st_bool_27 using mt_bool tags (false) values (now, false) sql show tags from st_bool_27 if $data05 != false then @@ -422,7 +422,7 @@ sql select * from st_bool_27 if $data01 != 0 then print ==56== expect: 0, actually: $data01 return -1 -endi +endi sql insert into st_bool_28 using mt_bool tags (0) values (now, 0) sql show tags from st_bool_28 if $data05 != false then @@ -433,8 +433,8 @@ sql select * from st_bool_28 if $data01 != 0 then print ==58== expect: 0, actually: $data01 return -1 -endi -sql insert into st_bool_29 using mt_bool tags (1) values (now, 1) +endi +sql insert into st_bool_29 using mt_bool tags (1) values (now, 1) sql show tags from st_bool_29 if $data05 != true then print ==59== expect: 1, actually: $data00 @@ -444,7 +444,7 @@ sql select * from st_bool_29 if $data01 != 1 then print ==60== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_30 using mt_bool tags (6.9) values (now, 6.9) sql show tags from st_bool_30 if $data05 != true then @@ -455,7 +455,7 @@ sql select * from st_bool_30 if $data01 != 1 then print ==62== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_31 using mt_bool tags (-3) values (now, -3) sql show tags from st_bool_31 if $data05 != true then @@ -466,7 +466,7 @@ sql select * from st_bool_31 if $data01 != 1 then print ==64== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_32 using mt_bool tags (+300) values (now, +300) sql show tags from st_bool_32 if $data05 != true then @@ -477,7 +477,7 @@ sql select * from st_bool_32 if $data01 != 1 then print ==64== expect: 1, actually: $data01 return -1 -endi +endi sql insert into st_bool_33 using mt_bool tags (+30.890) values (now, +30.890) sql show tags from st_bool_33 if $data05 != true then @@ -488,7 +488,7 @@ sql select * from st_bool_33 if $data01 != 1 then print ==64== expect: 1, actually: $data01 return -1 -endi +endi @@ -610,13 +610,13 @@ 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_h0 using mt_bool tags (1) values (now, 123abc) +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_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_i0 using mt_bool tags (1) values (now, 1) sql insert into st_bool_i1 using mt_bool tags (1) values (now, 1) @@ -626,12 +626,12 @@ 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_i0 set tag tagname=123abc +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='' +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='' -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_double.sim b/tests/script/tsim/parser/columnValue_double.sim index d74dda36dc..da09b77353 100644 --- a/tests/script/tsim/parser/columnValue_double.sim +++ b/tests/script/tsim/parser/columnValue_double.sim @@ -12,7 +12,7 @@ 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 ######## case 0: double -print ========== double +print ========== double sql create table mt_double (ts timestamp, c double) tags (tagname double) ## case 00: static create table for test tag values @@ -157,7 +157,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_double_1 values (now, NULL) sql select * from st_double_1 if $rows != 1 then @@ -165,7 +165,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_double_2 values (now, 'NULL') sql select * from st_double_2 if $rows != 1 then @@ -204,10 +204,10 @@ sql select * from st_double_6 if $rows != 1 then return -1 endi -#if $data01 != 340282346638528859811704183484516925440.00000 then +#if $data01 != 340282346638528859811704183484516925440.00000 then # print ==== data01:$data01, expect:340282346638528859811704183484516925440.00000 # return -1 -#endi +#endi sql insert into st_double_7 values (now, -1.7976931348623157e+308) sql select * from st_double_7 if $rows != 1 then @@ -215,15 +215,15 @@ if $rows != 1 then endi #if $data01 != -340282346638528859811704183484516925440.00000 then # return -1 -#endi -sql insert into st_double_8 values (now, +100.89) +#endi +sql insert into st_double_8 values (now, +100.89) sql select * from st_double_8 if $rows != 1 then return -1 endi #if $data01 != 100.89000000 then # return -1 -#endi +#endi sql insert into st_double_9 values (now, "-0.98") sql select * from st_double_9 if $rows != 1 then @@ -231,7 +231,7 @@ if $rows != 1 then endi #if $data01 != -0.980000000 then # return -1 -#endi +#endi sql insert into st_double_10 values (now, '0') sql select * from st_double_10 if $rows != 1 then @@ -239,15 +239,15 @@ if $rows != 1 then endi #if $data01 != 0.00000000 then # tsim only print 4 bits after dot # return -1 -#endi -sql insert into st_double_11 values (now, -0) +#endi +sql insert into st_double_11 values (now, -0) sql select * from st_double_11 if $rows != 1 then return -1 endi #if $data01 != 0.000000000 then # return -1 -#endi +#endi sql insert into st_double_12 values (now, "+056") sql select * from st_double_12 if $rows != 1 then @@ -255,7 +255,7 @@ if $rows != 1 then endi #if $data01 != 56.000000 then # return -1 -#endi +#endi sql insert into st_double_13 values (now, +056) sql select * from st_double_13 @@ -264,7 +264,7 @@ if $rows != 1 then endi #if $data01 != 56.000000000 then # return -1 -#endi +#endi sql insert into st_double_14 values (now, -056) sql select * from st_double_14 @@ -273,7 +273,7 @@ if $rows != 1 then endi #if $data01 != -56 then # return -1 -#endi +#endi ## case 02: dynamic create table for test tag values sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL ) @@ -285,7 +285,7 @@ sql select * from st_double_16 if $data01 != NULL then return -1 endi - + sql insert into st_double_17 using mt_double tags (NULL) values (now, NULL) sql show tags from st_double_17 if $data05 != NULL then @@ -294,7 +294,7 @@ endi sql select * from st_double_17 if $data01 != NULL then return -1 -endi +endi sql insert into st_double_18 using mt_double tags ('NULL') values (now, 'NULL') sql show tags from st_double_18 if $data05 != NULL then @@ -339,7 +339,7 @@ sql show tags from st_double_22 sql select * from st_double_22 #if $data01 != 127 then # return -1 -#endi +#endi sql insert into st_double_23 using mt_double tags (-127) values (now, -1.7976931348623157e+308) sql show tags from st_double_23 #if $data05 != -127 then @@ -348,7 +348,7 @@ sql show tags from st_double_23 sql select * from st_double_23 #if $data01 != -127 then # return -1 -#endi +#endi sql insert into st_double_24 using mt_double tags (10) values (now, 10) sql show tags from st_double_24 #if $data05 != 10 then @@ -357,7 +357,7 @@ sql show tags from st_double_24 sql select * from st_double_24 #if $data01 != 10 then # return -1 -#endi +#endi sql insert into st_double_25 using mt_double tags ("-0") values (now, "-0") sql show tags from st_double_25 #if $data05 != 0 then @@ -366,7 +366,7 @@ sql show tags from st_double_25 sql select * from st_double_25 #if $data01 != 0 then # return -1 -#endi +#endi sql insert into st_double_26 using mt_double tags ('123') values (now, '12.3') sql show tags from st_double_26 #if $data05 != 123 then @@ -375,7 +375,7 @@ sql show tags from st_double_26 sql select * from st_double_26 #if $data01 != 123 then # return -1 -#endi +#endi sql insert into st_double_27 using mt_double tags (+056) values (now, +0005.6) sql show tags from st_double_27 #if $data05 != 56 then @@ -384,7 +384,7 @@ sql show tags from st_double_27 sql select * from st_double_27 #if $data01 != 56 then # return -1 -#endi +#endi sql insert into st_double_28 using mt_double tags (-056) values (now, -005.6) sql show tags from st_double_28 #if $data05 != -56 then @@ -393,7 +393,7 @@ sql show tags from st_double_28 sql select * from st_double_28 #if $data01 != -56 then # return -1 -#endi +#endi ### case 03: alter tag values #sql alter table st_double_0 set tag tagname=1.7976931348623157e+308 @@ -444,12 +444,12 @@ sql_error create table st_double_e0 using mt_double tags (31.7976931348623157e+3 sql_error create table st_double_e0 using mt_double tags (-31.7976931348623157e+308) #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 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_error create table st_double_e0 using mt_double tags (abc) +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) @@ -465,31 +465,31 @@ sql create table st_double_e10 using mt_double tags (123) sql create table st_double_e11 using mt_double tags (123) sql create table st_double_e12 using mt_double tags (123) -sql_error insert into st_double_e0 values (now, 11.7976931348623157e+308) -sql_error insert into st_double_e1 values (now, -11.7976931348623157e+308) -sql_error insert into st_double_e2 values (now, 111.7976931348623157e+308) -sql_error insert into st_double_e3 values (now, -111.7976931348623157e+308) -#sql_error insert into st_double_e4 values (now, 12.80) -#sql_error insert into st_double_e5 values (now, -11.80) -sql_error insert into st_double_e6 values (now, 123abc) +sql_error insert into st_double_e0 values (now, 11.7976931348623157e+308) +sql_error insert into st_double_e1 values (now, -11.7976931348623157e+308) +sql_error insert into st_double_e2 values (now, 111.7976931348623157e+308) +sql_error insert into st_double_e3 values (now, -111.7976931348623157e+308) +#sql_error insert into st_double_e4 values (now, 12.80) +#sql_error insert into st_double_e5 values (now, -11.80) +sql_error insert into st_double_e6 values (now, 123abc) 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 insert into st_double_e12 values (now, '') +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 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) -sql_error insert into st_double_e15 using mt_double tags (033) values (now, 131.7976931348623157e+308) -sql_error insert into st_double_e16 using mt_double tags (033) values (now, -131.7976931348623157e+308) -#sql_error insert into st_double_e17 using mt_double tags (033) values (now, 12.80) -#sql_error insert into st_double_e18 using mt_double tags (033) values (now, -11.80) -sql_error insert into st_double_e19 using mt_double tags (033) values (now, 123abc) +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) +sql_error insert into st_double_e15 using mt_double tags (033) values (now, 131.7976931348623157e+308) +sql_error insert into st_double_e16 using mt_double tags (033) values (now, -131.7976931348623157e+308) +#sql_error insert into st_double_e17 using mt_double tags (033) values (now, 12.80) +#sql_error insert into st_double_e18 using mt_double tags (033) values (now, -11.80) +sql_error insert into st_double_e19 using mt_double tags (033) values (now, 123abc) sql_error insert into st_double_e20 using mt_double tags (033) values (now, "123abc") -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 insert into st_double_e25_1 using mt_double tags (033) values (now, '') +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 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) @@ -518,15 +518,15 @@ sql insert into st_double_e23 using mt_double tags (033) values (now, 00062) sql insert into st_double_e24 using mt_double tags (033) values (now, 00062) sql insert into st_double_e25 using mt_double tags (033) values (now, 00062) -sql_error alter table st_double_e13 set tag tagname=1.8976931348623157e+308 -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 alter table st_double_e20 set tag tagname="123abc" -sql_error alter table st_double_e22 set tag tagname=abc -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='' +sql_error alter table st_double_e13 set tag tagname=1.8976931348623157e+308 +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 alter table st_double_e20 set tag tagname="123abc" +sql_error alter table st_double_e22 set tag tagname=abc +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='' -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_float.sim b/tests/script/tsim/parser/columnValue_float.sim index a55e1aea2d..3e20e178c3 100644 --- a/tests/script/tsim/parser/columnValue_float.sim +++ b/tests/script/tsim/parser/columnValue_float.sim @@ -12,7 +12,7 @@ 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 ######## case 0: float -print ========== float +print ========== float sql create table mt_float (ts timestamp, c float) tags (tagname float) ## case 00: static create table for test tag values @@ -174,7 +174,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_float_1 values (now, NULL) sql select * from st_float_1 if $rows != 1 then @@ -182,7 +182,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_float_2 values (now, 'NULL') sql select * from st_float_2 if $rows != 1 then @@ -238,14 +238,14 @@ if $data01 != -340282346638528859811704183484516925440.00000 then return -1 endi -sql insert into st_float_8 values (now, +100.89) +sql insert into st_float_8 values (now, +100.89) sql select * from st_float_8 if $rows != 1 then return -1 endi #if $data01 != 100.89000 then # return -1 -#endi +#endi sql insert into st_float_9 values (now, "-0.98") sql select * from st_float_9 if $rows != 1 then @@ -253,7 +253,7 @@ if $rows != 1 then endi #if $data01 != -0.980000 then # return -1 -#endi +#endi sql insert into st_float_10 values (now, '0') sql select * from st_float_10 if $rows != 1 then @@ -261,15 +261,15 @@ if $rows != 1 then endi #if $data01 != 0.00000 then # tsim only print 4 bits after dot # return -1 -#endi -sql insert into st_float_11 values (now, -0) +#endi +sql insert into st_float_11 values (now, -0) sql select * from st_float_11 if $rows != 1 then return -1 endi #if $data01 != 0.00000 then # return -1 -#endi +#endi sql insert into st_float_12 values (now, "+056") sql select * from st_float_12 if $rows != 1 then @@ -277,7 +277,7 @@ if $rows != 1 then endi #if $data01 != 56.000000 then # return -1 -#endi +#endi sql insert into st_float_13 values (now, +056) sql select * from st_float_13 @@ -286,7 +286,7 @@ if $rows != 1 then endi #if $data01 != 56.000000 then # return -1 -#endi +#endi sql insert into st_float_14 values (now, -056) sql select * from st_float_14 @@ -295,7 +295,7 @@ if $rows != 1 then endi #if $data01 != -56 then # return -1 -#endi +#endi ## case 02: dynamic create table for test tag values sql insert into st_float_16 using mt_float tags (NULL) values (now, NULL) @@ -307,7 +307,7 @@ sql select * from st_float_16 if $data01 != NULL then return -1 endi - + sql insert into st_float_17 using mt_float tags (NULL) values (now, NULL) sql show tags from st_float_17 if $data05 != NULL then @@ -316,7 +316,7 @@ endi sql select * from st_float_17 if $data01 != NULL then return -1 -endi +endi sql insert into st_float_18 using mt_float tags ('NULL') values (now, 'NULL') sql show tags from st_float_18 if $data05 != NULL then @@ -474,12 +474,12 @@ 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 (-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 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_error create table st_float_e0 using mt_float tags (abc) +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) @@ -495,31 +495,31 @@ sql create table st_float_e10 using mt_float tags (123) sql create table st_float_e11 using mt_float tags (123) sql create table st_float_e12 using mt_float tags (123) -sql_error insert into st_float_e0 values (now, 3.50282347e+38) -sql_error insert into st_float_e1 values (now, -3.50282347e+38) -sql_error insert into st_float_e2 values (now, 13.40282347e+38) -sql_error insert into st_float_e3 values (now, -13.40282347e+38) -#sql_error insert into st_float_e4 values (now, 12.80) -#sql_error insert into st_float_e5 values (now, -11.80) -sql_error insert into st_float_e6 values (now, 123abc) +sql_error insert into st_float_e0 values (now, 3.50282347e+38) +sql_error insert into st_float_e1 values (now, -3.50282347e+38) +sql_error insert into st_float_e2 values (now, 13.40282347e+38) +sql_error insert into st_float_e3 values (now, -13.40282347e+38) +#sql_error insert into st_float_e4 values (now, 12.80) +#sql_error insert into st_float_e5 values (now, -11.80) +sql_error insert into st_float_e6 values (now, 123abc) 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 insert into st_float_e12 values (now, '') +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 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) -sql_error insert into st_float_e15 using mt_float tags (033) values (now, 13.40282347e+38) -sql_error insert into st_float_e16 using mt_float tags (033) values (now, -13.40282347e+38) -#sql_error insert into st_float_e17 using mt_float tags (033) values (now, 12.80) -#sql_error insert into st_float_e18 using mt_float tags (033) values (now, -11.80) -sql_error insert into st_float_e19 using mt_float tags (033) values (now, 123abc) +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) +sql_error insert into st_float_e15 using mt_float tags (033) values (now, 13.40282347e+38) +sql_error insert into st_float_e16 using mt_float tags (033) values (now, -13.40282347e+38) +#sql_error insert into st_float_e17 using mt_float tags (033) values (now, 12.80) +#sql_error insert into st_float_e18 using mt_float tags (033) values (now, -11.80) +sql_error insert into st_float_e19 using mt_float tags (033) values (now, 123abc) sql_error insert into st_float_e20 using mt_float tags (033) values (now, "123abc") -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 insert into st_float_e25_1 using mt_float tags (033) values (now, '') +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 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) @@ -548,15 +548,15 @@ sql insert into st_float_e23 using mt_float tags (033) values (now, 00062) sql insert into st_float_e24 using mt_float tags (033) values (now, 00062) sql insert into st_float_e25 using mt_float tags (033) values (now, 00062) -sql_error alter table st_float_e13 set tag tagname=3.50282347e+38 -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 alter table st_float_e20 set tag tagname="123abc" -sql_error alter table st_float_e22 set tag tagname=abc -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='' +sql_error alter table st_float_e13 set tag tagname=3.50282347e+38 +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 alter table st_float_e20 set tag tagname="123abc" +sql_error alter table st_float_e22 set tag tagname=abc +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='' -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_int.sim b/tests/script/tsim/parser/columnValue_int.sim index 34ad3d93fd..009fbd1ede 100644 --- a/tests/script/tsim/parser/columnValue_int.sim +++ b/tests/script/tsim/parser/columnValue_int.sim @@ -12,7 +12,7 @@ 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 ######## case 0: int -print ========== int +print ========== int sql create table mt_int (ts timestamp, c int) tags (tagname int) ## case 00: static create table for test tag values @@ -86,7 +86,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_int_1 values (now, NULL) sql select * from st_int_1 if $rows != 1 then @@ -94,7 +94,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_int_6 values (now, 2147483647) sql select * from st_int_6 if $rows != 1 then @@ -102,7 +102,7 @@ if $rows != 1 then endi if $data01 != 2147483647 then return -1 -endi +endi sql insert into st_int_7 values (now, -2147483647) sql select * from st_int_7 if $rows != 1 then @@ -110,15 +110,15 @@ if $rows != 1 then endi if $data01 != -2147483647 then return -1 -endi -sql insert into st_int_8 values (now, +100) +endi +sql insert into st_int_8 values (now, +100) sql select * from st_int_8 if $rows != 1 then return -1 endi if $data01 != 100 then return -1 -endi +endi sql insert into st_int_9 values (now, "-098") sql select * from st_int_9 if $rows != 1 then @@ -126,7 +126,7 @@ if $rows != 1 then endi if $data01 != -98 then return -1 -endi +endi sql insert into st_int_10 values (now, '0') sql select * from st_int_10 if $rows != 1 then @@ -134,15 +134,15 @@ if $rows != 1 then endi if $data01 != 0 then return -1 -endi -sql insert into st_int_11 values (now, -0) +endi +sql insert into st_int_11 values (now, -0) sql select * from st_int_11 if $rows != 1 then return -1 endi if $data01 != 0 then return -1 -endi +endi sql insert into st_int_12 values (now, "+056") sql select * from st_int_12 if $rows != 1 then @@ -150,7 +150,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_int_13 values (now, +056) sql select * from st_int_13 @@ -159,7 +159,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_int_14 values (now, -056) sql select * from st_int_14 @@ -168,7 +168,7 @@ if $rows != 1 then endi if $data01 != -56 then return -1 -endi +endi ## case 02: dynamic create table for test tag values sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL) @@ -180,7 +180,7 @@ sql select * from st_int_16 if $data01 != NULL then return -1 endi - + sql insert into st_int_17 using mt_int tags (NULL) values (now, NULL) sql show tags from st_int_17 if $data05 != NULL then @@ -189,7 +189,7 @@ endi sql select * from st_int_17 if $data01 != NULL then return -1 -endi +endi sql insert into st_int_18 using mt_int tags ('NULL') values (now, 'NULL') sql show tags from st_int_18 if $data05 != NULL then @@ -234,7 +234,7 @@ endi sql select * from st_int_22 if $data01 != 2147483647 then return -1 -endi +endi sql insert into st_int_23 using mt_int tags (-2147483647) values (now, -2147483647) sql show tags from st_int_23 if $data05 != -2147483647 then @@ -243,7 +243,7 @@ endi sql select * from st_int_23 if $data01 != -2147483647 then return -1 -endi +endi sql insert into st_int_24 using mt_int tags (10) values (now, 10) sql show tags from st_int_24 if $data05 != 10 then @@ -252,7 +252,7 @@ endi sql select * from st_int_24 if $data01 != 10 then return -1 -endi +endi sql insert into st_int_25 using mt_int tags ("-0") values (now, "-0") sql show tags from st_int_25 if $data05 != 0 then @@ -261,7 +261,7 @@ endi sql select * from st_int_25 if $data01 != 0 then return -1 -endi +endi sql insert into st_int_26 using mt_int tags ('123') values (now, '123') sql show tags from st_int_26 if $data05 != 123 then @@ -270,7 +270,7 @@ endi sql select * from st_int_26 if $data01 != 123 then return -1 -endi +endi sql insert into st_int_27 using mt_int tags (+056) values (now, +00056) sql show tags from st_int_27 if $data05 != 56 then @@ -279,7 +279,7 @@ endi sql select * from st_int_27 if $data01 != 56 then return -1 -endi +endi sql insert into st_int_28 using mt_int tags (-056) values (now, -0056) sql show tags from st_int_28 if $data05 != -56 then @@ -288,7 +288,7 @@ endi sql select * from st_int_28 if $data01 != -56 then return -1 -endi +endi ### case 03: alter tag values #sql alter table st_int_0 set tag tagname=2147483647 @@ -339,12 +339,12 @@ 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 #sql_error create table st_int_e0 using mt_int tags (-11.80) -sql_error create table st_int_e0 using mt_int tags (123abc) +sql_error create table st_int_e0 using mt_int tags (123abc) 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 create table st_int_e0_err2 using mt_int tags ('') +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 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) @@ -360,31 +360,31 @@ sql create table st_int_e10 using mt_int tags (123) 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 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) -#sql_error insert into st_int_e5 values (now, -11.80) -sql_error insert into st_int_e6 values (now, 123abc) +sql_error insert into st_int_e0 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) +#sql_error insert into st_int_e5 values (now, -11.80) +sql_error insert into st_int_e6 values (now, 123abc) 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 insert into st_int_e12 values (now, '') +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 insert into st_int_e12 values (now, '') -sql_error insert into st_int_e13 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) -#sql_error insert into st_int_e18 using mt_int tags (033) values (now, -11.80) -sql_error insert into st_int_e19 using mt_int tags (033) values (now, 123abc) +sql_error insert into st_int_e13 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) +#sql_error insert into st_int_e18 using mt_int tags (033) values (now, -11.80) +sql_error insert into st_int_e19 using mt_int tags (033) values (now, 123abc) 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 insert into st_int_e25 using mt_int tags (033) values (now, '') +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 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 insert into st_int_e14_1 using mt_int tags (-2147483648) values (now, -033) @@ -413,15 +413,15 @@ sql insert into st_int_e23 using mt_int tags (033) values (now, 00062) 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 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_e13 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 -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 alter table st_int_e25 set tag tagname='' +sql_error alter table st_int_e19 set tag tagname=123abc +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 alter table st_int_e25 set tag tagname='' -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_smallint.sim b/tests/script/tsim/parser/columnValue_smallint.sim index 39608a8efe..0dcb0d85f4 100644 --- a/tests/script/tsim/parser/columnValue_smallint.sim +++ b/tests/script/tsim/parser/columnValue_smallint.sim @@ -15,7 +15,7 @@ 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 -print ========== smallint +print ========== smallint sql create table mt_smallint (ts timestamp, c smallint) tags (tagname smallint) ## case 00: static create table for test tag values @@ -89,7 +89,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_smallint_1 values (now, NULL) sql select * from st_smallint_1 if $rows != 1 then @@ -97,7 +97,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_smallint_6 values (now, 32767) sql select * from st_smallint_6 if $rows != 1 then @@ -105,7 +105,7 @@ if $rows != 1 then endi if $data01 != 32767 then return -1 -endi +endi sql insert into st_smallint_7 values (now, -32767) sql select * from st_smallint_7 if $rows != 1 then @@ -113,15 +113,15 @@ if $rows != 1 then endi if $data01 != -32767 then return -1 -endi -sql insert into st_smallint_8 values (now, +100) +endi +sql insert into st_smallint_8 values (now, +100) sql select * from st_smallint_8 if $rows != 1 then return -1 endi if $data01 != 100 then return -1 -endi +endi sql insert into st_smallint_9 values (now, "-098") sql select * from st_smallint_9 if $rows != 1 then @@ -129,7 +129,7 @@ if $rows != 1 then endi if $data01 != -98 then return -1 -endi +endi sql insert into st_smallint_10 values (now, '0') sql select * from st_smallint_10 if $rows != 1 then @@ -137,15 +137,15 @@ if $rows != 1 then endi if $data01 != 0 then return -1 -endi -sql insert into st_smallint_11 values (now, -0) +endi +sql insert into st_smallint_11 values (now, -0) sql select * from st_smallint_11 if $rows != 1 then return -1 endi if $data01 != 0 then return -1 -endi +endi sql insert into st_smallint_12 values (now, "+056") sql select * from st_smallint_12 if $rows != 1 then @@ -153,7 +153,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_smallint_13 values (now, +056) sql select * from st_smallint_13 @@ -162,7 +162,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_smallint_14 values (now, -056) sql select * from st_smallint_14 @@ -171,7 +171,7 @@ if $rows != 1 then endi if $data01 != -56 then return -1 -endi +endi ## case 02: dynamic create table for test tag values sql insert into st_smallint_16 using mt_smallint tags (NULL) values (now, NULL) @@ -183,7 +183,7 @@ sql select * from st_smallint_16 if $data01 != NULL then return -1 endi - + sql insert into st_smallint_17 using mt_smallint tags (NULL) values (now, NULL) sql show tags from st_smallint_17 if $data05 != NULL then @@ -192,7 +192,7 @@ endi sql select * from st_smallint_17 if $data01 != NULL then return -1 -endi +endi sql insert into st_smallint_18 using mt_smallint tags ('NULL') values (now, 'NULL') sql show tags from st_smallint_18 if $data05 != NULL then @@ -237,7 +237,7 @@ endi sql select * from st_smallint_22 if $data01 != 32767 then return -1 -endi +endi sql insert into st_smallint_23 using mt_smallint tags (-32767) values (now, -32767) sql show tags from st_smallint_23 if $data05 != -32767 then @@ -246,7 +246,7 @@ endi sql select * from st_smallint_23 if $data01 != -32767 then return -1 -endi +endi sql insert into st_smallint_24 using mt_smallint tags (10) values (now, 10) sql show tags from st_smallint_24 if $data05 != 10 then @@ -255,7 +255,7 @@ endi sql select * from st_smallint_24 if $data01 != 10 then return -1 -endi +endi sql insert into st_smallint_25 using mt_smallint tags ("-0") values (now, "-0") sql show tags from st_smallint_25 if $data05 != 0 then @@ -264,7 +264,7 @@ endi sql select * from st_smallint_25 if $data01 != 0 then return -1 -endi +endi sql insert into st_smallint_26 using mt_smallint tags ('123') values (now, '123') sql show tags from st_smallint_26 if $data05 != 123 then @@ -273,7 +273,7 @@ endi sql select * from st_smallint_26 if $data01 != 123 then return -1 -endi +endi sql insert into st_smallint_27 using mt_smallint tags (+056) values (now, +00056) sql show tags from st_smallint_27 if $data05 != 56 then @@ -282,7 +282,7 @@ endi sql select * from st_smallint_27 if $data01 != 56 then return -1 -endi +endi sql insert into st_smallint_28 using mt_smallint tags (-056) values (now, -0056) sql show tags from st_smallint_28 if $data05 != -56 then @@ -291,7 +291,7 @@ endi sql select * from st_smallint_28 if $data01 != -56 then return -1 -endi +endi ## case 03: alter tag values #sql alter table st_smallint_0 set tag tagname=32767 @@ -342,12 +342,12 @@ 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 #sql_error create table st_smallint_e0 using mt_smallint tags (-11.80) -sql_error create table st_smallint_e0 using mt_smallint tags (123abc) +sql_error create table st_smallint_e0 using mt_smallint tags (123abc) 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 create table st_smallint_e0_1 using mt_smallint tags ('') +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 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) @@ -363,31 +363,31 @@ sql create table st_smallint_e10 using mt_smallint tags (123) 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 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) -#sql_error insert into st_smallint_e5 values (now, -11.80) -sql_error insert into st_smallint_e6 values (now, 123abc) +sql_error insert into st_smallint_e0 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) +#sql_error insert into st_smallint_e5 values (now, -11.80) +sql_error insert into st_smallint_e6 values (now, 123abc) 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 insert into st_smallint_e12 values (now, '') +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 insert into st_smallint_e12 values (now, '') -sql_error insert into st_smallint_e13 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) -#sql_error insert into st_smallint_e18 using mt_smallint tags (033) values (now, -11.80) -sql_error insert into st_smallint_e19 using mt_smallint tags (033) values (now, 123abc) +sql_error insert into st_smallint_e13 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) +#sql_error insert into st_smallint_e18 using mt_smallint tags (033) values (now, -11.80) +sql_error insert into st_smallint_e19 using mt_smallint tags (033) values (now, 123abc) sql_error insert into st_smallint_e20 using mt_smallint tags (033) values (now, "123abc") -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 insert into st_smallint_e25_1 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 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 insert into st_smallint_e14 using mt_smallint tags (-32768) values (now, -033) @@ -416,15 +416,15 @@ sql insert into st_smallint_e23 using mt_smallint tags (033) values (now, 00062) 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 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 -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 alter table st_smallint_e25 set tag tagname='' +sql_error alter table st_smallint_e13 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 +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 alter table st_smallint_e25 set tag tagname='' -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/columnValue_tinyint.sim b/tests/script/tsim/parser/columnValue_tinyint.sim index fe2734c245..62ae4e5228 100644 --- a/tests/script/tsim/parser/columnValue_tinyint.sim +++ b/tests/script/tsim/parser/columnValue_tinyint.sim @@ -12,7 +12,7 @@ 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 ######## case 0: tinyint -print ========== tinyint +print ========== tinyint sql create table mt_tinyint (ts timestamp, c tinyint) tags (tagname tinyint) ## case 00: static create table for test tag values @@ -87,7 +87,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_tinyint_1 values (now, NULL) sql select * from st_tinyint_1 if $rows != 1 then @@ -95,7 +95,7 @@ if $rows != 1 then endi if $data01 != NULL then return -1 -endi +endi sql insert into st_tinyint_6 values (now, 127) sql select * from st_tinyint_6 if $rows != 1 then @@ -103,7 +103,7 @@ if $rows != 1 then endi if $data01 != 127 then return -1 -endi +endi sql insert into st_tinyint_7 values (now, -127) sql select * from st_tinyint_7 if $rows != 1 then @@ -111,15 +111,15 @@ if $rows != 1 then endi if $data01 != -127 then return -1 -endi -sql insert into st_tinyint_8 values (now, +100) +endi +sql insert into st_tinyint_8 values (now, +100) sql select * from st_tinyint_8 if $rows != 1 then return -1 endi if $data01 != 100 then return -1 -endi +endi sql insert into st_tinyint_9 values (now, "-098") sql select * from st_tinyint_9 if $rows != 1 then @@ -127,7 +127,7 @@ if $rows != 1 then endi if $data01 != -98 then return -1 -endi +endi sql insert into st_tinyint_10 values (now, '0') sql select * from st_tinyint_10 if $rows != 1 then @@ -135,15 +135,15 @@ if $rows != 1 then endi if $data01 != 0 then return -1 -endi -sql insert into st_tinyint_11 values (now, -0) +endi +sql insert into st_tinyint_11 values (now, -0) sql select * from st_tinyint_11 if $rows != 1 then return -1 endi if $data01 != 0 then return -1 -endi +endi sql insert into st_tinyint_12 values (now, "+056") sql select * from st_tinyint_12 if $rows != 1 then @@ -151,7 +151,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_tinyint_13 values (now, +056) sql select * from st_tinyint_13 @@ -160,7 +160,7 @@ if $rows != 1 then endi if $data01 != 56 then return -1 -endi +endi sql insert into st_tinyint_14 values (now, -056) sql select * from st_tinyint_14 @@ -169,7 +169,7 @@ if $rows != 1 then endi if $data01 != -56 then return -1 -endi +endi ## case 02: dynamic create table for test tag values sql insert into st_tinyint_16 using mt_tinyint tags (NULL) values (now, NULL) @@ -181,7 +181,7 @@ sql select * from st_tinyint_16 if $data01 != NULL then return -1 endi - + sql insert into st_tinyint_17 using mt_tinyint tags (NULL) values (now, NULL) sql show tags from st_tinyint_17 if $data05 != NULL then @@ -190,7 +190,7 @@ endi sql select * from st_tinyint_17 if $data01 != NULL then return -1 -endi +endi sql insert into st_tinyint_18 using mt_tinyint tags ('NULL') values (now, 'NULL') sql show tags from st_tinyint_18 if $data05 != NULL then @@ -235,7 +235,7 @@ endi sql select * from st_tinyint_22 if $data01 != 127 then return -1 -endi +endi sql insert into st_tinyint_23 using mt_tinyint tags (-127) values (now, -127) sql show tags from st_tinyint_23 if $data05 != -127 then @@ -244,7 +244,7 @@ endi sql select * from st_tinyint_23 if $data01 != -127 then return -1 -endi +endi sql insert into st_tinyint_24 using mt_tinyint tags (10) values (now, 10) sql show tags from st_tinyint_24 if $data05 != 10 then @@ -253,7 +253,7 @@ endi sql select * from st_tinyint_24 if $data01 != 10 then return -1 -endi +endi sql insert into st_tinyint_25 using mt_tinyint tags ("-0") values (now, "-0") sql show tags from st_tinyint_25 if $data05 != 0 then @@ -262,7 +262,7 @@ endi sql select * from st_tinyint_25 if $data01 != 0 then return -1 -endi +endi sql insert into st_tinyint_26 using mt_tinyint tags ('123') values (now, '123') sql show tags from st_tinyint_26 if $data05 != 123 then @@ -271,7 +271,7 @@ endi sql select * from st_tinyint_26 if $data01 != 123 then return -1 -endi +endi sql insert into st_tinyint_27 using mt_tinyint tags (+056) values (now, +00056) sql show tags from st_tinyint_27 if $data05 != 56 then @@ -280,7 +280,7 @@ endi sql select * from st_tinyint_27 if $data01 != 56 then return -1 -endi +endi sql insert into st_tinyint_28 using mt_tinyint tags (-056) values (now, -0056) sql show tags from st_tinyint_28 if $data05 != -56 then @@ -289,7 +289,7 @@ endi sql select * from st_tinyint_28 if $data01 != -56 then return -1 -endi +endi ## case 03: alter tag values #sql alter table st_tinyint_0 set tag tagname=127 @@ -340,12 +340,12 @@ 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 #sql_error create table st_tinyint_e0 using mt_tinyint tags (-11.80) -sql_error create table st_tinyint_e0 using mt_tinyint tags (123abc) +sql_error create table st_tinyint_e0 using mt_tinyint tags (123abc) 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 create table st_tinyint_e0_2 using mt_tinyint tags ('') +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 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) @@ -361,31 +361,31 @@ sql create table st_tinyint_e10 using mt_tinyint tags (123) 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 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) -#sql_error insert into st_tinyint_e5 values (now, -11.80) -sql_error insert into st_tinyint_e6 values (now, 123abc) +sql_error insert into st_tinyint_e0 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) +#sql_error insert into st_tinyint_e5 values (now, -11.80) +sql_error insert into st_tinyint_e6 values (now, 123abc) 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 insert into st_tinyint_e12 values (now, '') +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 insert into st_tinyint_e12 values (now, '') -sql_error insert into st_tinyint_e13 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) -#sql_error insert into st_tinyint_e18 using mt_tinyint tags (033) values (now, -11.80) -sql_error insert into st_tinyint_e19 using mt_tinyint tags (033) values (now, 123abc) +sql_error insert into st_tinyint_e13 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) +#sql_error insert into st_tinyint_e18 using mt_tinyint tags (033) values (now, -11.80) +sql_error insert into st_tinyint_e19 using mt_tinyint tags (033) values (now, 123abc) sql_error insert into st_tinyint_e20 using mt_tinyint tags (033) values (now, "123abc") -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 insert into st_tinyint_e25_2 using mt_tinyint tags (033) values (now, '') +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 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 insert into st_tinyint_e14 using mt_tinyint tags (-128) values (now, -033) @@ -414,15 +414,15 @@ sql insert into st_tinyint_e23 using mt_tinyint tags (033) values (now, 00062) 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 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 -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 alter table st_tinyint_e25 set tag tagname='' +sql_error alter table st_tinyint_e13 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 +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 alter table st_tinyint_e25 set tag tagname='' -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/commit.sim b/tests/script/tsim/parser/commit.sim index 0877168609..ae19a4803b 100644 --- a/tests/script/tsim/parser/commit.sim +++ b/tests/script/tsim/parser/commit.sim @@ -9,7 +9,7 @@ $stbPrefix = sc_stb $tbNum = 10 $rowNum = 10000 $totalNum = $tbNum * $rowNum -$loops = 5 +$loops = 5 $log = 1 $ts0 = 1537146000000 $delta = 600000 @@ -34,7 +34,7 @@ while $i < $halfNum $tb1 = $tbPrefix . $tbId sql create table $tb using $stb tags( $i ) sql create table $tb1 using $stb tags( $tbId ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -48,10 +48,10 @@ while $i < $halfNum $nchar = $nchar . ' sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw print ====== tables created sql use $db @@ -62,7 +62,7 @@ $i = 0 while $loop <= $loops print repeat = $loop while $i < 10 - sql select count(*) from $stb where t1 = $i + sql select count(*) from $stb where t1 = $i if $data00 != $rowNum then print expect $rowNum , actual: $data00 return -1 @@ -89,7 +89,7 @@ $i = 0 while $loop <= $loops print repeat = $loop while $i < 10 - sql select count(*) from $stb where t1 = $i + sql select count(*) from $stb where t1 = $i if $data00 != $rowNum then return -1 endi @@ -102,4 +102,4 @@ while $loop <= $loops $loop = $loop + 1 endw -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/condition.sim b/tests/script/tsim/parser/condition.sim index 700d1b98c0..1fec5c0ba1 100644 --- a/tests/script/tsim/parser/condition.sim +++ b/tests/script/tsim/parser/condition.sim @@ -4,7 +4,7 @@ system sh/exec.sh -n dnode1 -s start sql connect sql drop database if exists cdb -sql create database if not exists cdb +sql create database if not exists cdb sql use cdb sql create table stb1 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) sql create table tb1 using stb1 tags(1,'1',1.0) @@ -37,7 +37,7 @@ sql insert into tb4 values ('2021-05-05 18:19:19',44,44.0,44,44,44,44.0,false,'4 sql insert into tb5 values ('2021-05-05 18:19:20',51,51.0,51,51,51,51.0,true ,'51','51') sql insert into tb5 values ('2021-05-05 18:19:21',52,52.0,52,52,52,52.0,true ,'52','52') sql insert into tb5 values ('2021-05-05 18:19:22',53,53.0,53,53,53,53.0,false,'53','53') -sql insert into tb5 values ('2021-05-05 18:19:23',54,54.0,54,54,54,54.0,false,'54','54') +sql insert into tb5 values ('2021-05-05 18:19:23',54,54.0,54,54,54,54.0,false,'54','54') sql insert into tb6 values ('2021-05-05 18:19:24',61,61.0,61,61,61,61.0,true ,'61','61') sql insert into tb6 values ('2021-05-05 18:19:25',62,62.0,62,62,62,62.0,true ,'62','62') sql insert into tb6 values ('2021-05-05 18:19:26',63,63.0,63,63,63,63.0,false,'63','63') diff --git a/tests/script/tsim/parser/create_db.sim b/tests/script/tsim/parser/create_db.sim index d50b53b2f7..dc0a12f64a 100644 --- a/tests/script/tsim/parser/create_db.sim +++ b/tests/script/tsim/parser/create_db.sim @@ -23,10 +23,10 @@ sql create database $db sql use $db sql show databases -if $rows != 3 then +if $rows != 3 then return -1 endi -if $data20 != $db then +if $data20 != $db then return -1 endi sql drop database $db @@ -41,7 +41,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data20 != $db then +if $data20 != $db then return -1 endi sql drop database $db @@ -101,7 +101,7 @@ $duration = 10 $keep = 365,365,365 $rows_db = 1000 $cache = 16 # 16MB -$ablocks = 100 +$ablocks = 100 $tblocks = 32 # max=512, automatically trimmed when exceeding $ctime = 36000 # 10 hours $wal = 1 # valid value is 1, 2 @@ -112,16 +112,16 @@ sql show databases if $rows != 3 then return -1 endi -if $data20 != $db then +if $data20 != $db then return -1 endi -if $data24 != $replica then +if $data24 != $replica then return -1 endi -if $data26 != 14400m then +if $data26 != 14400m then return -1 endi -if $data27 != 525600m,525600m,525600m then +if $data27 != 525600m,525600m,525600m then return -1 endi @@ -134,7 +134,7 @@ sql_error create database $db replica 4 # day [1, 3650] sql_error create database $db day 0 -sql_error create database $db day 3651 +sql_error create database $db day 3651 # keep [1, infinity] sql_error create database $db keep 0 @@ -155,7 +155,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 27360m,27360m,27360m then +if $data27 != 27360m,27360m,27360m then return -1 endi sql drop database dbk0 @@ -164,7 +164,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 27360m,28800m,28800m then +if $data27 != 27360m,28800m,28800m then return -1 endi sql drop database dbka @@ -174,7 +174,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 15840m,15840m,15840m then +if $data27 != 15840m,15840m,15840m then return -1 endi sql drop database dbk1 @@ -183,7 +183,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 15840m,17280m,18720m then +if $data27 != 15840m,17280m,18720m then return -1 endi sql drop database dbk2 @@ -192,7 +192,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 15840m,15840m,18720m then +if $data27 != 15840m,15840m,18720m then return -1 endi sql drop database dbk3 @@ -201,7 +201,7 @@ sql show databases if $rows != 3 then return -1 endi -if $data27 != 15840m,18720m,18720m then +if $data27 != 15840m,18720m,18720m then return -1 endi sql drop database dbk4 @@ -238,7 +238,7 @@ if $rows != 3 then endi sql show databases print wallevel $data20_testwal -if $data20_testwal != 1 then +if $data20_testwal != 1 then return -1 endi sql drop database testwal @@ -249,7 +249,7 @@ if $rows != 3 then return -1 endi print wallevel $data13_testwal -if $data13_testwal != 2 then +if $data13_testwal != 2 then return -1 endi sql drop database testwal @@ -263,7 +263,7 @@ sql_error create database $db comp 3 sql_error drop database $db sql show databases -if $rows != 2 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/create_mt.sim b/tests/script/tsim/parser/create_mt.sim index 8f0c0e030b..e2f02f9740 100644 --- a/tests/script/tsim/parser/create_mt.sim +++ b/tests/script/tsim/parser/create_mt.sim @@ -30,7 +30,7 @@ sql show stables if $rows != 1 then return -1 endi -if $data00 != $mt then +if $data00 != $mt then return -1 endi sql_error DROP METRIC $mt @@ -75,7 +75,7 @@ sql_error create table $mt (ts timestamp, col $i_tinyint ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_nchar ) tags (tag1 int) # correct using of nchar -sql create table $mt (ts timestamp, col nchar(10)) tags (tag1 int) +sql create table $mt (ts timestamp, col nchar(10)) tags (tag1 int) sql show stables if $rows != 1 then return -1 @@ -115,7 +115,7 @@ endi if $data00 != $mt then return -1 endi -sql drop table $mt +sql drop table $mt print illegal_data_type_in_tags test passed # illegal_tag_name test @@ -141,12 +141,12 @@ $stables = stables sql_error create table $mt (ts timestamp, col1 int) tags ( $tb_ int) sql_error create table $mt (ts timestamp, col1 int) tags ( $tbs int) sql_error create table $mt (ts timestamp, col1 int) tags ( $db_ int) -sql_error create table $mt (ts timestamp, col1 int) tags ( $dbs int) +sql_error create table $mt (ts timestamp, col1 int) tags ( $dbs int) sql_error create table $mt (ts timestamp, col1 int) tags ( $ses int) sql_error create table $mt (ts timestamp, col1 int) tags ( $int int) sql_error create table $mt (ts timestamp, col1 int) tags ( $bint int) sql_error create table $mt (ts timestamp, col1 int) tags ( $binary int) -sql create table $mt (ts timestamp, col1 int) tags ( $str int) +sql create table $mt (ts timestamp, col1 int) tags ( $str int) sql drop table $mt sql_error create table $mt (ts timestamp, col1 int) tags ( $tag int) sql_error create table $mt (ts timestamp, col1 int) tags ( $tags int) @@ -184,7 +184,7 @@ sql drop table $tb sql_error create table $tb using $mt tags (abc) #the case below might need more consideration -sql_error create table $tb using $mt tags ('abc') +sql_error create table $tb using $mt tags ('abc') sql drop table if exists $tb sql reset query cache sql_error create table $tb using $mt tags (1e1) @@ -202,12 +202,12 @@ $mt2 = mt2 #sql_error create table $mt1 (ts timestamp, $CN_char int) tags (tag1 int) #sql_error create table $mt2 (ts timestamp, col1 int) tags ( $CN_char int) #sql show metrics -#if $rows != 3 then +#if $rows != 3 then # return -1 #endi ##print expected: $CN_char ##print returned: $data00 -#if $data00 != $CN_char then +#if $data00 != $CN_char then # return -1 #endi ##print expected: $mt1 @@ -241,7 +241,7 @@ print chinese_char_in_metrics test passed sql drop database $db sql show databases -if $rows != 2 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/create_tb.sim b/tests/script/tsim/parser/create_tb.sim index 384c8f8757..ea6709807f 100644 --- a/tests/script/tsim/parser/create_tb.sim +++ b/tests/script/tsim/parser/create_tb.sim @@ -31,7 +31,7 @@ if $rows != 1 then return -1 endi print data00 = $data00 -if $data00 != $tb then +if $data00 != $tb then return -1 endi sql DROP TABLE $tb @@ -47,7 +47,7 @@ print =========== create_tb.sim case2: illegal_table_name test $illegal_tb1 = 1db $illegal_tb2 = d@b -sql_error create table $illegal_db1 (ts timestamp, tcol int) +sql_error create table $illegal_db1 (ts timestamp, tcol int) sql_error create table $illegal_db2 (ts timestamp, tcol int) print illegal_table_name test passed @@ -99,19 +99,19 @@ $tint = tinyint $nchar = nchar sql_error create table $tb (ts timestamp, $tb_ int) -sql_error create table $tb (ts timestamp, $tbs int) -sql_error create table $tb (ts timestamp, $db_ int) +sql_error create table $tb (ts timestamp, $tbs int) +sql_error create table $tb (ts timestamp, $db_ int) sql_error create table $tb (ts timestamp, $dbs int) sql_error create table $tb (ts timestamp, $ses int) sql_error create table $tb (ts timestamp, $int int) -sql_error create table $tb (ts timestamp, $bint int) -sql_error create table $tb (ts timestamp, $binary int) -sql create table $tb (ts timestamp, $str int) +sql_error create table $tb (ts timestamp, $bint int) +sql_error create table $tb (ts timestamp, $binary int) +sql create table $tb (ts timestamp, $str int) sql drop table $tb -sql_error create table $tb (ts timestamp, $tag int) +sql_error create table $tb (ts timestamp, $tag int) sql_error create table $tb (ts timestamp, $tags int) -sql_error create table $tb (ts timestamp, $sint int) -sql_error create table $tb (ts timestamp, $tint int) +sql_error create table $tb (ts timestamp, $sint int) +sql_error create table $tb (ts timestamp, $tint int) sql_error create table $tb (ts timestamp, $nchar int) # too long column name @@ -124,23 +124,23 @@ print ========== create_tb.sim case5: chinese_char_in_table_support test $CN_char = 涛思 $tb1 = tb1 -sql_error create table $CN_char (ts timestamp, col1 int) -#sql show tables -#if $rows != 1 then +sql_error create table $CN_char (ts timestamp, col1 int) +#sql show tables +#if $rows != 1 then # return -1 #endi #print expected: $CN_char #print returned: $data00 -#if $data00 != $CN_char then +#if $data00 != $CN_char then # return -1 #endi #sql drop table $CN_char -sql_error create table $tb1 (ts timestamp, $CN_char int) +sql_error create table $tb1 (ts timestamp, $CN_char int) #print expected: $tb1 #print returned: $data10 #sql show tables -#if $rows != 1 then +#if $rows != 1 then # return -1 #endi #if $data00 != $tb1 then @@ -181,8 +181,8 @@ print table_already_exists test passed sql drop database $db sql show databases -if $rows != 2 then +if $rows != 2 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/create_tb_with_tag_name.sim b/tests/script/tsim/parser/create_tb_with_tag_name.sim index c4d9c11648..15c31989fa 100644 --- a/tests/script/tsim/parser/create_tb_with_tag_name.sim +++ b/tests/script/tsim/parser/create_tb_with_tag_name.sim @@ -15,16 +15,16 @@ sql select id,t1,t2,t3 from tb1 if $rows != 1 then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != NULL then +if $data02 != NULL then return -1 endi -if $data03 != NULL then +if $data03 != NULL then return -1 endi @@ -33,16 +33,16 @@ sql show tags from tb2 if $rows != 4 then return -1 endi -if $data05 != NULL then +if $data05 != NULL then return -1 endi -if $data15 != NULL then +if $data15 != NULL then return -1 endi -if $data25 != 12 then +if $data25 != 12 then return -1 endi -if $data35 != 22.000000000 then +if $data35 != 22.000000000 then return -1 endi @@ -51,16 +51,16 @@ sql show tags from tb3; if $rows != 4 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data15 != 2 then +if $data15 != 2 then return -1 endi -if $data25 != 3 then +if $data25 != 3 then return -1 endi -if $data35 != 33.000000000 then +if $data35 != 33.000000000 then return -1 endi @@ -69,16 +69,16 @@ sql show tags from tb4; if $rows != 4 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data15 != 2 then +if $data15 != 2 then return -1 endi -if $data25 != 33 then +if $data25 != 33 then return -1 endi -if $data35 != 44.000000000 then +if $data35 != 44.000000000 then return -1 endi @@ -96,16 +96,16 @@ sql show tags from tb12; if $rows != 4 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data15 != 2 then +if $data15 != 2 then return -1 endi -if $data25 != NULL then +if $data25 != NULL then return -1 endi -if $data35 != NULL then +if $data35 != NULL then return -1 endi @@ -114,16 +114,16 @@ sql show tags from tb13; if $rows != 4 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data15 != 2 then +if $data15 != 2 then return -1 endi -if $data25 != NULL then +if $data25 != NULL then return -1 endi -if $data35 != NULL then +if $data35 != NULL then return -1 endi diff --git a/tests/script/tsim/parser/dbtbnameValidate.sim b/tests/script/tsim/parser/dbtbnameValidate.sim index 939bc0ac4d..331f4c4672 100644 --- a/tests/script/tsim/parser/dbtbnameValidate.sim +++ b/tests/script/tsim/parser/dbtbnameValidate.sim @@ -85,18 +85,18 @@ sql insert into abc.tk_subt001 (ts, b, d) values (now-1m, 'binary_6', sql insert into abc.tk_subt001 (ts, b, d) values (now-1s, 'binary_7', 1.007) sql insert into abc.tk_subt001 (ts, b, d) values (now-1a, 'binary_8', 1.008) sql select * from tk_subt001 -if $rows != 6 then +if $rows != 6 then print ==== expect rows is 6, but actually is $rows return -1 endi sql insert into abc.tk_subt002 using tk_mt tags (22, 'subt002x') values (now+1s, 2001, 'binary_2001', true, 2001.001, 2001.001, 'nchar_2001') -sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002') values (now+1m, 2002, 'binary_2002', false, 2002.001, 2002.001, 'nchar_2002') +sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002') values (now+1m, 2002, 'binary_2002', false, 2002.001, 2002.001, 'nchar_2002') sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002') values (now+1h, 2003, 'binary_2003', false, 2003.001, 2003.001, 'nchar_2003') sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002') values (now+1d, 2004, 'binary_2004', true, 2004.001, 2004.001, 'nchar_2004') sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002') values (now+1w, 2005, 'binary_2005', false, 2005.001, 2005.001, 'nchar_2005') sql select * from tk_subt002 -if $rows != 5 then +if $rows != 5 then print ==== expect rows is 5, but actually is $rows return -1 endi @@ -106,7 +106,7 @@ sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (3, 'subt003') sql insert into abc.tk_subt003 values (now-36d, 3006, 'binary_3006', true, 3006.001, 3006.001, 'nchar_3006') sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (33, 'subt003x') values (now-35d, 3007, false, 3007.001, 'nchar_3007') sql select * from tk_subt003 -if $rows != 4 then +if $rows != 4 then print ==== expect rows is 4, but actually is $rows return -1 endi diff --git a/tests/script/tsim/parser/distinct.sim b/tests/script/tsim/parser/distinct.sim index 6d7dec0659..78eaa68dab 100644 --- a/tests/script/tsim/parser/distinct.sim +++ b/tests/script/tsim/parser/distinct.sim @@ -34,11 +34,11 @@ while $i < $tbNum sql insert into $tb values('2015-08-18 00:18:00', 4); sql insert into $tb values('2015-08-18 00:24:00', 5); sql insert into $tb values('2015-08-18 00:30:00', 6); -endw +endw $i = 0 $tb = $tbPrefix . $i -print ====== table created +print ====== table created #### select distinct tag sql select distinct t1 from $stb @@ -66,17 +66,17 @@ if $rows != 6 then endi ### select multi normal column -### select distinct multi column on sub table +### select distinct multi column on sub table sql select distinct ts, c1 from $tb if $rows != 6 then return -1 endi -### select distinct +### select distinct sql drop database $db sql show databases -if $rows != 2 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/fill.sim b/tests/script/tsim/parser/fill.sim index 396bdd1e56..ce2635ed43 100644 --- a/tests/script/tsim/parser/fill.sim +++ b/tests/script/tsim/parser/fill.sim @@ -27,17 +27,17 @@ $ts = $ts0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - sql insert into $tb values ( $ts , $x , $x , $x , $x , $x , true, 'BINARY', 'NCHAR' ) + sql insert into $tb values ( $ts , $x , $x , $x , $x , $x , true, 'BINARY', 'NCHAR' ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw # setup $i = 0 @@ -72,7 +72,7 @@ endi if $data13 != 6.00000 then return -1 endi - + # unspecified filling method sql_error select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6) @@ -81,31 +81,31 @@ sql_error select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb w print constant_fill test print count_with_constant_fill sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 1 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 1 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 1 then @@ -115,31 +115,31 @@ endi # avg_with_fill print avg_with_constant_fill sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0.000000000 then return -1 endi -if $data11 != 6.000000000 then +if $data11 != 6.000000000 then return -1 endi if $data21 != 1.000000000 then return -1 endi -if $data31 != 6.000000000 then +if $data31 != 6.000000000 then return -1 endi if $data41 != 2.000000000 then return -1 endi -if $data51 != 6.000000000 then +if $data51 != 6.000000000 then return -1 endi if $data61 != 3.000000000 then return -1 endi -if $data71 != 6.000000000 then +if $data71 != 6.000000000 then return -1 endi if $data81 != 4.000000000 then @@ -149,31 +149,31 @@ endi # max_with_fill print max_with_fill sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -183,31 +183,31 @@ endi # min_with_fill print min_with_fill sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -217,31 +217,31 @@ endi # first_with_fill print first_with_fill sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -306,32 +306,32 @@ endi # last_with_fill print last_with_fill sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then print expect 0, actual:$data01 return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -340,13 +340,13 @@ endi # fill_negative_values sql select _wstart, sum(c1), avg(c2), max(c3), min(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -1, -1, -1, -1, -1, -1, -1) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != -1 then +if $data11 != -1 then return -1 endi @@ -401,7 +401,7 @@ sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(v print select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -409,7 +409,7 @@ if $data01 != 1 then endi sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1); -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -417,7 +417,7 @@ if $data01 != 1 then endi sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10'); -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -431,31 +431,31 @@ endi ## previous fill print fill(prev) sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 1 then +if $data11 != 1 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 1 then return -1 endi -if $data51 != 1 then +if $data51 != 1 then return -1 endi if $data61 != 1 then return -1 endi -if $data71 != 1 then +if $data71 != 1 then return -1 endi if $data81 != 1 then @@ -464,31 +464,31 @@ endi # avg_with_fill sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0.000000000 then return -1 endi -if $data11 != 0.000000000 then +if $data11 != 0.000000000 then return -1 endi if $data21 != 1.000000000 then return -1 endi -if $data31 != 1.000000000 then +if $data31 != 1.000000000 then return -1 endi if $data41 != 2.000000000 then return -1 endi -if $data51 != 2.000000000 then +if $data51 != 2.000000000 then return -1 endi if $data61 != 3.000000000 then return -1 endi -if $data71 != 3.000000000 then +if $data71 != 3.000000000 then return -1 endi if $data81 != 4.000000000 then @@ -497,31 +497,31 @@ endi # max_with_fill sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -530,31 +530,31 @@ endi # min_with_fill sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -563,31 +563,31 @@ endi # first_with_fill sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -596,31 +596,31 @@ endi # last_with_fill sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -633,7 +633,7 @@ print fill(value, NULL) sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) print select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -664,13 +664,13 @@ if $data81 != 1 then return -1 endi sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(none) -if $rows != 5 then +if $rows != 5 then return -1 endi # avg_with_fill sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0.000000000 then @@ -703,7 +703,7 @@ endi # max_with_fill sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then @@ -736,7 +736,7 @@ endi # min_with_fill sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then @@ -769,7 +769,7 @@ endi # first_with_fill sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then @@ -802,7 +802,7 @@ endi # last_with_fill sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then diff --git a/tests/script/tsim/parser/fill_stb.sim b/tests/script/tsim/parser/fill_stb.sim index 107bac7089..88032cc2bd 100644 --- a/tests/script/tsim/parser/fill_stb.sim +++ b/tests/script/tsim/parser/fill_stb.sim @@ -35,7 +35,7 @@ while $i < $halfNum $tgstr1 = $tgstr1 . ' sql create table $tb using $stb tags( $i , $tgstr , $tgstr , $i , $i , $i ) sql create table $tb1 using $stb tags( $i1 , $tgstr1 , $tgstr1 , $i , $i , $i ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -47,13 +47,13 @@ while $i < $halfNum $binary = $binary . ' $nchar = 'nchar . $c $nchar = $nchar . ' - sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) - sql insert into $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) + sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) + sql insert into $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw print ====== tables created # setup @@ -167,7 +167,7 @@ endi if $data13 != 6.00000 then return -1 endi - + # unspecified filling method sql_error select max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6) @@ -245,35 +245,35 @@ sql_error select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '2e1'); $val = $rowNum * 2 $val = $val - 1 -if $rows != $val then +if $rows != $val then return -1 endi if $data01 != $rowNum then return -1 endi -if $data11 != 20 then +if $data11 != 20 then return -1 endi sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 2e1); -if $rows != $val then +if $rows != $val then return -1 endi if $data01 != $rowNum then return -1 endi -if $data11 != 20 then +if $data11 != 20 then return -1 endi sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '20'); -if $rows != $val then +if $rows != $val then return -1 endi if $data01 != $rowNum then return -1 endi -if $data11 != 20 then +if $data11 != 20 then return -1 endi @@ -358,7 +358,7 @@ endi ## previous fill print fill(prev) sql select max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 interval(5m) fill(prev) group by t1 limit 5 -if $rows != 25 then +if $rows != 25 then return -1 endi if $data01 != 0 then @@ -370,19 +370,19 @@ endi if $data04 != NULL then return -1 endi -if $data09 != 5 then +if $data09 != 5 then return -1 endi if $data12 != NULL then return -1 endi -if $data19 != 5 then +if $data19 != 5 then return -1 endi if $data18 != nchar0 then return -1 endi -if $data59 != 6 then +if $data59 != 6 then return -1 endi if $data69 != 6 then @@ -392,7 +392,7 @@ endi ## NULL fill print fill(NULL) sql select max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 interval(5m) fill(value, NULL) group by t1 limit 5 -if $rows != 25 then +if $rows != 25 then return -1 endi if $data01 != 0 then @@ -407,7 +407,7 @@ endi if $data06 != 1 then return -1 endi -if $data09 != 5 then +if $data09 != 5 then return -1 endi if $data11 != NULL then @@ -416,13 +416,13 @@ endi if $data12 != NULL then return -1 endi -if $data19 != 5 then +if $data19 != 5 then return -1 endi if $data18 != NULL then return -1 endi -if $data59 != 6 then +if $data59 != 6 then return -1 endi if $data69 != 6 then @@ -432,8 +432,8 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/fill_us.sim b/tests/script/tsim/parser/fill_us.sim index 82d282642e..94f6918c65 100644 --- a/tests/script/tsim/parser/fill_us.sim +++ b/tests/script/tsim/parser/fill_us.sim @@ -27,17 +27,17 @@ $ts = $ts0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - sql insert into $tb values ( $ts , $x , $x , $x , $x , $x , true, 'BINARY', 'NCHAR' ) + sql insert into $tb values ( $ts , $x , $x , $x , $x , $x , true, 'BINARY', 'NCHAR' ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw # setup $i = 0 @@ -74,7 +74,7 @@ endi if $data13 != 6.00000 then return -1 endi - + # unspecified filling method sql_error select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6) @@ -84,31 +84,31 @@ print constant_fill test print count_with_constant_fill print sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 1 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 1 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 1 then @@ -118,31 +118,31 @@ endi # avg_with_fill print avg_witt_constant_fill sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0.000000000 then return -1 endi -if $data11 != 6.000000000 then +if $data11 != 6.000000000 then return -1 endi if $data21 != 1.000000000 then return -1 endi -if $data31 != 6.000000000 then +if $data31 != 6.000000000 then return -1 endi if $data41 != 2.000000000 then return -1 endi -if $data51 != 6.000000000 then +if $data51 != 6.000000000 then return -1 endi if $data61 != 3.000000000 then return -1 endi -if $data71 != 6.000000000 then +if $data71 != 6.000000000 then return -1 endi if $data81 != 4.000000000 then @@ -152,31 +152,31 @@ endi # max_with_fill print max_with_fill sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -186,31 +186,31 @@ endi # min_with_fill print min_with_fill sql select min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -220,31 +220,31 @@ endi # first_with_fill print first_with_fill sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -309,31 +309,31 @@ endi # last_with_fill print last_with_fill sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 6 then +if $data11 != 6 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 6 then +if $data31 != 6 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 6 then +if $data51 != 6 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 6 then +if $data71 != 6 then return -1 endi if $data81 != 4 then @@ -342,13 +342,13 @@ endi # fill_negative_values sql select _wstart, sum(c1), avg(c2), max(c3), min(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -1, -1, -1, -1, -1, -1, -1) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != -1 then +if $data11 != -1 then return -1 endi @@ -401,7 +401,7 @@ sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(valu sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true'); sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -409,7 +409,7 @@ if $data01 != 1 then endi sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1); -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -417,7 +417,7 @@ if $data01 != 1 then endi sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10'); -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -432,31 +432,31 @@ endi ## previous fill print fill(prev) sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 1 then +if $data11 != 1 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 1 then return -1 endi -if $data51 != 1 then +if $data51 != 1 then return -1 endi if $data61 != 1 then return -1 endi -if $data71 != 1 then +if $data71 != 1 then return -1 endi if $data81 != 1 then @@ -465,31 +465,31 @@ endi # avg_with_fill sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0.000000000 then return -1 endi -if $data11 != 0.000000000 then +if $data11 != 0.000000000 then return -1 endi if $data21 != 1.000000000 then return -1 endi -if $data31 != 1.000000000 then +if $data31 != 1.000000000 then return -1 endi if $data41 != 2.000000000 then return -1 endi -if $data51 != 2.000000000 then +if $data51 != 2.000000000 then return -1 endi if $data61 != 3.000000000 then return -1 endi -if $data71 != 3.000000000 then +if $data71 != 3.000000000 then return -1 endi if $data81 != 4.000000000 then @@ -498,31 +498,31 @@ endi # max_with_fill sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -531,31 +531,31 @@ endi # min_with_fill sql select min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -564,31 +564,31 @@ endi # first_with_fill sql select first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -597,31 +597,31 @@ endi # last_with_fill sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then return -1 endi -if $data11 != 0 then +if $data11 != 0 then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != 1 then +if $data31 != 1 then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != 2 then +if $data51 != 2 then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != 3 then +if $data71 != 3 then return -1 endi if $data81 != 4 then @@ -634,7 +634,7 @@ print fill(value, NULL) sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) print select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 1 then @@ -665,13 +665,13 @@ if $data81 != 1 then return -1 endi sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(none) -if $rows != 5 then +if $rows != 5 then return -1 endi # avg_with_fill sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0.000000000 then @@ -704,7 +704,7 @@ endi # max_with_fill sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then @@ -737,7 +737,7 @@ endi # min_with_fill sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then @@ -770,7 +770,7 @@ endi # first_with_fill sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then @@ -803,7 +803,7 @@ endi # last_with_fill sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) -if $rows != 9 then +if $rows != 9 then return -1 endi if $data01 != 0 then @@ -845,7 +845,7 @@ endi #print =============== clear #sql drop database $db #sql show databases -#if $rows != 0 then +#if $rows != 0 then # return -1 #endi @@ -880,7 +880,7 @@ sql insert into us_t1 values ('2018-09-17 09:00:00.000029', 29 , 29) print sql select avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(value, 999, 999) sql select avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(value, 999, 999) -if $rows != 8 then +if $rows != 8 then return -1 endi if $data01 != 2.000000000 then @@ -909,7 +909,7 @@ if $data71 != 21.000000000 then endi sql select avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(none) -if $rows != 6 then +if $rows != 6 then return -1 endi if $data01 != 2.000000000 then @@ -932,7 +932,7 @@ if $data51 != 21.000000000 then endi sql select avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(null) -if $rows != 8 then +if $rows != 8 then return -1 endi if $data01 != 2.000000000 then @@ -965,7 +965,7 @@ endi sql select avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(prev) -if $rows != 8 then +if $rows != 8 then return -1 endi if $data01 != 2.000000000 then @@ -994,7 +994,7 @@ if $data71 != 21.000000000 then endi sql select _wstart, avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(linear) -if $rows != 8 then +if $rows != 8 then return -1 endi if $data01 != 2.000000000 then @@ -1022,4 +1022,4 @@ if $data71 != 21.000000000 then return -1 endi -print ======== fill_us.sim run end...... ================ \ No newline at end of file +print ======== fill_us.sim run end...... ================ diff --git a/tests/script/tsim/parser/first_last.sim b/tests/script/tsim/parser/first_last.sim index 4f1dcb12fe..7826ced37e 100644 --- a/tests/script/tsim/parser/first_last.sim +++ b/tests/script/tsim/parser/first_last.sim @@ -19,7 +19,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db maxrows 400 +sql create database $db maxrows 400 sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) @@ -29,18 +29,18 @@ $ts = $ts0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $stb tags( $i ) - + $x = 0 while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - $c6 = $x / 128 + $c6 = $x / 128 $c6 = $c6 * 128 $c6 = $x - $c6 - sql insert into $tb values ( $ts , $x , $x , $x , $x , $x , $c6 , true, 'BINARY', 'NCHAR' ) + sql insert into $tb values ( $ts , $x , $x , $x , $x , $x , $c6 , true, 'BINARY', 'NCHAR' ) $x = $x + 1 - endw - + endw + $i = $i + 1 endw diff --git a/tests/script/tsim/parser/first_last_query.sim b/tests/script/tsim/parser/first_last_query.sim index 92c9fd14d6..533f59f4b2 100644 --- a/tests/script/tsim/parser/first_last_query.sim +++ b/tests/script/tsim/parser/first_last_query.sim @@ -29,22 +29,22 @@ if $data00 != @18-09-17 08:59:00.000@ then return -1 endi if $data01 != 0 then - return -1 -endi + return -1 +endi if $data02 != 0 then - return -1 -endi + return -1 +endi print data03 = $data03 if $data03 != 0.00000 then print expect 0.00000, actual: $data03 - return -1 -endi + return -1 +endi if $data04 != 0.000000000 then return -1 endi if $data05 != 0 then return -1 -endi +endi if $data06 != 0 then return -1 endi @@ -66,20 +66,20 @@ if $rows != 1 then return -1 endi if $data00 != @18-09-18 01:40:00.000@ then - return -1 -endi + return -1 +endi if $data01 != 999 then - return -1 + return -1 endi if $data02 != 999 then - return -1 + return -1 endi if $data03 != 999.00000 then - return -1 -endi + return -1 +endi if $data04 != 999.000000000 then return -1 @@ -88,7 +88,7 @@ endi #if $data05 != NULL then if $data05 != 999 then return -1 -endi +endi #if $data06 != NULL then if $data06 != 103 then return -1 @@ -108,8 +108,8 @@ endi ### test if first works for committed data. An 'order by ts desc' clause should be present, and queried data should come from at least 2 file blocks $tb = $tbPrefix . 9 -sql select first(ts), first(c1) from $tb where ts < '2018-10-17 10:00:00.000' -if $rows != 1 then +sql select first(ts), first(c1) from $tb where ts < '2018-10-17 10:00:00.000' +if $rows != 1 then return -1 endi if $data00 != @18-09-17 09:00:00.000@ then @@ -121,7 +121,7 @@ endi $tb = $tbPrefix . 9 sql select first(ts), first(c1) from $tb where ts < '2018-10-17 10:00:00.000' -if $rows != 1 then +if $rows != 1 then return -1 endi if $data00 != @18-09-17 09:00:00.000@ then diff --git a/tests/script/tsim/parser/fourArithmetic-basic.sim b/tests/script/tsim/parser/fourArithmetic-basic.sim index bfda75e54d..29d05b93cc 100644 --- a/tests/script/tsim/parser/fourArithmetic-basic.sim +++ b/tests/script/tsim/parser/fourArithmetic-basic.sim @@ -18,7 +18,7 @@ print =============== create super table sql create table if not exists stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double) tags (t1 int) sql show stables -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -28,7 +28,7 @@ sql create table ct0 using stb tags(1000) #sql create table ct3 using stb tags(3000) sql show tables -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -63,7 +63,7 @@ $loop_test = 0 loop_test_pos: sql select ts, c2-c1, c3/c1, c4+c1, c1*9, c1%3 from ct0 -print ===> rows: $rows +print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data20 $data21 $data22 $data23 $data24 $data25 @@ -96,15 +96,15 @@ if $loop_test == 0 then print =============== stop and restart taosd system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start - + $loop_cnt = 0 check_dnode_ready_0: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi sql show dnodes print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 if $data00 != 1 then @@ -114,7 +114,7 @@ if $loop_test == 0 then goto check_dnode_ready_0 endi - $loop_test = 1 + $loop_test = 1 goto loop_test_pos endi diff --git a/tests/script/tsim/parser/function.sim b/tests/script/tsim/parser/function.sim index 9423f53e3a..0219a84c64 100644 --- a/tests/script/tsim/parser/function.sim +++ b/tests/script/tsim/parser/function.sim @@ -91,7 +91,7 @@ if $data13 != 1 then return -1 endi -sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:07:00' interval(1m) +sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:07:00' interval(1m) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data10 $data11 $data12 $data13 $data14 $data15 $data16 print $data20 $data21 $data22 $data23 $data24 $data25 $data26 @@ -114,7 +114,7 @@ if $data01 != 2.068333156 then return -1 endi -sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:27:00' interval(10m) +sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:27:00' interval(10m) if $rows != 3 then return -1 endi @@ -190,8 +190,8 @@ if $rows != 0 then return -1 endi -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) +sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) +sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) #todo add test case while column filter exists for twa query @@ -536,7 +536,7 @@ if $data14 != 2 then return -1 endi -sql select _wstart, stddev(k), stddev(b), stddev(c), tbname,a from m1 partition by tbname, a interval(10s) order by tbname +sql select _wstart, stddev(k), stddev(b), stddev(c), tbname,a from m1 partition by tbname, a interval(10s) order by tbname if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/parser/groupby-basic.sim b/tests/script/tsim/parser/groupby-basic.sim index 7fe91f5100..4c70399e4b 100644 --- a/tests/script/tsim/parser/groupby-basic.sim +++ b/tests/script/tsim/parser/groupby-basic.sim @@ -77,7 +77,7 @@ $ts1 = $tb1 . .ts $ts2 = $tb2 . .ts print ===============================groupby_operation -print +print print ==== select count(*), c1 from group_tb0 group by c1 sql select count(*), c1 from group_tb0 group by c1 print rows: $rows @@ -142,7 +142,7 @@ print $data20 $data21 $data22 $data23 print $data80 $data81 $data82 $data83 print $data90 $data91 $data92 $data93 -return +return sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1; if $row != 20 then @@ -581,10 +581,10 @@ endi sql create table st (ts timestamp, c int) tags (t1 int, t2 int, t3 int, t4 int); sql create table t1 using st tags(1, 1, 1, 1); sql create table t2 using st tags(1, 2, 2, 2); -sql insert into t1 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; -sql insert into t1 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; -sql insert into t2 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; -sql insert into t2 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; +sql insert into t1 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; +sql insert into t1 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; +sql insert into t2 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; +sql insert into t2 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; print =================>TD-2665 sql_error create table txx as select avg(c) as t from st; diff --git a/tests/script/tsim/parser/groupby.sim b/tests/script/tsim/parser/groupby.sim index c4c19ca211..12a698b1cc 100644 --- a/tests/script/tsim/parser/groupby.sim +++ b/tests/script/tsim/parser/groupby.sim @@ -565,10 +565,10 @@ endi sql create table st (ts timestamp, c int) tags (t1 int, t2 int, t3 int, t4 int); sql create table t1 using st tags(1, 1, 1, 1); sql create table t2 using st tags(1, 2, 2, 2); -sql insert into t1 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; -sql insert into t1 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; -sql insert into t2 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; -sql insert into t2 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; +sql insert into t1 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; +sql insert into t1 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; +sql insert into t2 values ('2020-03-27 04:11:16.000', 1)('2020-03-27 04:11:17.000', 2) ('2020-03-27 04:11:18.000', 3) ('2020-03-27 04:11:19.000', 4) ; +sql insert into t2 values ('2020-03-27 04:21:16.000', 1)('2020-03-27 04:31:17.000', 2) ('2020-03-27 04:51:18.000', 3) ('2020-03-27 05:10:19.000', 4) ; print =================>TD-2665 sql_error create table txx as select avg(c) as t from st; diff --git a/tests/script/tsim/parser/having.sim b/tests/script/tsim/parser/having.sim index 8debf8b1d1..b000ac5008 100644 --- a/tests/script/tsim/parser/having.sim +++ b/tests/script/tsim/parser/having.sim @@ -16,7 +16,7 @@ sql create table tb1 using st2 tags (1,1.0,"1",1.0,1,1,"1"); sql create table tb2 using st2 tags (2,2.0,"2",2.0,2,2,"2"); sql create table tb3 using st2 tags (3,3.0,"3",3.0,3,3,"3"); sql create table tb4 using st2 tags (4,4.0,"4",4.0,4,4,"4"); - + sql insert into tb1 values (now-200s,1,1.0,1.0,1,1,1,true ,"1","1") sql insert into tb1 values (now-150s,1,1.0,1.0,1,1,1,false,"1","1") sql insert into tb1 values (now-100s,2,2.0,2.0,2,2,2,true ,"2","2") @@ -30,28 +30,28 @@ sql select count(*),f1 from st2 group by f1 having count(f1) > 0 order by f1; if $rows != 4 then return -1 endi -if $data00 != 2 then +if $data00 != 2 then return -1 endi -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data20 != 2 then +if $data20 != 2 then return -1 endi -if $data21 != 3 then +if $data21 != 3 then return -1 endi -if $data30 != 2 then +if $data30 != 2 then return -1 endi -if $data31 != 4 then +if $data31 != 4 then return -1 endi @@ -59,28 +59,28 @@ sql select count(*),f1 from st2 group by f1 having count(*) > 0 order by f1; if $rows != 4 then return -1 endi -if $data00 != 2 then +if $data00 != 2 then return -1 endi -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data20 != 2 then +if $data20 != 2 then return -1 endi -if $data21 != 3 then +if $data21 != 3 then return -1 endi -if $data30 != 2 then +if $data30 != 2 then return -1 endi -if $data31 != 4 then +if $data31 != 4 then return -1 endi @@ -88,28 +88,28 @@ sql select count(*),f1 from st2 group by f1 having count(f2) > 0 order by f1; if $rows != 4 then return -1 endi -if $data00 != 2 then +if $data00 != 2 then return -1 endi -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data20 != 2 then +if $data20 != 2 then return -1 endi -if $data21 != 3 then +if $data21 != 3 then return -1 endi -if $data30 != 2 then +if $data30 != 2 then return -1 endi -if $data31 != 4 then +if $data31 != 4 then return -1 endi @@ -119,16 +119,16 @@ sql select last(f1) from st2 group by f1 having count(f2) > 0 order by f1;; if $rows != 4 then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data20 != 3 then +if $data20 != 3 then return -1 endi -if $data30 != 4 then +if $data30 != 4 then return -1 endi @@ -140,16 +140,16 @@ sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2 order by f1 if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi @@ -157,16 +157,16 @@ sql select avg(f1),count(f1) from st2 group by f1 having avg(f1) > 2 and sum(f1) if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi @@ -174,22 +174,22 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2 and if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 6 then +if $data02 != 6 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 8 then +if $data12 != 8 then return -1 endi @@ -197,22 +197,22 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having avg(f1) > 2 ord if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 6 then +if $data02 != 6 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 8 then +if $data12 != 8 then return -1 endi @@ -220,40 +220,40 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0 ord if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi @@ -261,13 +261,13 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 2 and if $rows != 1 then return -1 endi -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 4 then +if $data02 != 4 then return -1 endi @@ -276,22 +276,22 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having 1 <= sum(f1) an if $rows != 2 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi @@ -299,16 +299,16 @@ sql select avg(f1),count(f1),sum(f1),twa(f1),tbname from st2 group by tbname hav if $rows != 1 then return -1 endi -if $data00 != 2.500000000 then +if $data00 != 2.500000000 then return -1 endi -if $data01 != 8 then +if $data01 != 8 then return -1 endi -if $data02 != 20 then +if $data02 != 20 then return -1 endi -if $data04 != tb1 then +if $data04 != tb1 then return -1 endi @@ -318,16 +318,16 @@ sql select avg(f1),count(f1),sum(f1),twa(f1),tbname from st2 group by tbname hav if $rows != 1 then return -1 endi -if $data00 != 2.500000000 then +if $data00 != 2.500000000 then return -1 endi -if $data01 != 8 then +if $data01 != 8 then return -1 endi -if $data02 != 20 then +if $data02 != 20 then return -1 endi -if $data04 != tb1 then +if $data04 != tb1 then return -1 endi @@ -337,40 +337,40 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 0 ord if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi @@ -378,31 +378,31 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 ord if $rows != 3 then return -1 endi -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 4 then +if $data02 != 4 then return -1 endi -if $data10 != 3.000000000 then +if $data10 != 3.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 6 then +if $data12 != 6 then return -1 endi -if $data20 != 4.000000000 then +if $data20 != 4.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 8 then +if $data22 != 8 then return -1 endi @@ -411,119 +411,119 @@ sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 1 ord if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 1 order by f1; -if $rows != 4 then +if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 or sum(f1) > 4 order by f1; -if $rows != 3 then +if $rows != 3 then return -1 endi -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 4 then +if $data02 != 4 then return -1 endi -if $data10 != 3.000000000 then +if $data10 != 3.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 6 then +if $data12 != 6 then return -1 endi -if $data20 != 4.000000000 then +if $data20 != 4.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 8 then +if $data22 != 8 then return -1 endi ############or issue sql select avg(f1),count(f1),sum(f1) from st2 group by f1 having sum(f1) > 3 and avg(f1) > 4 order by f1; -if $rows != 0 then +if $rows != 0 then return -1 endi @@ -635,7 +635,7 @@ endi if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi if $data03 != 0.000000000 then @@ -735,18 +735,18 @@ endi if $data23 != 0.000000000 then return -1 endi -if $data30 != 4.000000000 then - return -1 -endi -if $data31 != 2 then - return -1 -endi -if $data32 != 8 then - return -1 -endi -if $data33 != 0.000000000 then - return -1 -endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi sql_error select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having (LEASTSQUARES(f1) < 1); @@ -777,27 +777,27 @@ if $data03 != 0.000000000 then endi if $data10 != 3.000000000 then return -1 -endi -if $data11 != 2 then - return -1 -endi -if $data12 != 6 then - return -1 endi -if $data13 != 0.000000000 then - return -1 -endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi if $data20 != 4.000000000 then return -1 -endi -if $data21 != 2 then - return -1 -endi -if $data22 != 8 then - return -1 endi -if $data23 != 0.000000000 then - return -1 +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 endi sql select avg(f1),count(st2.*),sum(f1),stddev(f1) from st2 group by f1 having min(f1) > 2 order by f1; @@ -818,16 +818,16 @@ if $data03 != 0.000000000 then endi if $data10 != 4.000000000 then return -1 -endi -if $data11 != 2 then - return -1 -endi -if $data12 != 8 then - return -1 -endi -if $data13 != 0.000000000 then - return -1 -endi +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1) from st2 group by f1 having min(f1) > 2 order by f1; if $rows != 2 then @@ -900,27 +900,27 @@ if $data14 != 4 then endi sql select avg(f1),count(st2.*),sum(f1),stddev(f1),min(f1),max(f1) from st2 group by f1 having max(f1) != 2 order by f1; -if $rows != 3 then - return -1 -endi -if $data00 != 1.000000000 then - return -1 -endi -if $data01 != 2 then - return -1 -endi -if $data02 != 2 then - return -1 -endi -if $data03 != 0.000000000 then - return -1 -endi -if $data04 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi if $data10 != 3.000000000 then return -1 endi @@ -928,7 +928,7 @@ if $data11 != 2 then return -1 endi if $data12 != 6 then - return -1 + return -1 endi if $data13 != 0.000000000 then return -1 @@ -946,7 +946,7 @@ if $data21 != 2 then return -1 endi if $data22 != 8 then - return -1 + return -1 endi if $data23 != 0.000000000 then return -1 @@ -990,7 +990,7 @@ if $data12 != 6 then return -1 endi if $data13 != 0.000000000 then - return -1 + return -1 endi if $data14 != 3 then return -1 @@ -1013,9 +1013,9 @@ endi if $data24 != 4 then return -1 endi -if $data25 != 4 then - return -1 -endi +if $data25 != 4 then + return -1 +endi @@ -1080,12 +1080,12 @@ endi if $data24 != 4 then return -1 endi -if $data25 != 4 then - return -1 -endi -if $data26 != 4 then - return -1 -endi +if $data25 != 4 then + return -1 +endi +if $data26 != 4 then + return -1 +endi @@ -1121,18 +1121,18 @@ if $data30 != 4.000000000 then endi sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 order by f1; -if $rows != 3 then +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 3.000000000 then return -1 endi -if $data00 != 2.000000000 then - return -1 -endi -if $data10 != 3.000000000 then - return -1 -endi if $data20 != 4.000000000 then - return -1 -endi + return -1 +endi sql select aPERCENTILE(f1,20) from st2 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50 order by f1; if $rows != 3 then @@ -1195,7 +1195,7 @@ if $data10 != 2.000000000 then endi if $data20 != 3.000000000 then return -1 -endi +endi if $data30 != 4.000000000 then return -1 endi @@ -1204,7 +1204,7 @@ sql select avg(f1),spread(f2) from st2 group by f1 order by f1; if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi if $data01 != 0.000000000 then @@ -1213,7 +1213,7 @@ endi if $data10 != 2.000000000 then return -1 endi -if $data11 != 0.000000000 then +if $data11 != 0.000000000 then return -1 endi if $data20 != 3.000000000 then @@ -1222,7 +1222,7 @@ endi if $data21 != 0.000000000 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi if $data31 != 0.000000000 then @@ -1239,13 +1239,13 @@ endi if $data01 != 0.000000000 then return -1 endi -if $data02 != 0.000000000 then - return -1 -endi -if $data03 != 0.000000000 then - return -1 -endi -if $data10 != 2.000000000 then +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then return -1 endi if $data11 != 0.000000000 then @@ -1257,7 +1257,7 @@ endi if $data13 != 0.000000000 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi if $data21 != 0.000000000 then @@ -1283,9 +1283,9 @@ if $data33 != 0.000000000 then endi sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) != 0 order by f1; -if $rows != 0 then - return -1 -endi +if $rows != 0 then + return -1 +endi sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 group by f1 having spread(f1) + 1 > 0; @@ -1438,7 +1438,7 @@ if $data01 != 0.000000000 then endi if $data02 != 0.000000000 then return -1 -endi +endi if $data03 != 0.000000000 then return -1 endi @@ -1529,7 +1529,7 @@ if $data13 != 0.000000000 then endi sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f2 > 2 group by f1 having avg(f1) > 0 order by f1; -if $rows != 2 then +if $rows != 2 then return -1 endi if $data00 != 3.000000000 then @@ -1558,7 +1558,7 @@ if $data13 != 0.000000000 then endi sql select avg(f1), spread(f1), spread(f2), spread(st2.f1) from st2 where f3 > 2 group by f1 having avg(f1) > 0 order by f1; -if $rows != 2 then +if $rows != 2 then return -1 endi if $data00 != 3.000000000 then @@ -1624,7 +1624,7 @@ endi if $data02 != 0.000000000 then return -1 endi -if $data03 != 0.000000000 then +if $data03 != 0.000000000 then return -1 endi @@ -1643,7 +1643,7 @@ endi if $data02 != 0.000000000 then return -1 endi -if $data03 != 0.000000000 then +if $data03 != 0.000000000 then return -1 endi @@ -1660,7 +1660,7 @@ endi if $data02 != 0.000000000 then return -1 endi -if $data03 != 0.000000000 then +if $data03 != 0.000000000 then return -1 endi diff --git a/tests/script/tsim/parser/having_child.sim b/tests/script/tsim/parser/having_child.sim index 747a3e2e9b..ae78c806ca 100644 --- a/tests/script/tsim/parser/having_child.sim +++ b/tests/script/tsim/parser/having_child.sim @@ -16,7 +16,7 @@ sql create table tb1 using st2 tags (1,1.0,"1",1.0,1,1,"1"); sql create table tb2 using st2 tags (2,2.0,"2",2.0,2,2,"2"); sql create table tb3 using st2 tags (3,3.0,"3",3.0,3,3,"3"); sql create table tb4 using st2 tags (4,4.0,"4",4.0,4,4,"4"); - + sql insert into tb1 values (now-200s,1,1.0,1.0,1,1,1,true ,"1","1") sql insert into tb1 values (now-150s,1,1.0,1.0,1,1,1,false,"1","1") sql insert into tb1 values (now-100s,2,2.0,2.0,2,2,2,true ,"2","2") @@ -30,28 +30,28 @@ sql select count(*),f1 from tb1 group by f1 having count(f1) > 0 order by f1; if $rows != 4 then return -1 endi -if $data00 != 2 then +if $data00 != 2 then return -1 endi -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data20 != 2 then +if $data20 != 2 then return -1 endi -if $data21 != 3 then +if $data21 != 3 then return -1 endi -if $data30 != 2 then +if $data30 != 2 then return -1 endi -if $data31 != 4 then +if $data31 != 4 then return -1 endi @@ -59,28 +59,28 @@ sql select count(*),f1 from tb1 group by f1 having count(*) > 0 order by f1; if $rows != 4 then return -1 endi -if $data00 != 2 then +if $data00 != 2 then return -1 endi -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data20 != 2 then +if $data20 != 2 then return -1 endi -if $data21 != 3 then +if $data21 != 3 then return -1 endi -if $data30 != 2 then +if $data30 != 2 then return -1 endi -if $data31 != 4 then +if $data31 != 4 then return -1 endi @@ -88,28 +88,28 @@ sql select count(*),f1 from tb1 group by f1 having count(f2) > 0 order by f1; if $rows != 4 then return -1 endi -if $data00 != 2 then +if $data00 != 2 then return -1 endi -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data20 != 2 then +if $data20 != 2 then return -1 endi -if $data21 != 3 then +if $data21 != 3 then return -1 endi -if $data30 != 2 then +if $data30 != 2 then return -1 endi -if $data31 != 4 then +if $data31 != 4 then return -1 endi @@ -119,16 +119,16 @@ sql select last(f1) from tb1 group by f1 having count(f2) > 0 order by f1;; if $rows != 4 then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data10 != 2 then +if $data10 != 2 then return -1 endi -if $data20 != 3 then +if $data20 != 3 then return -1 endi -if $data30 != 4 then +if $data30 != 4 then return -1 endi @@ -142,16 +142,16 @@ sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2 order by f1 if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi @@ -159,16 +159,16 @@ sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2 and sum(f1) if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi @@ -176,22 +176,22 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2 and if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 6 then +if $data02 != 6 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 8 then +if $data12 != 8 then return -1 endi @@ -199,22 +199,22 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2 ord if $rows != 2 then return -1 endi -if $data00 != 3.000000000 then +if $data00 != 3.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 6 then +if $data02 != 6 then return -1 endi -if $data10 != 4.000000000 then +if $data10 != 4.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 8 then +if $data12 != 8 then return -1 endi @@ -222,40 +222,40 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0 ord if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi @@ -263,13 +263,13 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 2 and if $rows != 1 then return -1 endi -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 4 then +if $data02 != 4 then return -1 endi @@ -278,22 +278,22 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having 1 <= sum(f1) an if $rows != 2 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi @@ -309,40 +309,40 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0 ord if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi @@ -350,31 +350,31 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 ord if $rows != 3 then return -1 endi -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 4 then +if $data02 != 4 then return -1 endi -if $data10 != 3.000000000 then +if $data10 != 3.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 6 then +if $data12 != 6 then return -1 endi -if $data20 != 4.000000000 then +if $data20 != 4.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 8 then +if $data22 != 8 then return -1 endi @@ -383,119 +383,119 @@ sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 1 ord if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 1 order by f1; -if $rows != 4 then +if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi -if $data10 != 2.000000000 then +if $data10 != 2.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 4 then +if $data12 != 4 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 6 then +if $data22 != 6 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi -if $data31 != 2 then +if $data31 != 2 then return -1 endi -if $data32 != 8 then +if $data32 != 8 then return -1 endi sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 4 order by f1; -if $rows != 3 then +if $rows != 3 then return -1 endi -if $data00 != 2.000000000 then +if $data00 != 2.000000000 then return -1 endi -if $data01 != 2 then +if $data01 != 2 then return -1 endi -if $data02 != 4 then +if $data02 != 4 then return -1 endi -if $data10 != 3.000000000 then +if $data10 != 3.000000000 then return -1 endi -if $data11 != 2 then +if $data11 != 2 then return -1 endi -if $data12 != 6 then +if $data12 != 6 then return -1 endi -if $data20 != 4.000000000 then +if $data20 != 4.000000000 then return -1 endi -if $data21 != 2 then +if $data21 != 2 then return -1 endi -if $data22 != 8 then +if $data22 != 8 then return -1 endi ############or issue sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 and avg(f1) > 4 order by f1; -if $rows != 0 then +if $rows != 0 then return -1 endi @@ -607,7 +607,7 @@ endi if $data01 != 2 then return -1 endi -if $data02 != 2 then +if $data02 != 2 then return -1 endi if $data03 != 0.000000000 then @@ -707,18 +707,18 @@ endi if $data23 != 0.000000000 then return -1 endi -if $data30 != 4.000000000 then - return -1 -endi -if $data31 != 2 then - return -1 -endi -if $data32 != 8 then - return -1 -endi -if $data33 != 0.000000000 then - return -1 -endi +if $data30 != 4.000000000 then + return -1 +endi +if $data31 != 2 then + return -1 +endi +if $data32 != 8 then + return -1 +endi +if $data33 != 0.000000000 then + return -1 +endi sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (LEASTSQUARES(f1) < 1); @@ -749,27 +749,27 @@ if $data03 != 0.000000000 then endi if $data10 != 3.000000000 then return -1 -endi -if $data11 != 2 then - return -1 -endi -if $data12 != 6 then - return -1 endi -if $data13 != 0.000000000 then - return -1 -endi +if $data11 != 2 then + return -1 +endi +if $data12 != 6 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi if $data20 != 4.000000000 then return -1 -endi -if $data21 != 2 then - return -1 -endi -if $data22 != 8 then - return -1 endi -if $data23 != 0.000000000 then - return -1 +if $data21 != 2 then + return -1 +endi +if $data22 != 8 then + return -1 +endi +if $data23 != 0.000000000 then + return -1 endi sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having min(f1) > 2 order by f1; @@ -790,16 +790,16 @@ if $data03 != 0.000000000 then endi if $data10 != 4.000000000 then return -1 -endi -if $data11 != 2 then - return -1 -endi -if $data12 != 8 then - return -1 -endi -if $data13 != 0.000000000 then - return -1 -endi +endi +if $data11 != 2 then + return -1 +endi +if $data12 != 8 then + return -1 +endi +if $data13 != 0.000000000 then + return -1 +endi sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1) from tb1 group by f1 having min(f1) > 2 order by f1; if $rows != 2 then @@ -872,27 +872,27 @@ if $data14 != 4 then endi sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1) from tb1 group by f1 having max(f1) != 2 order by f1; -if $rows != 3 then - return -1 -endi -if $data00 != 1.000000000 then - return -1 -endi -if $data01 != 2 then - return -1 -endi -if $data02 != 2 then - return -1 -endi -if $data03 != 0.000000000 then - return -1 -endi -if $data04 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi +if $rows != 3 then + return -1 +endi +if $data00 != 1.000000000 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 1 then + return -1 +endi if $data10 != 3.000000000 then return -1 endi @@ -900,7 +900,7 @@ if $data11 != 2 then return -1 endi if $data12 != 6 then - return -1 + return -1 endi if $data13 != 0.000000000 then return -1 @@ -918,7 +918,7 @@ if $data21 != 2 then return -1 endi if $data22 != 8 then - return -1 + return -1 endi if $data23 != 0.000000000 then return -1 @@ -962,7 +962,7 @@ if $data12 != 6 then return -1 endi if $data13 != 0.000000000 then - return -1 + return -1 endi if $data14 != 3 then return -1 @@ -985,9 +985,9 @@ endi if $data24 != 4 then return -1 endi -if $data25 != 4 then - return -1 -endi +if $data25 != 4 then + return -1 +endi @@ -1052,12 +1052,12 @@ endi if $data24 != 4 then return -1 endi -if $data25 != 4 then - return -1 -endi -if $data26 != 4 then - return -1 -endi +if $data25 != 4 then + return -1 +endi +if $data26 != 4 then + return -1 +endi @@ -1099,18 +1099,18 @@ if $data30 != 4.000000000 then endi sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 order by f1; -if $rows != 3 then +if $rows != 3 then + return -1 +endi +if $data00 != 2.000000000 then + return -1 +endi +if $data10 != 3.000000000 then return -1 endi -if $data00 != 2.000000000 then - return -1 -endi -if $data10 != 3.000000000 then - return -1 -endi if $data20 != 4.000000000 then - return -1 -endi + return -1 +endi sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50 order by f1; if $rows != 3 then @@ -1173,7 +1173,7 @@ if $data10 != 2.000000000 then endi if $data20 != 3.000000000 then return -1 -endi +endi if $data30 != 4.000000000 then return -1 endi @@ -1182,7 +1182,7 @@ sql select avg(f1),spread(f2) from tb1 group by f1 order by f1; if $rows != 4 then return -1 endi -if $data00 != 1.000000000 then +if $data00 != 1.000000000 then return -1 endi if $data01 != 0.000000000 then @@ -1191,7 +1191,7 @@ endi if $data10 != 2.000000000 then return -1 endi -if $data11 != 0.000000000 then +if $data11 != 0.000000000 then return -1 endi if $data20 != 3.000000000 then @@ -1200,7 +1200,7 @@ endi if $data21 != 0.000000000 then return -1 endi -if $data30 != 4.000000000 then +if $data30 != 4.000000000 then return -1 endi if $data31 != 0.000000000 then @@ -1217,13 +1217,13 @@ endi if $data01 != 0.000000000 then return -1 endi -if $data02 != 0.000000000 then - return -1 -endi -if $data03 != 0.000000000 then - return -1 -endi -if $data10 != 2.000000000 then +if $data02 != 0.000000000 then + return -1 +endi +if $data03 != 0.000000000 then + return -1 +endi +if $data10 != 2.000000000 then return -1 endi if $data11 != 0.000000000 then @@ -1235,7 +1235,7 @@ endi if $data13 != 0.000000000 then return -1 endi -if $data20 != 3.000000000 then +if $data20 != 3.000000000 then return -1 endi if $data21 != 0.000000000 then @@ -1261,9 +1261,9 @@ if $data33 != 0.000000000 then endi sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) != 0 order by f1; -if $rows != 0 then - return -1 -endi +if $rows != 0 then + return -1 +endi sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 group by f1 having spread(f1) + 1 > 0; @@ -1416,7 +1416,7 @@ if $data01 != 0.000000000 then endi if $data02 != 0.000000000 then return -1 -endi +endi if $data03 != 0.000000000 then return -1 endi @@ -1507,7 +1507,7 @@ if $data13 != 0.000000000 then endi sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f2 > 2 group by f1 having avg(f1) > 0 order by f1; -if $rows != 2 then +if $rows != 2 then return -1 endi if $data00 != 3.000000000 then @@ -1536,7 +1536,7 @@ if $data13 != 0.000000000 then endi sql select avg(f1), spread(f1), spread(f2), spread(tb1.f1) from tb1 where f3 > 2 group by f1 having avg(f1) > 0 order by f1; -if $rows != 2 then +if $rows != 2 then return -1 endi if $data00 != 3.000000000 then @@ -1602,7 +1602,7 @@ endi if $data02 != 0.000000000 then return -1 endi -if $data03 != 0.000000000 then +if $data03 != 0.000000000 then return -1 endi @@ -1621,7 +1621,7 @@ endi if $data02 != 0.000000000 then return -1 endi -if $data03 != 0.000000000 then +if $data03 != 0.000000000 then return -1 endi @@ -1638,7 +1638,7 @@ endi if $data02 != 0.000000000 then return -1 endi -if $data03 != 0.000000000 then +if $data03 != 0.000000000 then return -1 endi diff --git a/tests/script/tsim/parser/import.sim b/tests/script/tsim/parser/import.sim index 332ddba6b5..00c5aae54c 100644 --- a/tests/script/tsim/parser/import.sim +++ b/tests/script/tsim/parser/import.sim @@ -16,7 +16,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db sql create table tb (ts timestamp, c1 int, c2 timestamp) @@ -78,4 +78,4 @@ if $data40 != @19-05-05 11:59:00.000@ then endi if $data50 != @19-05-05 12:00:00.000@ then return -1 -endi \ No newline at end of file +endi diff --git a/tests/script/tsim/parser/import_commit1.sim b/tests/script/tsim/parser/import_commit1.sim index e1aa0b6bb0..61cf9dc576 100644 --- a/tests/script/tsim/parser/import_commit1.sim +++ b/tests/script/tsim/parser/import_commit1.sim @@ -19,7 +19,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db @@ -31,9 +31,9 @@ $x = 0 while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - sql insert into $tb values ( $ts , $x ) + sql insert into $tb values ( $ts , $x ) $x = $x + 1 -endw +endw print ====== tables created $ts = $ts0 + $delta @@ -42,9 +42,9 @@ sql import into $tb values ( $ts , -1) sql select count(*) from $tb $res = $rowNum + 1 if $data00 != $res then - print expected: $res - print returned: $rows + print expected: $res + print returned: $rows return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/import_commit2.sim b/tests/script/tsim/parser/import_commit2.sim index 783a902818..5255ad23ac 100644 --- a/tests/script/tsim/parser/import_commit2.sim +++ b/tests/script/tsim/parser/import_commit2.sim @@ -18,7 +18,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db @@ -30,9 +30,9 @@ $x = 0 while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - sql insert into $tb values ( $ts , $x ) + sql insert into $tb values ( $ts , $x ) $x = $x + 1 -endw +endw print ====== tables created $ts = $ts0 + $delta @@ -41,9 +41,9 @@ sql import into $tb values ( $ts , -1) sql select count(*) from $tb $res = $rowNum + 1 if $data00 != $res then - print expected: $res - print returned: $rows + print expected: $res + print returned: $rows return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/import_commit3.sim b/tests/script/tsim/parser/import_commit3.sim index 1dc985cc1d..614a84a9a0 100644 --- a/tests/script/tsim/parser/import_commit3.sim +++ b/tests/script/tsim/parser/import_commit3.sim @@ -18,7 +18,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db sql reset query cache @@ -30,9 +30,9 @@ $x = 0 while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - sql insert into $tb values ( $ts , $x , $x , $x , $x , $x ) + sql insert into $tb values ( $ts , $x , $x , $x , $x , $x ) $x = $x + 1 -endw +endw print ====== tables created $ts = $ts + 1 @@ -46,9 +46,9 @@ sql show databases sql select count(*) from $tb $res = $rowNum + 2 if $data00 != $res then - print expected: $res - print returned: $rows + print expected: $res + print returned: $rows return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/insert_tb.sim b/tests/script/tsim/parser/insert_tb.sim index 426ac4001f..a10e3f553e 100644 --- a/tests/script/tsim/parser/insert_tb.sim +++ b/tests/script/tsim/parser/insert_tb.sim @@ -59,7 +59,7 @@ sql select * from $tb order by ts desc if $rows != 3 then return -1 endi -if $data01 != $col1 then +if $data01 != $col1 then return -1 endi print data03 = $data03 @@ -213,7 +213,7 @@ if $data46 != @quoted double@ then endi # case: support NULL char of the binary field [TBASE-660] -sql create table NULLb (ts timestamp, c1 binary(20), c2 binary(20), c3 float) +sql create table NULLb (ts timestamp, c1 binary(20), c2 binary(20), c3 float) sql insert into NULLb values ('2018-09-17 09:00:00.000', '', '', 3.746) sql select * from NULLb if $rows != 1 then @@ -222,8 +222,8 @@ endi #sql drop database $db #sql show databases -#if $rows != 0 then +#if $rows != 0 then # return -1 #endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/interp.sim b/tests/script/tsim/parser/interp.sim index cd67083701..f6cfc86098 100644 --- a/tests/script/tsim/parser/interp.sim +++ b/tests/script/tsim/parser/interp.sim @@ -18,7 +18,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) @@ -32,7 +32,7 @@ while $i < $halfNum $tb1 = $tbPrefix . $tbId sql create table $tb using $stb tags( $i ) sql create table $tb1 using $stb tags( $tbId ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -46,10 +46,10 @@ while $i < $halfNum $nchar = $nchar . ' sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw print ====== tables created sql create table ap1 (ts timestamp, pav float); diff --git a/tests/script/tsim/parser/join_multitables.sim b/tests/script/tsim/parser/join_multitables.sim index 4278be52f3..6817d2325d 100644 --- a/tests/script/tsim/parser/join_multitables.sim +++ b/tests/script/tsim/parser/join_multitables.sim @@ -20,25 +20,25 @@ sql create stable st8 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 sql create stable st9 (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5)); sql create stable sta (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5)); sql create stable stb (ts timestamp, f1 int, f2 double, f3 binary(10)) tags(id1 int, id2 smallint, id3 double, id4 bool, id5 binary(5)); - + sql create table tb0_1 using st0 tags(0,1,2.0,true,'3'); sql create table tb0_2 using st0 tags(1,2,3.0,false,'4'); sql create table tb0_3 using st0 tags(2,3,4.0,true,'5'); sql create table tb0_4 using st0 tags(3,4,5.0,false,'6'); sql create table tb0_5 using st0 tags(4,5,6.0,true,'7'); - + sql create table tb1_1 using st1 tags(0,1,2.0,true,'3'); sql create table tb1_2 using st1 tags(1,2,3.0,false,'4'); sql create table tb1_3 using st1 tags(2,3,4.0,true,'5'); sql create table tb1_4 using st1 tags(3,4,5.0,false,'6'); sql create table tb1_5 using st1 tags(4,5,6.0,true,'7'); - + sql create table tb2_1 using st2 tags(0,1,2.0,true,'3'); sql create table tb2_2 using st2 tags(1,2,3.0,false,'4'); sql create table tb2_3 using st2 tags(2,3,4.0,true,'5'); sql create table tb2_4 using st2 tags(3,4,5.0,false,'6'); sql create table tb2_5 using st2 tags(4,5,6.0,true,'7'); - + sql create table tb3_1 using st3 tags(0,1,2.0,true,'3'); sql create table tb3_2 using st3 tags(1,2,3.0,false,'4'); sql create table tb3_3 using st3 tags(2,3,4.0,true,'5'); @@ -50,13 +50,13 @@ sql create table tb4_2 using st4 tags(1,2,3.0,false,'4'); sql create table tb4_3 using st4 tags(2,3,4.0,true,'5'); sql create table tb4_4 using st4 tags(3,4,5.0,false,'6'); sql create table tb4_5 using st4 tags(4,5,6.0,true,'7'); - + sql create table tb5_1 using st5 tags(0,1,2.0,true,'3'); sql create table tb5_2 using st5 tags(1,2,3.0,false,'4'); sql create table tb5_3 using st5 tags(2,3,4.0,true,'5'); sql create table tb5_4 using st5 tags(3,4,5.0,false,'6'); sql create table tb5_5 using st5 tags(4,5,6.0,true,'7'); - + sql create table tb6_1 using st6 tags(0,1,2.0,true,'3'); sql create table tb6_2 using st6 tags(1,2,3.0,false,'4'); sql create table tb6_3 using st6 tags(2,3,4.0,true,'5'); @@ -144,7 +144,7 @@ sql insert into tb1_5 values('2021-03-02 05:00:00.000', 9915,9915.0,'15'); sql insert into tb1_5 values('2021-03-03 05:00:00.000', 9915,9915.0,'15'); sql insert into tb1_5 values('2021-03-04 05:00:00.000', 9915,9915.0,'15'); sql insert into tb1_5 values('2021-03-05 05:00:00.000', 9915,9915.0,'15'); - + sql insert into tb2_1 values('2021-03-01 01:00:00.000', 9921,9921.0,'21'); sql insert into tb2_1 values('2021-03-02 01:00:00.000', 9921,9921.0,'21'); sql insert into tb2_1 values('2021-03-03 01:00:00.000', 9921,9921.0,'21'); @@ -379,7 +379,7 @@ sql insert into tba_5 values('2021-03-02 05:00:00.000', 99105,99105.0,'a5'); sql insert into tba_5 values('2021-03-03 05:00:00.000', 99105,99105.0,'a5'); sql insert into tba_5 values('2021-03-04 05:00:00.000', 99105,99105.0,'a5'); sql insert into tba_5 values('2021-03-05 05:00:00.000', 99105,99105.0,'a5'); - + sql insert into tbb_1 values('2021-03-01 01:00:00.000', 99111,99111.0,'b1'); sql insert into tbb_1 values('2021-03-02 01:00:00.000', 99111,99111.0,'b1'); sql insert into tbb_1 values('2021-03-03 01:00:00.000', 99111,99111.0,'b1'); @@ -410,35 +410,35 @@ sql select * from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then +if $data01 != 9901 then return -1 endi -if $data02 != 9901.000000000 then +if $data02 != 9901.000000000 then return -1 endi -if $data03 != 01 then +if $data03 != 01 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi -if $data09 != @21-03-01 01:00:00.000@ then +if $data09 != @21-03-01 01:00:00.000@ then return -1 endi @@ -446,35 +446,35 @@ sql select * from st0, st1 where st0.ts=st1.ts and st0.id2=st1.id2; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then +if $data01 != 9901 then return -1 endi -if $data02 != 9901.000000000 then +if $data02 != 9901.000000000 then return -1 endi -if $data03 != 01 then +if $data03 != 01 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi -if $data09 != @21-03-01 01:00:00.000@ then +if $data09 != @21-03-01 01:00:00.000@ then return -1 endi @@ -482,35 +482,35 @@ sql select * from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then +if $data01 != 9901 then return -1 endi -if $data02 != 9901.000000000 then +if $data02 != 9901.000000000 then return -1 endi -if $data03 != 01 then +if $data03 != 01 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi -if $data09 != @21-03-01 01:00:00.000@ then +if $data09 != @21-03-01 01:00:00.000@ then return -1 endi @@ -518,35 +518,35 @@ sql select * from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then +if $data01 != 9901 then return -1 endi -if $data02 != 9901.000000000 then +if $data02 != 9901.000000000 then return -1 endi -if $data03 != 01 then +if $data03 != 01 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi -if $data09 != @21-03-01 01:00:00.000@ then +if $data09 != @21-03-01 01:00:00.000@ then return -1 endi @@ -554,32 +554,32 @@ sql select st0.* from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then +if $data01 != 9901 then return -1 endi -if $data02 != 9901.000000000 then +if $data02 != 9901.000000000 then return -1 endi -if $data03 != 01 then +if $data03 != 01 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi @@ -587,32 +587,32 @@ sql select st0.* from st0, st1 where st0.ts=st1.ts and st1.id2=st0.id2; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then +if $data01 != 9901 then return -1 endi -if $data02 != 9901.000000000 then +if $data02 != 9901.000000000 then return -1 endi -if $data03 != 01 then +if $data03 != 01 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi @@ -620,32 +620,32 @@ sql select st0.* from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then +if $data01 != 9901 then return -1 endi -if $data02 != 9901.000000000 then +if $data02 != 9901.000000000 then return -1 endi -if $data03 != 01 then +if $data03 != 01 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi @@ -653,32 +653,32 @@ sql select st1.* from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9911 then +if $data01 != 9911 then return -1 endi -if $data02 != 9911.000000000 then +if $data02 != 9911.000000000 then return -1 endi -if $data03 != 11 then +if $data03 != 11 then return -1 endi -if $data04 != 0 then +if $data04 != 0 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 2.000000000 then +if $data06 != 2.000000000 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then print $data07 return -1 endi -if $data08 != 3 then +if $data08 != 3 then return -1 endi @@ -686,28 +686,28 @@ sql select st0.f1,st1.f1 from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 o if $rows != 25 then return -1 endi -if $data00 != 9901 then +if $data00 != 9901 then return -1 endi -if $data01 != 9911 then +if $data01 != 9911 then return -1 endi -if $data10 != 9901 then +if $data10 != 9901 then return -1 endi -if $data11 != 9911 then +if $data11 != 9911 then return -1 endi -if $data20 != 9901 then +if $data20 != 9901 then return -1 endi -if $data21 != 9911 then +if $data21 != 9911 then return -1 endi -if $data30 != 9901 then +if $data30 != 9901 then return -1 endi -if $data31 != 9911 then +if $data31 != 9911 then return -1 endi @@ -715,16 +715,16 @@ sql select st0.ts,st1.ts from st0, st1 where st0.ts=st1.ts and st1.id2=st0.id2; if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != @21-03-01 01:00:00.000@ then +if $data01 != @21-03-01 01:00:00.000@ then return -1 endi -if $data50 != @21-03-02 01:00:00.000@ then +if $data50 != @21-03-02 01:00:00.000@ then return -1 endi -if $data51 != @21-03-02 01:00:00.000@ then +if $data51 != @21-03-02 01:00:00.000@ then return -1 endi @@ -732,22 +732,22 @@ sql select st1.ts,st0.ts,st0.id3,st1.id3,st0.f3,st1.f3 from st0, st1 where st0.i if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != @21-03-01 01:00:00.000@ then +if $data01 != @21-03-01 01:00:00.000@ then return -1 endi -if $data02 != 2.000000000 then +if $data02 != 2.000000000 then return -1 endi -if $data03 != 2.000000000 then +if $data03 != 2.000000000 then return -1 endi -if $data04 != 01 then +if $data04 != 01 then return -1 endi -if $data05 != 11 then +if $data05 != 11 then return -1 endi @@ -755,34 +755,34 @@ sql select st0.ts,st0.f2,st1.f3,st1.f2,st0.f3 from st0, st1 where st1.id5=st0.id if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901.000000000 then +if $data01 != 9901.000000000 then return -1 endi -if $data02 != 11 then +if $data02 != 11 then return -1 endi -if $data03 != 9911.000000000 then +if $data03 != 9911.000000000 then return -1 endi -if $data04 != 01 then +if $data04 != 01 then return -1 endi -if $data50 != @21-03-02 01:00:00.000@ then +if $data50 != @21-03-02 01:00:00.000@ then return -1 endi -if $data51 != 9901.000000000 then +if $data51 != 9901.000000000 then return -1 endi -if $data52 != 11 then +if $data52 != 11 then return -1 endi -if $data53 != 9911.000000000 then +if $data53 != 9911.000000000 then return -1 endi -if $data54 != 01 then +if $data54 != 01 then return -1 endi @@ -790,31 +790,31 @@ sql select _wstart, last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != @21-03-01 01:00:00.000@ then +if $data01 != @21-03-01 01:00:00.000@ then return -1 endi -if $data02 != 9901 then +if $data02 != 9901 then return -1 endi -if $data03 != 9901.000000000 then +if $data03 != 9901.000000000 then return -1 endi -if $data04 != 01 then +if $data04 != 01 then return -1 endi -if $data05 != @21-03-01 01:00:00.000@ then +if $data05 != @21-03-01 01:00:00.000@ then return -1 endi -if $data06 != 9911 then +if $data06 != 9911 then return -1 endi -if $data07 != 9911.000000000 then +if $data07 != 9911.000000000 then return -1 endi -if $data08 != 11 then +if $data08 != 11 then return -1 endi @@ -822,31 +822,31 @@ sql select _wstart, last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id if $rows != 5 then return -1 endi -if $data00 != @21-03-01 00:00:00.000@ then +if $data00 != @21-03-01 00:00:00.000@ then return -1 endi -if $data01 != @21-03-01 05:00:00.000@ then - return -1 -endi -if $data02 != 9905 then - return -1 -endi -if $data03 != 9905.000000000 then - return -1 -endi -if $data04 != 05 then - return -1 -endi -if $data05 != @21-03-01 05:00:00.000@ then - return -1 -endi -if $data06 != 9915 then - return -1 -endi -if $data07 != 9915.000000000 then - return -1 -endi -if $data08 != 15 then +if $data01 != @21-03-01 05:00:00.000@ then + return -1 +endi +if $data02 != 9905 then + return -1 +endi +if $data03 != 9905.000000000 then + return -1 +endi +if $data04 != 05 then + return -1 +endi +if $data05 != @21-03-01 05:00:00.000@ then + return -1 +endi +if $data06 != 9915 then + return -1 +endi +if $data07 != 9915.000000000 then + return -1 +endi +if $data08 != 15 then return -1 endi @@ -854,34 +854,34 @@ sql select st0.*,st1.* from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then - return -1 -endi -if $data02 != 9901.000000000 then - return -1 -endi -if $data03 != 01 then - return -1 -endi -if $data04 != 0 then - return -1 -endi -if $data05 != 1 then - return -1 -endi -if $data06 != 2.000000000 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != 3 then +if $data01 != 9901 then return -1 endi -if $data09 != @21-03-01 01:00:00.000@ then +if $data02 != 9901.000000000 then + return -1 +endi +if $data03 != 01 then + return -1 +endi +if $data04 != 0 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 2.000000000 then + return -1 +endi +if $data07 != 1 then + return -1 +endi +if $data08 != 3 then + return -1 +endi +if $data09 != @21-03-01 01:00:00.000@ then return -1 endi @@ -890,34 +890,34 @@ sql select st0.ts,* from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 order if $rows != 25 then return -1 endi -if $data00 != @21-03-01 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != @21-03-01 01:00:00.000@ then +if $data01 != @21-03-01 01:00:00.000@ then return -1 endi -if $data02 != 9901 then - return -1 -endi -if $data03 != 9901.000000000 then - return -1 -endi -if $data04 != 01 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 1 then - return -1 -endi -if $data07 != 2.000000000 then - return -1 -endi -if $data08 != 1 then - return -1 -endi -if $data09 != 3 then +if $data02 != 9901 then + return -1 +endi +if $data03 != 9901.000000000 then + return -1 +endi +if $data04 != 01 then + return -1 +endi +if $data05 != 0 then + return -1 +endi +if $data06 != 1 then + return -1 +endi +if $data07 != 2.000000000 then + return -1 +endi +if $data08 != 1 then + return -1 +endi +if $data09 != 3 then return -1 endi @@ -925,386 +925,386 @@ sql select st0.*,st1.* from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and if $rows != 5 then return -1 endi -if $data00 != @21-03-02 01:00:00.000@ then +if $data00 != @21-03-02 01:00:00.000@ then print $data00 return -1 endi -if $data01 != 9901 then - return -1 -endi -if $data02 != 9901.000000000 then - return -1 -endi -if $data03 != 01 then - return -1 -endi -if $data04 != 0 then - return -1 -endi -if $data05 != 1 then - return -1 -endi -if $data06 != 2.000000000 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != 3 then - return -1 -endi -if $data09 != @21-03-02 01:00:00.000@ then - return -1 -endi +if $data01 != 9901 then + return -1 +endi +if $data02 != 9901.000000000 then + return -1 +endi +if $data03 != 01 then + return -1 +endi +if $data04 != 0 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 2.000000000 then + return -1 +endi +if $data07 != 1 then + return -1 +endi +if $data08 != 3 then + return -1 +endi +if $data09 != @21-03-02 01:00:00.000@ then + return -1 +endi sql select top(st1.f1, 5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1; if $rows != 5 then - return -1 -endi -if $data00 != 9915 then - return -1 -endi -if $data10 != 9915 then - return -1 -endi -if $data20 != 9915 then - return -1 -endi -if $data30 != 9915 then - return -1 -endi -if $data40 != 9915 then - return -1 -endi + return -1 +endi +if $data00 != 9915 then + return -1 +endi +if $data10 != 9915 then + return -1 +endi +if $data20 != 9915 then + return -1 +endi +if $data30 != 9915 then + return -1 +endi +if $data40 != 9915 then + return -1 +endi sql select st0.ts, top(st0.f1,5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1 order by st0.ts; if $rows != 5 then - return -1 -endi -if $data00 != @21-03-01 05:00:00.000@ then return -1 endi -if $data01 != 9905 then - return -1 -endi -if $data10 != @21-03-02 05:00:00.000@ then - return -1 -endi -if $data11 != 9905 then - return -1 -endi -if $data20 != @21-03-03 05:00:00.000@ then - return -1 -endi -if $data21 != 9905 then - return -1 -endi -if $data30 != @21-03-04 05:00:00.000@ then +if $data00 != @21-03-01 05:00:00.000@ then + return -1 +endi +if $data01 != 9905 then + return -1 +endi +if $data10 != @21-03-02 05:00:00.000@ then + return -1 +endi +if $data11 != 9905 then + return -1 +endi +if $data20 != @21-03-03 05:00:00.000@ then + return -1 +endi +if $data21 != 9905 then + return -1 +endi +if $data30 != @21-03-04 05:00:00.000@ then + return -1 +endi +if $data31 != 9905 then + return -1 +endi +if $data40 != @21-03-05 05:00:00.000@ then + return -1 +endi +if $data41 != 9905 then return -1 endi -if $data31 != 9905 then - return -1 -endi -if $data40 != @21-03-05 05:00:00.000@ then - return -1 -endi -if $data41 != 9905 then - return -1 -endi #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st3.id1 and st3.ts=st2.ts and st2.id1=st1.id1 and st1.ts=st0.ts; #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st3.id1 and st3.ts=st2.ts and st2.id1=st1.id1 and st1.ts=st0.ts and st0.id1=st2.id1 and st1.ts=st2.ts; #if $rows != 25 then # print $rows -# return -1 -#endi -#if $data00 != @21-03-01 01:00:00.000@ then # return -1 #endi -#if $data01 != 9901 then -# return -1 -#endi -#if $data02 != 9901.000000000 then -# return -1 -#endi -#if $data03 != 01 then -# return -1 -#endi -#if $data04 != 0 then -# return -1 -#endi -#if $data05 != 1 then -# return -1 -#endi -#if $data06 != 2.000000000 then -# return -1 -#endi -#if $data07 != 1 then +#if $data00 != @21-03-01 01:00:00.000@ then +# return -1 +#endi +#if $data01 != 9901 then +# return -1 +#endi +#if $data02 != 9901.000000000 then +# return -1 +#endi +#if $data03 != 01 then +# return -1 +#endi +#if $data04 != 0 then +# return -1 +#endi +#if $data05 != 1 then +# return -1 +#endi +#if $data06 != 2.000000000 then +# return -1 +#endi +#if $data07 != 1 then +# return -1 +#endi +#if $data08 != 3 then +# return -1 +#endi +#if $data09 != @21-03-01 01:00:00.000@ then # return -1 #endi -#if $data08 != 3 then -# return -1 -#endi -#if $data09 != @21-03-01 01:00:00.000@ then -# return -1 -#endi #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st1.id1 and st1.ts=st0.ts and st2.id1=st3.id1 and st3.ts=st2.ts; #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st1.id1 and st1.ts=st0.ts and st2.id1=st3.id1 and st3.ts=st2.ts and st0.id1=st2.id1 and st0.ts=st2.ts; #if $rows != 25 then -# return -1 -#endi -#if $data00 != @21-03-01 01:00:00.000@ then # return -1 #endi -#if $data01 != 9901 then -# return -1 -#endi -#if $data02 != 9901.000000000 then -# return -1 -#endi -#if $data03 != 01 then -# return -1 -#endi -#if $data04 != 0 then -# return -1 -#endi -#if $data05 != 1 then +#if $data00 != @21-03-01 01:00:00.000@ then # return -1 -#endi -#if $data06 != 2.000000000 then -# return -1 -#endi -#if $data07 != 1 then -# return -1 -#endi -#if $data08 != 3 then -# return -1 -#endi -#if $data09 != @21-03-01 01:00:00.000@ then -# return -1 -#endi - +#endi +#if $data01 != 9901 then +# return -1 +#endi +#if $data02 != 9901.000000000 then +# return -1 +#endi +#if $data03 != 01 then +# return -1 +#endi +#if $data04 != 0 then +# return -1 +#endi +#if $data05 != 1 then +# return -1 +#endi +#if $data06 != 2.000000000 then +# return -1 +#endi +#if $data07 != 1 then +# return -1 +#endi +#if $data08 != 3 then +# return -1 +#endi +#if $data09 != @21-03-01 01:00:00.000@ then +# return -1 +#endi + sql select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9 where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.ts=st1.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1 and st0.id1=st1.id1; if $rows != 25 then - return -1 -endi -if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then - return -1 -endi -if $data02 != 9901.000000000 then - return -1 -endi -if $data03 != 01 then - return -1 -endi -if $data04 != 0 then - return -1 -endi -if $data05 != 1 then - return -1 -endi -if $data06 != 2.000000000 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != 3 then - return -1 -endi -if $data09 != @21-03-01 01:00:00.000@ then - return -1 -endi +if $data00 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data01 != 9901 then + return -1 +endi +if $data02 != 9901.000000000 then + return -1 +endi +if $data03 != 01 then + return -1 +endi +if $data04 != 0 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 2.000000000 then + return -1 +endi +if $data07 != 1 then + return -1 +endi +if $data08 != 3 then + return -1 +endi +if $data09 != @21-03-01 01:00:00.000@ then + return -1 +endi sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts; if $rows != 5 then - return -1 -endi -if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then - return -1 -endi -if $data02 != 9901.000000000 then - return -1 -endi -if $data03 != 01 then - return -1 -endi -if $data04 != @21-03-01 01:00:00.000@ then - return -1 -endi -if $data05 != 9911 then - return -1 -endi -if $data06 != 9911.000000000 then - return -1 -endi -if $data07 != 11 then - return -1 -endi -if $data10 != @21-03-02 01:00:00.000@ then +if $data00 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data01 != 9901 then + return -1 +endi +if $data02 != 9901.000000000 then + return -1 +endi +if $data03 != 01 then + return -1 +endi +if $data04 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data05 != 9911 then + return -1 +endi +if $data06 != 9911.000000000 then + return -1 +endi +if $data07 != 11 then + return -1 +endi +if $data10 != @21-03-02 01:00:00.000@ then + return -1 +endi +if $data11 != 9901 then + return -1 +endi +if $data12 != 9901.000000000 then + return -1 +endi +if $data13 != 01 then + return -1 +endi +if $data14 != @21-03-02 01:00:00.000@ then + return -1 +endi +if $data15 != 9911 then + return -1 +endi +if $data16 != 9911.000000000 then + return -1 +endi +if $data17 != 11 then return -1 endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data15 != 9911 then - return -1 -endi -if $data16 != 9911.000000000 then - return -1 -endi -if $data17 != 11 then - return -1 -endi sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id1; if $rows != 5 then - return -1 -endi -if $data00 != @21-03-01 01:00:00.000@ then return -1 endi -if $data01 != 9901 then - return -1 -endi -if $data02 != 9901.000000000 then - return -1 -endi -if $data03 != 01 then - return -1 -endi -if $data04 != @21-03-01 01:00:00.000@ then - return -1 -endi -if $data05 != 9911 then - return -1 -endi -if $data06 != 9911.000000000 then - return -1 -endi -if $data07 != 11 then - return -1 -endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data15 != 9911 then - return -1 -endi -if $data16 != 9911.000000000 then - return -1 -endi -if $data17 != 11 then - return -1 +if $data00 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data01 != 9901 then + return -1 +endi +if $data02 != 9901.000000000 then + return -1 +endi +if $data03 != 01 then + return -1 +endi +if $data04 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data05 != 9911 then + return -1 +endi +if $data06 != 9911.000000000 then + return -1 +endi +if $data07 != 11 then + return -1 +endi +if $data10 != @21-03-02 01:00:00.000@ then + return -1 +endi +if $data11 != 9901 then + return -1 +endi +if $data12 != 9901.000000000 then + return -1 +endi +if $data13 != 01 then + return -1 +endi +if $data14 != @21-03-02 01:00:00.000@ then + return -1 +endi +if $data15 != 9911 then + return -1 +endi +if $data16 != 9911.000000000 then + return -1 +endi +if $data17 != 11 then + return -1 endi sql select tb0_1.*, tb1_2.*,tb2_3.*,tb3_4.*,tb4_5.* from tb0_1, tb1_2, tb2_3, tb3_4, tb4_5 where tb0_1.ts=tb1_2.ts and tb0_1.ts=tb2_3.ts and tb0_1.ts=tb3_4.ts and tb0_1.ts=tb4_5.ts; if $rows != 0 then - return -1 -endi + return -1 +endi sql select tb0_1.*, tb1_1.*,tb2_1.*,tb3_1.*,tb4_1.* from tb0_1, tb1_1, tb2_1, tb3_1, tb4_1 where tb0_1.ts=tb1_1.ts and tb0_1.ts=tb2_1.ts and tb0_1.ts=tb3_1.ts and tb0_1.ts=tb4_1.ts; -if $rows != 5 then - return -1 -endi -if $data00 != @21-03-01 01:00:00.000@ then +if $rows != 5 then + return -1 +endi +if $data00 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data01 != 9901 then + return -1 +endi +if $data02 != 9901.000000000 then + return -1 +endi +if $data03 != 01 then + return -1 +endi +if $data04 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data05 != 9911 then + return -1 +endi +if $data06 != 9911.000000000 then + return -1 +endi +if $data07 != 11 then + return -1 +endi +if $data08 != @21-03-01 01:00:00.000@ then + return -1 +endi +if $data09 != 9921 then return -1 endi -if $data01 != 9901 then - return -1 -endi -if $data02 != 9901.000000000 then - return -1 -endi -if $data03 != 01 then - return -1 -endi -if $data04 != @21-03-01 01:00:00.000@ then - return -1 -endi -if $data05 != 9911 then - return -1 -endi -if $data06 != 9911.000000000 then - return -1 -endi -if $data07 != 11 then - return -1 -endi -if $data08 != @21-03-01 01:00:00.000@ then - return -1 -endi -if $data09 != 9921 then - return -1 -endi sql select tb0_5.*, tb1_5.*,tb2_5.*,tb3_5.*,tb4_5.*,tb5_5.*, tb6_5.*,tb7_5.*,tb8_5.*,tb9_5.* from tb0_5, tb1_5, tb2_5, tb3_5, tb4_5,tb5_5, tb6_5, tb7_5, tb8_5, tb9_5 where tb9_5.ts=tb8_5.ts and tb8_5.ts=tb7_5.ts and tb7_5.ts=tb6_5.ts and tb6_5.ts=tb5_5.ts and tb5_5.ts=tb4_5.ts and tb4_5.ts=tb3_5.ts and tb3_5.ts=tb2_5.ts and tb2_5.ts=tb1_5.ts and tb1_5.ts=tb0_5.ts; -if $rows != 5 then - return -1 -endi -if $data00 != @21-03-01 05:00:00.000@ then +if $rows != 5 then + return -1 +endi +if $data00 != @21-03-01 05:00:00.000@ then + return -1 +endi +if $data01 != 9905 then + return -1 +endi +if $data02 != 9905.000000000 then + return -1 +endi +if $data03 != 05 then + return -1 +endi +if $data04 != @21-03-01 05:00:00.000@ then + return -1 +endi +if $data05 != 9915 then + return -1 +endi +if $data06 != 9915.000000000 then + return -1 +endi +if $data07 != 15 then + return -1 +endi +if $data08 != @21-03-01 05:00:00.000@ then + return -1 +endi +if $data09 != 9925 then return -1 endi -if $data01 != 9905 then - return -1 -endi -if $data02 != 9905.000000000 then - return -1 -endi -if $data03 != 05 then - return -1 -endi -if $data04 != @21-03-01 05:00:00.000@ then - return -1 -endi -if $data05 != 9915 then - return -1 -endi -if $data06 != 9915.000000000 then - return -1 -endi -if $data07 != 15 then - return -1 -endi -if $data08 != @21-03-01 05:00:00.000@ then - return -1 -endi -if $data09 != 9925 then - return -1 -endi sql_error select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.f1=tb1_1.f1; sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id2; sql select tb0_5.*, tb1_5.*,tb2_5.*,tb3_5.*,tb4_5.*,tb5_5.*, tb6_5.*,tb7_5.*,tb8_5.*,tb9_5.*,tba_5.* from tb0_5, tb1_5, tb2_5, tb3_5, tb4_5,tb5_5, tb6_5, tb7_5, tb8_5, tb9_5, tba_5 where tb9_5.ts=tb8_5.ts and tb8_5.ts=tb7_5.ts and tb7_5.ts=tb6_5.ts and tb6_5.ts=tb5_5.ts and tb5_5.ts=tb4_5.ts and tb4_5.ts=tb3_5.ts and tb3_5.ts=tb2_5.ts and tb2_5.ts=tb1_5.ts and tb1_5.ts=tb0_5.ts and tb0_5.ts=tba_5.ts; - + sql select * from st0, st1 where st0.ts=st1.ts; sql_error select * from st0, st1 where st0.id1=st1.id1; sql_error select * from st0, st1 where st0.f1=st1.f1 and st0.id1=st1.id1; diff --git a/tests/script/tsim/parser/join_multivnode.sim b/tests/script/tsim/parser/join_multivnode.sim index f1204326d3..e94915e11b 100644 --- a/tests/script/tsim/parser/join_multivnode.sim +++ b/tests/script/tsim/parser/join_multivnode.sim @@ -55,7 +55,7 @@ while $i < $tbNum endw $tstart = 100000 -$mt = $mtPrefix . 1 +$mt = $mtPrefix . 1 sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12), t3 int) $i = 0 @@ -110,7 +110,7 @@ if $row != 3000 then return -1 endi -# TODO +# TODO return print ======= second tags join diff --git a/tests/script/tsim/parser/last_cache.sim b/tests/script/tsim/parser/last_cache.sim index 40c6e4ce12..9a41a9f5aa 100644 --- a/tests/script/tsim/parser/last_cache.sim +++ b/tests/script/tsim/parser/last_cache.sim @@ -24,7 +24,7 @@ sql create table tbb using st2 tags (5); sql create table tbc using st2 tags (5); sql create table tbd using st2 tags (5); sql create table tbe using st2 tags (5); - + sql insert into tb1 values ("2021-05-09 10:10:10", 1, 2.0, '3', -1000) sql insert into tb1 values ("2021-05-10 10:10:11", 4, 5.0, NULL, -2000) sql insert into tb1 values ("2021-05-12 10:10:12", 6,NULL, NULL, -3000) diff --git a/tests/script/tsim/parser/last_cache_query.sim b/tests/script/tsim/parser/last_cache_query.sim index ebbb784da5..f32435960c 100644 --- a/tests/script/tsim/parser/last_cache_query.sim +++ b/tests/script/tsim/parser/last_cache_query.sim @@ -9,7 +9,7 @@ sql select last(ts) from tb1 if $rows != 1 then return -1 endi -if $data00 != @21-05-12 10:10:12.000@ then +if $data00 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi @@ -18,7 +18,7 @@ sql select last(f1) from tb1 if $rows != 1 then return -1 endi -if $data00 != 6 then +if $data00 != 6 then print $data00 return -1 endi @@ -27,21 +27,21 @@ sql select last(*) from tb1 if $rows != 1 then return -1 endi -if $data00 != @21-05-12 10:10:12.000@ then +if $data00 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi -if $data01 != 6 then +if $data01 != 6 then return -1 endi -if $data02 != 5.000000000 then +if $data02 != 5.000000000 then print $data02 return -1 endi -if $data03 != 3 then +if $data03 != 3 then return -1 endi -if $data04 != @70-01-01 07:59:57.000@ then +if $data04 != @70-01-01 07:59:57.000@ then return -1 endi @@ -49,28 +49,28 @@ sql select last(tb1.*,ts,f4) from tb1 if $rows != 1 then return -1 endi -if $data00 != @21-05-12 10:10:12.000@ then +if $data00 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi -if $data01 != 6 then +if $data01 != 6 then return -1 endi -if $data02 != 5.000000000 then +if $data02 != 5.000000000 then print $data02 return -1 endi -if $data03 != 3 then +if $data03 != 3 then return -1 endi -if $data04 != @70-01-01 07:59:57.000@ then +if $data04 != @70-01-01 07:59:57.000@ then return -1 endi -if $data05 != @21-05-12 10:10:12.000@ then +if $data05 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi -if $data06 != @70-01-01 07:59:57.000@ then +if $data06 != @70-01-01 07:59:57.000@ then return -1 endi @@ -79,7 +79,7 @@ sql select last(ts) from tb2 if $rows != 1 then return -1 endi -if $data00 != @21-05-11 10:11:15.000@ then +if $data00 != @21-05-11 10:11:15.000@ then print $data00 return -1 endi @@ -88,7 +88,7 @@ sql select last(f1) from tb2 if $rows != 1 then return -1 endi -if $data00 != -6 then +if $data00 != -6 then print $data00 return -1 endi @@ -97,21 +97,21 @@ sql select last(*) from tb2 if $rows != 1 then return -1 endi -if $data00 != @21-05-11 10:11:15.000@ then +if $data00 != @21-05-11 10:11:15.000@ then print $data00 return -1 endi -if $data01 != -6 then +if $data01 != -6 then return -1 endi -if $data02 != -7.000000000 then +if $data02 != -7.000000000 then print $data02 return -1 endi -if $data03 != -8 then +if $data03 != -8 then return -1 endi -if $data04 != @70-01-01 07:59:56.999@ then +if $data04 != @70-01-01 07:59:56.999@ then if $data04 != @70-01-01 07:59:57.-01@ then return -1 endi @@ -121,30 +121,30 @@ sql select last(tb2.*,ts,f4) from tb2 if $rows != 1 then return -1 endi -if $data00 != @21-05-11 10:11:15.000@ then +if $data00 != @21-05-11 10:11:15.000@ then print $data00 return -1 endi -if $data01 != -6 then +if $data01 != -6 then return -1 endi -if $data02 != -7.000000000 then +if $data02 != -7.000000000 then print $data02 return -1 endi -if $data03 != -8 then +if $data03 != -8 then return -1 endi -if $data04 != @70-01-01 07:59:56.999@ then +if $data04 != @70-01-01 07:59:56.999@ then if $data04 != @70-01-01 07:59:57.-01@ then return -1 endi endi -if $data05 != @21-05-11 10:11:15.000@ then +if $data05 != @21-05-11 10:11:15.000@ then print $data00 return -1 endi -if $data06 != @70-01-01 07:59:56.999@ then +if $data06 != @70-01-01 07:59:56.999@ then if $data04 != @70-01-01 07:59:57.-01@ then return -1 endi @@ -155,21 +155,21 @@ sql select last(*) from tbd if $rows != 1 then return -1 endi -if $data00 != @21-05-11 10:12:29.000@ then +if $data00 != @21-05-11 10:12:29.000@ then print $data00 return -1 endi -if $data01 != NULL then +if $data01 != NULL then return -1 endi -if $data02 != NULL then +if $data02 != NULL then print $data02 return -1 endi -if $data03 != NULL then +if $data03 != NULL then return -1 endi -if $data04 != NULL then +if $data04 != NULL then return -1 endi @@ -184,7 +184,7 @@ sql select last(ts) from st2 if $rows != 1 then return -1 endi -if $data00 != @21-05-12 10:10:12.000@ then +if $data00 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi @@ -193,7 +193,7 @@ sql select last(f1) from st2 if $rows != 1 then return -1 endi -if $data00 != 6 then +if $data00 != 6 then print $data00 return -1 endi @@ -202,21 +202,21 @@ sql select last(*) from st2 if $rows != 1 then return -1 endi -if $data00 != @21-05-12 10:10:12.000@ then +if $data00 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi -if $data01 != 6 then +if $data01 != 6 then return -1 endi -if $data02 != 37.000000000 then +if $data02 != 37.000000000 then print $data02 return -1 endi -if $data03 != 27 then +if $data03 != 27 then return -1 endi -if $data04 != @70-01-01 07:59:57.000@ then +if $data04 != @70-01-01 07:59:57.000@ then return -1 endi @@ -225,28 +225,28 @@ sql select last(st2.*,ts,f4) from st2 if $rows != 1 then return -1 endi -if $data00 != @21-05-12 10:10:12.000@ then +if $data00 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi -if $data01 != 6 then +if $data01 != 6 then return -1 endi -if $data02 != 37.000000000 then +if $data02 != 37.000000000 then print $data02 return -1 endi -if $data03 != 27 then +if $data03 != 27 then return -1 endi -if $data04 != @70-01-01 07:59:57.000@ then +if $data04 != @70-01-01 07:59:57.000@ then return -1 endi -if $data05 != @21-05-12 10:10:12.000@ then +if $data05 != @21-05-12 10:10:12.000@ then print $data00 return -1 endi -if $data06 != @70-01-01 07:59:57.000@ then +if $data06 != @70-01-01 07:59:57.000@ then return -1 endi @@ -260,99 +260,99 @@ print ===> $data40 $data41 $data42 $data43 $data44 $data45 $data46 $data47 $data if $rows != 5 then return -1 endi -if $data00 != @21-05-12 10:10:12.000@ then +if $data00 != @21-05-12 10:10:12.000@ then return -1 endi -if $data01 != 6 then +if $data01 != 6 then return -1 endi -if $data02 != 5.000000000 then +if $data02 != 5.000000000 then print $data02 return -1 endi -if $data03 != 21 then +if $data03 != 21 then return -1 endi -if $data04 != @70-01-01 07:59:57.000@ then +if $data04 != @70-01-01 07:59:57.000@ then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data10 != @21-05-11 10:12:23.000@ then +if $data10 != @21-05-11 10:12:23.000@ then return -1 endi -if $data11 != 22 then +if $data11 != 22 then return -1 endi -if $data12 != 23.000000000 then +if $data12 != 23.000000000 then print $data02 return -1 endi -if $data13 != -8 then +if $data13 != -8 then return -1 endi -if $data14 != @70-01-01 07:59:58.-04@ then +if $data14 != @70-01-01 07:59:58.-04@ then return -1 endi -if $data15 != 2 then +if $data15 != 2 then return -1 endi -if $data20 != @21-05-10 10:12:24.000@ then +if $data20 != @21-05-10 10:12:24.000@ then return -1 endi -if $data21 != 24 then +if $data21 != 24 then return -1 endi if $data22 != 11.000000000 then print expect 11.000000000 actual: $data22 return -1 endi -if $data23 != 25 then +if $data23 != 25 then return -1 endi if $data24 != @70-01-01 07:59:57.-04@ then = return -1 endi -if $data25 != 3 then +if $data25 != 3 then return -1 endi -if $data30 != @21-05-11 10:12:25.000@ then +if $data30 != @21-05-11 10:12:25.000@ then return -1 endi -if $data31 != 26 then +if $data31 != 26 then return -1 endi -if $data32 != 17.000000000 then +if $data32 != 17.000000000 then print $data02 return -1 endi -if $data33 != 27 then +if $data33 != 27 then return -1 endi -if $data34 != @70-01-01 07:59:56.-04@ then +if $data34 != @70-01-01 07:59:56.-04@ then return -1 endi -if $data35 != 4 then +if $data35 != 4 then return -1 endi -if $data40 != @21-05-11 10:12:29.000@ then +if $data40 != @21-05-11 10:12:29.000@ then return -1 endi -if $data41 != 36 then +if $data41 != 36 then return -1 endi -if $data42 != 37.000000000 then +if $data42 != 37.000000000 then print $data02 return -1 endi -if $data43 != 35 then +if $data43 != 35 then return -1 endi -if $data44 != @70-01-01 07:59:56.-05@ then +if $data44 != @70-01-01 07:59:56.-05@ then return -1 endi -if $data45 != 5 then +if $data45 != 5 then return -1 endi @@ -367,21 +367,21 @@ sql select last(*) from tbn; if $rows != 1 then return -1 endi -if $data00 != @21-05-13 10:10:12.000@ then +if $data00 != @21-05-13 10:10:12.000@ then print $data00 return -1 endi -if $data01 != 6 then +if $data01 != 6 then return -1 endi -if $data02 != 5.000000000 then +if $data02 != 5.000000000 then print $data02 return -1 endi -if $data03 != 3 then +if $data03 != 3 then return -1 endi -if $data04 != @70-01-01 07:59:57.000@ then +if $data04 != @70-01-01 07:59:57.000@ then return -1 endi diff --git a/tests/script/tsim/parser/last_groupby.sim b/tests/script/tsim/parser/last_groupby.sim index 68d7f10fe2..f1545036dc 100644 --- a/tests/script/tsim/parser/last_groupby.sim +++ b/tests/script/tsim/parser/last_groupby.sim @@ -10,7 +10,7 @@ sql use $db sql create stable st2 (ts timestamp, f1 int, f2 float, f3 double, f4 bigint, f5 smallint, f6 tinyint, f7 bool, f8 binary(10), f9 nchar(10)) tags (id1 int, id2 float, id3 nchar(10), id4 double, id5 smallint, id6 bigint, id7 binary(10)) sql create table tb1 using st2 tags (1,1.0,"1",1.0,1,1,"1"); - + sql insert into tb1 values (now-200s,1,1.0,1.0,1,1,1,true,"1","1") sql insert into tb1 values (now-100s,2,2.0,2.0,2,2,2,true,"2","2") sql insert into tb1 values (now,3,3.0,3.0,3,3,3,true,"3","3") @@ -24,32 +24,32 @@ sql select f1, last(*) from st2 group by f1 order by f1; if $rows != 4 then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data02 != 1 then +if $data02 != 1 then print $data02 return -1 endi -if $data03 != 1.00000 then +if $data03 != 1.00000 then return -1 endi -if $data04 != 1.000000000 then +if $data04 != 1.000000000 then return -1 endi -if $data05 != 1 then +if $data05 != 1 then return -1 endi -if $data06 != 1 then +if $data06 != 1 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then return -1 endi -if $data08 != 1 then +if $data08 != 1 then return -1 endi -if $data09 != 1 then +if $data09 != 1 then return -1 endi @@ -57,31 +57,31 @@ sql select f1, last(f1,st2.*) from st2 group by f1 order by f1; if $rows != 4 then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data01 != 1 then +if $data01 != 1 then return -1 endi -if $data03 != 1 then +if $data03 != 1 then return -1 endi -if $data04 != 1.00000 then +if $data04 != 1.00000 then return -1 endi -if $data05 != 1.000000000 then +if $data05 != 1.000000000 then return -1 endi -if $data06 != 1 then +if $data06 != 1 then return -1 endi -if $data07 != 1 then +if $data07 != 1 then return -1 endi -if $data08 != 1 then +if $data08 != 1 then return -1 endi -if $data09 != 1 then +if $data09 != 1 then return -1 endi diff --git a/tests/script/tsim/parser/lastrow.sim b/tests/script/tsim/parser/lastrow.sim index 12971e9f2c..fc14a40efb 100644 --- a/tests/script/tsim/parser/lastrow.sim +++ b/tests/script/tsim/parser/lastrow.sim @@ -27,7 +27,7 @@ while $i > 0 $tb = $tbPrefix . $i sql create table $tb using $stb tags( $i ) $i = $i - 1 -endw +endw $ts = $ts0 $i = 1 @@ -36,7 +36,7 @@ while $i <= $tbNum $tb = $tbPrefix . $i while $x < $rowNum $ts = $ts + $delta - $c6 = $x / 128 + $c6 = $x / 128 $c6 = $c6 * 128 $c6 = $x - $c6 $c3 = NULL @@ -46,9 +46,9 @@ while $i <= $tbNum if $xr = 0 then $c3 = $x endi - sql insert into $tb values ( $ts , $x , NULL , $x , $x , $x , $c6 , true, 'BINARY', 'NCHAR' ) + sql insert into $tb values ( $ts , $x , NULL , $x , $x , $x , $c6 , true, 'BINARY', 'NCHAR' ) $x = $x + 1 - endw + endw $i = $i + 1 endw diff --git a/tests/script/tsim/parser/lastrow_query.sim b/tests/script/tsim/parser/lastrow_query.sim index be8f089a79..5f557fd7bd 100644 --- a/tests/script/tsim/parser/lastrow_query.sim +++ b/tests/script/tsim/parser/lastrow_query.sim @@ -27,20 +27,20 @@ if $data00 != @18-09-25 09:00:00.000@ then return -1 endi if $data01 != 1439 then - return -1 -endi + return -1 +endi if $data02 != NULL then - return -1 -endi + return -1 +endi if $data03 != 1439.00000 then - return -1 -endi + return -1 +endi if $data04 != 1439.000000000 then return -1 endi if $data06 != 31 then return -1 -endi +endi if $data07 != 1 then return -1 endi @@ -110,7 +110,7 @@ if $rows != 1 then return -1 endi -sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 +sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 if $rows != 1 then return -1 endi diff --git a/tests/script/tsim/parser/like.sim b/tests/script/tsim/parser/like.sim index 96672aee3c..40dcec4080 100644 --- a/tests/script/tsim/parser/like.sim +++ b/tests/script/tsim/parser/like.sim @@ -21,12 +21,12 @@ sql insert into $table1 values(now-1m, "tablexname") sql insert into $table1 values(now-2m, "tablexxx") sql insert into $table1 values(now-2m, "table") -sql select b from $table1 +sql select b from $table1 if $rows != 4 then return -1 endi -sql select b from $table1 where b like 'table_name' +sql select b from $table1 where b like 'table_name' if $rows != 2 then return -1 endi @@ -37,17 +37,17 @@ if $rows != 1 then endi sql show tables; -if $rows != 2 then +if $rows != 2 then return -1 endi sql show tables like 'table_name' -if $rows != 2 then +if $rows != 2 then return -1 endi sql show tables like 'table\_name' -if $rows != 1 then +if $rows != 1 then return -1 endi diff --git a/tests/script/tsim/parser/limit.sim b/tests/script/tsim/parser/limit.sim index bbee7a931d..e79640f3af 100644 --- a/tests/script/tsim/parser/limit.sim +++ b/tests/script/tsim/parser/limit.sim @@ -18,7 +18,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) @@ -32,7 +32,7 @@ while $i < $halfNum $tb1 = $tbPrefix . $tbId sql create table $tb using $stb tags( $i ) sql create table $tb1 using $stb tags( $tbId ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -51,10 +51,10 @@ while $i < $halfNum $ts = $ts + $halfNum sql insert into $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw print ====== tables created run tsim/parser/limit_tb.sim @@ -73,4 +73,4 @@ sql use $db sql select * from (select ts, top(c1, 5) from $tb where ts >= $ts0 order by ts desc limit 3 offset 1) sql select * from (select ts, top(c1, 5) from $stb where ts >= $ts0 order by ts desc limit 3 offset 1) -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/limit1.sim b/tests/script/tsim/parser/limit1.sim index 6fbae4acd7..c35617fc4f 100644 --- a/tests/script/tsim/parser/limit1.sim +++ b/tests/script/tsim/parser/limit1.sim @@ -32,7 +32,7 @@ while $i < $halfNum $tb1 = $tbPrefix . $tbId sql create table $tb using $stb tags( $i ) sql create table $tb1 using $stb tags( $tbId ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -46,10 +46,10 @@ while $i < $halfNum $nchar = $nchar . ' sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw print ====== tables created run tsim/parser/limit1_tb.sim diff --git a/tests/script/tsim/parser/limit1_stb.sim b/tests/script/tsim/parser/limit1_stb.sim index 43fa06230c..be0963c0fd 100644 --- a/tests/script/tsim/parser/limit1_stb.sim +++ b/tests/script/tsim/parser/limit1_stb.sim @@ -134,7 +134,7 @@ if $rows != 0 then endi $offset = $offset - 1 -sql select * from $stb limit $limit offset $offset +sql select * from $stb limit $limit offset $offset if $rows != 1 then return -1 endi @@ -308,7 +308,7 @@ if $data06 != binary5 then return -1 endi if $data07 != nchar5 then - return -1 + return -1 endi $limit = $totalNum @@ -491,4 +491,4 @@ endi sql select 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 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 partition by t1 interval(5m) limit 2 offset 0 if $rows != 6 then return -1 -endi \ No newline at end of file +endi diff --git a/tests/script/tsim/parser/limit1_tb.sim b/tests/script/tsim/parser/limit1_tb.sim index 36c91fe4c7..0ba8265418 100644 --- a/tests/script/tsim/parser/limit1_tb.sim +++ b/tests/script/tsim/parser/limit1_tb.sim @@ -229,7 +229,7 @@ sql select sum(c1), avg(c2), stddev(c3), max(c4), min(c5), count(c6), first(c7), if $rows != 1 then return -1 endi -$val = 45 * $rowNum +$val = 45 * $rowNum $val = $val / 10 if $data00 != $val then return -1 @@ -479,7 +479,7 @@ endi ### aggregation + limit offset (with interval) sql select max(c1), max(c2), max(c3), max(c4), max(c5), max(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) limit 5 -if $rows != 5 then +if $rows != 5 then return -1 endi if $data01 != 0 then @@ -693,7 +693,7 @@ if $data11 != 3 then endi if $data21 != 3 then return -1 -endi +endi if $data31 != 2 then return -1 endi @@ -805,7 +805,7 @@ if $data02 != 3 then endi if $data03 != 5 then return -1 -endi +endi if $data04 != 3.00000 then return -1 endi diff --git a/tests/script/tsim/parser/limit2.sim b/tests/script/tsim/parser/limit2.sim index 3951ab4e08..e61c4ca1a4 100644 --- a/tests/script/tsim/parser/limit2.sim +++ b/tests/script/tsim/parser/limit2.sim @@ -22,7 +22,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int, t2 nchar(20), t3 binary(20), t4 bigint, t5 smallint, t6 double) @@ -40,7 +40,7 @@ while $i < $halfNum $tgstr1 = $tgstr1 . ' sql create table $tb using $stb tags( $i , $tgstr , $tgstr , $i , $i , $i ) sql create table $tb1 using $stb tags( $i1 , $tgstr1 , $tgstr1 , $i , $i , $i ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -52,13 +52,13 @@ while $i < $halfNum $binary = $binary . ' $nchar = 'nchar . $c $nchar = $nchar . ' - sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) - sql insert into $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) + sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) + sql insert into $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw print ====== tables created run tsim/parser/limit2_query.sim diff --git a/tests/script/tsim/parser/limit2_query.sim b/tests/script/tsim/parser/limit2_query.sim index 0200cf7d43..fc69035935 100644 --- a/tests/script/tsim/parser/limit2_query.sim +++ b/tests/script/tsim/parser/limit2_query.sim @@ -286,7 +286,7 @@ if $rows != $limit then return -1 endi - + $limit = $rowNum $offset = $limit / 2 $offset = $offset + 10 @@ -391,7 +391,7 @@ $offset = $offset - 2 sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2) group by t1 order by t1 limit $limit offset $offset if $rows != $tbNum then return -1 -endi +endi if $data00 != @18-11-25 19:30:00.000@ then return -1 endi diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim index a0aff953cf..2ecb2e1518 100644 --- a/tests/script/tsim/parser/limit_stb.sim +++ b/tests/script/tsim/parser/limit_stb.sim @@ -354,7 +354,7 @@ if $data06 != binary9 then return -1 endi if $data07 != nchar0 then - return -1 + return -1 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; @@ -387,7 +387,7 @@ if $data06 != binary5 then return -1 endi if $data07 != nchar5 then - return -1 + return -1 endi sql select c1, tbname, t1 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; diff --git a/tests/script/tsim/parser/limit_tb.sim b/tests/script/tsim/parser/limit_tb.sim index 6c5706778d..3e82b76758 100644 --- a/tests/script/tsim/parser/limit_tb.sim +++ b/tests/script/tsim/parser/limit_tb.sim @@ -218,7 +218,7 @@ sql select sum(c1), avg(c2), stddev(c3), max(c4), min(c5), count(c6), first(c7), if $rows != 1 then return -1 endi -$val = 45 * $rowNum +$val = 45 * $rowNum $val = $val / 10 print $data05 print $rowNum @@ -464,7 +464,7 @@ endi ### aggregation + limit offset (with interval) sql select max(c1), max(c2), max(c3), max(c4), max(c5), max(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) limit 5 -if $rows != 5 then +if $rows != 5 then return -1 endi if $data01 != 0 then @@ -684,7 +684,7 @@ if $data11 != 3 then endi if $data21 != 3 then return -1 -endi +endi sql select twa(c1), twa(c2), twa(c3), twa(c4), twa(c5), twa(c6) from $tb where ts >= $ts0 and ts <= $tsu limit 3 offset 1 if $rows != 0 then @@ -789,7 +789,7 @@ if $data02 != 3 then endi if $data03 != 5 then return -1 -endi +endi if $data04 != 3.00000 then return -1 endi diff --git a/tests/script/tsim/parser/mixed_blocks.sim b/tests/script/tsim/parser/mixed_blocks.sim index 80cdfcac99..401fd8c0cb 100644 --- a/tests/script/tsim/parser/mixed_blocks.sim +++ b/tests/script/tsim/parser/mixed_blocks.sim @@ -45,10 +45,10 @@ while $x < $rowNum $nchar = 'nchar . $c $nchar = $nchar . ' $c = 0 - $x - sql insert into $tb1 values ( $ts , $x , $x , $x , $x , true, $binary , $nchar ) - sql insert into $tb2 values ( $ts , $c , $c , $c , $c , true, $binary , $nchar ) + sql insert into $tb1 values ( $ts , $x , $x , $x , $x , true, $binary , $nchar ) + sql insert into $tb2 values ( $ts , $c , $c , $c , $c , true, $binary , $nchar ) $x = $x + 1 -endw +endw print ====== tables created sql show databases @@ -69,10 +69,10 @@ while $x < $rowNum $nchar = 'nchar . $c $nchar = $nchar . ' $c = 0 - $x - sql insert into $tb1 values ( $ts , $x , $x , $x , $x , true, $binary , $nchar ) - sql insert into $tb2 values ( $ts , $c , $c , $c , $c , true, $binary , $nchar ) + sql insert into $tb1 values ( $ts , $x , $x , $x , $x , true, $binary , $nchar ) + sql insert into $tb2 values ( $ts , $c , $c , $c , $c , true, $binary , $nchar ) $x = $x + 1 -endw +endw #### query a STable and using where clause to filter out all the data from tb2 and make the query only return first/last of tb1 sql select first(ts,c1), last(ts,c1), spread(c1), t1 from $stb where c1 > 0 group by t1 @@ -154,4 +154,4 @@ print ================== server restart completed sql select ts from m1 where ts='2020-1-1 1:5:1' if $rows != 1 then return -1 -endi \ No newline at end of file +endi diff --git a/tests/script/tsim/parser/nchar.sim b/tests/script/tsim/parser/nchar.sim index ca94d964bb..1f37b057dc 100644 --- a/tests/script/tsim/parser/nchar.sim +++ b/tests/script/tsim/parser/nchar.sim @@ -32,14 +32,14 @@ sql_error create table $mt (ts timestamp, nchar int) sql_error create table $mt (ts timestamp, col int) tags (nchar int) sql create table $mt (ts timestamp, col nchar(60)) tags (tg nchar(60)) sql show stables -if $rows != 1 then +if $rows != 1 then return -1 endi if $data00 != $mt then return -1 endi sql describe $mt -if $rows != 3 then +if $rows != 3 then return -1 endi if $data11 != NCHAR then @@ -128,7 +128,7 @@ print returned: $data01 $quote = " $ret1 = $quote . $data01 $ret2 = $ret1 . $quote -print $ret2 +print $ret2 if $ret2 = "NCHAR" then goto label2 else @@ -140,7 +140,7 @@ sql insert into $tb values (now+7s, "涛思" ) sql select * from $tb order by ts desc print expected: 涛思 print returned: $data01 -if $data01 != 涛思 then +if $data01 != 涛思 then return -1 endi @@ -157,26 +157,26 @@ sql create table $mt (ts timestamp, tbcol nchar(10), tbcol1 int) TAGS(tgcol ncha $i = 0 while $i < 5 $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0' ) + sql create table $tb using $mt tags( '0' ) $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , '0', $x ) + $ms = $x . m + sql insert into $tb values (now + $ms , '0', $x ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw while $i < 10 $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1' ) + sql create table $tb using $mt tags( '1' ) $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , '1', $x ) + $ms = $x . m + sql insert into $tb values (now + $ms , '1', $x ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw # case5: query_with_tag_filtering print ========== nchar.sim case5: query test @@ -205,7 +205,7 @@ endi # cumulative query with nchar tag filtering sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tgcol = '1' -if $rows != 1 then +if $rows != 1 then return -1 endi sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol @@ -225,15 +225,15 @@ if $data10 != 5 then return -1 endi sql_error select avg(tbcol) from $mt where tbcol1 = 1 group by tgcol -sql_error select sum(tbcol) from $mt where tbcol1 = 1 group by tgcol -sql_error select min(tbcol) from $mt where tbcol1 = 1 group by tgcol -sql_error select max(tbcol) from $mt where tbcol1 = 1 group by tgcol +sql_error select sum(tbcol) from $mt where tbcol1 = 1 group by tgcol +sql_error select min(tbcol) from $mt where tbcol1 = 1 group by tgcol +sql_error select max(tbcol) from $mt where tbcol1 = 1 group by tgcol sql select first(tbcol), tgcol from $mt where tbcol1 = 1 group by tgcol order by tgcol if $rows != 2 then return -1 endi -if $data00 != 0 then +if $data00 != 0 then return -1 endi if $data01 != 0 then @@ -250,7 +250,7 @@ sql select last(tbcol), tgcol from $mt where tbcol1 = 1 group by tgcol order by if $rows != 2 then return -1 endi -if $data00 != 0 then +if $data00 != 0 then return -1 endi if $data01 != 0 then @@ -262,7 +262,7 @@ endi if $data11 != 1 then return -1 endi - + sql create table stbb (ts timestamp, c1 nchar(5)) tags (t1 int) sql create table tbb1 using stbb tags(1) sql insert into tbb1 values ('2018-09-17 09:00:00', '涛思') @@ -290,24 +290,24 @@ endi # if $rows != 100 then # return -1 # endi -# +# # sql select * from $mt where ts > now + 4m and tbcol = '1' # if $rows != 75 then # return -1 # endi -# +# # sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol -# -# sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol -# +# +# sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol +# # sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol # -# case: query_with_wildcard +# case: query_with_wildcard # print =============== clear # sql drop database $db # sql show databases -# if $rows != 0 then +# if $rows != 0 then # return -1 # endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/nestquery.sim b/tests/script/tsim/parser/nestquery.sim index 8cb7a3790b..dd7a0c6c81 100644 --- a/tests/script/tsim/parser/nestquery.sim +++ b/tests/script/tsim/parser/nestquery.sim @@ -218,7 +218,7 @@ if $data00 != 0.016666667 then endi sql select derivative(c1, 1s, 0) from (select * from nest_tb0); -print $rows $data00 $data10 +print $rows $data00 $data10 if $rows != 9999 then return -1 endi diff --git a/tests/script/tsim/parser/null_char.sim b/tests/script/tsim/parser/null_char.sim index 1b4d123237..098f4061c1 100644 --- a/tests/script/tsim/parser/null_char.sim +++ b/tests/script/tsim/parser/null_char.sim @@ -433,7 +433,7 @@ endi sql alter table st41 set tag tag_double = '' sql alter table st41 set tag tag_double = 'abc' -sql alter table st41 set tag tag_double = '123abc' +sql alter table st41 set tag tag_double = '123abc' sql_error alter table st41 set tag tag_double = abc ################### bigint smallint tinyint @@ -501,7 +501,7 @@ sql_error alter table st51 set tag tag_tinyint = 'NULL' sql alter table st51 set tag tag_tinyint = '' sql_error alter table st51 set tag tag_tinyint = abc379 -# test end +# test end #sql drop database $db system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/precision_ns.sim b/tests/script/tsim/parser/precision_ns.sim index 45b140f382..522e5174a2 100644 --- a/tests/script/tsim/parser/precision_ns.sim +++ b/tests/script/tsim/parser/precision_ns.sim @@ -9,7 +9,7 @@ $mtPrefix = m_di_mt $ntPrefix = m_di_nt $tbNum = 2 $rowNum = 200 -$futureTs = 300000000000 +$futureTs = 300000000000 print =============== step1: create database and tables and insert data $i = 0 @@ -32,20 +32,20 @@ while $i < $tbNum while $x < $rowNum $cc = $futureTs + $x * 100 + 43 $ns = $cc . b - sql insert into $tb values (now + $ns , $x ) + sql insert into $tb values (now + $ns , $x ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw sql create table $nt (ts timestamp, tbcol int) $x = 0 while $x < $rowNum $cc = $futureTs + $x * 100 + 43 $ns = $cc . b - sql insert into $nt values (now + $ns , $x ) - $x = $x + 1 + sql insert into $nt values (now + $ns , $x ) + $x = $x + 1 endw print =============== step2: select count(*) from tables @@ -83,7 +83,7 @@ print =============== step3: check nano second timestamp $i = 0 $mt = $mtPrefix . $i $tb = $tbPrefix . $i -sql insert into $tb values (now-43b , $x ) +sql insert into $tb values (now-43b , $x ) sql select count(*) from $tb where ts= 2 and t3 <= 9 partition by tbname slimit ################################################## # slm_db1 is a database that contains the exactly the same -# schema as slm_db0, but all records in slm_db1 contains +# schema as slm_db0, but all records in slm_db1 contains # only NULL values. $db = $dbPrefix . 1 sql use $db @@ -156,7 +156,7 @@ if $data00 != 0 then return -1 endi -sql select t1,t2,t3,t4,t5,t6,count(ts) from $stb partition by t1,t2,t3,t4,t5,t6 +sql select t1,t2,t3,t4,t5,t6,count(ts) from $stb partition by t1,t2,t3,t4,t5,t6 if $rows != $tbNum then return -1 endi @@ -164,7 +164,7 @@ endi if $data(slm_tb1)[6] != $rowNum then return -1 endi -if $data(slm_tb2)[6] != $rowNum then +if $data(slm_tb2)[6] != $rowNum then return -1 endi if $data(slm_tb3)[0] != slm_tb3 then @@ -193,7 +193,7 @@ endi if $data00 != $rowNum then return -1 endi -if $data90 != $rowNum then +if $data90 != $rowNum then return -1 endi if $data01 != slm_tb9 then diff --git a/tests/script/tsim/parser/stableOp.sim b/tests/script/tsim/parser/stableOp.sim index 76f9fe202b..213cd10546 100644 --- a/tests/script/tsim/parser/stableOp.sim +++ b/tests/script/tsim/parser/stableOp.sim @@ -33,7 +33,7 @@ if $rows != 1 then return -1 endi print data00 = $data00 -if $data00 != $stb then +if $data00 != $stb then return -1 endi @@ -85,7 +85,7 @@ print create/alter/drop stable test passed sql drop database $db sql show databases -if $rows != 2 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/tags_dynamically_specifiy.sim b/tests/script/tsim/parser/tags_dynamically_specifiy.sim index e6cdeea970..676e91fc5e 100644 --- a/tests/script/tsim/parser/tags_dynamically_specifiy.sim +++ b/tests/script/tsim/parser/tags_dynamically_specifiy.sim @@ -96,4 +96,4 @@ sql create table tm0 using m1 tags('abcd', 'abcd'); sql_error alter table tm0 set tag b = 'abcd1'; sql_error alter table tm0 set tag a = 'abcd1'; -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/tags_filter.sim b/tests/script/tsim/parser/tags_filter.sim index 10fb135de3..cbdd9646ff 100644 --- a/tests/script/tsim/parser/tags_filter.sim +++ b/tests/script/tsim/parser/tags_filter.sim @@ -73,7 +73,7 @@ sql select * from stb where t1 > 'a' print =====================> TD-2685 sql_error select t1, count(t1) from stb; -## wildcard '%' +## wildcard '%' #sql select * from stb where t1 like '%' #if $rows != 1 then # return -1 @@ -100,7 +100,7 @@ endi sql drop database $db sql show databases -if $rows != 2 then +if $rows != 2 then return -1 endi @@ -202,4 +202,4 @@ if $rows != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/tbnameIn.sim b/tests/script/tsim/parser/tbnameIn.sim index 4a6513cfaa..02662f9add 100644 --- a/tests/script/tsim/parser/tbnameIn.sim +++ b/tests/script/tsim/parser/tbnameIn.sim @@ -22,7 +22,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db +sql create database $db print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int, t2 nchar(20), t3 binary(20), t4 bigint, t5 smallint, t6 double) @@ -40,7 +40,7 @@ while $i < $halfNum $tgstr1 = $tgstr1 . ' sql create table $tb using $stb tags( $i , $tgstr , $tgstr , $i , $i , $i ) sql create table $tb1 using $stb tags( $i1 , $tgstr1 , $tgstr1 , $i , $i , $i ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -48,16 +48,16 @@ while $i < $halfNum $c = $x / 10 $c = $c * 10 $c = $x - $c - $binary = 'binary . $c + $binary = 'binary . $c $binary = $binary . ' - $nchar = 'nchar . $c + $nchar = 'nchar . $c $nchar = $nchar . ' sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) $x = $x + 1 - endw + endw $i = $i + 1 -endw +endw print ====== tables created run tsim/parser/tbnameIn_query.sim @@ -69,4 +69,4 @@ print ================== server restart completed run tsim/parser/tbnameIn_query.sim -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/tbnameIn_query.sim b/tests/script/tsim/parser/tbnameIn_query.sim index 6bc40fa028..8c869b8cfa 100644 --- a/tests/script/tsim/parser/tbnameIn_query.sim +++ b/tests/script/tsim/parser/tbnameIn_query.sim @@ -26,7 +26,7 @@ sql use $db sql select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and t1 > 2 # tbname in used on meter -sql select count(*) from $tb where tbname in ('ti_tb1', 'ti_tb300') +sql select count(*) from $tb where tbname in ('ti_tb1', 'ti_tb300') ## tbname in + group by tag print select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') group by t1 order by t1 asc @@ -305,7 +305,7 @@ sql select count(*), t1 from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbn # return -1 #endi # -# +# #$limit = $rowNum #$offset = $limit / 2 #$offset = $offset + 10 @@ -410,7 +410,7 @@ sql select count(*), t1 from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbn #sql select max(c1), min(c2), sum(c3), avg(c4), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2) group by t1 order by t1 limit $limit offset $offset #if $rows != $tbNum then # return -1 -#endi +#endi #if $data00 != @18-11-25 19:30:00.000@ then # return -1 #endi diff --git a/tests/script/tsim/parser/timestamp.sim b/tests/script/tsim/parser/timestamp.sim index e663e499e5..fe4393fff0 100644 --- a/tests/script/tsim/parser/timestamp.sim +++ b/tests/script/tsim/parser/timestamp.sim @@ -30,7 +30,7 @@ while $i < $tbNum $t1 = ' . $tb $t1 = $t1 . ' sql create table $tb using $stb tags( $t1 ) - + $x = 0 while $x < $rowNum $xs = $x * $delta @@ -41,15 +41,15 @@ while $i < $tbNum $binary = binary . $c $nchar = '涛思nchar . $c $nchar = $nchar . ' - sql insert into $tb values ( $ts , $ts , $c ) + sql insert into $tb values ( $ts , $ts , $c ) $x = $x + 1 - endw + endw $ts = $ts + $delta sql insert into $tb values ( $ts , NULL, NULL ) $i = $i + 1 endw print ====== $db tables created - + run tsim/parser/timestamp_query.sim print ================== restart server to commit data into disk diff --git a/tests/script/tsim/parser/timestamp_query.sim b/tests/script/tsim/parser/timestamp_query.sim index e9f13e4461..6e92dbcb3a 100644 --- a/tests/script/tsim/parser/timestamp_query.sim +++ b/tests/script/tsim/parser/timestamp_query.sim @@ -23,7 +23,7 @@ $tsu = $tsu + $ts0 print ==================>issue #3481, normal column not allowed, sql select ts,c1,min(c2) from ts_stb0 -print ==================>issue #4681, not equal operator on primary timestamp not allowed +print ==================>issue #4681, not equal operator on primary timestamp not allowed sql select * from ts_stb0 where ts <> $ts0 ##### select from supertable diff --git a/tests/script/tsim/parser/top_groupby.sim b/tests/script/tsim/parser/top_groupby.sim index ff479a1494..03d0085f25 100644 --- a/tests/script/tsim/parser/top_groupby.sim +++ b/tests/script/tsim/parser/top_groupby.sim @@ -13,7 +13,7 @@ sql use $db sql create stable st2 (ts timestamp, f1 int, f2 float, f3 double, f4 bigint, f5 smallint, f6 tinyint, f7 bool, f8 binary(10), f9 nchar(10)) tags (id1 int, id2 float, id3 nchar(10), id4 double, id5 smallint, id6 bigint, id7 binary(10)) sql create table tb1 using st2 tags (1,1.0,"1",1.0,1,1,"1"); - + sql insert into tb1 values (now-200s,1,1.0,1.0,1,1,1,true,"1","1") sql insert into tb1 values (now-100s,2,2.0,2.0,2,2,2,true,"2","2") sql insert into tb1 values (now,3,3.0,3.0,3,3,3,true,"3","3") diff --git a/tests/script/tsim/parser/where.sim b/tests/script/tsim/parser/where.sim index 08e250c03e..e242dea8ec 100644 --- a/tests/script/tsim/parser/where.sim +++ b/tests/script/tsim/parser/where.sim @@ -17,7 +17,7 @@ $mt = $mtPrefix . $i sql drop database if exists $db -x step1 step1: -sql create database if not exists $db +sql create database if not exists $db sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int) @@ -169,7 +169,7 @@ sql create table wh_mt2_tb1 using wh_mt2 tags ('wh_mt2_tb1') # 2019-01-01 00:10:00.000 1546272600000 # 2019-01-01 09:00:00.000 1546304400000 # 2019-01-01 09:10:00.000 1546305000000 -sql insert into wh_mt2_tb1 values ('2019-01-01 00:00:00.000', '2019-01-01 09:00:00.000', 'binary10', 'nchar10') +sql insert into wh_mt2_tb1 values ('2019-01-01 00:00:00.000', '2019-01-01 09:00:00.000', 'binary10', 'nchar10') sql insert into wh_mt2_tb1 values ('2019-01-01 00:10:00.000', '2019-01-01 09:10:00.000', 'binary10', 'nchar10') sql select * from wh_mt2_tb1 where c1 > 1546304400000 @@ -309,7 +309,7 @@ endi sql select * from wh_mt0 where c3 = 1; print $rows -> 1000 -print $data00 $data01 $data02 +print $data00 $data01 $data02 if $row != 1000 then return -1 endi