Merge pull request #28945 from taosdata/enh/TD-31831-3.0
add describe many columns over 100 case
This commit is contained in:
commit
8c79fa5734
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"filetype":"insert",
|
||||||
|
"cfgdir":"/etc/taos",
|
||||||
|
"host":"127.0.0.1",
|
||||||
|
"port":6030,
|
||||||
|
"user":"root",
|
||||||
|
"password":"taosdata",
|
||||||
|
"thread_count":1,
|
||||||
|
"create_table_thread_count":1,
|
||||||
|
"confirm_parameter_prompt":"no",
|
||||||
|
"prepare_rand":100,
|
||||||
|
"num_of_records_per_req":100,
|
||||||
|
"databases": [
|
||||||
|
{
|
||||||
|
"dbinfo":{
|
||||||
|
"name":"test",
|
||||||
|
"drop":"yes"
|
||||||
|
},
|
||||||
|
"super_tables":[
|
||||||
|
{
|
||||||
|
"name":"meters",
|
||||||
|
"child_table_exists":"no",
|
||||||
|
"childtable_prefix":"d",
|
||||||
|
"data_source":"rand",
|
||||||
|
"insert_mode":"taosc",
|
||||||
|
"childtable_count": 1,
|
||||||
|
"insert_rows":10,
|
||||||
|
"timestamp_step":1000,
|
||||||
|
"start_timestamp":"2022-10-01 00:00:00.000",
|
||||||
|
"columns":[
|
||||||
|
{ "type": "int", "count": 1000, "max": 2000, "min": 0 }
|
||||||
|
],
|
||||||
|
"tags":[
|
||||||
|
{
|
||||||
|
"type":"binary",
|
||||||
|
"name":"location",
|
||||||
|
"max":64,
|
||||||
|
"min":1,
|
||||||
|
"values":[
|
||||||
|
"San Francisco",
|
||||||
|
"Los Angles",
|
||||||
|
"San Diego",
|
||||||
|
"San Jose",
|
||||||
|
"Palo Alto",
|
||||||
|
"Campbell",
|
||||||
|
"Mountain View",
|
||||||
|
"Sunnyvale",
|
||||||
|
"Santa Clara",
|
||||||
|
"Cupertino"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
###################################################################
|
||||||
|
# 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 time
|
||||||
|
import random
|
||||||
|
|
||||||
|
import frame.eos
|
||||||
|
import frame.etime
|
||||||
|
import frame.etool
|
||||||
|
import frame.etool
|
||||||
|
import frame.etool
|
||||||
|
import frame.etool
|
||||||
|
import taos
|
||||||
|
import frame.etool
|
||||||
|
import frame
|
||||||
|
|
||||||
|
from frame.log import *
|
||||||
|
from frame.sql import *
|
||||||
|
from frame.cases import *
|
||||||
|
from frame.caseBase import *
|
||||||
|
from frame.srvCtl import *
|
||||||
|
from frame import *
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase(TBase):
|
||||||
|
updatecfgDict = {
|
||||||
|
'slowLogScope':"query"
|
||||||
|
}
|
||||||
|
|
||||||
|
def checkDescribe(self):
|
||||||
|
tdLog.info(f"check describe show full.")
|
||||||
|
|
||||||
|
# insert
|
||||||
|
json = "cmdline/json/taosCli.json"
|
||||||
|
db, stb, childCount, insertRows = self.insertBenchJson(json)
|
||||||
|
# describe
|
||||||
|
sql = f"describe {db}.{stb};"
|
||||||
|
tdSql.query(sql)
|
||||||
|
tdSql.checkRows(2 + 1000)
|
||||||
|
# desc
|
||||||
|
sql = f"desc {db}.{stb};"
|
||||||
|
tdSql.query(sql)
|
||||||
|
tdSql.checkRows(2 + 1000)
|
||||||
|
|
||||||
|
# run
|
||||||
|
def run(self):
|
||||||
|
tdLog.debug(f"start to excute {__file__}")
|
||||||
|
|
||||||
|
# check show whole
|
||||||
|
self.checkDescribe()
|
||||||
|
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -17,9 +17,13 @@ import time
|
||||||
import datetime
|
import datetime
|
||||||
import random
|
import random
|
||||||
import copy
|
import copy
|
||||||
|
import json
|
||||||
|
|
||||||
|
import frame.eutil
|
||||||
from frame.log import *
|
from frame.log import *
|
||||||
from frame.sql import *
|
from frame.sql import *
|
||||||
|
from frame import *
|
||||||
|
import frame
|
||||||
|
|
||||||
# test case base
|
# test case base
|
||||||
class TBase:
|
class TBase:
|
||||||
|
@ -317,4 +321,77 @@ class TBase:
|
||||||
if strs != "":
|
if strs != "":
|
||||||
strs += sepa
|
strs += sepa
|
||||||
strs += f"'{ls}'"
|
strs += f"'{ls}'"
|
||||||
return strs
|
return strs
|
||||||
|
|
||||||
|
#
|
||||||
|
# taosBenchmark
|
||||||
|
#
|
||||||
|
|
||||||
|
# run taosBenchmark and check insert Result
|
||||||
|
def insertBenchJson(self, jsonFile, options="", checkStep=False):
|
||||||
|
# exe insert
|
||||||
|
cmd = f"{options} -f {jsonFile}"
|
||||||
|
frame.etool.benchMark(command = cmd)
|
||||||
|
|
||||||
|
#
|
||||||
|
# check insert result
|
||||||
|
#
|
||||||
|
with open(jsonFile, "r") as file:
|
||||||
|
data = json.load(file)
|
||||||
|
|
||||||
|
db = data["databases"][0]["dbinfo"]["name"]
|
||||||
|
stb = data["databases"][0]["super_tables"][0]["name"]
|
||||||
|
child_count = data["databases"][0]["super_tables"][0]["childtable_count"]
|
||||||
|
insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"]
|
||||||
|
timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"]
|
||||||
|
|
||||||
|
# drop
|
||||||
|
try:
|
||||||
|
drop = data["databases"][0]["dbinfo"]["drop"]
|
||||||
|
except:
|
||||||
|
drop = "yes"
|
||||||
|
|
||||||
|
# command is first
|
||||||
|
if options.find("-Q") != -1:
|
||||||
|
drop = "no"
|
||||||
|
|
||||||
|
# cachemodel
|
||||||
|
try:
|
||||||
|
cachemode = data["databases"][0]["dbinfo"]["cachemodel"]
|
||||||
|
except:
|
||||||
|
cachemode = None
|
||||||
|
|
||||||
|
# vgropus
|
||||||
|
try:
|
||||||
|
vgroups = data["databases"][0]["dbinfo"]["vgroups"]
|
||||||
|
except:
|
||||||
|
vgroups = None
|
||||||
|
|
||||||
|
tdLog.info(f"get json info: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n")
|
||||||
|
|
||||||
|
# all count insert_rows * child_table_count
|
||||||
|
sql = f"select * from {db}.{stb}"
|
||||||
|
tdSql.query(sql)
|
||||||
|
tdSql.checkRows(child_count * insert_rows)
|
||||||
|
|
||||||
|
# timestamp step
|
||||||
|
if checkStep:
|
||||||
|
sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};"
|
||||||
|
tdSql.query(sql)
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
if drop.lower() == "yes":
|
||||||
|
# check database optins
|
||||||
|
sql = f"select `vgroups`,`cachemodel` from information_schema.ins_databases where name='{db}';"
|
||||||
|
tdSql.query(sql)
|
||||||
|
|
||||||
|
if cachemode != None:
|
||||||
|
|
||||||
|
value = frame.eutil.removeQuota(cachemode)
|
||||||
|
tdLog.info(f" deal both origin={cachemode} after={value}")
|
||||||
|
tdSql.checkData(0, 1, value)
|
||||||
|
|
||||||
|
if vgroups != None:
|
||||||
|
tdSql.checkData(0, 0, vgroups)
|
||||||
|
|
||||||
|
return db, stb,child_count, insert_rows
|
|
@ -25,4 +25,13 @@ import psutil
|
||||||
# cpu frequent as random
|
# cpu frequent as random
|
||||||
def cpuRand(max):
|
def cpuRand(max):
|
||||||
decimal = int(str(psutil.cpu_freq().current).split(".")[1])
|
decimal = int(str(psutil.cpu_freq().current).split(".")[1])
|
||||||
return decimal % max
|
return decimal % max
|
||||||
|
|
||||||
|
# remove single and doulbe quotation
|
||||||
|
def removeQuota(origin):
|
||||||
|
value = ""
|
||||||
|
for c in origin:
|
||||||
|
if c != '\'' and c != '"':
|
||||||
|
value += c
|
||||||
|
|
||||||
|
return value
|
|
@ -52,6 +52,7 @@
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/sys/tb_perf_queries_exist_test.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f query/sys/tb_perf_queries_exist_test.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/test_having.py
|
,,y,army,./pytest.sh python3 ./test.py -f query/test_having.py
|
||||||
,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py
|
,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py
|
||||||
|
,,y,army,./pytest.sh python3 ./test.py -f cmdline/taosCli.py
|
||||||
|
|
||||||
#
|
#
|
||||||
# system test
|
# system test
|
||||||
|
|
|
@ -730,6 +730,10 @@ bool shellIsShowWhole(const char *sql) {
|
||||||
if (taosStrCaseStr(sql, "describe ") != NULL) {
|
if (taosStrCaseStr(sql, "describe ") != NULL) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// desc
|
||||||
|
if (taosStrCaseStr(sql, "desc ") != NULL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// show
|
// show
|
||||||
if (taosStrCaseStr(sql, "show ") != NULL) {
|
if (taosStrCaseStr(sql, "show ") != NULL) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue