schemalessInsert.py 70.6 KB
Newer Older
J
jiajingbin 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
###################################################################
#           Copyright (c) 2021 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 -*-

14
import traceback
J
jiajingbin 已提交
15 16
import random
import string
17
from taos.error import SchemalessError
J
jiajingbin 已提交
18 19 20 21 22 23
import time
from copy import deepcopy
import numpy as np
from util.log import *
from util.cases import *
from util.sql import *
24
from util.types import TDSmlProtocolType, TDSmlTimestampType
J
save  
jiajingbin 已提交
25
import threading
J
jiajingbin 已提交
26 27 28 29 30 31 32 33


class TDTestCase:
    def init(self, conn, logSql):
        tdLog.debug("start to execute %s" % __file__)
        tdSql.init(conn.cursor(), logSql)
        self._conn = conn 

J
jiajingbin 已提交
34 35 36 37 38 39 40 41 42
    def createDb(self, name="test", db_update_tag=0):
        if db_update_tag == 0:
            tdSql.execute(f"drop database if exists {name}")
            tdSql.execute(f"create database if not exists {name} precision 'us'")
        else:
            tdSql.execute(f"drop database if exists {name}")
            tdSql.execute(f"create database if not exists {name} precision 'us' update 1")
        tdSql.execute(f'use {name}')

J
jiajingbin 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
    def getLongName(self, len, mode = "mixed"):
        """
            generate long name
            mode could be numbers/letters/mixed
        """    
        if mode is "numbers": 
            chars = ''.join(random.choice(string.digits) for i in range(len))
        elif mode is "letters": 
            chars = ''.join(random.choice(string.ascii_letters.lower()) for i in range(len))
        else:
            chars = ''.join(random.choice(string.ascii_letters.lower() + string.digits) for i in range(len))
        return chars

    def timeTrans(self, time_value):
        if time_value.endswith("ns"):
            ts = int(''.join(list(filter(str.isdigit, time_value))))/1000000000
        elif time_value.endswith("us") or time_value.isdigit() and int(time_value) != 0:
            ts = int(''.join(list(filter(str.isdigit, time_value))))/1000000
        elif time_value.endswith("ms"):
            ts = int(''.join(list(filter(str.isdigit, time_value))))/1000
        elif time_value.endswith("s") and list(time_value)[-1] not in "num":
            ts = int(''.join(list(filter(str.isdigit, time_value))))/1
        elif int(time_value) == 0:
            ts = time.time()
        else:
            print("input ts maybe not right format")
        ulsec = repr(ts).split('.')[1][:6]
        if len(ulsec) < 6 and int(ulsec) != 0:
            ulsec = int(ulsec) * (10 ** (6 - len(ulsec)))
        elif int(ulsec) == 0:
            ulsec *= 6
74
            # * follow two rows added for tsCheckCase
J
jiajingbin 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
            td_ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ts))
            return td_ts
        #td_ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ts))
        td_ts = time.strftime("%Y-%m-%d %H:%M:%S.{}".format(ulsec), time.localtime(ts))
        return td_ts
        #return repr(datetime.datetime.strptime(td_ts, "%Y-%m-%d %H:%M:%S.%f"))
    
    def dateToTs(self, datetime_input):
        return int(time.mktime(time.strptime(datetime_input, "%Y-%m-%d %H:%M:%S.%f")))

    def getTdTypeValue(self, value):
        if value.endswith("i8"):
            td_type = "TINYINT"
            td_tag_value = ''.join(list(value)[:-2])
        elif value.endswith("i16"):
            td_type = "SMALLINT"
            td_tag_value = ''.join(list(value)[:-3])
        elif value.endswith("i32"):
            td_type = "INT"
            td_tag_value = ''.join(list(value)[:-3])
        elif value.endswith("i64"):
            td_type = "BIGINT"
            td_tag_value = ''.join(list(value)[:-3])
        elif value.endswith("u64"):
            td_type = "BIGINT UNSIGNED"
            td_tag_value = ''.join(list(value)[:-3])
        elif value.endswith("f32"):
            td_type = "FLOAT"
            td_tag_value = ''.join(list(value)[:-3])
            td_tag_value = '{}'.format(np.float32(td_tag_value))
        elif value.endswith("f64"):
            td_type = "DOUBLE"
            td_tag_value = ''.join(list(value)[:-3])
        elif value.startswith('L"'):
            td_type = "NCHAR"
            td_tag_value = ''.join(list(value)[2:-1])
        elif value.startswith('"') and value.endswith('"'):
            td_type = "BINARY"
            td_tag_value = ''.join(list(value)[1:-1])
        elif value.lower() == "t" or value == "true" or value == "True":
            td_type = "BOOL"
            td_tag_value = "True"
        elif value.lower() == "f" or value == "false" or value == "False":
            td_type = "BOOL"
            td_tag_value = "False"
        else:
            td_type = "FLOAT"
            td_tag_value = value
        return td_type, td_tag_value

    def typeTrans(self, type_list):
        type_num_list = []
        for tp in type_list:
            if tp.upper() == "TIMESTAMP":
                type_num_list.append(9)
            elif tp.upper() == "BOOL":
                type_num_list.append(1)
            elif tp.upper() == "TINYINT":
                type_num_list.append(2)
            elif tp.upper() == "SMALLINT":
                type_num_list.append(3)
            elif tp.upper() == "INT":
                type_num_list.append(4)
            elif tp.upper() == "BIGINT":
                type_num_list.append(5)
            elif tp.upper() == "FLOAT":
                type_num_list.append(6)
            elif tp.upper() == "DOUBLE":
                type_num_list.append(7)
            elif tp.upper() == "BINARY":
                type_num_list.append(8)
            elif tp.upper() == "NCHAR":
                type_num_list.append(10)
            elif tp.upper() == "BIGINT UNSIGNED":
                type_num_list.append(14)
        return type_num_list

    def inputHandle(self, input_sql):
        input_sql_split_list = input_sql.split(" ")

        stb_tag_list = input_sql_split_list[0].split(',')
        stb_col_list = input_sql_split_list[1].split(',')
        ts_value = self.timeTrans(input_sql_split_list[2])

        stb_name = stb_tag_list[0]
        stb_tag_list.pop(0)

        tag_name_list = []
        tag_value_list = []
        td_tag_value_list = []
        td_tag_type_list = []

        col_name_list = []
        col_value_list = []
        td_col_value_list = []
        td_col_type_list = []

        for elm in stb_tag_list:
            if "id=" in elm.lower():
                tb_name = elm.split('=')[1]
            else:
                tag_name_list.append(elm.split("=")[0])
                tag_value_list.append(elm.split("=")[1])
                tb_name = ""
                td_tag_value_list.append(self.getTdTypeValue(elm.split("=")[1])[1])
                td_tag_type_list.append(self.getTdTypeValue(elm.split("=")[1])[0])
        
        for elm in stb_col_list:
            col_name_list.append(elm.split("=")[0])
            col_value_list.append(elm.split("=")[1])
            td_col_value_list.append(self.getTdTypeValue(elm.split("=")[1])[1])
            td_col_type_list.append(self.getTdTypeValue(elm.split("=")[1])[0])

        final_field_list = []
        final_field_list.extend(col_name_list)
        final_field_list.extend(tag_name_list)

        final_type_list = []
        final_type_list.append("TIMESTAMP")
        final_type_list.extend(td_col_type_list)
        final_type_list.extend(td_tag_type_list)
        final_type_list = self.typeTrans(final_type_list)

        final_value_list = []
        final_value_list.append(ts_value)
        final_value_list.extend(td_col_value_list)
        final_value_list.extend(td_tag_value_list)
        return final_value_list, final_field_list, final_type_list, stb_name, tb_name

    def genFullTypeSql(self, stb_name="", tb_name="", t0="", t1="127i8", t2="32767i16", t3="2147483647i32",
                        t4="9223372036854775807i64", t5="11.12345f32", t6="22.123456789f64", t7="\"binaryTagValue\"",
                        t8="L\"ncharTagValue\"", c0="", c1="127i8", c2="32767i16", c3="2147483647i32",
                        c4="9223372036854775807i64", c5="11.12345f32", c6="22.123456789f64", c7="\"binaryColValue\"", 
J
save  
jiajingbin 已提交
208 209 210
                        c8="L\"ncharColValue\"", c9="7u64", ts="1626006833639000000ns",
                        id_noexist_tag=None, id_change_tag=None, id_upper_tag=None, id_double_tag=None,
                        ct_add_tag=None, ct_am_tag=None, ct_ma_tag=None, ct_min_tag=None):
