diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 9d64f0a40c9fac43aed987be20d4bbca70fa48ee..24465faaba52cbfc28f8121b5a558f43e4379b3e 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2760,7 +2760,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col if (pItem->pNode->Expr.paramList == NULL || (functionId != TSDB_FUNC_LEASTSQR && functionId != TSDB_FUNC_DERIVATIVE && functionId != TSDB_FUNC_ELAPSED && numOfParams != 1) || ((functionId == TSDB_FUNC_LEASTSQR || functionId == TSDB_FUNC_DERIVATIVE) && numOfParams != 3) || - (functionId == TSDB_FUNC_ELAPSED && numOfParams > 2)) { + (functionId == TSDB_FUNC_ELAPSED && numOfParams != 1 && numOfParams != 2)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 5f8964bb34b5939ab768877cb8ae701e20443f75..bcec2ffc57ba46aea9ffd222aa3bf3d3415ab0de 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -3783,7 +3783,7 @@ void tscSetQuerySort(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr) { size_t size = taosArrayGetSize(pQueryInfo->pUpstream); for(int32_t i = 0; i < size; ++i) { SQueryInfo* pq = taosArrayGetP(pQueryInfo->pUpstream, i); - if (pq->groupbyTag && pq->interval.interval > 0) { + if (pq->groupbyTag) { pQueryAttr->needSort = true; return; } diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index bbd448e2d8b5069fae438d7adb9de14a31446d1b..7041c922d9b8ff32d6c1340fe313769cf4cf9729 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -113,7 +113,7 @@ int32_t tscAcquireRpc(const char *key, const char *user, const char *secretEncry SRpcObj rpcObj; memset(&rpcObj, 0, sizeof(rpcObj)); - strncpy(rpcObj.key, key, strlen(key)); + tstrncpy(rpcObj.key, key, sizeof(rpcObj.key)); rpcObj.pDnodeConn = rpcOpen(&rpcInit); if (rpcObj.pDnodeConn == NULL) { pthread_mutex_unlock(&rpcObjMutex); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 3367c4a36acc33413fae256290ddc5926f2720e3..874a022a7104860fce8f6389bcc933b36a2fef22 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4928,7 +4928,11 @@ int32_t createProjectionExpr(SQueryInfo* pQueryInfo, STableMetaInfo* pTableMetaI } } - pse->colInfo.flag = pSource->base.colInfo.flag; //TSDB_COL_NORMAL; + if (!pQueryInfo->stableQuery && TSDB_COL_IS_TAG(pSource->base.colInfo.flag)) { + pse->colInfo.flag = (pSource->base.colInfo.flag) & (~TSDB_COL_TAG); + } else { + pse->colInfo.flag = pSource->base.colInfo.flag; + } pse->resType = pSource->base.resType; pse->resBytes = pSource->base.resBytes; strncpy(pse->colInfo.name, pSource->base.aliasName, tListLen(pse->colInfo.name)); diff --git a/src/connector/go b/src/connector/go index 25f8683ece07897fea12c347d369602b2235665f..7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4 160000 --- a/src/connector/go +++ b/src/connector/go @@ -1 +1 @@ -Subproject commit 25f8683ece07897fea12c347d369602b2235665f +Subproject commit 7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4 diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java index afba0398752f1fd6c23dd7874301be27616fdab2..501c7e17c837ce311ec0f7b43f63122e53b8a0d9 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java @@ -1,19 +1,19 @@ package com.taosdata.jdbc; -import com.google.common.collect.Lists; -import org.checkerframework.checker.units.qual.A; +import com.taosdata.jdbc.annotation.CatalogRunner; +import com.taosdata.jdbc.annotation.Description; +import com.taosdata.jdbc.annotation.TestTarget; import org.junit.*; +import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import java.sql.*; -import java.util.List; -/** - * test json tag - */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) +@RunWith(CatalogRunner.class) +@TestTarget(alias = "JsonTag", author = "huolibo", version = "2.0.36") public class JsonTagTest { - private static String dbname = "json_tag_test"; + private static final String dbName = "json_tag_test"; private static Connection connection; private static Statement statement; private static final String superSql = "create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)"; @@ -74,6 +74,7 @@ public class JsonTagTest { }; @Test + @Description("insert json tag") public void case01_InsertTest() throws SQLException { for (String sql : sql) { statement.execute(sql); @@ -87,7 +88,8 @@ public class JsonTagTest { } @Test - public void case02_InvalidJsonInsertTest() { + @Description("error json tag insert") + public void case02_ErrorJsonInsertTest() { int count = 0; for (String sql : errorJsonInsertSql) { try { @@ -99,59 +101,62 @@ public class JsonTagTest { Assert.assertEquals(errorJsonInsertSql.length, count); } - // test invalidate json key, key must can be printed assic char @Test(expected = SQLException.class) + @Description("exception will throw when json value is array") public void case02_ArrayErrorTest() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":[1,true]}')"); } @Test(expected = SQLException.class) - public void case02_EmptyKeyErrorTest() throws SQLException { - statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\":\"fff\"}')"); - } - - @Test(expected = SQLException.class) + @Description("exception will throw when json value is empty") public void case02_EmptyValueErrorTest() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":{}}')"); } @Test(expected = SQLException.class) + @Description("exception will throw when json key is not ASCII") public void case02_AbnormalKeyErrorTest1() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"。loc\":\"fff\"}')"); } @Test(expected = SQLException.class) + @Description("exception will throw when json key is '\\t'") public void case02_AbnormalKeyErrorTest2() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\t\":\"fff\"}')"); } @Test(expected = SQLException.class) + @Description("exception will throw when json key is chinese") public void case02_AbnormalKeyErrorTest3() throws SQLException { statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"试试\":\"fff\"}')"); } @Test + @Description("alter json tag") public void case03_AlterTag() throws SQLException { statement.execute("ALTER TABLE jsons1_1 SET TAG jtag='{\"tag1\":\"femail\",\"tag2\":35,\"tag3\":true}'"); } @Test(expected = SQLException.class) + @Description("exception will throw when add json tag") public void case03_AddTagErrorTest() throws SQLException { statement.execute("ALTER STABLE jsons1 add tag tag2 nchar(20)"); } @Test(expected = SQLException.class) + @Description("exception will throw when delete json tag") public void case03_dropTagErrorTest() throws SQLException { statement.execute("ALTER STABLE jsons1 drop tag jtag"); } @Test(expected = SQLException.class) + @Description("exception will throw when set some json tag value") public void case03_AlterTagErrorTest() throws SQLException { statement.execute("ALTER TABLE jsons1_1 SET TAG jtag=4"); } - // test error syntax @Test + @Description("exception will throw when select syntax error") public void case04_SelectErrorTest() { int count = 0; for (String sql : errorSelectSql) { @@ -164,8 +169,8 @@ public class JsonTagTest { Assert.assertEquals(errorSelectSql.length, count); } - // test select normal column @Test + @Description("normal select stable") public void case04_select01() throws SQLException { ResultSet resultSet = statement.executeQuery("select dataint from jsons1"); int count = 0; @@ -176,8 +181,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag @Test + @Description("select all column from stable") public void case04_select02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1"); int count = 0; @@ -189,6 +194,7 @@ public class JsonTagTest { } @Test + @Description("select json tag from stable") public void case04_select03() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1"); int count = 0; @@ -200,6 +206,7 @@ public class JsonTagTest { } @Test + @Description("where condition tag is null") public void case04_select04() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1 where jtag is null"); int count = 0; @@ -211,6 +218,7 @@ public class JsonTagTest { } @Test + @Description("where condition tag is not null") public void case04_select05() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1 where jtag is not null"); int count = 0; @@ -222,6 +230,7 @@ public class JsonTagTest { } @Test + @Description("select json tag") public void case04_select06() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1_8"); resultSet.next(); @@ -231,6 +240,7 @@ public class JsonTagTest { } @Test + @Description("select json tag") public void case04_select07() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1_1"); resultSet.next(); @@ -239,8 +249,8 @@ public class JsonTagTest { close(resultSet); } - // test jtag is NULL @Test + @Description("select not exist json tag") public void case04_select08() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag from jsons1_9"); resultSet.next(); @@ -249,8 +259,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is string @Test + @Description("select a json tag") public void case04_select09() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_1"); resultSet.next(); @@ -260,6 +270,7 @@ public class JsonTagTest { } @Test + @Description("select a json tag, the value is empty") public void case04_select10() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag2' from jsons1_6"); resultSet.next(); @@ -268,8 +279,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is int @Test + @Description("select a json tag, the value is int") public void case04_select11() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag2' from jsons1_1"); resultSet.next(); @@ -278,8 +289,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is bool @Test + @Description("select a json tag, the value is boolean") public void case04_select12() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag3' from jsons1_1"); resultSet.next(); @@ -288,8 +299,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is null @Test + @Description("select a json tag, the value is null") public void case04_select13() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_4"); resultSet.next(); @@ -298,8 +309,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', value is double @Test + @Description("select a json tag, the value is double") public void case04_select14() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_5"); resultSet.next(); @@ -308,8 +319,8 @@ public class JsonTagTest { close(resultSet); } - // test select json tag->'key', key is not exist @Test + @Description("select a json tag, the key is not exist") public void case04_select15() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag10' from jsons1_4"); resultSet.next(); @@ -319,6 +330,7 @@ public class JsonTagTest { } @Test + @Description("select a json tag, the result number equals tables number") public void case04_select16() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1"); int count = 0; @@ -330,18 +342,7 @@ public class JsonTagTest { } @Test - public void case04_select17() throws SQLException { - ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1"); - int count = 0; - while (resultSet.next()) { - count++; - } - Assert.assertEquals(sql.length + invalidJsonCreateSql.length + invalidJsonInsertSql.length, count); - close(resultSet); - } - - // where json value is string - @Test + @Description("where condition '=' for string") public void case04_select19() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'='beijing'"); int count = 0; @@ -353,6 +354,7 @@ public class JsonTagTest { } @Test + @Description("select and where conditon '=' for string") public void case04_select20() throws SQLException { ResultSet resultSet = statement.executeQuery("select dataint,tbname,jtag->'tag1',jtag from jsons1 where jtag->'tag2'='beijing'"); int count = 0; @@ -364,6 +366,7 @@ public class JsonTagTest { } @Test + @Description("where condition result is null") public void case04_select21() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='beijing'"); int count = 0; @@ -375,6 +378,7 @@ public class JsonTagTest { } @Test + @Description("where condition equation has chinese") public void case04_select23() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='收到货'"); int count = 0; @@ -386,6 +390,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>' for character") public void case05_symbolOperation01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'>'beijing'"); int count = 0; @@ -397,6 +402,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>=' for character") public void case05_symbolOperation02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'>='beijing'"); int count = 0; @@ -408,6 +414,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<' for character") public void case05_symbolOperation03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'<'beijing'"); int count = 0; @@ -419,6 +426,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<=' in character") public void case05_symbolOperation04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'<='beijing'"); int count = 0; @@ -430,6 +438,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' in character") public void case05_symbolOperation05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'!='beijing'"); int count = 0; @@ -441,6 +450,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '=' empty") public void case05_symbolOperation06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'=''"); int count = 0; @@ -453,11 +463,11 @@ public class JsonTagTest { // where json value is int @Test + @Description("where condition support '=' for int") public void case06_selectValue01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=5"); int count = 0; while (resultSet.next()) { - System.out.println(resultSet.getString(1)); count++; } Assert.assertEquals(1, count); @@ -465,6 +475,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '<' for int") public void case06_selectValue02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<54"); int count = 0; @@ -476,6 +487,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<=' for int") public void case06_selectValue03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<=11"); int count = 0; @@ -487,6 +499,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '>' for int") public void case06_selectValue04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>4"); int count = 0; @@ -498,6 +511,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>=' for int") public void case06_selectValue05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>=5"); int count = 0; @@ -509,6 +523,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '!=' for int") public void case06_selectValue06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=5"); int count = 0; @@ -520,6 +535,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '!=' for int") public void case06_selectValue07() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=55"); int count = 0; @@ -531,6 +547,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support '!=' for int and result is nothing") public void case06_selectValue08() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=10"); int count = 0; @@ -541,8 +558,8 @@ public class JsonTagTest { close(resultSet); } - // where json value is double @Test + @Description("where condition support '=' for double") public void case07_selectValue01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=1.232"); int count = 0; @@ -554,6 +571,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<' for double") public void case07_doubleOperation01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<1.232"); int count = 0; @@ -565,6 +583,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '<=' for double") public void case07_doubleOperation02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<=1.232"); int count = 0; @@ -576,6 +595,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>' for double") public void case07_doubleOperation03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>1.23"); int count = 0; @@ -587,6 +607,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '>=' for double") public void case07_doubleOperation04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>=1.232"); int count = 0; @@ -598,6 +619,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' for double") public void case07_doubleOperation05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=1.232"); int count = 0; @@ -609,6 +631,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' for double") public void case07_doubleOperation06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=3.232"); int count = 0; @@ -620,16 +643,19 @@ public class JsonTagTest { } @Test(expected = SQLException.class) + @Description("exception will throw when denominator is zero") public void case07_doubleOperation07() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1'/0=3"); } @Test(expected = SQLException.class) + @Description("exception will throw when invalid operation") public void case07_doubleOperation08() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1'/5=1"); } @Test + @Description("where condition support '=' for boolean") public void case08_boolOperation01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=true"); int count = 0; @@ -641,6 +667,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '=' for boolean") public void case08_boolOperation02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false"); int count = 0; @@ -652,6 +679,7 @@ public class JsonTagTest { } @Test + @Description("where condition support '!=' for boolean") public void case08_boolOperation03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=false"); int count = 0; @@ -663,12 +691,13 @@ public class JsonTagTest { } @Test(expected = SQLException.class) + @Description("exception will throw when '>' operation for boolean") public void case08_boolOperation04() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1'>false"); } - // where json value is null @Test + @Description("where conditional support '=null'") public void case09_select01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=null"); int count = 0; @@ -680,6 +709,7 @@ public class JsonTagTest { } @Test + @Description("where conditional support 'is null'") public void case09_select02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag is null"); int count = 0; @@ -691,6 +721,7 @@ public class JsonTagTest { } @Test + @Description("where condition support 'is not null'") public void case09_select03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag is not null"); int count = 0; @@ -702,6 +733,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag '='") public void case09_select04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag_no_exist'=3"); int count = 0; @@ -713,6 +745,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag 'is null'") public void case09_select05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' is null"); int count = 0; @@ -724,6 +757,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag 'is null'") public void case09_select06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag4' is null"); int count = 0; @@ -735,6 +769,7 @@ public class JsonTagTest { } @Test + @Description("where condition support one tag 'is not null'") public void case09_select07() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag3' is not null"); int count = 0; @@ -745,8 +780,8 @@ public class JsonTagTest { close(resultSet); } - // test ? @Test + @Description("contains") public void case09_select10() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag1'"); int count = 0; @@ -758,6 +793,7 @@ public class JsonTagTest { } @Test + @Description("contains") public void case09_select11() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag3'"); int count = 0; @@ -769,6 +805,7 @@ public class JsonTagTest { } @Test + @Description("contains with no exist tag") public void case09_select12() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag_no_exist'"); int count = 0; @@ -779,8 +816,8 @@ public class JsonTagTest { close(resultSet); } - // test json tag in where condition with and/or @Test + @Description("where condition with and") public void case10_selectAndOr01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='beijing'"); int count = 0; @@ -792,6 +829,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'or'") public void case10_selectAndOr02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false or jtag->'tag2'='beijing'"); int count = 0; @@ -803,6 +841,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'and'") public void case10_selectAndOr03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'"); int count = 0; @@ -814,6 +853,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'or'") public void case10_selectAndOr04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35"); int count = 0; @@ -825,6 +865,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'or' and contains") public void case10_selectAndOr05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' is not null and jtag contains 'tag3'"); int count = 0; @@ -836,6 +877,7 @@ public class JsonTagTest { } @Test + @Description("where condition with 'and' and contains") public void case10_selectAndOr06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='femail' and jtag contains 'tag3'"); int count = 0; @@ -846,8 +888,8 @@ public class JsonTagTest { close(resultSet); } - // test with tbname/normal column @Test + @Description("test with tbname/normal column") public void case11_selectTbName01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1'"); int count = 0; @@ -859,6 +901,7 @@ public class JsonTagTest { } @Test + @Description("test with tbname/normal column") public void case11_selectTbName02() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3'"); int count = 0; @@ -870,6 +913,7 @@ public class JsonTagTest { } @Test + @Description("test with tbname/normal column") public void case11_selectTbName03() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=3"); int count = 0; @@ -881,6 +925,7 @@ public class JsonTagTest { } @Test + @Description("test with tbname/normal column") public void case11_selectTbName04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=23"); int count = 0; @@ -891,8 +936,8 @@ public class JsonTagTest { close(resultSet); } - // test where condition like @Test + @Description("where condition like") public void case12_selectWhere01() throws SQLException { ResultSet resultSet = statement.executeQuery("select *,tbname from jsons1 where jtag->'tag2' like 'bei%'"); int count = 0; @@ -904,6 +949,7 @@ public class JsonTagTest { } @Test + @Description("where condition like") public void case12_selectWhere02() throws SQLException { ResultSet resultSet = statement.executeQuery("select *,tbname from jsons1 where jtag->'tag1' like 'fe%' and jtag->'tag2' is not null"); int count = 0; @@ -914,14 +960,14 @@ public class JsonTagTest { close(resultSet); } - // test where condition in no support in @Test(expected = SQLException.class) + @Description("where condition in no support in") public void case12_selectWhere03() throws SQLException { statement.executeQuery("select * from jsons1 where jtag->'tag1' in ('beijing')"); } - // test where condition match @Test + @Description("where condition match") public void case12_selectWhere04() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match 'ma'"); int count = 0; @@ -933,6 +979,7 @@ public class JsonTagTest { } @Test + @Description("where condition match") public void case12_selectWhere05() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match 'ma$'"); int count = 0; @@ -944,6 +991,7 @@ public class JsonTagTest { } @Test + @Description("where condition match") public void case12_selectWhere06() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2' match 'jing$'"); int count = 0; @@ -955,6 +1003,7 @@ public class JsonTagTest { } @Test + @Description("where condition match") public void case12_selectWhere07() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match '收到'"); int count = 0; @@ -965,13 +1014,14 @@ public class JsonTagTest { close(resultSet); } - // test distinct @Test + @Description("insert distinct") public void case13_selectDistinct01() throws SQLException { statement.execute("insert into jsons1_14 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '你就会', 'dws')"); } @Test + @Description("distinct json tag") public void case13_selectDistinct02() throws SQLException { ResultSet resultSet = statement.executeQuery("select distinct jtag->'tag1' from jsons1"); int count = 0; @@ -983,6 +1033,7 @@ public class JsonTagTest { } @Test + @Description("distinct json tag") public void case13_selectDistinct03() throws SQLException { ResultSet resultSet = statement.executeQuery("select distinct jtag from jsons1"); int count = 0; @@ -993,13 +1044,14 @@ public class JsonTagTest { close(resultSet); } - // test dumplicate key with normal colomn @Test + @Description("insert json tag") public void case14_selectDump01() throws SQLException { statement.execute("INSERT INTO jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"datastr\":\"是是是\"}') values(1591060828000, 4, false, 'jjsf', \"你就会\")"); } @Test + @Description("test duplicate key with normal column") public void case14_selectDump02() throws SQLException { ResultSet resultSet = statement.executeQuery("select *,tbname,jtag from jsons1 where jtag->'datastr' match '是' and datastr match 'js'"); int count = 0; @@ -1011,6 +1063,7 @@ public class JsonTagTest { } @Test + @Description("test duplicate key with normal column") public void case14_selectDump03() throws SQLException { ResultSet resultSet = statement.executeQuery("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'"); int count = 0; @@ -1021,8 +1074,8 @@ public class JsonTagTest { close(resultSet); } - // test join @Test + @Description("insert json tag for join test") public void case15_selectJoin01() throws SQLException { statement.execute("create table if not exists jsons2(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)"); statement.execute("insert into jsons2_1 using jsons2 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 2, false, 'json2', '你是2')"); @@ -1033,17 +1086,17 @@ public class JsonTagTest { statement.execute("insert into jsons3_2 using jsons3 tags('{\"tag1\":5,\"tag2\":\"beijing\"}') values (1591060638000, 2, true, 'json3', 'sss')"); } - // TODO check result @Test + @Description("select json tag from join") public void case15_selectJoin02() throws SQLException { ResultSet resultSet = statement.executeQuery("select 'sss',33,a.jtag->'tag3' from jsons2 a,jsons3 b where a.ts=b.ts and a.jtag->'tag1'=b.jtag->'tag1'"); - + resultSet.next(); + Assert.assertEquals("sss", resultSet.getString(1)); close(resultSet); } - // test group by & order by json tag - // TODO check other result @Test + @Description("group by and order by json tag desc") public void case16_selectGroupOrder01() throws SQLException { ResultSet resultSet = statement.executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' desc"); int count = 0; @@ -1055,6 +1108,7 @@ public class JsonTagTest { } @Test + @Description("group by and order by json tag asc") public void case16_selectGroupOrder02() throws SQLException { ResultSet resultSet = statement.executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' asc"); int count = 0; @@ -1065,9 +1119,8 @@ public class JsonTagTest { close(resultSet); } - // test stddev with group by json tag - // TODO check result @Test + @Description("stddev with group by json tag") public void case17_selectStddev01() throws SQLException { ResultSet resultSet = statement.executeQuery("select stddev(dataint) from jsons1 group by jtag->'tag1'"); String s = ""; @@ -1082,8 +1135,8 @@ public class JsonTagTest { close(resultSet); } - // subquery with json tag @Test + @Description("subquery json tag") public void case18_selectSubquery01() throws SQLException { ResultSet resultSet = statement.executeQuery("select * from (select jtag, dataint from jsons1)"); int count = 0; @@ -1095,8 +1148,14 @@ public class JsonTagTest { } @Test + @Description("subquery some json tags") public void case18_selectSubquery02() throws SQLException { ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)"); + + ResultSetMetaData metaData = resultSet.getMetaData(); + String columnName = metaData.getColumnName(1); + Assert.assertEquals("jtag->'tag1'", columnName); + int count = 0; while (resultSet.next()) { count++; @@ -1106,15 +1165,7 @@ public class JsonTagTest { } @Test - public void case18_selectSubquery03() throws SQLException { - ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)"); - ResultSetMetaData metaData = resultSet.getMetaData(); - String columnName = metaData.getColumnName(1); - Assert.assertEquals("jtag->'tag1'", columnName); - close(resultSet); - } - - @Test + @Description("query some json tags from subquery") public void case18_selectSubquery04() throws SQLException { ResultSet resultSet = statement.executeQuery("select ts,tbname,jtag->'tag1' from (select jtag->'tag1',tbname,ts from jsons1 order by ts)"); int count = 0; @@ -1142,9 +1193,9 @@ public class JsonTagTest { try { connection = DriverManager.getConnection(url); statement = connection.createStatement(); - statement.execute("drop database if exists " + dbname); - statement.execute("create database if not exists " + dbname); - statement.execute("use " + dbname); + statement.execute("drop database if exists " + dbName); + statement.execute("create database if not exists " + dbName); + statement.execute("use " + dbName); statement.execute(superSql); } catch (SQLException e) { e.printStackTrace(); @@ -1155,7 +1206,7 @@ public class JsonTagTest { public static void afterClass() { try { if (null != statement) { - statement.execute("drop database " + dbname); + statement.execute("drop database " + dbName); statement.close(); } if (null != connection) { diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java index a090dd10e3564d498ab807909f97aefb3b2f3466..712cc0c8c1b0b094a20db0fe36d33f553878d71d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java @@ -2,17 +2,23 @@ package com.taosdata.jdbc; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.taosdata.jdbc.annotation.CatalogRunner; +import com.taosdata.jdbc.annotation.Description; +import com.taosdata.jdbc.annotation.TestTarget; import com.taosdata.jdbc.enums.SchemalessProtocolType; import com.taosdata.jdbc.enums.SchemalessTimestampType; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import java.sql.*; import java.util.ArrayList; import java.util.List; +@RunWith(CatalogRunner.class) +@TestTarget(alias = "Schemaless",author = "huolibo", version = "2.0.36") public class SchemalessInsertTest { private final String dbname = "test_schemaless_insert"; private Connection conn; @@ -23,6 +29,7 @@ public class SchemalessInsertTest { * @throws SQLException execute error */ @Test + @Description("line insert") public void schemalessInsert() throws SQLException { // given String[] lines = new String[]{ @@ -53,6 +60,7 @@ public class SchemalessInsertTest { * @throws SQLException execute error */ @Test + @Description("telnet insert") public void telnetInsert() throws SQLException { // given String[] lines = new String[]{ @@ -87,6 +95,7 @@ public class SchemalessInsertTest { * @throws SQLException execute error */ @Test + @Description("json insert") public void jsonInsert() throws SQLException { // given String json = "[\n" + diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java new file mode 100644 index 0000000000000000000000000000000000000000..490346e401dba956c8743abb452bcc943df67904 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java @@ -0,0 +1,86 @@ +package com.taosdata.jdbc.annotation; + +import java.util.ArrayList; +import java.util.List; + +/** + * Test class + */ +public class CatalogClass { + + private String name; + private String alias; + private String author; + private String version; + private List methods = new ArrayList<>(); + private int total; + private int failure; + + public void setTotal(int total) { + this.total = total; + } + + public void setFailure(int failure) { + this.failure = failure; + } + + public void setAuthor(String author) { + this.author = author; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setName(String name) { + this.name = name; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public void setMethods(List methods) { + this.methods = methods; + } + + @Override + public String toString() { + if (methods.size() < 1) + return null; + StringBuilder sb = new StringBuilder(); + sb.append("ClassName: ").append(name); + String msg = trim(alias); + if (null != msg) + sb.append("\tAlias:").append(alias); + sb.append("\tTotal:").append(total) + .append("\tFailure:").append(failure).append("\n"); + for (CatalogMethod method : methods) { + sb.append("\t").append(method.getName()); + sb.append("\t").append(method.isSuccess()); + sb.append("\t").append(method.getMessage()); + String mAuthor = trim(method.getAuthor()); + if (null == mAuthor) { + sb.append("\t").append(author); + } else { + sb.append("\t").append(method.getAuthor()); + } + String mVersion = trim(method.getVersion()); + if (null == mVersion) { + sb.append("\t").append(version); + } else { + sb.append("\t").append(mVersion); + } + sb.append("\n"); + } + return sb.toString(); + } + + private String trim(String s) { + if (null == s || s.trim().equals("")) { + return null; + } else { + return s.trim(); + } + } +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java new file mode 100644 index 0000000000000000000000000000000000000000..2d22302d02f531eca055fa76dea18d8de9f7371f --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java @@ -0,0 +1,104 @@ +package com.taosdata.jdbc.annotation; + +import org.junit.runner.Description; +import org.junit.runner.Result; +import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunListener; + +import java.io.File; +import java.io.FileWriter; +import java.util.LinkedList; + +public class CatalogListener extends RunListener { + public static final String CATALOG_FILE = "target/TestCaseCatalog.txt"; + CatalogClass catalogClass = null; + private final LinkedList methods = new LinkedList<>(); + + @Override + public void testRunStarted(Description description) throws Exception { + catalogClass = new CatalogClass(); + TestTarget target = description.getAnnotation(TestTarget.class); + if (target != null) { + catalogClass.setAlias(target.alias()); + catalogClass.setAuthor(target.author()); + catalogClass.setVersion(target.version()); + } + catalogClass.setName(getClassName(description.getClassName())); + } + + private String getClassName(String name) { + if (null == name || name.trim().equals("")) { + return null; + } + name = name.trim(); + int pos = name.lastIndexOf("."); + if (-1 == pos) { + return name; + } + return name.substring(pos + 1); + } + + @Override + public void testRunFinished(Result result) throws Exception { + catalogClass.setMethods(methods); + catalogClass.setTotal(result.getRunCount()); + catalogClass.setFailure(result.getFailureCount()); + File file = new File(CATALOG_FILE); + if (!file.exists()) { + synchronized (CatalogListener.class) { + if (!file.exists()) { + file.createNewFile(); + try (FileWriter writer = new FileWriter(file, true)) { + writer.write("\tName\tPass\tMessage\tAuthor\tVersion\n"); + writer.write(catalogClass.toString()); + } + } + } + } else { + try (FileWriter writer = new FileWriter(file, true)) { + writer.write(catalogClass.toString()); + } + } + } + + @Override + public void testStarted(Description description) throws Exception { + } + + @Override + public void testFinished(Description description) throws Exception { + com.taosdata.jdbc.annotation.Description annotation + = description.getAnnotation(com.taosdata.jdbc.annotation.Description.class); + if (annotation != null) { + CatalogMethod method = new CatalogMethod(); + method.setMessage(annotation.value()); + method.setAuthor(annotation.author()); + method.setVersion(annotation.version()); + method.setSuccess(true); + method.setName(description.getMethodName()); + methods.addLast(method); + } + } + + @Override + public void testFailure(Failure failure) throws Exception { + com.taosdata.jdbc.annotation.Description annotation + = failure.getDescription().getAnnotation(com.taosdata.jdbc.annotation.Description.class); + CatalogMethod method = new CatalogMethod(); + method.setMessage(annotation.value()); + method.setAuthor(annotation.author()); + method.setVersion(annotation.version()); + method.setSuccess(false); + method.setName(failure.getDescription().getMethodName()); + methods.addFirst(method); + } + + @Override + public void testAssumptionFailure(Failure failure) { + } + + @Override + public void testIgnored(Description description) throws Exception { + super.testIgnored(description); + } +} \ No newline at end of file diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java new file mode 100644 index 0000000000000000000000000000000000000000..1dd074df2d1298781bbbfa7e7709113db2c6ca01 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java @@ -0,0 +1,52 @@ +package com.taosdata.jdbc.annotation; + +/** + * Test method + */ +public class CatalogMethod { + private String name; + private boolean success; + private String message; + private String author; + private String version; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java new file mode 100644 index 0000000000000000000000000000000000000000..08e5f9212287d517838448d0122ab0876812cc1d --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java @@ -0,0 +1,36 @@ +package com.taosdata.jdbc.annotation; + +import org.junit.internal.AssumptionViolatedException; +import org.junit.internal.runners.model.EachTestNotifier; +import org.junit.runner.notification.RunNotifier; +import org.junit.runner.notification.StoppedByUserException; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.InitializationError; +import org.junit.runners.model.Statement; + +public class CatalogRunner extends BlockJUnit4ClassRunner { + + public CatalogRunner(Class testClass) throws InitializationError { + super(testClass); + } + + @Override + public void run(RunNotifier notifier) { + //add user-defined listener + notifier.addListener(new CatalogListener()); + EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription()); + + notifier.fireTestRunStarted(getDescription()); + + try { + Statement statement = classBlock(notifier); + statement.evaluate(); + } catch (AssumptionViolatedException av) { + testNotifier.addFailedAssumption(av); + } catch (StoppedByUserException exception) { + throw exception; + } catch (Throwable e) { + testNotifier.addFailure(e); + } + } +} \ No newline at end of file diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java new file mode 100644 index 0000000000000000000000000000000000000000..669b0a088656c030281e82620117469b3a375c75 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java @@ -0,0 +1,19 @@ +package com.taosdata.jdbc.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface Description { + + String value(); + + // git blame author + String author() default ""; + + // since which version; + String version() default ""; +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java new file mode 100644 index 0000000000000000000000000000000000000000..3d1db681647d3b23818143156ffd513c46a6e495 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java @@ -0,0 +1,18 @@ +package com.taosdata.jdbc.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE}) +public @interface TestTarget { + + String alias() default ""; + + String author(); + + String version() default ""; + +} diff --git a/src/kit/taos-tools b/src/kit/taos-tools index 78519c0c90a261b6a559c6bbe7f3d3b5a7b630b4..0b4a16e96b5cc9cb6e4f8cacf6a1f3028c91adb0 160000 --- a/src/kit/taos-tools +++ b/src/kit/taos-tools @@ -1 +1 @@ -Subproject commit 78519c0c90a261b6a559c6bbe7f3d3b5a7b630b4 +Subproject commit 0b4a16e96b5cc9cb6e4f8cacf6a1f3028c91adb0 diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index 4c61cbb0f730780c6c7106a02c765974b2d21706..6a19ca5c8d1e0c7f30da30c37c24c008ea34b2ee 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -588,6 +588,12 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { op = OP_Fill; taosArrayPush(plan, &op); } + // outer query order by support + int32_t orderColId = pQueryAttr->order.orderColId; + if (pQueryAttr->vgId == 0 && orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX && orderColId != INT32_MIN) { + op = OP_Order; + taosArrayPush(plan, &op); + } } } else if (pQueryAttr->groupbyColumn) { diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 232d10a7d07594c9c62cd13767c320da27af2a73..7b5dafcc8e771ba7d6e7b5691226bbc84a556ef8 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -131,7 +131,7 @@ void taosCloseLog() { taosStopLog(); //tsem_post(&(tsLogObj.logHandle->buffNotEmpty)); taosMsleep(MAX_LOG_INTERVAL/1000); - if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { + if (tsLogObj.logHandle && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { pthread_join(tsLogObj.logHandle->asyncThread, NULL); } // In case that other threads still use log resources causing invalid write in valgrind diff --git a/tests/examples/C#/taosdemo/taosdemo.cs b/tests/examples/C#/taosdemo/taosdemo.cs index 2c77285488830323ed03a04a1d1c89c048ad2ea8..e62a502d1508c1339e559160b50da39e622a021f 100644 --- a/tests/examples/C#/taosdemo/taosdemo.cs +++ b/tests/examples/C#/taosdemo/taosdemo.cs @@ -361,7 +361,10 @@ namespace TDengineDriver threadArr[i] = new Thread(createTableThread.ThreadMain); threadArr[i].Start(); - threadArr[i].Join(); + } + for (int j = 0; j < numOfThreads; j++) + { + threadArr[j].Join(); } } @@ -482,7 +485,10 @@ namespace TDengineDriver threadArr[i] = new Thread(insertThread.ThreadMain); threadArr[i].Start(); - threadArr[i].Join(); + } + for (int j = 0; j < numOfThreads; j++) + { + threadArr[j].Join(); } } diff --git a/tests/pytest/fulltest-connector.sh b/tests/pytest/fulltest-connector.sh new file mode 100755 index 0000000000000000000000000000000000000000..eb685bd2146508a55d470c45bd3b4780997de64c --- /dev/null +++ b/tests/pytest/fulltest-connector.sh @@ -0,0 +1,9 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +# restful test for python +# python3 test.py -f restful/restful_bind_db1.py +# python3 test.py -f restful/restful_bind_db2.py +python3 ./test.py -f client/nettest.py \ No newline at end of file diff --git a/tests/pytest/fulltest-insert.sh b/tests/pytest/fulltest-insert.sh new file mode 100755 index 0000000000000000000000000000000000000000..6a2a027c818ecc018829436b63e86a9d96629e5b --- /dev/null +++ b/tests/pytest/fulltest-insert.sh @@ -0,0 +1,154 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +python3 testCompress.py +python3 testNoCompress.py + +python3 ./test.py -f import_merge/importBlock1HO.py +python3 ./test.py -f import_merge/importBlock1HPO.py +python3 ./test.py -f import_merge/importBlock1H.py +python3 ./test.py -f import_merge/importBlock1S.py +python3 ./test.py -f import_merge/importBlock1Sub.py +python3 ./test.py -f import_merge/importBlock1TO.py +python3 ./test.py -f import_merge/importBlock1TPO.py +python3 ./test.py -f import_merge/importBlock1T.py +python3 ./test.py -f import_merge/importBlock2HO.py +python3 ./test.py -f import_merge/importBlock2HPO.py +python3 ./test.py -f import_merge/importBlock2H.py +python3 ./test.py -f import_merge/importBlock2S.py +python3 ./test.py -f import_merge/importBlock2Sub.py +python3 ./test.py -f import_merge/importBlock2TO.py +python3 ./test.py -f import_merge/importBlock2TPO.py +python3 ./test.py -f import_merge/importBlock2T.py +python3 ./test.py -f import_merge/importBlockbetween.py +python3 ./test.py -f import_merge/importCacheFileHO.py +python3 ./test.py -f import_merge/importCacheFileHPO.py +python3 ./test.py -f import_merge/importCacheFileH.py +python3 ./test.py -f import_merge/importCacheFileS.py +python3 ./test.py -f import_merge/importCacheFileSub.py +python3 ./test.py -f import_merge/importCacheFileTO.py +python3 ./test.py -f import_merge/importCacheFileTPO.py +python3 ./test.py -f import_merge/importCacheFileT.py +python3 ./test.py -f import_merge/importDataH2.py +python3 ./test.py -f import_merge/importDataHO2.py +python3 ./test.py -f import_merge/importDataHO.py +python3 ./test.py -f import_merge/importDataHPO.py +python3 ./test.py -f import_merge/importDataLastHO.py +python3 ./test.py -f import_merge/importDataLastHPO.py +python3 ./test.py -f import_merge/importDataLastH.py +python3 ./test.py -f import_merge/importDataLastS.py +python3 ./test.py -f import_merge/importDataLastSub.py +python3 ./test.py -f import_merge/importDataLastTO.py +python3 ./test.py -f import_merge/importDataLastTPO.py +python3 ./test.py -f import_merge/importDataLastT.py +python3 ./test.py -f import_merge/importDataS.py +python3 ./test.py -f import_merge/importDataSub.py +python3 ./test.py -f import_merge/importDataTO.py +python3 ./test.py -f import_merge/importDataTPO.py +python3 ./test.py -f import_merge/importDataT.py +python3 ./test.py -f import_merge/importHeadOverlap.py +python3 ./test.py -f import_merge/importHeadPartOverlap.py +python3 ./test.py -f import_merge/importHead.py +python3 ./test.py -f import_merge/importHORestart.py +python3 ./test.py -f import_merge/importHPORestart.py +python3 ./test.py -f import_merge/importHRestart.py +python3 ./test.py -f import_merge/importLastHO.py +python3 ./test.py -f import_merge/importLastHPO.py +python3 ./test.py -f import_merge/importLastH.py +python3 ./test.py -f import_merge/importLastS.py +python3 ./test.py -f import_merge/importLastSub.py +python3 ./test.py -f import_merge/importLastTO.py +python3 ./test.py -f import_merge/importLastTPO.py +python3 ./test.py -f import_merge/importLastT.py +python3 ./test.py -f import_merge/importSpan.py +python3 ./test.py -f import_merge/importSRestart.py +python3 ./test.py -f import_merge/importSubRestart.py +python3 ./test.py -f import_merge/importTailOverlap.py +python3 ./test.py -f import_merge/importTailPartOverlap.py +python3 ./test.py -f import_merge/importTail.py +python3 ./test.py -f import_merge/importToCommit.py +python3 ./test.py -f import_merge/importTORestart.py +python3 ./test.py -f import_merge/importTPORestart.py +python3 ./test.py -f import_merge/importTRestart.py +python3 ./test.py -f import_merge/importInsertThenImport.py +python3 ./test.py -f import_merge/importCSV.py +python3 ./test.py -f import_merge/import_update_0.py +python3 ./test.py -f import_merge/import_update_1.py +python3 ./test.py -f import_merge/import_update_2.py + +python3 ./test.py -f insert/basic.py +python3 ./test.py -f insert/int.py +python3 ./test.py -f insert/float.py +python3 ./test.py -f insert/bigint.py +python3 ./test.py -f insert/bool.py +python3 ./test.py -f insert/double.py +python3 ./test.py -f insert/smallint.py +python3 ./test.py -f insert/tinyint.py +python3 ./test.py -f insert/date.py +python3 ./test.py -f insert/binary.py +python3 ./test.py -f insert/nchar.py +#python3 ./test.py -f insert/nchar-boundary.py +python3 ./test.py -f insert/nchar-unicode.py +python3 ./test.py -f insert/multi.py +python3 ./test.py -f insert/randomNullCommit.py +python3 insert/retentionpolicy.py +python3 ./test.py -f insert/alterTableAndInsert.py +python3 ./test.py -f insert/insertIntoTwoTables.py +python3 ./test.py -f insert/before_1970.py +python3 ./test.py -f insert/special_character_show.py +python3 bug2265.py +python3 ./test.py -f insert/bug3654.py +python3 ./test.py -f insert/insertDynamicColBeforeVal.py +python3 ./test.py -f insert/in_function.py +python3 ./test.py -f insert/modify_column.py +#python3 ./test.py -f insert/line_insert.py +python3 ./test.py -f insert/specialSql.py +python3 ./test.py -f insert/timestamp.py +python3 ./test.py -f insert/metadataUpdate.py +python3 ./test.py -f insert/unsignedInt.py +python3 ./test.py -f insert/unsignedBigint.py +python3 ./test.py -f insert/unsignedSmallint.py +python3 ./test.py -f insert/unsignedTinyint.py +python3 ./test.py -f insert/insertFromCSV.py +python3 ./test.py -f insert/boundary2.py +python3 ./test.py -f insert/insert_locking.py +python3 test.py -f insert/insert_before_use_db.py +python3 ./test.py -f insert/flushwhiledrop.py +python3 ./test.py -f insert/verifyMemToDiskCrash.py +#python3 ./test.py -f insert/schemalessInsert.py +#python3 ./test.py -f insert/openTsdbJsonInsert.py +python3 ./test.py -f insert/openTsdbTelnetLinesInsert.py + + +# update +python3 ./test.py -f update/merge_commit_data.py +python3 ./test.py -f update/allow_update.py +python3 ./test.py -f update/allow_update-0.py +python3 ./test.py -f update/append_commit_data.py +python3 ./test.py -f update/append_commit_last-0.py +python3 ./test.py -f update/append_commit_last.py + + +python3 ./test.py -f update/merge_commit_data2.py +python3 ./test.py -f update/merge_commit_data2_update0.py +python3 ./test.py -f update/merge_commit_last-0.py +python3 ./test.py -f update/merge_commit_last.py +python3 ./test.py -f update/update_options.py +python3 ./test.py -f update/merge_commit_data-0.py + +# wal +python3 ./test.py -f wal/addOldWalTest.py +python3 ./test.py -f wal/sdbComp.py + + + + + + + + + + + diff --git a/tests/pytest/fulltest-others.sh b/tests/pytest/fulltest-others.sh new file mode 100755 index 0000000000000000000000000000000000000000..e0b0851a22de16dbc3e6aea17937121573eb9997 --- /dev/null +++ b/tests/pytest/fulltest-others.sh @@ -0,0 +1,48 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +#python3 ./test.py -f dbmgmt/database-name-boundary.py +python3 test.py -f dbmgmt/nanoSecondCheck.py + +# +python3 ./test.py -f tsdb/tsdbComp.py + +# user +python3 ./test.py -f user/user_create.py +python3 ./test.py -f user/pass_len.py + +# perfbenchmark +python3 ./test.py -f perfbenchmark/bug3433.py +#python3 ./test.py -f perfbenchmark/bug3589.py +#python3 ./test.py -f perfbenchmark/taosdemoInsert.py + +#alter table +python3 ./test.py -f alter/alter_table_crash.py +python3 ./test.py -f alter/alterTabAddTagWithNULL.py +python3 ./test.py -f alter/alterTimestampColDataProcess.py +python3 ./test.py -f alter/alter_table.py +python3 ./test.py -f alter/alter_debugFlag.py +python3 ./test.py -f alter/alter_keep.py +python3 ./test.py -f alter/alter_cacheLastRow.py +python3 ./test.py -f alter/alter_create_exception.py +python3 ./test.py -f alter/alterColMultiTimes.py + +python3 ./test.py -f account/account_create.py + +# client +python3 ./test.py -f client/client.py +python3 ./test.py -f client/version.py +python3 ./test.py -f client/alterDatabase.py +python3 ./test.py -f client/noConnectionErrorTest.py +python3 ./test.py -f client/taoshellCheckCase.py +# python3 ./test.py -f client/change_time_1_1.py +# python3 ./test.py -f client/change_time_1_2.py +python3 client/twoClients.py + +python3 testMinTablesPerVnode.py + +# topic +python3 ./test.py -f topic/topicQuery.py + diff --git a/tests/pytest/fulltest-query.sh b/tests/pytest/fulltest-query.sh new file mode 100755 index 0000000000000000000000000000000000000000..04e1eb7c527a69fdadf78985062ee2ba02d41517 --- /dev/null +++ b/tests/pytest/fulltest-query.sh @@ -0,0 +1,200 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + + +# timezone +python3 ./test.py -f TimeZone/TestCaseTimeZone.py + +#stable +python3 ./test.py -f stable/insert.py +python3 ./test.py -f stable/query_after_reset.py + +#table +python3 ./test.py -f table/alter_wal0.py +python3 ./test.py -f table/column_name.py +python3 ./test.py -f table/column_num.py +python3 ./test.py -f table/db_table.py +python3 ./test.py -f table/create_sensitive.py +python3 ./test.py -f table/tablename-boundary.py +python3 ./test.py -f table/max_table_length.py +python3 ./test.py -f table/alter_column.py +python3 ./test.py -f table/boundary.py +#python3 ./test.py -f table/create.py +python3 ./test.py -f table/del_stable.py +python3 ./test.py -f table/create_db_from_normal_db.py + +# tag +python3 ./test.py -f tag_lite/filter.py +python3 ./test.py -f tag_lite/create-tags-boundary.py +python3 ./test.py -f tag_lite/3.py +python3 ./test.py -f tag_lite/4.py +python3 ./test.py -f tag_lite/5.py +python3 ./test.py -f tag_lite/6.py +python3 ./test.py -f tag_lite/add.py +python3 ./test.py -f tag_lite/bigint.py +python3 ./test.py -f tag_lite/binary_binary.py +python3 ./test.py -f tag_lite/binary.py +python3 ./test.py -f tag_lite/bool_binary.py +python3 ./test.py -f tag_lite/bool_int.py +python3 ./test.py -f tag_lite/bool.py +python3 ./test.py -f tag_lite/change.py +python3 ./test.py -f tag_lite/column.py +python3 ./test.py -f tag_lite/commit.py +python3 ./test.py -f tag_lite/create.py +python3 ./test.py -f tag_lite/datatype.py +python3 ./test.py -f tag_lite/datatype-without-alter.py +python3 ./test.py -f tag_lite/delete.py +python3 ./test.py -f tag_lite/double.py +python3 ./test.py -f tag_lite/float.py +python3 ./test.py -f tag_lite/int_binary.py +python3 ./test.py -f tag_lite/int_float.py +python3 ./test.py -f tag_lite/int.py +python3 ./test.py -f tag_lite/set.py +python3 ./test.py -f tag_lite/smallint.py +python3 ./test.py -f tag_lite/tinyint.py +python3 ./test.py -f tag_lite/timestamp.py +python3 ./test.py -f tag_lite/TestModifyTag.py +python3 ./test.py -f tag_lite/unsignedInt.py +python3 ./test.py -f tag_lite/unsignedBigint.py +python3 ./test.py -f tag_lite/unsignedSmallint.py +python3 ./test.py -f tag_lite/unsignedTinyint.py +python3 ./test.py -f tag_lite/alter_tag.py +python3 ./test.py -f tag_lite/drop_auto_create.py +python3 ./test.py -f tag_lite/json_tag_extra.py + +#query +python3 ./test.py -f query/distinctOneColTb.py +python3 ./test.py -f query/filter.py +python3 ./test.py -f query/filterCombo.py +python3 ./test.py -f query/queryNormal.py +python3 ./test.py -f query/queryError.py +python3 ./test.py -f query/filterAllIntTypes.py +python3 ./test.py -f query/filterFloatAndDouble.py +python3 ./test.py -f query/filterOtherTypes.py +python3 ./test.py -f query/querySort.py +python3 ./test.py -f query/queryJoin.py +python3 ./test.py -f query/select_last_crash.py +python3 ./test.py -f query/queryNullValueTest.py +python3 ./test.py -f query/queryInsertValue.py +python3 ./test.py -f query/queryConnection.py +python3 ./test.py -f query/queryCountCSVData.py +python3 ./test.py -f query/natualInterval.py +python3 ./test.py -f query/bug1471.py +#python3 ./test.py -f query/dataLossTest.py +python3 ./test.py -f query/bug1874.py +python3 ./test.py -f query/bug1875.py +python3 ./test.py -f query/bug1876.py +python3 ./test.py -f query/bug2218.py +python3 ./test.py -f query/bug2117.py +python3 ./test.py -f query/bug2118.py +python3 ./test.py -f query/bug2143.py +python3 ./test.py -f query/sliding.py +python3 ./test.py -f query/unionAllTest.py +python3 ./test.py -f query/bug2281.py +python3 ./test.py -f query/udf.py +python3 ./test.py -f query/bug2119.py +python3 ./test.py -f query/isNullTest.py +python3 ./test.py -f query/queryWithTaosdKilled.py +python3 ./test.py -f query/floatCompare.py +python3 ./test.py -f query/query1970YearsAf.py +python3 ./test.py -f query/bug3351.py +python3 ./test.py -f query/bug3375.py +python3 ./test.py -f query/queryJoin10tables.py +python3 ./test.py -f query/queryStddevWithGroupby.py +python3 ./test.py -f query/querySecondtscolumnTowherenow.py +python3 ./test.py -f query/queryFilterTswithDateUnit.py +python3 ./test.py -f query/queryTscomputWithNow.py +python3 ./test.py -f query/queryStableJoin.py +python3 ./test.py -f query/computeErrorinWhere.py +python3 ./test.py -f query/queryTsisNull.py +python3 ./test.py -f query/subqueryFilter.py +python3 ./test.py -f query/nestedQuery/queryInterval.py +python3 ./test.py -f query/queryStateWindow.py +# python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py +python3 ./test.py -f query/nestquery_last_row.py +python3 ./test.py -f query/nestedQuery/nestedQuery.py +python3 ./test.py -f query/nestedQuery/nestedQuery_datacheck.py +python3 ./test.py -f query/queryCnameDisplay.py +# python3 ./test.py -f query/operator_cost.py +# python3 ./test.py -f query/long_where_query.py +python3 test.py -f query/nestedQuery/queryWithSpread.py +python3 ./test.py -f query/bug6586.py +# python3 ./test.py -f query/bug5903.py +python3 test.py -f query/queryInterval.py +python3 test.py -f query/queryFillTest.py +python3 ./test.py -f query/last_cache.py +python3 ./test.py -f query/last_row_cache.py +python3 ./test.py -f query/queryGroupbySort.py +python3 ./test.py -f query/filterAllUnsignedIntTypes.py +python3 ./test.py -f query/queryBetweenAnd.py +python3 ./test.py -f query/querySession.py +python3 ./test.py -f query/queryWildcardLength.py +python3 ./test.py -f query/queryTbnameUpperLower.py +python3 ./test.py -f query/query.py +python3 ./test.py -f query/queryDiffColsTagsAndOr.py +python3 ./test.py -f query/queryGroupTbname.py +python3 ./test.py -f query/queryRegex.py + +#stream +python3 ./test.py -f stream/metric_1.py +python3 ./test.py -f stream/metric_n.py +python3 ./test.py -f stream/new.py +python3 ./test.py -f stream/stream1.py +python3 ./test.py -f stream/stream2.py +#python3 ./test.py -f stream/parser.py +python3 ./test.py -f stream/history.py +python3 ./test.py -f stream/sys.py +python3 ./test.py -f stream/table_1.py +python3 ./test.py -f stream/table_n.py +python3 ./test.py -f stream/showStreamExecTimeisNull.py +python3 ./test.py -f stream/cqSupportBefore1970.py + +python3 ./test.py -f query/queryGroupbyWithInterval.py +python3 queryCount.py + +# subscribe +python3 test.py -f subscribe/singlemeter.py +#python3 test.py -f subscribe/stability.py +python3 test.py -f subscribe/supertable.py + +# functions +python3 ./test.py -f functions/all_null_value.py +python3 ./test.py -f functions/function_avg.py -r 1 +python3 ./test.py -f functions/function_bottom.py -r 1 +python3 ./test.py -f functions/function_count.py -r 1 +python3 ./test.py -f functions/function_count_last_stab.py +python3 ./test.py -f functions/function_diff.py -r 1 +python3 ./test.py -f functions/function_first.py -r 1 +python3 ./test.py -f functions/function_last.py -r 1 +python3 ./test.py -f functions/function_last_row.py -r 1 +python3 ./test.py -f functions/function_leastsquares.py -r 1 +python3 ./test.py -f functions/function_max.py -r 1 +python3 ./test.py -f functions/function_min.py -r 1 +python3 ./test.py -f functions/function_operations.py -r 1 +python3 ./test.py -f functions/function_percentile.py -r 1 +python3 ./test.py -f functions/function_spread.py -r 1 +python3 ./test.py -f functions/function_stddev.py -r 1 +python3 ./test.py -f functions/function_sum.py -r 1 +python3 ./test.py -f functions/function_top.py -r 1 +python3 ./test.py -f functions/function_sample.py -r 1 +python3 ./test.py -f functions/function_twa.py -r 1 +python3 ./test.py -f functions/function_twa_test2.py +python3 ./test.py -f functions/function_stddev_td2555.py +python3 ./test.py -f functions/showOfflineThresholdIs864000.py +python3 ./test.py -f functions/function_interp.py +#python3 ./test.py -f functions/queryTestCases.py +python3 ./test.py -f functions/function_stateWindow.py +python3 ./test.py -f functions/function_derivative.py +python3 ./test.py -f functions/function_irate.py +python3 ./test.py -f functions/function_ceil.py +python3 ./test.py -f functions/function_floor.py +python3 ./test.py -f functions/function_round.py +python3 ./test.py -f functions/function_elapsed.py +python3 ./test.py -f functions/function_mavg.py +python3 ./test.py -f functions/function_csum.py +python3 ./test.py -f functions/function_percentile2.py +python3 ./test.py -f functions/variable_httpDbNameMandatory.py + + diff --git a/tests/pytest/fulltest-tools.sh b/tests/pytest/fulltest-tools.sh new file mode 100755 index 0000000000000000000000000000000000000000..cac445501229f0b54f1464a07583d05cbf4c88a4 --- /dev/null +++ b/tests/pytest/fulltest-tools.sh @@ -0,0 +1,47 @@ +#!/bin/bash +ulimit -c unlimited +#======================p1-start=============== +#======================p1-end=============== + +# tools +python3 test.py -f tools/taosdumpTest.py +python3 test.py -f tools/taosdumpTest2.py + +python3 test.py -f tools/taosdemoTest.py +python3 test.py -f tools/taosdemoTestWithoutMetric.py +python3 test.py -f tools/taosdemoTestWithJson.py +python3 test.py -f tools/taosdemoTestLimitOffset.py +python3 test.py -f tools/taosdemoTestTblAlt.py +python3 test.py -f tools/taosdemoTestSampleData.py +python3 test.py -f tools/taosdemoTestInterlace.py +# python3 test.py -f tools/taosdemoTestQuery.py +python3 ./test.py -f tools/taosdemoTestdatatype.py + +# nano support +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoQuery.py +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanosubscribe.py +python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_step.py +python3 test.py -f tools/taosdumpTestNanoSupport.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py +python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py +python3 test.py -f tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py +python3 test.py -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py +#python3 test.py -f tools/taosdemoAllTest/TD-10539/create_taosdemo.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py + + + + + + + + + + + + diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 47e535cbd81b9cbc9675493342c1b734ccbeeca2..b14be1cc110caea6fc42dd6ca66934d5b5333f3f 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -52,6 +52,8 @@ python3 ./test.py -f table/create_db_from_normal_db.py #stable python3 ./test.py -f stable/insert.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py +python3 test.py -f tag_lite/json_tag_extra.py # tag python3 ./test.py -f tag_lite/filter.py @@ -223,6 +225,7 @@ python3 ./test.py -f perfbenchmark/bug3433.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py +python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py #query python3 test.py -f query/distinctOneColTb.py diff --git a/tests/pytest/functions/function_elapsed_case.py b/tests/pytest/functions/function_elapsed_case.py index 56610a9347c3ab90a9addc64dd62a6ed60758abf..6b279d7f63de0cdbd854457350b670520ea455ec 100644 --- a/tests/pytest/functions/function_elapsed_case.py +++ b/tests/pytest/functions/function_elapsed_case.py @@ -320,6 +320,8 @@ class ElapsedCase: def selectIllegalTest(self): tdSql.execute("use wxy_db") + tdSql.error("select elapsed() from t1") + tdSql.error("select elapsed(,) from t1") tdSql.error("select elapsed(1) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") tdSql.error("select elapsed('2021-11-18 00:00:10') from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") tdSql.error("select elapsed(now) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'") diff --git a/tests/pytest/functions/variable_httpDbNameMandatory.py b/tests/pytest/functions/variable_httpDbNameMandatory.py index 3be620ad1e1631126697d93e388df82be3e9d57c..1cd2516ec9303f2f038bc22a69afcd01bce3a930 100644 --- a/tests/pytest/functions/variable_httpDbNameMandatory.py +++ b/tests/pytest/functions/variable_httpDbNameMandatory.py @@ -34,11 +34,15 @@ class TDTestCase: def getBuildPath(self) -> str: selfPath = os.path.dirname(os.path.realpath(__file__)) + global cfgPath if ("community" in selfPath): projPath = selfPath[:selfPath.find("community")] + cfgPath = projPath + "/community/sim/dnode1/cfg" else: projPath = selfPath[:selfPath.find("tests")] + cfgPath = projPath + "/sim/dnode1/cfg" + for root, dirs, files in os.walk(projPath): if ("taosd" in files): @@ -53,8 +57,10 @@ class TDTestCase: if ("community" in selfPath): cfgDir = self.getBuildPath() + "/community/sim/dnode1/cfg" + else: cfgDir = self.getBuildPath() + "/sim/dnode1/cfg" + return cfgDir def getCfgFile(self) -> str: @@ -85,8 +91,8 @@ class TDTestCase: def TS834(self): tdLog.printNoPrefix("==========TS-782==========") tdSql.prepare() - - cfgfile = self.getCfgFile() + buildPath = self.getBuildPath() + cfgfile = cfgPath + "/taos.cfg" tdSql.execute("show variables") res_com = tdSql.cursor.fetchall() diff --git a/tests/pytest/tag_lite/json_tag_extra.py b/tests/pytest/tag_lite/json_tag_extra.py new file mode 100644 index 0000000000000000000000000000000000000000..094359d05141d02e181bd2ed92beffbfd612f507 --- /dev/null +++ b/tests/pytest/tag_lite/json_tag_extra.py @@ -0,0 +1,591 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, db_test.stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +import time +import random + +class TDTestCase: + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + tdSql.execute("drop database if exists db_json;") + print("==============step1 tag format =======") + tdLog.info("create database ") + tdSql.execute("create database db_json") + tdSql.execute("use db_json") + # test tag format + tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)") + tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json(10000000))") + tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,jtag1 json)") + tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,dataBool bool)") + + tdSql.execute("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":\"fff\",\"id\":5}')") + + # two stables: jsons1 jsons2 ,test tag's value and key + tdSql.execute("insert into jsons1_1(ts,dataInt) using jsons1 tags('{\"loc+\":\"fff\",\"id\":5}') values (now,12)") + + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{oc:\"fff\",\"id\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":fff,\"id\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('3333')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":}')") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":bool)") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags(true)") + tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('[{\"num\":5}]')") + + # test object and key max length. max key length is 256, max object length is 4096 include abcd. + tdSql.execute("create table if not exists jsons4(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)") + + char1= ''.join(['abcd']*64) + char2=''.join(char1) + char3= ''.join(['abcd']*1022) + print(len(char3)) # 4088 + tdSql.execute("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s\":5}')" % char1) # len(key)=256 + tdSql.error("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s1\":5}')" % char2) # len(key)=257 + tdSql.execute("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"T\":\"%s\"}')" % char3) # len(object)=4096 + tdSql.error("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"TS\":\"%s\"}')" % char3) # len(object)=4097 + + tdSql.execute("insert into jsons1_1 values(now, 1, 'json1')") + tdSql.execute("insert into jsons1_1 values(now+1s, 1, 'json1')") + tdSql.execute("insert into jsons1_2 using jsons1 tags('{\"num\":5,\"location\":\"beijing\"}') values (now, 1, 'json2')") + tdSql.execute("insert into jsons1_3 using jsons1 tags('{\"num\":34,\"location\":\"beijing\",\"level\":\"l1\"}') values (now, 1, 'json3')") + tdSql.execute("insert into jsons1_4 using jsons1 tags('{\"class\":55,\"location\":\"beijing\",\"name\":\"name4\"}') values (now, 1, 'json4')") + + # test : json'vaule is null and + tdSql.execute("create table if not exists jsons2(ts timestamp, dataInt2 int, dataStr2 nchar(50)) tags(jtag2 json)") + tdSql.execute("CREATE TABLE if not exists jsons2_1 using jsons2 tags('{}')") + tdSql.query("select jtag2 from jsons2_1") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_2 using jsons2 tags('')") + tdSql.query("select jtag2 from jsons2_2") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_3 using jsons2 tags('null')") + tdSql.query("select jtag2 from jsons2_3") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_4 using jsons2 tags('\t')") + tdSql.query("select jtag2 from jsons2_4") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_5 using jsons2 tags(' ')") + tdSql.query("select jtag2 from jsons2_5") + tdSql.checkData(0, 0, None) + tdSql.execute("CREATE TABLE if not exists jsons2_6 using jsons2 tags('{\"nv\":null,\"tea\":true,\"\":false,\"\":123,\"tea\":false}')") + tdSql.query("select jtag2 from jsons2_6") + tdSql.checkData(0, 0, "{\"nv\":null,\"tea\":true}") + tdSql.execute("CREATE TABLE if not exists jsons2_7 using jsons2 tags('{\"test7\":\"\"}')") + tdSql.query("select jtag2 from jsons2_7") + tdSql.checkData(0, 0, "{\"test7\":\"\"}") + tdSql.execute("CREATE TABLE if not exists jsons2_8 using jsons2 tags('{\"nv\":null,\"tea\":123,\"\":false,\"\":123,\"tea\":false}')") + tdSql.query("select jtag2 from jsons2_8") + tdSql.checkData(0, 0, "{\"nv\":null,\"tea\":123}") + + print("==============step2 alter json table==") + tdLog.info("alter stable add tag") + tdSql.error("ALTER STABLE jsons2 add tag jtag3 nchar(20)") + tdSql.error("ALTER STABLE jsons2 drop tag jtag2") + tdSql.execute("ALTER STABLE jsons2 change tag jtag2 jtag3") + tdSql.query("select jtag3->'tea' from jsons2_6") + tdSql.checkData(0, 0, "true") + tdSql.error("ALTER TABLE jsons2_6 SET TAG jtag3='{\"tea-=[].;!@#$%^&*()/\":}'") + tdSql.execute("ALTER TABLE jsons2_6 SET TAG jtag3='{\"tea-=[].;!@#$%^&*()/\":false}'") + tdSql.query("select jtag3 from jsons2_6") + tdSql.checkData(0, 0, "{\"tea-=[].;!@#$%^&*()/\":false}") + tdSql.execute("ALTER TABLE jsons1_1 SET TAG jtag='{\"sex\":\"femail\",\"age\":35}'") + tdSql.query("select jtag from jsons1_1") + tdSql.checkData(0, 0, "{\"sex\":\"femail\",\"age\":35}") + + + + print("==============step3") + tdLog.info("select table") + + tdSql.query("select jtag from jsons1_1") + tdSql.checkData(0, 0, "{\"sex\":\"femail\",\"age\":35}") + + tdSql.query("select jtag from jsons1 where jtag->'name'='name4'") + tdSql.checkData(0, 0, "{\"class\":55,\"location\":\"beijing\",\"name\":\"name4\"}") + + + tdSql.query("select * from jsons1") + tdSql.checkRows(6) + + tdSql.query("select * from jsons1_1") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where jtag->'location'='beijing'") + tdSql.checkRows(3) + + tdSql.query("select jtag->'location' from jsons1_2") + tdSql.checkData(0, 0, "\"beijing\"") + + + tdSql.query("select jtag->'num' from jsons1 where jtag->'level'='l1'") + tdSql.checkData(0, 0, 34) + + tdSql.query("select jtag->'location' from jsons1") + tdSql.checkRows(4) + + tdSql.query("select jtag from jsons1_1") + tdSql.checkRows(1) + + tdSql.query("select * from jsons1 where jtag contains 'sex' or jtag contains 'num'") + tdSql.checkRows(5) + + tdSql.query("select * from jsons1 where jtag contains 'sex' and jtag contains 'num'") + tdSql.checkRows(0) + + tdSql.query("select jtag->'sex' from jsons1 where jtag contains 'sex' or jtag contains 'num'") + tdSql.checkData(0, 0, "\"femail\"") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'location'='beijing'") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'num'=5 or jtag contains 'sex'") + tdSql.checkRows(4) + + # test with tbname + tdSql.query("select * from jsons1 where tbname = 'jsons1_1'") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where tbname = 'jsons1_1' or jtag contains 'num'") + tdSql.checkRows(5) + + tdSql.query("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'num'") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where tbname = 'jsons1_1' or jtag->'num'=5") + tdSql.checkRows(4) + + # test where condition like + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%'") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' and jtag->'location'='beijin'") + tdSql.checkRows(0) + + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' or jtag->'location'='beijin'") + tdSql.checkRows(3) + + tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' and jtag->'num'=34") + tdSql.checkRows(1) + + tdSql.query("select *,tbname from jsons1 where (jtag->'location' like 'shanghai%' or jtag->'num'=34) and jtag->'class'=55") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where jtag->'num' like '5%'") + tdSql.checkRows(0) + + # # test where condition in + # tdSql.query("select * from jsons1 where jtag->'location' in ('beijing')") + # tdSql.checkRows(3) + + # tdSql.query("select * from jsons1 where jtag->'num' in (5,34)") + # tdSql.checkRows(2) + + # tdSql.error("select * from jsons1 where jtag->'num' in ('5',34)") + + # tdSql.query("select * from jsons1 where jtag->'location' in ('beijing') and jtag->'class'=55") + # tdSql.checkRows(1) + + # test where condition match + tdSql.query("select * from jsons1 where jtag->'location' match 'jin$'") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where jtag->'location' match 'jin'") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where datastr match 'json' and jtag->'location' match 'jin'") + tdSql.checkRows(3) + + tdSql.query("select * from jsons1 where jtag->'num' match '5'") + tdSql.checkRows(0) + + # test json string parse + tdSql.error("CREATE TABLE if not exists jsons1_5 using jsons1 tags('efwewf')") + tdSql.execute("CREATE TABLE if not exists jsons1_5 using jsons1 tags('\t')") + tdSql.execute("CREATE TABLE if not exists jsons1_6 using jsons1 tags('')") + + tdSql.query("select jtag from jsons1_6") + tdSql.checkData(0, 0, None) + + tdSql.execute("CREATE TABLE if not exists jsons1_7 using jsons1 tags('{}')") + tdSql.query("select jtag from jsons1_7") + tdSql.checkData(0, 0, None) + + tdSql.execute("CREATE TABLE if not exists jsons1_8 using jsons1 tags('null')") + tdSql.query("select jtag from jsons1_8") + tdSql.checkData(0, 0, None) + + tdSql.execute("CREATE TABLE if not exists jsons1_9 using jsons1 tags('{\"\":4,\"time\":null}')") + tdSql.query("select jtag from jsons1_9") + tdSql.checkData(0, 0, "{\"time\":null}") + + tdSql.execute("CREATE TABLE if not exists jsons1_10 using jsons1 tags('{\"k1\":\"\",\"k1\":\"v1\",\"k2\":true,\"k3\":false,\"k4\":55}')") + tdSql.query("select jtag from jsons1_10") + tdSql.checkData(0, 0, "{\"k1\":\"\",\"k2\":true,\"k3\":false,\"k4\":55}") + + tdSql.query("select jtag->'k2' from jsons1_10") + tdSql.checkData(0, 0, "true") + + tdSql.query("select jtag from jsons1 where jtag->'k1'=''") + tdSql.checkRows(1) + + tdSql.query("select jtag from jsons1 where jtag->'k2'=true") + tdSql.checkRows(1) + + tdSql.query("select jtag from jsons1 where jtag is null") + tdSql.checkRows(4) + + tdSql.query("select jtag from jsons1 where jtag is not null") + tdSql.checkRows(6) + + tdSql.query("select * from jsons1 where jtag->'location' is not null") + tdSql.checkRows(3) + + tdSql.query("select tbname,jtag from jsons1 where jtag->'location' is null") + tdSql.checkRows(7) + + tdSql.query("select * from jsons1 where jtag->'num' is not null") + tdSql.checkRows(2) + + tdSql.query("select * from jsons1 where jtag->'location'='null'") + tdSql.checkRows(0) + + tdSql.query("select * from jsons1 where jtag->'num'=null") + tdSql.checkRows(0) + + # test distinct + tdSql.query("select distinct jtag from jsons1") + tdSql.checkRows(7) + + tdSql.query("select distinct jtag->'location' from jsons1") + tdSql.checkRows(2) + + # test chinese + tdSql.execute("CREATE TABLE if not exists jsons1_11 using jsons1 tags('{\"k1\":\"中国\",\"k5\":\"是是是\"}')") + + tdSql.query("select tbname,jtag from jsons1 where jtag->'k1' match '中'") + tdSql.checkRows(1) + + tdSql.query("select tbname,jtag from jsons1 where jtag->'k1'='中国'") + tdSql.checkRows(1) + + #test dumplicate key with normal colomn + tdSql.execute("INSERT INTO jsons1_12 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"dataStr\":\"是是是\"}') values(now, 4, \"你就会\")") + + tdSql.query("select *,tbname,jtag from jsons1 where jtag->'dataStr' match '是'") + tdSql.checkRows(1) + + tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt'") + tdSql.checkRows(1) + + # test filter : and /or / in/ like + tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool'") + tdSql.checkRows(2) + + tdSql.query("select * from jsons1 where jtag->'num' is not null and jtag contains 'class' or jtag contains 'databool'") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 4) + + tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' and jtag->'location' like 'bei%'") + tdSql.checkRows(2) + + tdSql.query("select * from jsons1 where datastr like '你就会' and ( jtag->'num' is not null or jtag contains 'tbname' and jtag contains 'databool' )") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 4) + + tdSql.error("select * from jsons1 where datastr like '你就会' and jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool'") + + + tdSql.error("select * from jsons1 where datastr like '你就会' or jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' or jtag->'location' in ('beijing') and jtag->'location' like 'bei%' ") + + tdSql.query("select * from jsons1 where datastr like '你就会' and (jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' and jtag->'location' like 'bei%' )") + tdSql.checkRows(0) + + tdSql.error("select *,tbname,jtag from jsons1 where dataBool=true") + + # test error + tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags(3333)") + tdSql.execute("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"1loc\":\"fff\",\";id\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"。loc\":\"fff\",\"fsd\":5}')") + tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"试试\":\"fff\",\";id\":5}')") + tdSql.error("insert into jsons1_13 using jsons1 tags(3)") + + # test query normal column,tag and tbname + tdSql.execute("create stable if not exists jsons3(ts timestamp, dataInt3 int, dataBool3 bool, dataStr3 nchar(50)) tags(jtag3 json)") + tdSql.execute("create table jsons3_2 using jsons3 tags('{\"t\":true,\"t123\":123,\"\":\"true\"}')") + + tdSql.execute("create table jsons3_3 using jsons3 tags('{\"t\":true,\"t123\":456,\"k1\":true,\"str1\":\"111\"}')") + tdSql.execute("insert into jsons3_3 values(now, 4, true, 'test')") + + tdSql.execute("insert into jsons3_4 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null,\"str1\":\"112\"}') values(now, 5, true, 'test')") + tdSql.query("select * from jsons3 where jtag3->'k1'=true") + tdSql.checkRows(1) + tdSql.error("select jtag3->k1 from jsons3 ") + tdSql.error("select jtag3 from jsons3 where jtag3->'k1'") + tdSql.error("select jtag3 from jsons3 where jtag3 contains 'k1'=true") + tdSql.error("select jtag3 contains 'k1' from jsons3;") + tdSql.error("select jtag3 contains 'k1'=true from jsons3;") + tdSql.error("select jtag3->'k1'=true from jsons3;") + tdSql.execute("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":123,\"s\":null}') values(now, 5, true, 'test')") + tdSql.execute("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":012,\"k2\":null,\"s\":null}') values(now+1s, 5, true, 'test')") + tdSql.query("select jtag3 from jsons3_5") + tdSql.checkData(0, 0, '{\"t\":true,\"t123\":789,\"k1\":123,\"s\":null}') + tdSql.execute("insert into jsons3_6 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null}') values(now, 5, true, 'test')") + tdSql.query("select jtag3 from jsons3 where jtag3->'t123'=12 or jtag3 contains 'k1'") + tdSql.checkRows(4) + tdSql.query("select distinct jtag3 from jsons3 where jtag3->'t123'=12 or jtag3 contains 'k1'") + tdSql.checkRows(4) + + + tdSql.execute("INSERT INTO jsons1_14 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"tianjing\",\"dataStr\":\"是是是\"}') values(now,5, \"你就会\")") + + tdSql.query("select ts,jtag->'tbname',tbname from jsons1 where dataint>=1 and jtag contains 'tbname'") + tdSql.checkRows(2) + tdSql.checkData(0, 1, '\"tt\"') + + tdSql.query("select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'") + tdSql.checkRows(1) + tdSql.checkData(0, 3, 'jsons1_14') + + tdSql.query("select ts,jtag3->'tbname', jtag3->'str1',tbname from jsons3 where jtag3->'t123' between 456 and 789 and jtag3->'str1' like '11%' ") + tdSql.checkRows(2) + for i in range(1): + if tdSql.queryResult[i][1] == 'jsons3_3': + tdSql.checkData(i, 2, 111) + + tdSql.query("select jtag3->'',dataint3 from jsons3") + tdSql.checkRows(5) + for i in range(4): + if tdSql.queryResult[i][1] == 4: + tdSql.checkData(i, 0, None) + tdSql.query("select tbname,dataint3,jtag3->'k1' from jsons3;") + tdSql.checkRows(5) + for i in range(4): + if tdSql.queryResult[i][1] == 4: + tdSql.checkData(i, 2, 'true') + + # Select_exprs is SQL function -Aggregation function , tests includes group by and order by + + tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by jtag->'location';") + tdSql.checkData(2, 3, '\"tianjing\"') + tdSql.checkRows(3) + for i in range(2): + if tdSql.queryResult[i][3] == 'beijing': + tdSql.checkData(i, 0, 1) + tdSql.checkData(i, 1, 3) + tdSql.error("select avg(dataInt) as 123 ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by 123") + tdSql.error("select avg(dataInt) as avgdata ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by avgdata ;") + tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by ts;") + tdSql.checkRows(3) + tdSql.error("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by tbname;") + #notice,it should return error **** + tdSql.error("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by jtag->'num' ;") + tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by jtag->'age' ;") + tdSql.checkRows(2) + tdSql.error("select avg(dataInt) from jsons1 group by jtag->'location' order by dataInt;") + tdSql.error("select avg(dataInt),tbname from jsons1 group by jtag->'location' order by tbname;") + tdSql.execute("CREATE TABLE if not exists jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"beijing\"}')") + tdSql.execute("insert into jsons1_15 values(now+1s, 2, 'json1')") + tdSql.error("select twa(dataint) from jsons1 group by jtag->'location' order by jtag->'location';") + tdSql.error("select irate(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select stddev(dataint) from jsons1 group by jtag->'location';") + tdSql.checkRows(3) + tdSql.query(" select stddev(dataint) from jsons1 where jtag->'location'='beijing';") + tdSql.checkRows(1) + tdSql.error(" select LEASTSQUARES(dataint,1,2) from jsons1_1 where jtag->'location' ='beijing' ;") + + + + # Select_exprs is SQL function -Selection function + + tdSql.query(" select min(dataint),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing' or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + tdSql.query(" select max(dataint),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 12) + tdSql.query(" select first(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select last(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.error(" select last(*),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select last_row(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,0) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,50) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,90) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,100) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,0,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,50,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query(" select apercentile(dataint,100,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkRows(1) + tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location';") + tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' asc;") + tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' desc;") + tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts desc;") + tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts asc;") + tdSql.query("select top(dataint,100) from jsons1 group by jtag->'location';") + tdSql.query("select bottom(dataint,1) from jsons1 group by jtag->'location';") + tdSql.query("select bottom(dataint,100) from jsons1 group by jtag->'location';") + + tdSql.execute("create table if not exists jsons_interp(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)") + tdSql.execute("insert into jsons_interp_1 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"rate\":456,\"tea\":false}') values ('2021-07-25 02:19:54.119',2,'true',0.9,0.1,'123')") + tdSql.execute("insert into jsons_interp_1 values ('2021-07-25 02:19:54.219',3,'true',-4.8,-5.5,'123') ") + tdSql.execute("insert into jsons_interp_2 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"level\":\"123456\",\"rate\":123,\"tea\":false}') values ('2021-07-25 02:19:54.319',4,'true',0.9,0.1,'123')") + tdSql.execute("insert into jsons_interp_2 values ('2021-07-25 02:19:54.419',5,'true',-5.1,1.3,'123') ") + tdSql.query("select interp(dataint) as itd from jsons_interp where (jtag->'rate'=123 or jtag->'rate'=456) and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) group by tbname order by ts desc ;") + tdSql.checkRows(4) + tdSql.checkData(0,1,3) + tdSql.checkData(2,1,5) + + tdSql.query("select interp(dataint) as itd from jsons_interp where (jtag->'rate'=123 or jtag->'rate'=456) and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) group by tbname order by tbname asc;") + tdSql.checkRows(4) + tdSql.checkData(0,1,2) + tdSql.checkData(2,1,4) + + # Select_exprs is SQL function -Calculation function + tdSql.error(" select diff(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.error(" select Derivative(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select SPREAD(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.checkData(0, 0, 11) + tdSql.query(" select ceil(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select floor(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + tdSql.query(" select round(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;") + #need insert new data --data type is double or float and tests ceil floor round . + tdSql.execute("create table if not exists jsons7(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)") + tdSql.execute("insert into jsons7_1 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now+2s,2,'true',0.9,0.1,'123')") + tdSql.execute("insert into jsons7_1 using jsons7 tags('{\"nv\":null,\"tea\":true,\"tea\":false}') values (now+3s,2,'true',0.9,0.1,'123')") + tdSql.query("select * from jsons7 where jtag->'tea'=0 ;") + tdSql.checkRows(0) + tdSql.query("select * from jsons7 where jtag->'tea'=3;") + # tdSql.checkRows(0) + tdSql.execute("insert into jsons7_1 values (now+1s,3,'true',-4.8,-5.5,'123') ") + tdSql.execute("insert into jsons7_1 values (now+2s,4,'true',1.9998,2.00001,'123') ") + tdSql.execute("insert into jsons7_2 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":123,\"tea\":false}') values (now,5,'true',4.01,2.2,'123') ") + tdSql.execute("insert into jsons7_2 using jsons7 tags('{\"nv\":null,\"tea\":true,\"tag\":123,\"tea\":false}') values (now+5s,5,'false',4.01,2.2,'123') ") + tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+3s,-0.9) ") + tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+4s,-2.9) ") + tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+1s,-0.9) ") + tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+2s,-1.9) ") + tdSql.execute("CREATE TABLE if not exists jsons7_3 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":4569,\"tea\":false}') ") + tdSql.query("select ts,ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select ts,floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select ts,round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';") + tdSql.query("select round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';") + + #modify one same key and diffirent data type,include negative number of double + tdSql.execute("insert into jsons7_4 using jsons7 tags('{\"nv\":null,\"tea\":123,\"tag\":123,\"tea\":false}') values (now+1s,5,'true',4.01,2.2,'abc'); ") + tdSql.execute("insert into jsons7_5 using jsons7 tags('{\"nv\":null,\"tea\":\"app\",\"tag\":123,\"tea\":false}') values (now+2s,5,'true',4.01,2.2,'abc'); ") + tdSql.error("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111111111111111111111111111111111111111111111111111111111111111,\"tag\":123,\"tea\":false}') values (now+3s,5,'true',4.01,2.2,'123'); ") + tdSql.execute("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111,\"tag\":123,\"tea\":false}') values (now,5,'false',4.01,2.2,'t123'); ") + tdSql.query("select jtag from jsons7 where jtag->'tea'>-1.01;") + # tdSql.checkRows(2) + + # test join + tdSql.execute("create table if not exists jsons6(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)") + tdSql.execute("create table if not exists jsons5(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)") + tdSql.execute("CREATE TABLE if not exists jsons6_1 using jsons6 tags('{\"loc\":\"fff\",\"id\":6,\"user\":\"ffc\"}')") + tdSql.execute("CREATE TABLE if not exists jsons6_2 using jsons6 tags('{\"loc\":\"ffc\",\"id\":5}')") + tdSql.execute("insert into jsons6_1 values ('2020-04-18 15:00:00.000', 1, false, 'json1')") + tdSql.execute("insert into jsons6_2 values ('2020-04-18 15:00:01.000', 2, false, 'json1')") + tdSql.execute("insert into jsons5_1 using jsons5 tags('{\"loc\":\"fff\",\"num\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:00.000', 2, true, 'json2')") + tdSql.execute("insert into jsons5_2 using jsons5 tags('{\"loc\":\"fff\",\"id\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:01.000', 2, true, 'json2')") + tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'loc'=b.jtag->'loc'") + tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'user'=b.jtag->'loc';") + tdSql.query("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'id'=b.jtag->'id'") + tdSql.checkData(0, 0, "sss") + tdSql.checkData(0, 2, "\"ffc\"") + + + + # #nested query + tdSql.error("select jtag->'tag' from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where cdata=3 ") # not currently supported + tdSql.error("select jtag from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where jtag->'tag'=123 ") # not currently supported + tdSql.query("select * from (select tbname,jtag->'tea',ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where cdata=5 ") + tdSql.checkRows(5) + for i in range(5): + if tdSql.queryResult[i][0] == 'jsons7_4': + tdSql.checkData(i, 1, 123) + tdSql.checkData(i, 3, 5) + if tdSql.queryResult[i][0] == 'jsons7_5': + tdSql.checkData(i, 1, "\"app\"") + + # query child table + tdSql.error("select * from jsons3_2 where jtag3->'k1'=true;") + # tdSql.checkData(0, 0, None) + # tdSql.checkRows(3) + + # union all :max times is 100 + unioSql = "select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing' union all " + for i in range(99): + if (i < 98): + unioSql += "select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing' union all " + else: + print(i) + unioSql += " select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'" + tdSql.query(unioSql) + tdSql.checkRows(100) + unioSql += " union all select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'" + tdSql.error(unioSql) + + + + # fuction testcase : stddev, supported data type: int\str\bool unsupported data type: float\double + tdSql.query(" select stddev(datafloat),dataint from jsons7 group by dataint;") + tdSql.checkRows(5) + tdSql.query(" select stddev(dataint) from jsons7 group by datastr;") + tdSql.checkRows(4) + tdSql.query(" select stddev(dataint) from jsons7 group by databool;") + tdSql.checkRows(3) + tdSql.error(" select stddev(dataint) from jsons7 group by datafloat;") + tdSql.error(" select stddev(dataint) from jsons7 group by datadouble;") + tdSql.execute("create table if not exists jsons8(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50),datatime timestamp) tags(jtag json)") + tdSql.execute("insert into jsons8_1 using jsons8 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now,2,'true',0.9,0.1,'abc',now+60s)") + tdSql.execute("insert into jsons8_2 using jsons8 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now+5s,2,'true',0.9,0.1,'abc',now+65s)") + tdSql.query(" select stddev(dataint) from jsons8 group by datatime;") + tdSql.error(" select stddev(datatime) from jsons8 group by datadouble;") + + + # # test drop tables and databases + # tdSql.execute("drop table jsons1_1") + # tdSql.execute("drop stable jsons1") + # tdSql.execute("drop stable jsons3") + # tdSql.execute("drop stable jsons2") + # tdSql.execute("drop database db_json") + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json index 3f194f376a12772151c4d1c32f233e0d67e72857..e10fd1116b948032d5aa67dc0844bbf493d650de 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json @@ -41,7 +41,7 @@ "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 10000, + "insert_rows": 100, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", @@ -67,7 +67,7 @@ "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 20000, + "insert_rows": 200, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", diff --git a/tests/pytest/tools/taosdemoAllTest/insert-chinese.json b/tests/pytest/tools/taosdemoAllTest/insert-chinese.json new file mode 100644 index 0000000000000000000000000000000000000000..b7f3be9546c61fe895979cdc13e39eea5a322400 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-chinese.json @@ -0,0 +1,63 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "chinese": "yes", + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 150, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json index 0a4f8a0df22e7362124ce3be2f581d437739368b..2c3b8c6f81962e02ff5aac37c58fb04b79159a7c 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json @@ -32,7 +32,7 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, @@ -56,7 +56,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, @@ -80,7 +80,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, @@ -104,7 +104,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, @@ -128,7 +128,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, @@ -152,7 +152,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json index 7b90980445ddf3a0bbbd7a5652179635a85c6b53..f8fe21a6c4015a27ee663bc7ac54a7889af62add 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json @@ -32,7 +32,7 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, @@ -56,7 +56,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, @@ -80,7 +80,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, @@ -104,7 +104,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, @@ -128,7 +128,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, @@ -152,7 +152,7 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json index 5f1c3fb6ca9ac7d088281f89e93e4c038d97ad56..d51dee428fc8f1bb61af84d5f570f69cce344651 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json @@ -35,13 +35,13 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 100, + "childtable_count": 10, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 20000, + "insert_rows": 200, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", @@ -61,13 +61,13 @@ { "name": "stb1", "child_table_exists":"no", - "childtable_count": 100, + "childtable_count": 20, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 20000, + "insert_rows": 200, "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json new file mode 100644 index 0000000000000000000000000000000000000000..be55d31d5595b210695584f6dbbc334bb7b7f8e6 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json index 02efafbbbe5657ab5a81e64fef0c43405ca6e317..67abdc67eed813501e012c8b7dce5d0719d22eb6 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json +++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json @@ -109,58 +109,6 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb2", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb02_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb4", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb04_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "taosc", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 100, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json index c86ed978170d2a0c8fac12a3c9346dc5a87839f7..17153c2f2c00a2e296ebf59409be1287cb203c24 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json +++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json @@ -55,7 +55,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 5, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 1, "count":3075}, {"type": "BINARY", "len": 32, "count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json b/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json index c85713c94c3dd6fe5ee55bcc36badcce474a746e..6a59d4d75d9f7f29e3697c26d72793b9ad8bd554 100644 --- a/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json +++ b/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json @@ -11,7 +11,7 @@ "super_table_query": { "stblname": "stb0", "query_interval": 10000, - "concurrent": 9, + "threads": 9, "sqls": [ { "sql": "select last_row(*) from xxxx", diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json index 5be20c28bba11ff40296d062f93ab4fda57a1f88..cbd4f6cb59c1ddd146b42a233c740d6bbaca45d3 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json @@ -35,7 +35,7 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 1000, + "childtable_count": 10, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 1, @@ -55,13 +55,13 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}, {"type": "TIMESTAMP"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}], + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}], "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}] }, { "name": "stb1", "child_table_exists":"no", - "childtable_count": 1000, + "childtable_count": 20, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 10, diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json index 2de298efa6553ec0c6de095ee0515a73e777445f..f21cd6297c5a6277c4d9dfb5ec6eda1d9220de97 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json @@ -35,14 +35,14 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 2, + "childtable_count": 1, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "json" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 0, @@ -59,16 +59,16 @@ "tags": [{"type": "INT", "count":1}] }, { - "name": "stb2", + "name": "stb1", "child_table_exists":"no", - "childtable_count": 4, + "childtable_count": 2, "childtable_prefix": "stb02_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "json" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -265,6 +265,84 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16, "count":1}], "tags": [{"type": "BINARY", "count":1}] + }, + { + "name": "stb10", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb10_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "UBIGINT"}], + "tags": [{"type": "UBIGINT", "count":1}] + }, + { + "name": "stb11", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb11_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "UTINYINT"}], + "tags": [{"type": "UTINYINT", "count":1}] + }, + { + "name": "stb12", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "USMALLINT"}], + "tags": [{"type": "USMALLINT", "count":1}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json index ff825440e5cbfd8aa5d8d6e74538c5802af8af38..983a3009db68e95fecf3f8eda91f0aa3f41aff37 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json @@ -35,14 +35,14 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 2, + "childtable_count": 1, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 0, @@ -61,14 +61,14 @@ { "name": "stb1", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 2, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -87,14 +87,14 @@ { "name": "stb2", "child_table_exists":"no", - "childtable_count": 4, + "childtable_count": 3, "childtable_prefix": "stb02_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -113,14 +113,14 @@ { "name": "stb3", "child_table_exists":"no", - "childtable_count": 5, + "childtable_count": 4, "childtable_prefix": "stb03_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -139,14 +139,14 @@ { "name": "stb4", "child_table_exists":"no", - "childtable_count": 6, + "childtable_count": 5, "childtable_prefix": "stb04_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":30, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -165,14 +165,14 @@ { "name": "stb5", "child_table_exists":"no", - "childtable_count": 15, + "childtable_count": 6, "childtable_prefix": "stb05_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":20, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -191,7 +191,7 @@ { "name": "stb6", "child_table_exists":"no", - "childtable_count": 20, + "childtable_count": 7, "childtable_prefix": "stb06_", "auto_create_table": "no", "batch_create_tbl_num": 100, @@ -217,14 +217,14 @@ { "name": "stb7", "child_table_exists":"no", - "childtable_count": 30, + "childtable_count": 8 , "childtable_prefix": "stb07_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":5, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -243,14 +243,14 @@ { "name": "stb8", "child_table_exists":"no", - "childtable_count": 20, + "childtable_count": 9, "childtable_prefix": "stb08_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":30, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -269,14 +269,14 @@ { "name": "stb9", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 10, "childtable_prefix": "stb09_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -295,14 +295,14 @@ { "name": "stb10", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 11, "childtable_prefix": "stb10_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -321,14 +321,14 @@ { "name": "stb11", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 12, "childtable_prefix": "stb11_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, @@ -347,14 +347,14 @@ { "name": "stb12", "child_table_exists":"no", - "childtable_count": 3, + "childtable_count": 13, "childtable_prefix": "stb12_", "auto_create_table": "no", "batch_create_tbl_num": 100, "data_source": "rand", "insert_mode": "sml", "line_protocol": "telnet" , - "insert_rows":50, + "insert_rows":10, "childtable_limit": -1, "childtable_offset":0, "interlace_rows": 32767, diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json new file mode 100644 index 0000000000000000000000000000000000000000..4e8ff40cfdb7650f9d82635ac5be42f67904158a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json @@ -0,0 +1,113 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "TIMESTAMP"}], + "tags": [{"type": "TIMESTAMP", "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "TIMESTAMP"}], + "tags": [{"type": "TIMESTAMP", "count":1}] + }, + { + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 3, + "childtable_prefix": "stb12_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json" , + "insert_rows":50, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [ {"type": "TIMESTAMP"}], + "tags": [{"type": "TIMESTAMP", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json new file mode 100644 index 0000000000000000000000000000000000000000..c70db14b4c9b5fabe590eb8fec4a1f0e4dbc831a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "sml", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json index 83689d6c40e3844707cc367431f37f4f8ec144d5..12034adc0788f84852019d776fc0987cbc9c4f16 100644 --- a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json +++ b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json @@ -109,58 +109,6 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb2", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb02_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "sml", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb4", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb04_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "sml", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 100, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json index 98770a9fc80d8cde52674352469dffb5fa268715..2712f885936c12c1cf7742376ea541fd12e55cd4 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json @@ -32,14 +32,14 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "NN123_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -56,14 +56,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "NNN_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -80,14 +80,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "NNY_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -104,14 +104,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "NY123_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -128,14 +128,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "NYN_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -152,14 +152,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "NYY_", "batch_create_tbl_num": 100, - "data_source": "rand", - "insert_mode": "stmt", + "data_source": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json index 9646f3dd23ef7bc9cbde6317437e10d96b0b213a..f8fe21a6c4015a27ee663bc7ac54a7889af62add 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json @@ -32,14 +32,14 @@ "update": 0 }, "super_tables": [{ - "name": "stb", + "name": "stb1", "child_table_exists":"no", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "YN123_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -56,14 +56,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb2", "child_table_exists":"no", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "YNN_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -80,14 +80,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb3", "child_table_exists":"no", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "YNY_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -104,14 +104,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb4", "child_table_exists":"yes", "auto_create_table": "123", "childtable_count": 20, "childtable_prefix": "YY123_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -128,14 +128,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb5", "child_table_exists":"yes", "auto_create_table": "no", "childtable_count": 20, "childtable_prefix": "YYN_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, @@ -152,14 +152,14 @@ "columns": [{"type": "INT"}], "tags": [{"type": "TINYINT"}] },{ - "name": "stb", + "name": "stb6", "child_table_exists":"yes", "auto_create_table": "yes", "childtable_count": 20, "childtable_prefix": "YYY_", "batch_create_tbl_num": 100, "data_source": "rand", - "insert_mode": "stmt", + "insert_mode": "taosc", "insert_rows": 5, "childtable_limit": 40, "childtable_offset":0, diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json new file mode 100644 index 0000000000000000000000000000000000000000..f59d2e4e22e165ddf1adf8b95212d521a75737d9 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 10240000000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb02_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb04_", + "auto_create_table": "no", + "batch_create_tbl_num": 12, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 1, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 100, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json index 5b7a7eda59831646a97318025b2b66979a17411a..4903335d181a0f06a0f0714072301438883f0f6e 100644 --- a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json +++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json @@ -109,58 +109,6 @@ "tags_file": "", "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb2", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb02_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "stmt", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] - }, - { - "name": "stb4", - "child_table_exists":"no", - "childtable_count": 1, - "childtable_prefix": "stb04_", - "auto_create_table": "no", - "batch_create_tbl_num": 12, - "data_source": "rand", - "insert_mode": "stmt", - "insert_rows": 1, - "childtable_limit": 0, - "childtable_offset":0, - "multi_thread_write_one_tbl": "no", - "interlace_rows": 100, - "insert_interval":0, - "max_sql_len": 1024000, - "disorder_ratio": 0, - "disorder_range": 1000, - "timestamp_step": 1, - "start_timestamp": "2020-10-01 00:00:00.000", - "sample_format": "csv", - "sample_file": "./sample.csv", - "tags_file": "", - "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}], - "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] } diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py index 3bb290fdd0550bbebd95ebd9c30ee34272808281..4fdaab25fe182141bebbc06a30fa257481360be3 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py @@ -48,7 +48,7 @@ class TDTestCase: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" - # insert: create one or mutiple tables per sql and insert multiple rows per sql + # taosc interface os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-allDataType.json -y " % binPath) tdSql.execute("use db") tdSql.query("select count (tbname) from stb0") @@ -79,7 +79,52 @@ class TDTestCase: tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 200000) - + + # insert-interface: sml + os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-allDataType-sml.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 20) + # tdSql.query("select last(ts) from db.stb00_0") + # tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 1000) + # tdSql.query("select last(ts) from db.stb01_0") + # tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 4000) + + + # # insert-interface: sml-json + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y " % binPath) + # tdSql.execute("use db") + # tdSql.query("show stables") + # for i in range(13): + # for j in range(13): + # if tdSql.queryResult[i][0] == 'stb%d'%j: + # # print(i,"stb%d"%j) + # tdSql.checkData(i, 4, j+1) + + + # insert-interface: sml-telnet + os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("show stables") + for i in range(13): + for j in range(13): + if tdSql.queryResult[i][0] == 'stb%d'%j: + # print(i,"stb%d"%j) + tdSql.checkData(i, 4, j+1) + for i in range(13): + tdSql.query("select count(*) from stb%d"%i) + tdSql.checkData(0, 0, (i+1)*10) + + # insert-interface: sml-telnet + assert os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-sml-timestamp.json -y " % binPath) !=0 + + # taosdemo command line os.system("%staosBenchmark -t 1000 -n 100 -T 10 -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,NCHAR,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY -y " % binPath) tdSql.execute("use test") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py new file mode 100644 index 0000000000000000000000000000000000000000..7f3106e0fa52b8622fe91546e13e4df69defed73 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py @@ -0,0 +1,184 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + global cfgPath + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + cfgPath = projPath + "/community/sim/dnode1/cfg" + + else: + projPath = selfPath[:selfPath.find("tests")] + cfgPath = projPath + "/sim/dnode1/cfg" + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + # def checkGerData(): + + def run(self): + buildPath = self.getBuildPath() + print("%s" % cfgPath ) + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + tdLog.info("create super table") + # create super table + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("describe meters;") + tdSql.checkRows(13) + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + + tdLog.info("create general table -N ") + tdSql.execute("drop database db1;") + # create general table -N + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("describe `test.0`;") + tdSql.checkRows(11) + tdSql.error("select count(*) from meters") + tdSql.error("select count(tbname) from meters") + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + tdLog.info("use diffrent interface stmt") + tdSql.execute("drop database db1;") + # use diffrent interface-stmt + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + # tdLog.info("use diffrent interface rest") + # tdSql.execute("drop database db1;") + # # use diffrent interface -rest + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + tdLog.info("use diffrent interface sml") + tdSql.execute("drop database db1;") + # use diffrent interface-sml + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + + tdLog.info("all data type") + tdSql.execute("drop database db1;") + # all data type + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + tdLog.info("all data type and interlace rows") + tdSql.execute("drop database db1;") + # all data type + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10\ + -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096\ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + tdSql.execute("use db3") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + tdLog.info("all data type and too much para") + tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ + localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + tdSql.execute("drop database db3;") + # repeate parameters + os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ + localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + tdSql.execute("use db1") + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(tbname) from meters") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from `test.0`") + tdSql.checkData(0, 0, 100) + + # tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \ + # -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath,cfgPath)) + # # taosdemo error-exceeds max length + # assert os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \ + # -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath,cfgPath)) != 0 + + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res*.txt*") + os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename ) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 2aaa5795866e03ab0bf4d3dbf6c0e431ebd604d3..06236a1d0175e4f685b29584cc0456e621fb754b 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -68,21 +68,21 @@ class TDTestCase: tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 2000) - # restful connector insert data - os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath) - tdSql.execute("use db") - tdSql.query("select count (tbname) from stb0") - tdSql.checkData(0, 0, 10) - tdSql.query("select count (tbname) from stb1") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 100) - tdSql.query("select count(*) from stb01_1") - tdSql.checkData(0, 0, 20) - tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 200) + # # restful connector insert data + # os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath) + # tdSql.execute("use db") + # tdSql.query("select count (tbname) from stb0") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count (tbname) from stb1") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from stb00_0") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from stb0") + # tdSql.checkData(0, 0, 100) + # tdSql.query("select count(*) from stb01_1") + # tdSql.checkData(0, 0, 20) + # tdSql.query("select count(*) from stb1") + # tdSql.checkData(0, 0, 200) # default values json files tdSql.execute("drop database if exists db") @@ -103,30 +103,30 @@ class TDTestCase: tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 20) tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 10000) + tdSql.checkData(0, 0, 100) tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 100000) + tdSql.checkData(0, 0, 1000) tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 20000) + tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 400000) + tdSql.checkData(0, 0, 4000) # insert: using parament "insert_interval to controls spped of insert. # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath) tdSql.execute("use db") tdSql.query("show stables") - tdSql.checkData(0, 4, 100) + tdSql.checkData(0, 4, 10) tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 20000) + tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 2000000) + tdSql.checkData(0, 0, 2000) tdSql.query("show stables") - tdSql.checkData(1, 4, 100) + tdSql.checkData(1, 4, 20) tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 20000) + tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 2000000) + tdSql.checkData(0, 0, 4000) # spend 2min30s for 3 testcases. # insert: drop and child_table_exists combination test @@ -218,6 +218,10 @@ class TDTestCase: tdSql.query("select count(*) from db.stb3") tdSql.checkRows(1) tdSql.execute("drop database if exists db") + os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y " % binPath) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath) tdSql.error("select count(*) from db.stb0") tdSql.execute("drop database if exists db") @@ -353,6 +357,15 @@ class TDTestCase: tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes tdSql.checkRows(20) + # insert: test chinese encoding + os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (*) from stb0") + tdSql.checkData(0, 0, 1500) + + # rm useless files os.system("rm -rf ./insert*_res.txt*") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py index 4c2baf5a11d3f5dff3a98664be11cac78ebb9c6b..f1eee8d0cff9f3ca22e70c683343f57ec7baca2b 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py @@ -56,12 +56,8 @@ class TDTestCase: tdSql.checkData(0, 0, 10) tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 20) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 100) tdSql.query("select count(*) from stb0") tdSql.checkData(0, 0, 1000) - tdSql.query("select count(*) from stb01_1") - tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 4000) @@ -73,31 +69,27 @@ class TDTestCase: tdSql.checkData(0, 0, 10) tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 15) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 150) tdSql.query("select count(*) from stb0") tdSql.checkData(0, 0, 1500) - tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 200) tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 3000) - # insert: using parament "insert_interval to controls spped of insert. - # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath) - tdSql.execute("use db") - tdSql.query("select tbname from stb0") - tdSql.checkRows(100 ) - tdSql.query("select count(*) from stb00_0") - tdSql.checkData(0, 0, 20) - tdSql.query("select count(*) from stb0") - tdSql.checkData(0, 0, 2000) - tdSql.query("show stables") - tdSql.checkData(1, 4, 20) - tdSql.query("select count(*) from stb01_0") - tdSql.checkData(0, 0, 35) - tdSql.query("select count(*) from stb1") - tdSql.checkData(0, 0, 700) + # # insert: using parament "insert_interval to controls spped of insert. + # # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。 + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath) + # tdSql.execute("use db") + # tdSql.query("select tbname from db.stb0") + # tdSql.checkRows(100 ) + # # tdSql.query("select count(*) from stb00_0") + # # tdSql.checkData(0, 0, 20) + # tdSql.query("select count(*) from stb0") + # tdSql.checkData(0, 0, 2000) + # tdSql.query("show stables") + # tdSql.checkData(1, 4, 20) + # # tdSql.query("select count(*) from stb01_0") + # # tdSql.checkData(0, 0, 35) + # tdSql.query("select count(*) from stb1") + # tdSql.checkData(0, 0, 700) # spend 2min30s for 3 testcases. # insert: drop and child_table_exists combination test @@ -142,10 +134,10 @@ class TDTestCase: # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y " % binPath) # tdSql.query("select count(*) from db.stb0") # tdSql.checkData(0, 0, 10000) - tdSql.execute("drop database if exists db") - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath) - tdSql.query("select count(*) from db.stb0") - tdSql.checkRows(0) + # tdSql.execute("drop database if exists db") + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath) + # tdSql.query("select count(*) from db.stb0") + # tdSql.checkRows(0) tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y " % binPath) tdSql.execute("use db") @@ -160,11 +152,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select count(*) from db.stb1") tdSql.checkRows(1) - tdSql.error("select * from db.stb4") - tdSql.error("select * from db.stb2") tdSql.query("select count(*) from db.stb3") tdSql.checkRows(1) tdSql.execute("drop database if exists db") + os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json -y " % binPath) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json -y " % binPath) tdSql.error("select count(*) from db.stb0") tdSql.execute("drop database if exists db") @@ -177,14 +171,17 @@ class TDTestCase: os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json -y " % binPath) tdSql.error("use db") tdSql.execute("drop database if exists blf") - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath) - tdSql.execute("use blf") - tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") - tdSql.checkData(0, 0, "2020-03-31 12:00:00.000") - tdSql.query("select first(ts) from blf.p_0_topics_2") - tdSql.checkData(0, 0, "2019-10-01 00:00:00") - tdSql.query("select last(ts) from blf.p_0_topics_6 ") - tdSql.checkData(0, 0, "2020-09-29 23:59:00") + + # child table name is invalid reading,so + # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath) + # tdSql.execute("use blf") + # tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1") + # tdSql.checkData(0, 0, "2020-03-31 12:00:00.000") + # tdSql.query("select first(ts) from blf.p_0_topics_2") + # tdSql.checkData(0, 0, "2019-10-01 00:00:00") + # tdSql.query("select last(ts) from blf.p_0_topics_6 ") + # tdSql.checkData(0, 0, "2020-09-29 23:59:00") + # it will be commented in ci because it spend too much time to insert data, but when you can excute it when you want to test this case. # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json -y " % binPath) # tdSql.execute("use db") @@ -200,6 +197,7 @@ class TDTestCase: # tdSql.checkData(0, 0, 5000000) + # insert: timestamp and step os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-timestep-sml.json -y " % binPath) tdSql.execute("use db") @@ -207,12 +205,12 @@ class TDTestCase: tdSql.checkData(0, 0, 10) tdSql.query("select count (tbname) from stb1") tdSql.checkData(0, 0, 20) - tdSql.query("select last(ts) from db.stb00_0") - tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") + # tdSql.query("select last(ts) from db.stb00_0") + # tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") tdSql.query("select count(*) from stb0") tdSql.checkData(0, 0, 200) - tdSql.query("select last(ts) from db.stb01_0") - tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") + # tdSql.query("select last(ts) from db.stb01_0") + # tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 400) @@ -228,17 +226,17 @@ class TDTestCase: tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 10) - # insert: sample json - os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y " % binPath) - tdSql.execute("use dbtest123") - tdSql.query("select c2 from stb0") - tdSql.checkData(0, 0, 2147483647) - tdSql.query("select * from stb1 where t1=-127") - tdSql.checkRows(20) - tdSql.query("select * from stb1 where t2=127") - tdSql.checkRows(10) - tdSql.query("select * from stb1 where t2=126") - tdSql.checkRows(10) + # insert: doesn‘t currently supported sample json + assert os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y " % binPath) != 0 + # tdSql.execute("use dbtest123") + # tdSql.query("select c2 from stb0") + # tdSql.checkData(0, 0, 2147483647) + # tdSql.query("select * from stb1 where t1=-127") + # tdSql.checkRows(20) + # tdSql.query("select * from stb1 where t2=127") + # tdSql.checkRows(10) + # tdSql.query("select * from stb1 where t2=126") + # tdSql.checkRows(10) # insert: test interlace parament os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interlace-row-sml.json -y " % binPath) diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py index 5dba103ef9eafaf15d3159cae94e2b3a264cd8a9..05ccce79101b5bec1b541bd0436b86fc0151492c 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py @@ -187,6 +187,10 @@ class TDTestCase: tdSql.query("select count(*) from db.stb3") tdSql.checkRows(1) tdSql.execute("drop database if exists db") + os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json -y " % binPath) + tdSql.error("select * from db.stb4") + tdSql.error("select * from db.stb2") + tdSql.execute("drop database if exists db") os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json -y " % binPath) tdSql.error("select count(*) from db.stb0") tdSql.execute("drop database if exists db") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py index e0b56b93ba0ed2c1e0a3e25bdc176059ea1ef61a..06dcda48064913d69b18cfa004a8218958e35413 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py @@ -174,15 +174,15 @@ class TDTestCase: "2020-11-01 00:00:00.004") # query times less than or equal to 100 - os.system( + assert os.system( "%staosBenchmark -f tools/taosdemoAllTest/queryInsertdata.json" % - binPath) - os.system( + binPath) == 0 + assert os.system( "%staosBenchmark -f tools/taosdemoAllTest/querySpeciMutisql100.json" % - binPath) - os.system( + binPath) != 0 + assert os.system( "%staosBenchmark -f tools/taosdemoAllTest/querySuperMutisql100.json" % - binPath) + binPath) == 0 # query result print QPS os.system( diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/general/parser/nestquery.sim index f066acab03b79d6671ca6f5ae1e20f35f93cbb2f..3653efe0be35340c3aa68b678f63de7f0a0dda10 100644 --- a/tests/script/general/parser/nestquery.sim +++ b/tests/script/general/parser/nestquery.sim @@ -951,4 +951,209 @@ sql insert into sub2 using st tags(2) values(now ,3); sql insert into sub2 using st tags(2) values(now ,4); sql_error select max(ts_inter) ,tbname from (select elapsed(ts) ts_inter ,tbname from st interval (1s) group by tbname) order by ts sql drop database test11969 + +print ==========================================> TD-11097 +sql create database td11097 +sql use td11097 +sql create table meters2 (ts timestamp, voltage bigint,num int) tags (location binary(30), groupid int); +sql create table D001 using meters2 tags ("Beijing.Chaoyang", 1); +sql create table D002 using meters2 tags ("Beijing.haidian", 2); +sql create table D003 using meters2 tags ('"Beijing.Tongzhou"', 3); +$ts = 1639556426000 +sql insert into d001 values ( $ts ,1,2); +sql insert into d001 values ( $ts +1m,2,3); +sql insert into d001 values ( $ts +2m,4,3); +sql insert into d001 values ( $ts +4m,8,3); +sql insert into d002 values ( $ts ,4,3); +sql insert into d002 values ( $ts +3m,40,3); +sql insert into d002 values ( $ts +1m,46,3); +sql insert into d001 values ( $ts +20m,1,2); +sql insert into d002 values ( $ts +21m,4,3); +sql select diff(voltage) value from meters2 group by tbname; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; + +$emptyString = @@ +print execute sql select diff(voltage) value from meters2 group by tbname; +sql select diff(voltage) value from meters2 group by tbname; +if $data00 != @21-12-15 16:21:26.000@ then + return -1 +endi +if $data01 != @1@ then + return -1 +endi +if $data02 != @d001@ then + return -1 +endi +if $data10 != @21-12-15 16:22:26.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data12 != @d001@ then + return -1 +endi +if $data20 != @21-12-15 16:24:26.000@ then + return -1 +endi +if $data21 != @4@ then + return -1 +endi +if $data22 != @d001@ then + return -1 +endi +if $data30 != @21-12-15 16:40:26.000@ then + return -1 +endi +if $data31 != @-7@ then + return -1 +endi +if $data32 != @d001@ then + return -1 +endi +if $data40 != @21-12-15 16:21:26.000@ then + return -1 +endi +if $data41 != @42@ then + return -1 +endi +if $data42 != @d002@ then + return -1 +endi +if $data50 != @21-12-15 16:23:26.000@ then + return -1 +endi +if $data51 != @-6@ then + return -1 +endi +if $data52 != @d002@ then + return -1 +endi +if $data60 != @21-12-15 16:41:26.000@ then + return -1 +endi +if $data61 != @-36@ then + return -1 +endi +if $data62 != @d002@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; +if $data00 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data01 != @43@ then + return -1 +endi +if $data10 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data21 != @-6@ then + return -1 +endi +if $data30 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data41 != @-7@ then + return -1 +endi +if $data50 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data51 != @-36@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; +if $data00 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data01 != @43@ then + return -1 +endi +if $data10 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data11 != @2@ then + return -1 +endi +if $data20 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data21 != @-6@ then + return -1 +endi +if $data30 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data31 != @4@ then + return -1 +endi +if $data40 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data41 != @-7@ then + return -1 +endi +if $data50 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data51 != @-36@ then + return -1 +endi +print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; +sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; +if $data00 != @21-12-15 16:41:00.000@ then + return -1 +endi +if $data01 != @-36@ then + return -1 +endi +if $data10 != @21-12-15 16:40:00.000@ then + return -1 +endi +if $data11 != @-7@ then + return -1 +endi +if $data20 != @21-12-15 16:24:00.000@ then + return -1 +endi +if $data21 != @4@ then + return -1 +endi +if $data30 != @21-12-15 16:23:00.000@ then + return -1 +endi +if $data31 != @-6@ then + return -1 +endi +if $data40 != @21-12-15 16:22:00.000@ then + return -1 +endi +if $data41 != @2@ then + return -1 +endi +if $data50 != @21-12-15 16:21:00.000@ then + return -1 +endi +if $data51 != @43@ then + return -1 +endi +sql drop database td11097 + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/select_with_tags.sim b/tests/script/general/parser/select_with_tags.sim index 195eca928fa4ddbf3795ae3e40f973ea0a5e8def..258b59f4ae5ffd75878bca469efc226a6d2d0825 100644 --- a/tests/script/general/parser/select_with_tags.sim +++ b/tests/script/general/parser/select_with_tags.sim @@ -956,4 +956,39 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group #sql select count(c1) from select_tags_mt0 where c1=99 group by tbname; #sql select count(*),tbname from select_tags_mt0 group by tbname +print ==================================> TD-11943 +sql create database test11943; +sql use test11943; +sql create stable st (ts timestamp , id int ) tags (ind int ); +sql insert into sub1 using st tags(1) values(now ,1); +sql insert into sub1 using st tags(1) values(now ,2); +sql insert into sub2 using st tags(2) values(now ,3); +sql insert into sub2 using st tags(2) values(now ,4); +sql select tbname ,max(id)+5 from sub1; +if $data00 != @sub1@ then + return -1 +endi +if $data01 != @7.000000000@ then + return -1 +endi +sql select ind, max(id)+5 from st group by tbname +if $data00 != @1@ then + return -1 +endi +if $data01 != @7.000000000@ then + return -1 +endi +if $data02 != @sub1@ then + return -1 +endi +if $data10 != @2@ then + return -1 +endi +if $data11 != @9.000000000@ then + return -1 +endi +if $data12 != @sub2@ then + return -1 +endi +sql drop database test11943 system sh/exec.sh -n dnode1 -s stop -x SIGINT