未验证 提交 4478a61b 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #9259 from taosdata/dev/chr

[TD-11094][TD-6677][TD-10789][TD-12389]<test>:add taosdemo shell test case
###################################################################
# 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 os
import taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
import time
import random
import datetime
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
# def assertCheck(self, filename, queryResult, expectResult):
# self.filename = filename
# self.queryResult = queryResult
# self.expectResult = expectResult
# args0 = (filename, queryResult, expectResult)
# assert queryResult == expectResult, "Queryfile:%s ,result is %s != expect: %s" % args0
def assertfileDataExport(self, filename, expectResult):
self.filename = filename
self.expectResult = expectResult
with open("%s" % filename, 'r+') as f1:
for line in f1.readlines():
queryResultTaosc = line.strip().split(',')[0]
# self.assertCheck(filename, queryResultTaosc, expectResult)
def run(self):
starttime = 1537146000000
tdSql.prepare()
tdSql.execute("drop database if exists db_json;")
print("==============step1 tag format =======")
tdLog.info("create database db_jsonB ")
tdSql.execute("create database db_jsonB")
tdSql.execute("use db_jsonB")
# test Benchmark
tdSql.execute("create table if not exists jsons1(ts timestamp,dataFloat float) tags(jtag json)")
for numTables in range(500):
json = "{\"loc1%d\":\"beijingandshanghaiandchangzhouandshijiazhuanganda%d\",\"loc2%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandb%d\" ,\"loc3%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandc%d\",\
\"loc4%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandd%d\",\"loc5%d\":\"beijingandshanghaiandchangzhouandshijiazhuangande%d\",\"loc6%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandf%d\",\
\"loc7%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandg%d\"}"% (numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables)
print(json)
createTableSqls = "create table if not exists jsons1_%d using jsons1 tags('%s')" %(numTables,json)
print(createTableSqls)
tdLog.info(createTableSqls)
tdSql.execute(createTableSqls)
for numRecords in range(1,101):
dataFloatSql=numRecords*10+numRecords*0.01
insertDataSqls = "insert into jsons1_%d values(%d+%ds, %d) " %(numTables,starttime,numRecords,dataFloatSql)
tdLog.info(insertDataSqls)
tdSql.execute(insertDataSqls)
tdSql.execute("use db_jsonB")
now_time1 = datetime.datetime.now()
tdSql.query("select * from jsons1 where ts>1537145900000 and ts<1537156000000;")
spendTimes1 = datetime.datetime.now() - now_time1
print(spendTimes1)
now_time2 = datetime.datetime.now()
tdSql.query("select * from jsons1 where ts>1537156000000;")
spendTimes2 = datetime.datetime.now() - now_time2
print(spendTimes2)
tdSql.execute("drop database db_jsonB")
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())
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys
import os
import taos import taos
from util.log import tdLog from util.log import tdLog
from util.cases import tdCases from util.cases import tdCases
...@@ -25,6 +26,21 @@ class TDTestCase: ...@@ -25,6 +26,21 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), logSql)
# def assertCheck(self, filename, queryResult, expectResult):
# self.filename = filename
# self.queryResult = queryResult
# self.expectResult = expectResult
# args0 = (filename, queryResult, expectResult)
# assert queryResult == expectResult, "Queryfile:%s ,result is %s != expect: %s" % args0
def assertfileDataExport(self, filename, expectResult):
self.filename = filename
self.expectResult = expectResult
with open("%s" % filename, 'r+') as f1:
for line in f1.readlines():
queryResultTaosc = line.strip().split(',')[0]
# self.assertCheck(filename, queryResultTaosc, expectResult)
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
tdSql.execute("drop database if exists db_json;") tdSql.execute("drop database if exists db_json;")
...@@ -62,8 +78,18 @@ class TDTestCase: ...@@ -62,8 +78,18 @@ class TDTestCase:
tdSql.error("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s1\":5}')" % char2) # len(key)=257 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.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.error("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"TS\":\"%s\"}')" % char3) # len(object)=4097
# test the min/max length of double type , and int64 is not required
tdSql.error("CREATE TABLE if not exists jsons4_3 using jsons4 tags('{\"doublength\":-1.8e308}')")
tdSql.error("CREATE TABLE if not exists jsons4_3 using jsons4 tags('{\"doublength\":1.8e308}')")
tdSql.execute("CREATE TABLE if not exists jsons4_4 using jsons4 tags('{\"doublength\":-1.7e308}')")
tdSql.execute("CREATE TABLE if not exists jsons4_5 using jsons4 tags('{\"doublength\":1.71e308}')")
tdSql.query("select jtag from jsons4 where jtag->'doublength'<-1.69e+308;")
tdSql.checkRows(1)
tdSql.query("select jtag from jsons4 where jtag->'doublength'>1.7e+308;")
tdSql.checkRows(1)
tdSql.execute("insert into jsons1_1 values(now, 1, 'json1')") tdSql.execute("insert into jsons1_1 values(now+2s, 1, 'json1')")
tdSql.execute("insert into jsons1_1 values(now+1s, 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_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_3 using jsons1 tags('{\"num\":34,\"location\":\"beijing\",\"level\":\"l1\"}') values (now, 1, 'json3')")
...@@ -194,15 +220,12 @@ class TDTestCase: ...@@ -194,15 +220,12 @@ class TDTestCase:
tdSql.checkRows(0) tdSql.checkRows(0)
# # test where condition in # # test where condition in
# tdSql.query("select * from jsons1 where jtag->'location' in ('beijing')") tdSql.error("select * from jsons1 where jtag->'location' in ('beijing')")
# tdSql.checkRows(3) # tdSql.checkRows(3)
tdSql.error("select * from jsons1 where jtag->'num' in (5,34)")
# tdSql.query("select * from jsons1 where jtag->'num' in (5,34)")
# tdSql.checkRows(2) # tdSql.checkRows(2)
tdSql.error("select * from jsons1 where jtag->'num' in ('5',34)")
# tdSql.error("select * from jsons1 where jtag->'num' in ('5',34)") tdSql.error("select * from jsons1 where jtag->'location' in ('beijing') and jtag->'class'=55")
# tdSql.query("select * from jsons1 where jtag->'location' in ('beijing') and jtag->'class'=55")
# tdSql.checkRows(1) # tdSql.checkRows(1)
# test where condition match # test where condition match
...@@ -412,8 +435,25 @@ class TDTestCase: ...@@ -412,8 +435,25 @@ class TDTestCase:
tdSql.query(" select stddev(dataint) from jsons1 where jtag->'location'='beijing';") tdSql.query(" select stddev(dataint) from jsons1 where jtag->'location'='beijing';")
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.error(" select LEASTSQUARES(dataint,1,2) from jsons1_1 where jtag->'location' ='beijing' ;") tdSql.error(" select LEASTSQUARES(dataint,1,2) from jsons1_1 where jtag->'location' ='beijing' ;")
tdSql.query("select count(jtag) from jsons1 ;")
tdSql.checkData(0, 0, 15)
tdSql.error("select count( jtag->'location'='beijing') from jsons1 ;")
tdSql.error("select count( jtag contains 'age') from jsons1 ;")
functionName = ['avg','twa','irate','stddev', 'stddev', 'leastsquares']
print(functionName)
for fn in functionName:
tdSql.error("select %s( jtag) from jsons1 ;"%fn)
tdSql.error("select %s( jtag->'location'='beijing') from jsons1 ;"%fn)
tdSql.error("select %s( jtag contains 'age') from jsons1 ;"%fn)
# tdSql.error("select avg( jtag) from jsons1 ;")
# tdSql.error("select avg( jtag->'location'='beijing') from jsons1 ;")
# tdSql.error("select avg( jtag contains 'age') from jsons1 ;")
# Select_exprs is SQL function -Selection function # Select_exprs is SQL function -Selection function
...@@ -467,6 +507,13 @@ class TDTestCase: ...@@ -467,6 +507,13 @@ class TDTestCase:
tdSql.checkRows(4) tdSql.checkRows(4)
tdSql.checkData(0,1,2) tdSql.checkData(0,1,2)
tdSql.checkData(2,1,4) tdSql.checkData(2,1,4)
#error
functionName = ['min','max','last','TOP','last_row','bottom','apercentile','interp']
print(functionName)
for fn in functionName:
tdSql.error("select %s( jtag) from jsons1 ;"%fn)
tdSql.error("select %s( jtag->'location'='beijing') from jsons1 ;"%fn)
tdSql.error("select %s( jtag contains 'age') from jsons1 ;"%fn)
# Select_exprs is SQL function -Calculation function # 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 diff(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
...@@ -500,13 +547,21 @@ class TDTestCase: ...@@ -500,13 +547,21 @@ class TDTestCase:
tdSql.query("select ts,round(dataint),round(datafloat),round(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';") tdSql.query("select round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';")
functionName = ['diff','Derivative','SPREAD','ceil','round','floor']
print(functionName)
for fn in functionName:
tdSql.error("select %s( jtag) from jsons1 ;"%fn)
tdSql.error("select %s( jtag->'location'='beijing') from jsons1 ;"%fn)
tdSql.error("select %s( jtag contains 'age') from jsons1 ;"%fn)
#modify one same key and diffirent data type,include negative number of double #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_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.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.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.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.query("select jtag from jsons7 where jtag->'tea'<-1.01;")
# tdSql.checkRows(2) tdSql.checkRows(1)
# test join # 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 jsons6(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)")
...@@ -572,6 +627,36 @@ class TDTestCase: ...@@ -572,6 +627,36 @@ class TDTestCase:
tdSql.query(" select stddev(dataint) from jsons8 group by datatime;") tdSql.query(" select stddev(dataint) from jsons8 group by datatime;")
tdSql.error(" select stddev(datatime) from jsons8 group by datadouble;") tdSql.error(" select stddev(datatime) from jsons8 group by datadouble;")
# # verify the tag length of the super table and the child table
# TD-12389
# tdSql.query("describe jsons1;")
# jtagLengthSup=tdSql.queryResult[3][2]
# tdSql.query("describe jsons1_1;")
# tdSql.checkData(3, 2, jtagLengthSup)
# #test import and export
# tdSql.execute("select * from jsons1 >> jsons1_data.csv;")
# tdSql.query("select * from jsons1 ")
# with open("./jsons1_data.csv", 'r+') as f1:
# # count=len(open("./jsons1_data.csv",'rU').readlines())
# # print(count)
# rows=0
# for line in f1.readlines():
# # for columns in range(4): # it will be replaced with column length later,but now it is setted to a fixed value first
# queryResultInt = line.strip().split(',')[1]
# # queryResultTag = line.strip().split(',')[3]
# # for rows in range(9):
# # print(rows,1,queryResultInt,queryResultTag)
# tdSql.checkData(rows, 1, "%s" %queryResultInt)
# # tdSql.checkData(rows, 3, "%s" %queryResultTag)
# rows +=1
# # test taos -f
# os.system("taos -f stable/json_tag_extra.py.sql ")
# tdSql.execute("use db_json")
# tdSql.query("select * from jsons1")
# tdSql.checkRows(9)
# # test drop tables and databases # # test drop tables and databases
# tdSql.execute("drop table jsons1_1") # tdSql.execute("drop table jsons1_1")
...@@ -579,7 +664,10 @@ class TDTestCase: ...@@ -579,7 +664,10 @@ class TDTestCase:
# tdSql.execute("drop stable jsons3") # tdSql.execute("drop stable jsons3")
# tdSql.execute("drop stable jsons2") # tdSql.execute("drop stable jsons2")
# tdSql.execute("drop database db_json") # tdSql.execute("drop database db_json")
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): def stop(self):
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
"batch_create_tbl_num": 20, "batch_create_tbl_num": 20,
"data_source": "rand", "data_source": "rand",
"insert_mode": "taosc", "insert_mode": "taosc",
"insert_rows": 150, "insert_rows": 100,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"multi_thread_write_one_tbl": "no", "multi_thread_write_one_tbl": "no",
...@@ -58,6 +58,138 @@ ...@@ -58,6 +58,138 @@
"tags_file": "", "tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}], "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}] "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb1",
"child_table_exists":"no",
"childtable_count": 20,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "rest",
"insert_rows": 100,
"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}]
},
{
"name": "stb2",
"child_table_exists":"no",
"childtable_count": 30,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "stmt",
"insert_rows": 100,
"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}]
},
{
"name": "stb3",
"child_table_exists":"no",
"childtable_count": 40,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"insert_rows": 100,
"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}]
},
{
"name": "stb4",
"child_table_exists":"no",
"childtable_count": 50,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet",
"insert_rows": 100,
"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"}],
"tags": [{"type": "TINYINT", "count":2}]
},
{
"name": "stb5",
"child_table_exists":"no",
"childtable_count": 60,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json",
"insert_rows": 100,
"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"}],
"tags": [{"type": "TINYINT"}]
}] }]
}] }]
} }
...@@ -85,16 +85,16 @@ ...@@ -85,16 +85,16 @@
"tags": [{"type": "TINYINT", "count":1}] "tags": [{"type": "TINYINT", "count":1}]
}, },
{ {
"name": "stb3", "name": "stb2",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 5, "childtable_count": 3,
"childtable_prefix": "stb03_", "childtable_prefix": "stb03_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "json" , "line_protocol": "json" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -111,16 +111,16 @@ ...@@ -111,16 +111,16 @@
"tags": [{"type": "BIGINT", "count":1}] "tags": [{"type": "BIGINT", "count":1}]
}, },
{ {
"name": "stb4", "name": "stb3",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 20, "childtable_count": 4,
"childtable_prefix": "stb04_", "childtable_prefix": "stb04_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "json" , "line_protocol": "json" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -137,16 +137,16 @@ ...@@ -137,16 +137,16 @@
"tags": [{"type": "SMALLINT", "count":1}] "tags": [{"type": "SMALLINT", "count":1}]
}, },
{ {
"name": "stb5", "name": "stb4",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 40, "childtable_count": 5,
"childtable_prefix": "stb05_", "childtable_prefix": "stb05_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "json" , "line_protocol": "json" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -163,16 +163,16 @@ ...@@ -163,16 +163,16 @@
"tags": [{"type": "FLOAT", "count":1}] "tags": [{"type": "FLOAT", "count":1}]
}, },
{ {
"name": "stb6", "name": "stb5",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 15, "childtable_count": 6,
"childtable_prefix": "stb06_", "childtable_prefix": "stb06_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "json" , "line_protocol": "json" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -188,17 +188,43 @@ ...@@ -188,17 +188,43 @@
"columns": [{"type": "DOUBLE"}], "columns": [{"type": "DOUBLE"}],
"tags": [{"type": "DOUBLE", "count":1}] "tags": [{"type": "DOUBLE", "count":1}]
}, },
{
"name": "stb6",
"child_table_exists":"no",
"childtable_count": 7,
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
"insert_rows":10,
"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": "UINT"}],
"tags": [{"type": "UINT", "count":1}]
},
{ {
"name": "stb7", "name": "stb7",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 10, "childtable_count": 8,
"childtable_prefix": "stb07_", "childtable_prefix": "stb07_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "json" , "line_protocol": "json" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -217,14 +243,14 @@ ...@@ -217,14 +243,14 @@
{ {
"name": "stb8", "name": "stb8",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 20, "childtable_count": 9,
"childtable_prefix": "stb08_", "childtable_prefix": "stb08_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "json" , "line_protocol": "json" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -243,14 +269,14 @@ ...@@ -243,14 +269,14 @@
{ {
"name": "stb9", "name": "stb9",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 3, "childtable_count": 10,
"childtable_prefix": "stb09_", "childtable_prefix": "stb09_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "json" , "line_protocol": "json" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -269,14 +295,14 @@ ...@@ -269,14 +295,14 @@
{ {
"name": "stb10", "name": "stb10",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 3, "childtable_count": 11,
"childtable_prefix": "stb10_", "childtable_prefix": "stb10_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "telnet" , "line_protocol": "telnet" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -295,14 +321,14 @@ ...@@ -295,14 +321,14 @@
{ {
"name": "stb11", "name": "stb11",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 3, "childtable_count": 12,
"childtable_prefix": "stb11_", "childtable_prefix": "stb11_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "telnet" , "line_protocol": "telnet" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
...@@ -321,14 +347,14 @@ ...@@ -321,14 +347,14 @@
{ {
"name": "stb12", "name": "stb12",
"child_table_exists":"no", "child_table_exists":"no",
"childtable_count": 3, "childtable_count": 13,
"childtable_prefix": "stb12_", "childtable_prefix": "stb12_",
"auto_create_table": "no", "auto_create_table": "no",
"batch_create_tbl_num": 100, "batch_create_tbl_num": 100,
"data_source": "rand", "data_source": "rand",
"insert_mode": "sml", "insert_mode": "sml",
"line_protocol": "telnet" , "line_protocol": "telnet" ,
"insert_rows":50, "insert_rows":10,
"childtable_limit": -1, "childtable_limit": -1,
"childtable_offset":0, "childtable_offset":0,
"interlace_rows": 32767, "interlace_rows": 32767,
......
...@@ -97,15 +97,15 @@ class TDTestCase: ...@@ -97,15 +97,15 @@ class TDTestCase:
tdSql.checkData(0, 0, 4000) tdSql.checkData(0, 0, 4000)
# # insert-interface: sml-json # insert-interface: sml-json
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y " % binPath) os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y " % binPath)
# tdSql.execute("use db") tdSql.execute("use db")
# tdSql.query("show stables") tdSql.query("show stables")
# for i in range(13): for i in range(13):
# for j in range(13): for j in range(13):
# if tdSql.queryResult[i][0] == 'stb%d'%j: if tdSql.queryResult[i][0] == 'stb%d'%j:
# # print(i,"stb%d"%j) # print(i,"stb%d"%j)
# tdSql.checkData(i, 4, j+1) tdSql.checkData(i, 4, j+1)
# insert-interface: sml-telnet # insert-interface: sml-telnet
......
...@@ -95,18 +95,18 @@ class TDTestCase: ...@@ -95,18 +95,18 @@ class TDTestCase:
tdSql.query("select count(*) from `test.0`") tdSql.query("select count(*) from `test.0`")
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
# tdLog.info("use diffrent interface rest") tdLog.info("use diffrent interface rest")
# tdSql.execute("drop database db1;") tdSql.execute("drop database db1;")
# # use diffrent interface -rest # 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 \ 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)) -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.execute("use db1")
# tdSql.query("select count(*) from meters") tdSql.query("select count(*) from meters")
# tdSql.checkData(0, 0, 1000) tdSql.checkData(0, 0, 1000)
# tdSql.query("select count(tbname) from meters") tdSql.query("select count(tbname) from meters")
# tdSql.checkData(0, 0, 10) tdSql.checkData(0, 0, 10)
# tdSql.query("select count(*) from `test.0`") tdSql.query("select count(*) from `test.0`")
# tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
tdLog.info("use diffrent interface sml") tdLog.info("use diffrent interface sml")
tdSql.execute("drop database db1;") tdSql.execute("drop database db1;")
...@@ -121,7 +121,7 @@ class TDTestCase: ...@@ -121,7 +121,7 @@ class TDTestCase:
tdLog.info("all data type") tdLog.info("all data type")
tdSql.execute("drop database db1;") tdSql.execute("drop database db1;")
# all data type # all data type-taosc
os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ 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 \ -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)) -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath))
...@@ -132,6 +132,43 @@ class TDTestCase: ...@@ -132,6 +132,43 @@ class TDTestCase:
tdSql.checkData(0, 0, 10) tdSql.checkData(0, 0, 10)
tdSql.query("select count(*) from `test.0`") tdSql.query("select count(*) from `test.0`")
tdSql.checkData(0, 0, 100) tdSql.checkData(0, 0, 100)
tdLog.info("all data type")
tdSql.execute("drop database db1;")
# all data type-stmt
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. -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)
# all data type-rest
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. -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)
# # all data type-rest
# os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \
# -b INT,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. -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)
# # tdSql.query("select count(*) from `test.0`")
# # tdSql.checkData(0, 0, 100)
tdLog.info("all data type and interlace rows") tdLog.info("all data type and interlace rows")
tdSql.execute("drop database db1;") tdSql.execute("drop database db1;")
...@@ -164,11 +201,18 @@ class TDTestCase: ...@@ -164,11 +201,18 @@ class TDTestCase:
tdSql.query("select count(*) from `test.0`") tdSql.query("select count(*) from `test.0`")
tdSql.checkData(0, 0, 100) 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\) \ # taosdemo error
# -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)) # too max length
# # taosdemo error-exceeds max length sql = "%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \
# 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)
# -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 tdLog.info("%s" % sql )
assert os.system("%s" % sql ) != 0
# error password
sql = "%staosBenchmark -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\) \
-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)
tdLog.info("%s" % sql )
assert os.system("%s" % sql ) != 0
testcaseFilename = os.path.split(__file__)[-1] testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf ./insert_res*.txt*") os.system("rm -rf ./insert_res*.txt*")
......
...@@ -74,22 +74,23 @@ class TDTestCase: ...@@ -74,22 +74,23 @@ class TDTestCase:
tdSql.query("select count(*) from stb1") tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 3000) tdSql.checkData(0, 0, 3000)
# # insert: using parament "insert_interval to controls spped of insert. # 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。 # 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) os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath)
# tdSql.execute("use db") tdSql.execute("use db")
# tdSql.query("select tbname from db.stb0") # tdSql.query("select count (tbname) from stb0")
# tdSql.checkRows(100 ) tdSql.query("select tbname from db.stb0")
# # tdSql.query("select count(*) from stb00_0") tdSql.checkRows(100 )
# # tdSql.checkData(0, 0, 20) # tdSql.query("select count(*) from stb00_0")
# tdSql.query("select count(*) from stb0") # tdSql.checkData(0, 0, 20)
# tdSql.checkData(0, 0, 2000) tdSql.query("select count(*) from stb0")
# tdSql.query("show stables") tdSql.checkData(0, 0, 2000)
# tdSql.checkData(1, 4, 20) tdSql.query("show stables")
# # tdSql.query("select count(*) from stb01_0") tdSql.checkData(1, 4, 20)
# # tdSql.checkData(0, 0, 35) # tdSql.query("select count(*) from stb01_0")
# tdSql.query("select count(*) from stb1") # tdSql.checkData(0, 0, 35)
# tdSql.checkData(0, 0, 700) tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 700)
# spend 2min30s for 3 testcases. # spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test # insert: drop and child_table_exists combination test
...@@ -134,10 +135,13 @@ class TDTestCase: ...@@ -134,10 +135,13 @@ class TDTestCase:
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y " % binPath) # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0") # tdSql.query("select count(*) from db.stb0")
# tdSql.checkData(0, 0, 10000) # tdSql.checkData(0, 0, 10000)
# there is no limit of 4096 columns,so cancels this case
# tdSql.execute("drop database if exists db") # tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath) # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0") # tdSql.query("select count(*) from db.stb0")
# tdSql.checkRows(0) # tdSql.checkRows(0)
tdSql.execute("drop database if exists db") tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y " % binPath) os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y " % binPath)
tdSql.execute("use db") tdSql.execute("use db")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册