J
jiajingbin 已提交
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
        if stb_name == "":
            stb_name = self.getLongName(len=6, mode="letters")
        if tb_name == "":
            tb_name = f'{stb_name}_{random.randint(0, 65535)}_{random.randint(0, 65535)}'
        if t0 == "":
            t0 = random.choice(["f", "F", "false", "False", "t", "T", "true", "True"])
        if c0 == "":
            c0 = random.choice(["f", "F", "false", "False", "t", "T", "true", "True"])
        #sql_seq = f'{stb_name},id=\"{tb_name}\",t0={t0},t1=127i8,t2=32767i16,t3=125.22f64,t4=11.321f32,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0={bool_value},c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryValue\",c8=L\"ncharValue\" 1626006833639000000ns'
        if id_upper_tag is not None:
            id = "ID"
        else:
            id = "id"
        sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}'
        if id_noexist_tag is not None:
            sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}'
J
save  
jiajingbin 已提交
227
            if ct_add_tag is not None:
J
jiajingbin 已提交
228 229 230 231 232
                sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t9={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}'
        if id_change_tag is not None:
            sql_seq = f'{stb_name},t0={t0},t1={t1},{id}=\"{tb_name}\",t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}'
        if id_double_tag is not None:
            sql_seq = f'{stb_name},{id}=\"{tb_name}_1\",t0={t0},t1={t1},{id}=\"{tb_name}_2\",t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9} {ts}'
J
save  
jiajingbin 已提交
233
        if ct_add_tag is not None:
J
jiajingbin 已提交
234
            sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t11={t1},t10={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9},c11={c8},c10={t0} {ts}'
J
save  
jiajingbin 已提交
235 236
        if ct_am_tag is not None:
            sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9},c11={c8},c10={t0} {ts}'
J
jiajingbin 已提交
237 238
            if id_noexist_tag is not None:
                    sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6},c7={c7},c8={c8},c9={c9},c11={c8},c10={t0} {ts}'
J
save  
jiajingbin 已提交
239 240
        if ct_ma_tag is not None:
            sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t11={t1},t10={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6} {ts}'
J
jiajingbin 已提交
241 242
            if id_noexist_tag is not None:
                sql_seq = f'{stb_name},t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6},t7={t7},t8={t8},t11={t1},t10={t8} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6} {ts}'
J
save  
jiajingbin 已提交
243 244
        if ct_min_tag is not None:
            sql_seq = f'{stb_name},{id}=\"{tb_name}\",t0={t0},t1={t1},t2={t2},t3={t3},t4={t4},t5={t5},t6={t6} c0={c0},c1={c1},c2={c2},c3={c3},c4={c4},c5={c5},c6={c6} {ts}'
J
jiajingbin 已提交
245
        return sql_seq, stb_name
J
jiajingbin 已提交
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
    
    def genMulTagColStr(self, genType, count):
        """
            genType must be tag/col
        """
        tag_str = ""
        col_str = ""
        if genType == "tag":
            for i in range(0, count):
                if i < (count-1):
                    tag_str += f't{i}=f,'
                else:
                    tag_str += f't{i}=f '
            return tag_str
        if genType == "col":
            for i in range(0, count):
                if i < (count-1):
                    col_str += f'c{i}=t,'
                else:
                    col_str += f'c{i}=t '
            return col_str

    def genLongSql(self, tag_count, col_count):
        stb_name = self.getLongName(7, mode="letters")
        tb_name = f'{stb_name}_1'
        tag_str = self.genMulTagColStr("tag", tag_count)
        col_str = self.genMulTagColStr("col", col_count)
        ts = "1626006833640000000ns"
        long_sql = stb_name + ',' + f'id=\"{tb_name}\"' + ',' + tag_str + col_str + ts
        return long_sql, stb_name

    def getNoIdTbName(self, stb_name):
        query_sql = f"select tbname from {stb_name}"
        tb_name = self.resHandle(query_sql, True)[0][0]
        return tb_name

    def resHandle(self, query_sql, query_tag):
283
        tdSql.execute('reset query cache')
J
jiajingbin 已提交
284 285 286 287 288 289 290 291 292 293 294 295 296 297
        row_info = tdSql.query(query_sql, query_tag)
        col_info = tdSql.getColNameList(query_sql, query_tag)
        res_row_list = []
        sub_list = []
        for row_mem in row_info:
            for i in row_mem:
                sub_list.append(str(i))
            res_row_list.append(sub_list)
        res_field_list_without_ts = col_info[0][1:]
        res_type_list = col_info[1]
        return res_row_list, res_field_list_without_ts, res_type_list

    def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, id=True, none_check_tag=None):
        expect_list = self.inputHandle(input_sql)
298
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
jiajingbin 已提交
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
        query_sql = f"{query_sql} {stb_name} {condition}"
        res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True)
        if ts == 0:
            res_ts = self.dateToTs(res_row_list[0][0])
            current_time = time.time()
            if current_time - res_ts < 60:
                tdSql.checkEqual(res_row_list[0][1:], expect_list[0][1:])
            else:
                print("timeout")
                tdSql.checkEqual(res_row_list[0], expect_list[0])
        else:
            if none_check_tag is not None:
                none_index_list = [i for i,x in enumerate(res_row_list[0]) if x=="None"]
                none_index_list.reverse()
                for j in none_index_list:
                    res_row_list[0].pop(j)
                    expect_list[0].pop(j)
            tdSql.checkEqual(res_row_list[0], expect_list[0])
        tdSql.checkEqual(res_field_list_without_ts, expect_list[1])
318 319 320
        for i in range(len(res_type_list)):
            tdSql.checkEqual(res_type_list[i], expect_list[2][i])
        # tdSql.checkEqual(res_type_list, expect_list[2])
J
jiajingbin 已提交
321

J
jiajingbin 已提交
322 323
    def cleanStb(self):
        query_sql = "show stables"
J
jiajingbin 已提交
324 325 326
        res_row_list = tdSql.query(query_sql, True)
        stb_list = map(lambda x: x[0], res_row_list)
        for stb in stb_list:
J
jiajingbin 已提交
327 328
            tdSql.execute(f'drop table if exists {stb}')

J
jiajingbin 已提交
329 330 331 332
    def initCheckCase(self):
        """
            normal tags and cols, one for every elm
        """
J
jiajingbin 已提交
333
        self.cleanStb()
J
jiajingbin 已提交
334
        input_sql, stb_name = self.genFullTypeSql()
J
jiajingbin 已提交
335 336 337 338 339 340
        self.resCmp(input_sql, stb_name)

    def boolTypeCheckCase(self):
        """
            check all normal type
        """
J
jiajingbin 已提交
341
        self.cleanStb()
J
jiajingbin 已提交
342 343
        full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
        for t_type in full_type_list:
J
jiajingbin 已提交
344
            input_sql, stb_name = self.genFullTypeSql(c0=t_type, t0=t_type)
J
jiajingbin 已提交
345 346 347 348 349 350 351 352 353 354
            self.resCmp(input_sql, stb_name)
        
    def symbolsCheckCase(self):
        """
            check symbols = `~!@#$%^&*()_-+={[}]\|:;'\",<.>/? 
        """
        '''
            please test :
            binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
        '''
J
jiajingbin 已提交
355
        self.cleanStb()
J
jiajingbin 已提交
356 357
        binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\"'
        nchar_symbols = f'L{binary_symbols}'
J
jiajingbin 已提交
358
        input_sql, stb_name = self.genFullTypeSql(c7=binary_symbols, c8=nchar_symbols, t7=binary_symbols, t8=nchar_symbols)
J
jiajingbin 已提交
359 360 361 362 363 364 365
        self.resCmp(input_sql, stb_name)

    def tsCheckCase(self):
        """
            test ts list --> ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"]
            # ! us级时间戳都为0时,数据库中查询显示,但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过
        """
J
jiajingbin 已提交
366
        self.cleanStb()
J
jiajingbin 已提交
367 368
        ts_list = ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022", 0]
        for ts in ts_list:
J
modify  
jiajingbin 已提交
369
            input_sql, stb_name = self.genFullTypeSql(ts=ts)
J
jiajingbin 已提交
370
            self.resCmp(input_sql, stb_name, ts=ts)
J
jiajingbin 已提交
371 372 373 374 375 376
    
    def idSeqCheckCase(self):
        """
            check id.index in tags
            eg: t0=**,id=**,t1=**
        """
J
jiajingbin 已提交
377
        self.cleanStb()
J
jiajingbin 已提交
378
        input_sql, stb_name = self.genFullTypeSql(id_change_tag=True)
J
jiajingbin 已提交
379 380 381 382 383 384 385
        self.resCmp(input_sql, stb_name)
    
    def idUpperCheckCase(self):
        """
            check id param
            eg: id and ID
        """
J
jiajingbin 已提交
386
        self.cleanStb()
J
jiajingbin 已提交
387
        input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True)
J
jiajingbin 已提交
388
        self.resCmp(input_sql, stb_name)
J
jiajingbin 已提交
389
        input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, id_upper_tag=True)
J
jiajingbin 已提交
390 391 392 393 394 395
        self.resCmp(input_sql, stb_name)

    def noIdCheckCase(self):
        """
            id not exist
        """
J
jiajingbin 已提交
396
        self.cleanStb()
J
jiajingbin 已提交
397
        input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True)
J
jiajingbin 已提交
398 399 400 401 402 403 404 405 406 407 408 409 410
        self.resCmp(input_sql, stb_name)
        query_sql = f"select tbname from {stb_name}"
        res_row_list = self.resHandle(query_sql, True)[0]
        if len(res_row_list[0][0]) > 0:
            tdSql.checkColNameList(res_row_list, res_row_list)
        else:
            tdSql.checkColNameList(res_row_list, "please check noIdCheckCase")

    def maxColTagCheckCase(self):
        """
            max tag count is 128
            max col count is ??
        """
J
save  
jiajingbin 已提交
411 412
        for input_sql in [self.genLongSql(128, 1)[0], self.genLongSql(1, 4094)[0]]:
            self.cleanStb()
413
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
save  
jiajingbin 已提交
414 415
        for input_sql in [self.genLongSql(129, 1)[0], self.genLongSql(1, 4095)[0]]:
            self.cleanStb()
416
            try:
417
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
418
            except SchemalessError:
419 420
                pass
            
J
jiajingbin 已提交
421 422 423
    def idIllegalNameCheckCase(self):
        """
            test illegal id name
J
jiajingbin 已提交
424
            mix "`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?"
J
jiajingbin 已提交
425
        """
J
jiajingbin 已提交
426
        self.cleanStb()
J
jiajingbin 已提交
427
        rstr = list("`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?")
J
jiajingbin 已提交
428 429
        for i in rstr:
            input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0]
430
            try:
431
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
432
            except SchemalessError:
433
                pass
J
jiajingbin 已提交
434 435 436 437 438

    def idStartWithNumCheckCase(self):
        """
            id is start with num
        """
J
jiajingbin 已提交
439
        self.cleanStb()
J
jiajingbin 已提交
440
        input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0]
441
        try:
442
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
443
        except SchemalessError:
444
            pass
J
jiajingbin 已提交
445 446 447 448 449

    def nowTsCheckCase(self):
        """
            check now unsupported
        """
J
jiajingbin 已提交
450
        self.cleanStb()
J
jiajingbin 已提交
451
        input_sql = self.genFullTypeSql(ts="now")[0]
452
        try:
453
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
454
        except SchemalessError:
455
            pass
J
jiajingbin 已提交
456 457 458 459 460

    def dateFormatTsCheckCase(self):
        """
            check date format ts unsupported
        """
J
jiajingbin 已提交
461
        self.cleanStb()
J
jiajingbin 已提交
462
        input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
463
        try:
464
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
465
        except SchemalessError:
466
            pass
J
jiajingbin 已提交
467 468 469 470 471
    
    def illegalTsCheckCase(self):
        """
            check ts format like 16260068336390us19
        """
J
jiajingbin 已提交
472
        self.cleanStb()
J
jiajingbin 已提交
473
        input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
474
        try:
475
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
476
        except SchemalessError:
477
            pass
J
jiajingbin 已提交
478 479 480 481 482

    def tagValueLengthCheckCase(self):
        """
            check full type tag value limit
        """
J
jiajingbin 已提交
483
        self.cleanStb()
J
save  
jiajingbin 已提交
484 485
        # i8
        for t1 in ["-127i8", "127i8"]:
J
jiajingbin 已提交
486
            input_sql, stb_name = self.genFullTypeSql(t1=t1)
J
save  
jiajingbin 已提交
487 488 489
            self.resCmp(input_sql, stb_name)
        for t1 in ["-128i8", "128i8"]:
            input_sql = self.genFullTypeSql(t1=t1)[0]
490
            try:
491
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
492
            except SchemalessError:
493
                pass
J
save  
jiajingbin 已提交
494

J
save  
jiajingbin 已提交
495 496
        #i16
        for t2 in ["-32767i16", "32767i16"]:
J
jiajingbin 已提交
497
            input_sql, stb_name = self.genFullTypeSql(t2=t2)
J
save  
jiajingbin 已提交
498 499 500
            self.resCmp(input_sql, stb_name)
        for t2 in ["-32768i16", "32768i16"]:
            input_sql = self.genFullTypeSql(t2=t2)[0]
501
            try:
502
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
503
            except SchemalessError:
504
                pass
J
save  
jiajingbin 已提交
505

J
save  
jiajingbin 已提交
506 507
        #i32
        for t3 in ["-2147483647i32", "2147483647i32"]:
J
jiajingbin 已提交
508
            input_sql, stb_name = self.genFullTypeSql(t3=t3)
J
save  
jiajingbin 已提交
509 510 511
            self.resCmp(input_sql, stb_name)
        for t3 in ["-2147483648i32", "2147483648i32"]:
            input_sql = self.genFullTypeSql(t3=t3)[0]
512
            try:
513
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
514
            except SchemalessError:
515
                pass
J
save  
jiajingbin 已提交
516

J
save  
jiajingbin 已提交
517 518
        #i64
        for t4 in ["-9223372036854775807i64", "9223372036854775807i64"]:
J
jiajingbin 已提交
519
            input_sql, stb_name = self.genFullTypeSql(t4=t4)
J
save  
jiajingbin 已提交
520 521 522
            self.resCmp(input_sql, stb_name)
        for t4 in ["-9223372036854775808i64", "9223372036854775808i64"]:
            input_sql = self.genFullTypeSql(t4=t4)[0]
523
            try:
524
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
525
            except SchemalessError:
526
                pass
J
save  
jiajingbin 已提交
527

J
save  
jiajingbin 已提交
528 529
        # f32
        for t5 in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]:
J
jiajingbin 已提交
530
            input_sql, stb_name = self.genFullTypeSql(t5=t5)
J
save  
jiajingbin 已提交
531 532 533 534
            self.resCmp(input_sql, stb_name)
        # * limit set to 4028234664*(10**38)
        for t5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
            input_sql = self.genFullTypeSql(t5=t5)[0]
535
            try:
536
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
537
                raise Exception("should not reach here")
538
            except SchemalessError as err:
539 540
                tdSql.checkNotEqual(err.errno, 0)

J
jiajingbin 已提交
541

542
        # f64
J
save  
jiajingbin 已提交
543
        for t6 in [f'{-1.79769*(10**308)}f64', f'{-1.79769*(10**308)}f64']:
J
jiajingbin 已提交
544
            input_sql, stb_name = self.genFullTypeSql(t6=t6)
J
save  
jiajingbin 已提交
545
            self.resCmp(input_sql, stb_name)
J
save  
jiajingbin 已提交
546 547 548
        # * limit set to 1.797693134862316*(10**308)
        for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
            input_sql = self.genFullTypeSql(c6=c6)[0]
549
            try:
550
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
551
                raise Exception("should not reach here")
552
            except SchemalessError as err:
553
                tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
554

J
save  
jiajingbin 已提交
555 556 557
        # binary 
        stb_name = self.getLongName(7, "letters")
        input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}" c0=f 1626006833639000000ns'
558
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
559
        
J
save  
jiajingbin 已提交
560
        input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16375, "letters")}" c0=f 1626006833639000000ns'
561
        try:
562
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
563
            raise Exception("should not reach here")
564
        except SchemalessError as err:
565
            pass
J
jiajingbin 已提交
566

J
save  
jiajingbin 已提交
567 568 569 570
        # nchar
        # * legal nchar could not be larger than 16374/4
        stb_name = self.getLongName(7, "letters")
        input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}" c0=f 1626006833639000000ns'
571
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
572

J
save  
jiajingbin 已提交
573
        input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4094, "letters")}" c0=f 1626006833639000000ns'
574
        try:
575
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
576
            raise Exception("should not reach here")
577
        except SchemalessError as err:
578
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
579

J
jiajingbin 已提交
580 581 582 583
    def colValueLengthCheckCase(self):
        """
            check full type col value limit
        """
J
jiajingbin 已提交
584
        self.cleanStb()
J
save  
jiajingbin 已提交
585 586
        # i8
        for c1 in ["-127i8", "127i8"]:
J
jiajingbin 已提交
587
            input_sql, stb_name = self.genFullTypeSql(c1=c1)
J
save  
jiajingbin 已提交
588 589 590 591
            self.resCmp(input_sql, stb_name)

        for c1 in ["-128i8", "128i8"]:
            input_sql = self.genFullTypeSql(c1=c1)[0]
592
            try:
593
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
594
                raise Exception("should not reach here")
595
            except SchemalessError as err:
596
                tdSql.checkNotEqual(err.errno, 0)
J
save  
jiajingbin 已提交
597 598
        # i16
        for c2 in ["-32767i16"]:
J
jiajingbin 已提交
599
            input_sql, stb_name = self.genFullTypeSql(c2=c2)
J
save  
jiajingbin 已提交
600 601 602
            self.resCmp(input_sql, stb_name)
        for c2 in ["-32768i16", "32768i16"]:
            input_sql = self.genFullTypeSql(c2=c2)[0]
603
            try:
604
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
605
                raise Exception("should not reach here")
606
            except SchemalessError as err:
607
                tdSql.checkNotEqual(err.errno, 0)
J
save  
jiajingbin 已提交
608 609 610

        # i32
        for c3 in ["-2147483647i32"]:
J
jiajingbin 已提交
611
            input_sql, stb_name = self.genFullTypeSql(c3=c3)
J
save  
jiajingbin 已提交
612 613 614
            self.resCmp(input_sql, stb_name)
        for c3 in ["-2147483648i32", "2147483648i32"]:
            input_sql = self.genFullTypeSql(c3=c3)[0]
615
            try:
616
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
617
                raise Exception("should not reach here")
618
            except SchemalessError as err:
619
                tdSql.checkNotEqual(err.errno, 0)
J
save  
jiajingbin 已提交
620 621 622

        # i64
        for c4 in ["-9223372036854775807i64"]:
J
jiajingbin 已提交
623
            input_sql, stb_name = self.genFullTypeSql(c4=c4)
J
save  
jiajingbin 已提交
624 625 626
            self.resCmp(input_sql, stb_name)
        for c4 in ["-9223372036854775808i64", "9223372036854775808i64"]:
            input_sql = self.genFullTypeSql(c4=c4)[0]
627
            try:
628
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
629
                raise Exception("should not reach here")
630
            except SchemalessError as err:
631
                tdSql.checkNotEqual(err.errno, 0)
J
save  
jiajingbin 已提交
632 633 634

        # f32       
        for c5 in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]:
J
jiajingbin 已提交
635
            input_sql, stb_name = self.genFullTypeSql(c5=c5)
J
save  
jiajingbin 已提交
636 637 638 639
            self.resCmp(input_sql, stb_name)
        # * limit set to 4028234664*(10**38)
        for c5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
            input_sql = self.genFullTypeSql(c5=c5)[0]
640
            try:
641
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
642
                raise Exception("should not reach here")
643
            except SchemalessError as err:
644
                tdSql.checkNotEqual(err.errno, 0)
J
save  
jiajingbin 已提交
645 646 647

        # f64
        for c6 in [f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64', f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64']:
J
jiajingbin 已提交
648
            input_sql, stb_name = self.genFullTypeSql(c6=c6)
J
save  
jiajingbin 已提交
649 650 651 652
            self.resCmp(input_sql, stb_name)
        # * limit set to 1.797693134862316*(10**308)
        for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
            input_sql = self.genFullTypeSql(c6=c6)[0]
653
            try:
654
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
655
                raise Exception("should not reach here")
656
            except SchemalessError as err:
657
                tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
658

J
save  
jiajingbin 已提交
659
        # # binary 
J
jiajingbin 已提交
660
        stb_name = self.getLongName(7, "letters")
J
save  
jiajingbin 已提交
661
        input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}" 1626006833639000000ns'
662
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
663
        
J
save  
jiajingbin 已提交
664
        input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16375, "letters")}" 1626006833639000000ns'
665
        try:
666
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
667
            raise Exception("should not reach here")
668
        except SchemalessError as err:
669
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
670 671 672

        # nchar
        # * legal nchar could not be larger than 16374/4
J
save  
jiajingbin 已提交
673 674
        stb_name = self.getLongName(7, "letters")
        input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}" 1626006833639000000ns'
675
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
676

J
save  
jiajingbin 已提交
677
        input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4094, "letters")}" 1626006833639000000ns'
678
        try:
679
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
680
            raise Exception("should not reach here")
681
        except SchemalessError as err:
682
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
683 684

    def tagColIllegalValueCheckCase(self):
J
jiajingbin 已提交
685

J
jiajingbin 已提交
686 687 688
        """
            test illegal tag col value
        """
J
jiajingbin 已提交
689
        self.cleanStb()
J
jiajingbin 已提交
690 691 692
        # bool
        for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
            input_sql1 = self.genFullTypeSql(t0=i)[0]
693
            try:
694
                self._conn.schemaless_insert([input_sql1], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
695
                raise Exception("should not reach here")
696
            except SchemalessError as err:
697
                tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
698
            input_sql2 = self.genFullTypeSql(c0=i)[0]
699
            try:
700
                self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
701
                raise Exception("should not reach here")
702
            except SchemalessError as err:
703
                tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720

        # i8 i16 i32 i64 f32 f64
        for input_sql in [
                self.genFullTypeSql(t1="1s2i8")[0], 
                self.genFullTypeSql(t2="1s2i16")[0],
                self.genFullTypeSql(t3="1s2i32")[0],
                self.genFullTypeSql(t4="1s2i64")[0],
                self.genFullTypeSql(t5="11.1s45f32")[0],
                self.genFullTypeSql(t6="11.1s45f64")[0], 
                self.genFullTypeSql(c1="1s2i8")[0], 
                self.genFullTypeSql(c2="1s2i16")[0],
                self.genFullTypeSql(c3="1s2i32")[0],
                self.genFullTypeSql(c4="1s2i64")[0],
                self.genFullTypeSql(c5="11.1s45f32")[0],
                self.genFullTypeSql(c6="11.1s45f64")[0],
                self.genFullTypeSql(c9="1s1u64")[0]
            ]:
721
            try:
722
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
723
                raise Exception("should not reach here")
724
            except SchemalessError as err:
725
                tdSql.checkNotEqual(err.errno, 0)
J
modify  
jiajingbin 已提交
726

727 728 729 730 731 732 733
        # check binary and nchar blank
        stb_name = self.getLongName(7, "letters")
        input_sql1 = f'{stb_name},t0=t c0=f,c1="abc aaa" 1626006833639000000ns'
        input_sql2 = f'{stb_name},t0=t c0=f,c1=L"abc aaa" 1626006833639000000ns'
        input_sql3 = f'{stb_name},t0=t,t1="abc aaa" c0=f 1626006833639000000ns'
        input_sql4 = f'{stb_name},t0=t,t1=L"abc aaa" c0=f 1626006833639000000ns'
        for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]:
734
            try:
735
                self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
736
                raise Exception("should not reach here")
737
            except SchemalessError as err:
738
                tdSql.checkNotEqual(err.errno, 0)
739 740 741 742 743 744

        # check accepted binary and nchar symbols 
        # # * ~!@#$¥%^&*()-+={}|[]、「」:;
        for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'):
            input_sql1 = f'{stb_name},t0=t c0=f,c1="abc{symbol}aaa" 1626006833639000000ns'
            input_sql2 = f'{stb_name},t0=t,t1="abc{symbol}aaa" c0=f 1626006833639000000ns'
745 746
            self._conn.schemaless_insert([input_sql1], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
            self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
747
        
J
jiajingbin 已提交
748 749 750 751 752

    def duplicateIdTagColInsertCheckCase(self):
        """
            check duplicate Id Tag Col
        """
J
jiajingbin 已提交
753
        self.cleanStb()
J
jiajingbin 已提交
754
        input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
755
        try:
756
            self._conn.schemaless_insert([input_sql_id], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
757
            raise Exception("should not reach here")
758
        except SchemalessError as err:
759
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
760 761 762

        input_sql = self.genFullTypeSql()[0]
        input_sql_tag = input_sql.replace("t5", "t6")
763
        try:
764
            self._conn.schemaless_insert([input_sql_tag], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
765
            raise Exception("should not reach here")
766
        except SchemalessError as err:
767
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
768 769 770

        input_sql = self.genFullTypeSql()[0]
        input_sql_col = input_sql.replace("c5", "c6")
771
        try:
772
            self._conn.schemaless_insert([input_sql_col], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
773
            raise Exception("should not reach here")
774
        except SchemalessError as err:
775
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
776 777 778

        input_sql = self.genFullTypeSql()[0]
        input_sql_col = input_sql.replace("c5", "C6")
779
        try:
780
            self._conn.schemaless_insert([input_sql_col], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
781
            raise Exception("should not reach here")
782
        except SchemalessError as err:
783
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
784 785 786 787 788 789

    ##### stb exist #####
    def noIdStbExistCheckCase(self):
        """
            case no id when stb exist
        """
J
jiajingbin 已提交
790
        self.cleanStb()
791
        input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", c0="f")
J
jiajingbin 已提交
792
        self.resCmp(input_sql, stb_name)
J
jiajingbin 已提交
793
        input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", c0="f")
J
jiajingbin 已提交
794 795 796 797 798 799 800 801 802
        self.resCmp(input_sql, stb_name, condition='where tbname like "t_%"')
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(2)
        # TODO cover other case

    def duplicateInsertExistCheckCase(self):
        """
            check duplicate insert when stb exist
        """
J
jiajingbin 已提交
803
        self.cleanStb()
J
jiajingbin 已提交
804
        input_sql, stb_name = self.genFullTypeSql()
J
jiajingbin 已提交
805
        self.resCmp(input_sql, stb_name)
806
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
jiajingbin 已提交
807 808 809 810 811 812
        self.resCmp(input_sql, stb_name)

    def tagColBinaryNcharLengthCheckCase(self):
        """
            check length increase
        """
J
jiajingbin 已提交
813
        self.cleanStb()
J
jiajingbin 已提交
814
        input_sql, stb_name = self.genFullTypeSql()
J
jiajingbin 已提交
815 816
        self.resCmp(input_sql, stb_name)
        tb_name = self.getLongName(5, "letters")
J
jiajingbin 已提交
817
        input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name,t7="\"binaryTagValuebinaryTagValue\"", t8="L\"ncharTagValuencharTagValue\"", c7="\"binaryTagValuebinaryTagValue\"", c8="L\"ncharTagValuencharTagValue\"")
J
jiajingbin 已提交
818 819 820 821 822
        self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"')

    def tagColAddDupIDCheckCase(self):
        """
            check column and tag count add, stb and tb duplicate
J
jiajingbin 已提交
823 824 825 826 827
            * tag: alter table ...
            * col: when update==0 and ts is same, unchange
            * so this case tag&&value will be added, 
            * col is added without value when update==0
            * col is added with value when update==1
J
jiajingbin 已提交
828
        """
J
jiajingbin 已提交
829
        self.cleanStb()
J
jiajingbin 已提交
830
        tb_name = self.getLongName(7, "letters")
J
jiajingbin 已提交
831 832 833
        for db_update_tag in [0, 1]:
            if db_update_tag == 1 :
                self.createDb("test_update", db_update_tag=db_update_tag)
J
jiajingbin 已提交
834
            input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", c0="f")
J
jiajingbin 已提交
835
            self.resCmp(input_sql, stb_name)
J
jiajingbin 已提交
836
            self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t0="f", c0="f", ct_add_tag=True)
J
jiajingbin 已提交
837 838 839 840 841
            if db_update_tag == 1 :
                self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"')
            else:
                self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True)

J
jiajingbin 已提交
842 843 844 845
    def tagColAddCheckCase(self):
        """
            check column and tag count add
        """
J
jiajingbin 已提交
846
        self.cleanStb()
J
jiajingbin 已提交
847 848
        tb_name = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", c0="f")
J
jiajingbin 已提交
849
        self.resCmp(input_sql, stb_name)
J
jiajingbin 已提交
850 851
        tb_name_1 = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name_1, t0="f", c0="f", ct_add_tag=True)
J
jiajingbin 已提交
852 853 854 855 856 857 858 859 860 861
        self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name_1}"')
        res_row_list = self.resHandle(f"select c10,c11,t10,t11 from {tb_name}", True)[0]
        tdSql.checkEqual(res_row_list[0], ['None', 'None', 'None', 'None'])
        self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True)

    def tagMd5Check(self):
        """
            condition: stb not change
            insert two table, keep tag unchange, change col
        """
J
jiajingbin 已提交
862
        self.cleanStb()
J
jiajingbin 已提交
863
        input_sql, stb_name = self.genFullTypeSql(t0="f", c0="f", id_noexist_tag=True)
J
jiajingbin 已提交
864 865
        self.resCmp(input_sql, stb_name)
        tb_name1 = self.getNoIdTbName(stb_name)
J
jiajingbin 已提交
866
        input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", c0="f", id_noexist_tag=True)
J
jiajingbin 已提交
867 868 869 870 871
        self.resCmp(input_sql, stb_name)
        tb_name2 = self.getNoIdTbName(stb_name)
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(1)
        tdSql.checkEqual(tb_name1, tb_name2)
J
jiajingbin 已提交
872
        input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", c0="f", id_noexist_tag=True, ct_add_tag=True)
873
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
jiajingbin 已提交
874 875 876 877 878
        tb_name3 = self.getNoIdTbName(stb_name)
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(2)
        tdSql.checkNotEqual(tb_name1, tb_name3)

J
modify  
jiajingbin 已提交
879
    # * tag binary max is 16384, col+ts binary max  49151
J
jiajingbin 已提交
880
    def tagColBinaryMaxLengthCheckCase(self):
J
save  
jiajingbin 已提交
881
        """
882
            every binary and nchar must be length+2
J
save  
jiajingbin 已提交
883
        """
J
jiajingbin 已提交
884
        self.cleanStb()
J
jiajingbin 已提交
885 886 887
        stb_name = self.getLongName(7, "letters")
        tb_name = f'{stb_name}_1'
        input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns'
888
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
save  
jiajingbin 已提交
889 890 891

        # * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2
        input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(5, "letters")}" c0=f 1626006833639000000ns'
892
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
893
        
J
modify  
jiajingbin 已提交
894 895
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(2)
J
save  
jiajingbin 已提交
896
        input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(6, "letters")}" c0=f 1626006833639000000ns'
897
        try:
898
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
899
            raise Exception("should not reach here")
900
        except SchemalessError:
901
            pass
J
modify  
jiajingbin 已提交
902 903
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(2)
J
save  
jiajingbin 已提交
904

J
save  
jiajingbin 已提交
905
        # # * check col,col+ts max in describe ---> 16143
J
save  
jiajingbin 已提交
906
        input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(12, "letters")}" 1626006833639000000ns'
907
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
908

J
modify  
jiajingbin 已提交
909 910 911
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(3)
        input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(13, "letters")}" 1626006833639000000ns'
912
        try:
913
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
914
            raise Exception("should not reach here")
915
        except SchemalessError as err:
916
            tdSql.checkNotEqual(err.errno, 0)
J
modify  
jiajingbin 已提交
917 918
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(3)
J
jiajingbin 已提交
919
    
J
modify  
jiajingbin 已提交
920
    # * tag nchar max is 16374/4, col+ts nchar max  49151
J
jiajingbin 已提交
921
    def tagColNcharMaxLengthCheckCase(self):
J
jiajingbin 已提交
922
        """
923
            check nchar length limit
J
jiajingbin 已提交
924 925
        """
        self.cleanStb()
J
jiajingbin 已提交
926 927 928
        stb_name = self.getLongName(7, "letters")
        tb_name = f'{stb_name}_1'
        input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns'
929
        code = self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
save  
jiajingbin 已提交
930 931 932

        # * legal nchar could not be larger than 16374/4
        input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(1, "letters")}" c0=f 1626006833639000000ns'
933
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
modify  
jiajingbin 已提交
934 935
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(2)
J
save  
jiajingbin 已提交
936
        input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(2, "letters")}" c0=f 1626006833639000000ns'
937
        try:
938
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
939
            raise Exception("should not reach here")
940
        except SchemalessError as err:
941
            tdSql.checkNotEqual(err.errno, 0)
J
modify  
jiajingbin 已提交
942 943
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(2)
J
jiajingbin 已提交
944

945
        input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(4, "letters")}" 1626006833639000000ns'
946
        self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
947 948 949
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(3)
        input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(5, "letters")}" 1626006833639000000ns'
950
        try:
951
            self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
952
            raise Exception("should not reach here")
953
        except SchemalessError as err:
954
            tdSql.checkNotEqual(err.errno, 0)
955 956
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(3)
J
jiajingbin 已提交
957 958 959 960 961

    def batchInsertCheckCase(self):
        """
            test batch insert
        """
J
jiajingbin 已提交
962
        self.cleanStb()
J
jiajingbin 已提交
963 964 965 966 967 968 969 970 971 972 973 974
        stb_name = self.getLongName(8, "letters")
        tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
        lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
                "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns",
                f"{stb_name},t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1626056811823316532ns",
                "stf567890,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns",
                "st123456,t1=4i64,t2=5f64,t3=\"t4\" c1=3i64,c3=L\"passitagain\",c2=true,c4=5f64 1626006833642000000ns",
                f"{stb_name},t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false 1626056811843316532ns",
                f"{stb_name},t2=5f64,t3=L\"ste2\" c3=\"iamszhou\",c4=false,c5=32i8,c6=64i16,c7=32i32,c8=88.88f32 1626056812843316532ns",
                "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns",
                "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns"
                ]
975
        self._conn.schemaless_insert(lines, TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
jiajingbin 已提交
976
    
J
save  
jiajingbin 已提交
977 978 979 980 981 982 983 984 985 986 987
    def multiInsertCheckCase(self, count):
            """
                test multi insert
            """
            self.cleanStb()
            sql_list = []
            stb_name = self.getLongName(8, "letters")
            tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
            for i in range(count):
                input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True)[0]
                sql_list.append(input_sql)
988
            self._conn.schemaless_insert(sql_list, TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
J
save  
jiajingbin 已提交
989

J
jiajingbin 已提交
990 991 992 993
    def batchErrorInsertCheckCase(self):
        """
            test batch error insert
        """
J
jiajingbin 已提交
994
        self.cleanStb()
J
jiajingbin 已提交
995 996
        stb_name = self.getLongName(8, "letters")
        lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
J
save  
jiajingbin 已提交
997
                f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"]
998
        try:
999
            self._conn.schemaless_insert(lines, TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
1000
            raise Exception("should not reach here")
1001
        except SchemalessError as err:
1002
            tdSql.checkNotEqual(err.errno, 0)
J
jiajingbin 已提交
1003

J
jiajingbin 已提交
1004
    def genSqlList(self, count=5, stb_name="", tb_name=""):
J
save  
jiajingbin 已提交
1005 1006 1007
        """
            stb --> supertable
            tb  --> table
J
save  
jiajingbin 已提交
1008 1009 1010
            ts  --> timestamp, same default
            col --> column, same default
            tag --> tag, same default
J
save  
jiajingbin 已提交
1011 1012
            d   --> different
            s   --> same
J
save  
jiajingbin 已提交
1013 1014
            a   --> add
            m   --> minus
J
save  
jiajingbin 已提交
1015 1016
        """
        d_stb_d_tb_list = list()
J
save  
jiajingbin 已提交
1017 1018
        s_stb_s_tb_list = list()
        s_stb_s_tb_a_col_a_tag_list = list()
J
save  
jiajingbin 已提交
1019
        s_stb_s_tb_m_col_m_tag_list = list()
J
jiajingbin 已提交
1020 1021 1022 1023
        s_stb_d_tb_list = list()
        s_stb_d_tb_a_col_m_tag_list = list()
        s_stb_d_tb_a_tag_m_col_list = list()
        s_stb_s_tb_d_ts_list = list()
J
modify  
jiajingbin 已提交
1024 1025 1026 1027 1028
        s_stb_s_tb_d_ts_a_col_m_tag_list = list()
        s_stb_s_tb_d_ts_a_tag_m_col_list = list()
        s_stb_d_tb_d_ts_list = list()
        s_stb_d_tb_d_ts_a_col_m_tag_list = list()
        s_stb_d_tb_d_ts_a_tag_m_col_list = list()
J
save  
jiajingbin 已提交
1029 1030
        for i in range(count):
            d_stb_d_tb_list.append(self.genFullTypeSql(t0="f", c0="f"))
J
jiajingbin 已提交
1031 1032 1033 1034 1035 1036 1037
            s_stb_s_tb_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"'))
            s_stb_s_tb_a_col_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ct_add_tag=True))
            s_stb_s_tb_m_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ct_min_tag=True))
            s_stb_d_tb_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True))
            s_stb_d_tb_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ct_am_tag=True))
            s_stb_d_tb_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ct_ma_tag=True))
            s_stb_s_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ts=0))
J
modify  
jiajingbin 已提交
1038 1039 1040 1041 1042
            s_stb_s_tb_d_ts_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ts=0, ct_am_tag=True))
            s_stb_s_tb_d_ts_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', ts=0, ct_ma_tag=True))
            s_stb_d_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0))
            s_stb_d_tb_d_ts_a_col_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, ct_am_tag=True))
            s_stb_d_tb_d_ts_a_tag_m_col_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, ct_ma_tag=True))
J
jiajingbin 已提交
1043

J
modify  
jiajingbin 已提交
1044 1045 1046 1047
        return d_stb_d_tb_list, s_stb_s_tb_list, s_stb_s_tb_a_col_a_tag_list, s_stb_s_tb_m_col_m_tag_list, \
            s_stb_d_tb_list, s_stb_d_tb_a_col_m_tag_list, s_stb_d_tb_a_tag_m_col_list, s_stb_s_tb_d_ts_list, \
            s_stb_s_tb_d_ts_a_col_m_tag_list, s_stb_s_tb_d_ts_a_tag_m_col_list, s_stb_d_tb_d_ts_list, \
            s_stb_d_tb_d_ts_a_col_m_tag_list, s_stb_d_tb_d_ts_a_tag_m_col_list
J
jiajingbin 已提交
1048

J
save  
jiajingbin 已提交
1049 1050 1051 1052

    def genMultiThreadSeq(self, sql_list):
        tlist = list()
        for insert_sql in sql_list:
1053
            t = threading.Thread(target=self._conn.schemaless_insert,args=([insert_sql[0]], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value))
J
save  
jiajingbin 已提交
1054 1055 1056 1057 1058 1059 1060
            tlist.append(t)
        return tlist

    def multiThreadRun(self, tlist):
        for t in tlist:
            t.start()
        for t in tlist:
J
jiajingbin 已提交
1061
            t.join()
J
save  
jiajingbin 已提交
1062

J
save  
jiajingbin 已提交
1063
    def stbInsertMultiThreadCheckCase(self):
J
jiajingbin 已提交
1064 1065 1066
        """
            thread input different stb
        """
J
jiajingbin 已提交
1067
        self.cleanStb()
J
jiajingbin 已提交
1068 1069
        input_sql = self.genSqlList()[0]
        self.multiThreadRun(self.genMultiThreadSeq(input_sql))
J
jiajingbin 已提交
1070 1071 1072 1073 1074 1075 1076
        tdSql.query(f"show tables;")
        tdSql.checkRows(5)
    
    def sStbStbDdataInsertMultiThreadCheckCase(self):
        """
            thread input same stb tb, different data, result keep first data
        """
J
jiajingbin 已提交
1077
        self.cleanStb()
J
jiajingbin 已提交
1078 1079
        tb_name = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
J
jiajingbin 已提交
1080 1081 1082 1083 1084 1085 1086
        self.resCmp(input_sql, stb_name)
        s_stb_s_tb_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[1]
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(1)
        expected_tb_name = self.getNoIdTbName(stb_name)[0]
        tdSql.checkEqual(tb_name, expected_tb_name)
J
jiajingbin 已提交
1087 1088
        tdSql.query(f"select * from {stb_name};")
        tdSql.checkRows(1)
J
jiajingbin 已提交
1089 1090 1091 1092 1093

    def sStbStbDdataAtcInsertMultiThreadCheckCase(self):
        """
            thread input same stb tb, different data, add columes and tags,  result keep first data
        """
J
jiajingbin 已提交
1094
        self.cleanStb()
J
jiajingbin 已提交
1095 1096
        tb_name = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
J
jiajingbin 已提交
1097 1098 1099 1100 1101 1102 1103
        self.resCmp(input_sql, stb_name)
        s_stb_s_tb_a_col_a_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[2]
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_a_col_a_tag_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(1)
        expected_tb_name = self.getNoIdTbName(stb_name)[0]
        tdSql.checkEqual(tb_name, expected_tb_name)
J
jiajingbin 已提交
1104 1105
        tdSql.query(f"select * from {stb_name};")
        tdSql.checkRows(1)
J
jiajingbin 已提交
1106 1107 1108
    
    def sStbStbDdataMtcInsertMultiThreadCheckCase(self):
        """
J
jiajingbin 已提交
1109
            thread input same stb tb, different data, minus columes and tags,  result keep first data
J
jiajingbin 已提交
1110 1111
        """
        self.cleanStb()
J
jiajingbin 已提交
1112 1113
        tb_name = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
J
jiajingbin 已提交
1114 1115 1116 1117 1118 1119 1120
        self.resCmp(input_sql, stb_name)
        s_stb_s_tb_m_col_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[3]
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_m_col_m_tag_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(1)
        expected_tb_name = self.getNoIdTbName(stb_name)[0]
        tdSql.checkEqual(tb_name, expected_tb_name)
J
jiajingbin 已提交
1121 1122 1123 1124 1125 1126 1127 1128
        tdSql.query(f"select * from {stb_name};")
        tdSql.checkRows(1)

    def sStbDtbDdataInsertMultiThreadCheckCase(self):
        """
            thread input same stb, different tb, different data
        """
        self.cleanStb()
J
jiajingbin 已提交
1129
        input_sql, stb_name = self.genFullTypeSql()
J
jiajingbin 已提交
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140
        self.resCmp(input_sql, stb_name)
        s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4]
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(6)

    def sStbDtbDdataAcMtInsertMultiThreadCheckCase(self):
        """
            thread input same stb, different tb, different data, add col, mul tag
        """
        self.cleanStb()
J
jiajingbin 已提交
1141
        input_sql, stb_name = self.genFullTypeSql()
J
jiajingbin 已提交
1142
        self.resCmp(input_sql, stb_name)
1143 1144 1145 1146 1147 1148
        # s_stb_d_tb_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[5]
        s_stb_d_tb_a_col_m_tag_list = [(f'{stb_name},t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="ngxgzdzs",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=F 1626006833639000000ns', 'hpxbys'), \
                                        (f'{stb_name},t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="vvfrdtty",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=True 1626006833639000000ns', 'hpxbys'), \
                                        (f'{stb_name},t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="kzscucnt",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=f 1626006833639000000ns', 'hpxbys'), \
                                        (f'{stb_name},t0=false,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="asegdbqk",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=false 1626006833639000000ns', 'hpxbys'), \
                                        (f'{stb_name},t0=T,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=true,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="yvqnhgmn",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=T 1626006833639000000ns', 'hpxbys')]
J
jiajingbin 已提交
1149 1150
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_col_m_tag_list))
        tdSql.query(f"show tables;")
1151
        tdSql.checkRows(3)
J
jiajingbin 已提交
1152 1153 1154 1155 1156 1157

    def sStbDtbDdataAtMcInsertMultiThreadCheckCase(self):
        """
            thread input same stb, different tb, different data, add tag, mul col
        """
        self.cleanStb()
J
jiajingbin 已提交
1158
        input_sql, stb_name = self.genFullTypeSql()
J
jiajingbin 已提交
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169
        self.resCmp(input_sql, stb_name)
        s_stb_d_tb_a_tag_m_col_list = self.genSqlList(stb_name=stb_name)[6]
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_tag_m_col_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(6)

    def sStbStbDdataDtsInsertMultiThreadCheckCase(self):
        """
            thread input same stb tb, different ts
        """
        self.cleanStb()
J
jiajingbin 已提交
1170 1171
        tb_name = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
J
jiajingbin 已提交
1172
        self.resCmp(input_sql, stb_name)
1173 1174 1175 1176 1177 1178
        # s_stb_s_tb_d_ts_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[7]
        s_stb_s_tb_d_ts_list =[(f'{stb_name},id="{tb_name}",t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="tgqkvsws",t8=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="htvnnldm",c8=L"ncharColValue",c9=7u64 0', 'sfzqdz'), \
                                (f'{stb_name},id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="fvrhhqiy",t8=L"ncharTagValue" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="gybqvhos",c8=L"ncharColValue",c9=7u64 0', 'sfzqdz'), \
                                (f'{stb_name},id="{tb_name}",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vifkabhu",t8=L"ncharTagValue" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="zlvxgquy",c8=L"ncharColValue",c9=7u64 0', 'sfzqdz'), \
                                (f'{stb_name},id="{tb_name}",t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="lsyotcrn",t8=L"ncharTagValue" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="oaupfgtz",c8=L"ncharColValue",c9=7u64 0', 'sfzqdz'), \
                                (f'{stb_name},id="{tb_name}",t0=T,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="jrwamcgy",t8=L"ncharTagValue" c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="vgzadjsh",c8=L"ncharColValue",c9=7u64 0', 'sfzqdz')]
J
jiajingbin 已提交
1179 1180 1181
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(1)
1182 1183 1184
        # ! Small probability bug ---> temporarily delete it
        # tdSql.query(f"select * from {stb_name}")
        # tdSql.checkRows(6)
J
jiajingbin 已提交
1185

J
modify  
jiajingbin 已提交
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212
    def sStbStbDdataDtsAcMtInsertMultiThreadCheckCase(self):
        """
            thread input same stb tb, different ts, add col, mul tag
        """
        self.cleanStb()
        tb_name = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
        self.resCmp(input_sql, stb_name)
        s_stb_s_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[8]
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_col_m_tag_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(1)
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(6)
        tdSql.query(f"select * from {stb_name} where t8 is not NULL")
        tdSql.checkRows(6)
        tdSql.query(f"select * from {tb_name} where c11 is not NULL;")
        tdSql.checkRows(5)

    def sStbStbDdataDtsAtMcInsertMultiThreadCheckCase(self):
        """
            thread input same stb tb, different ts, add tag, mul col
        """
        self.cleanStb()
        tb_name = self.getLongName(7, "letters")
        input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
        self.resCmp(input_sql, stb_name)
1213 1214 1215 1216 1217 1218
        # s_stb_s_tb_d_ts_a_tag_m_col_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[9]
        s_stb_s_tb_d_ts_a_tag_m_col_list = [(f'{stb_name},id="{tb_name}",t0=T,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="xsajdfjc",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 0', 'rgqcfb'), \
                                            (f'{stb_name},id="{tb_name}",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="qzeyolgt",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 0', 'rgqcfb'), \
                                            (f'{stb_name},id="{tb_name}",t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="suxqziwh",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue" c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 0', 'rgqcfb'), \
                                            (f'{stb_name},id="{tb_name}",t0=false,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="vapolpgr",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 0', 'rgqcfb'), \
                                            (f'{stb_name},id="{tb_name}",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="eustwpfl",t8=L"ncharTagValue",t11=127i8,t10=L"ncharTagValue" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 0', 'rgqcfb')]
J
modify  
jiajingbin 已提交
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_tag_m_col_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(1)
        tdSql.query(f"select * from {stb_name}")
        tdSql.checkRows(6)
        for c in ["c7", "c8", "c9"]:
            tdSql.query(f"select * from {stb_name} where {c} is NULL")
            tdSql.checkRows(5)        
        for t in ["t10", "t11"]:
            tdSql.query(f"select * from {stb_name} where {t} is not NULL;")
1229
            tdSql.checkRows(0)
J
modify  
jiajingbin 已提交
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241

    def sStbDtbDdataDtsInsertMultiThreadCheckCase(self):
        """
            thread input same stb, different tb, data, ts
        """
        self.cleanStb()
        input_sql, stb_name = self.genFullTypeSql()
        self.resCmp(input_sql, stb_name)
        s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10]
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_list))
        tdSql.query(f"show tables;")
        tdSql.checkRows(6)
J
jiajingbin 已提交
1242

J
modify  
jiajingbin 已提交
1243 1244 1245 1246 1247 1248 1249
    def sStbDtbDdataDtsAcMtInsertMultiThreadCheckCase(self):
        """
            thread input same stb, different tb, data, ts, add col, mul tag
        """
        self.cleanStb()
        input_sql, stb_name = self.genFullTypeSql()
        self.resCmp(input_sql, stb_name)
1250 1251 1252 1253 1254 1255
        # s_stb_d_tb_d_ts_a_col_m_tag_list = self.genSqlList(stb_name=stb_name)[11]
        s_stb_d_tb_d_ts_a_col_m_tag_list = [(f'{stb_name},t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="eltflgpz",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=True 0', 'ynnlov'), \
                                            (f'{stb_name},t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=False,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="ysznggwl",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=t 0', 'ynnlov'), \
                                            (f'{stb_name},t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="nxwjucch",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=f 0', 'ynnlov'), \
                                            (f'{stb_name},t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=T,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="fzseicnt",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=F 0', 'ynnlov'), \
                                            (f'{stb_name},t0=False,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=F,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="zwgurhdp",c8=L"ncharColValue",c9=7u64,c11=L"ncharColValue",c10=False 0', 'ynnlov')]
J
modify  
jiajingbin 已提交
1256 1257
        self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_a_col_m_tag_list))
        tdSql.query(f"show tables;")
1258
        tdSql.checkRows(3)
J
modify  
jiajingbin 已提交
1259 1260

    def test(self):
1261 1262
        input_sql1 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ddzhiksj\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bnhwlgvj\",c8=L\"ncharTagValue\",c9=7u64 1626006933640000000ns"
        input_sql2 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 1626006933640000000ns"
1263
        try:
1264 1265
            self._conn.schemaless_insert([input_sql1], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
            self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
1266
        except SchemalessError as err:
1267
            print(err.errno)
1268
        # self._conn.schemaless_insert([input_sql2], 0)
J
modify  
jiajingbin 已提交
1269 1270
        # input_sql3 = f'abcd,id="cc¥Ec",t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="ndsfdrum",t8=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="igwoehkm",c8=L"ncharColValue",c9=7u64 0'
        # print(input_sql3)
J
save  
jiajingbin 已提交
1271
        # input_sql4 = 'hmemeb,id="kilrcrldgf",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="fysodjql",t8=L"ncharTagValue" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="waszbfvc",c8=L"ncharColValue",c9=7u64 0'
1272
        # code = self._conn.schemaless_insert([input_sql3], 0)
J
modify  
jiajingbin 已提交
1273
        # print(code)
1274
        # self._conn.schemaless_insert([input_sql4], 0)
J
save  
jiajingbin 已提交
1275

J
jiajingbin 已提交
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296
    def runAll(self):
        self.initCheckCase()
        self.boolTypeCheckCase()
        self.symbolsCheckCase()
        self.tsCheckCase()
        self.idSeqCheckCase()
        self.idUpperCheckCase()
        self.noIdCheckCase()
        self.maxColTagCheckCase()
        self.idIllegalNameCheckCase()
        self.idStartWithNumCheckCase()
        self.nowTsCheckCase()
        self.dateFormatTsCheckCase()
        self.illegalTsCheckCase()
        self.tagValueLengthCheckCase()
        self.colValueLengthCheckCase()
        self.tagColIllegalValueCheckCase()
        self.duplicateIdTagColInsertCheckCase()
        self.noIdStbExistCheckCase()
        self.duplicateInsertExistCheckCase()
        self.tagColBinaryNcharLengthCheckCase()
J
jiajingbin 已提交
1297
        self.tagColAddDupIDCheckCase()
J
jiajingbin 已提交
1298 1299 1300
        self.tagColAddCheckCase()
        self.tagMd5Check()
        self.tagColBinaryMaxLengthCheckCase()
1301
        self.tagColNcharMaxLengthCheckCase()
J
jiajingbin 已提交
1302
        self.batchInsertCheckCase()
1303
        self.multiInsertCheckCase(1000)
J
jiajingbin 已提交
1304
        self.batchErrorInsertCheckCase()
J
modify  
jiajingbin 已提交
1305
        # MultiThreads
J
jiajingbin 已提交
1306 1307 1308 1309 1310
        self.stbInsertMultiThreadCheckCase()
        self.sStbStbDdataInsertMultiThreadCheckCase()
        self.sStbStbDdataAtcInsertMultiThreadCheckCase()
        self.sStbStbDdataMtcInsertMultiThreadCheckCase()
        self.sStbDtbDdataInsertMultiThreadCheckCase()
J
jiajingbin 已提交
1311

J
modify  
jiajingbin 已提交
1312
        # # ! concurrency conflict
1313 1314
        self.sStbDtbDdataAcMtInsertMultiThreadCheckCase()
        self.sStbDtbDdataAtMcInsertMultiThreadCheckCase()
J
modify  
jiajingbin 已提交
1315

J
jiajingbin 已提交
1316
        self.sStbStbDdataDtsInsertMultiThreadCheckCase()
J
jiajingbin 已提交
1317

J
modify  
jiajingbin 已提交
1318
        # # ! concurrency conflict
1319 1320
        self.sStbStbDdataDtsAcMtInsertMultiThreadCheckCase()
        self.sStbStbDdataDtsAtMcInsertMultiThreadCheckCase()
J
modify  
jiajingbin 已提交
1321

J
modify  
jiajingbin 已提交
1322 1323 1324
        self.sStbDtbDdataDtsInsertMultiThreadCheckCase()

        # ! concurrency conflict
1325
        self.sStbDtbDdataDtsAcMtInsertMultiThreadCheckCase()
J
modify  
jiajingbin 已提交
1326 1327 1328



J
jiajingbin 已提交
1329 1330 1331
    def run(self):
        print("running {}".format(__file__))
        self.createDb()
1332 1333 1334 1335 1336
        try:
            self.runAll()
        except Exception as err:
            print(''.join(traceback.format_exception(None, err, err.__traceback__)))
            raise err
1337 1338
        # self.tagColIllegalValueCheckCase()
        # self.test()
J
jiajingbin 已提交
1339 1340 1341 1342 1343

    def stop(self):
        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)

1344
tdCases.addWindows(__file__, TDTestCase())
J
jiajingbin 已提交
1345
tdCases.addLinux(__file__, TDTestCase())