提交 c0dacf53 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

Merge branch 'develop' of https://github.com/taosdata/TDengine into develop

......@@ -1016,7 +1016,9 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
}
if ((code = tscAllocPayload(pCmd, TSDB_PAYLOAD_SIZE)) != TSDB_CODE_SUCCESS) {
// TODO: 2048 is added because TSDB_MAX_TAGS_LEN now is 65536
// but TSDB_PAYLOAD_SIZE is 65380
if ((code = tscAllocPayload(pCmd, TSDB_PAYLOAD_SIZE + 2048)) != TSDB_CODE_SUCCESS) {
return code;
}
......
......@@ -1467,15 +1467,16 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
char * pMsg;
int msgLen = 0;
char *tmpData = 0;
if (pSql->cmd.allocSize > 0) {
tmpData = calloc(1, pSql->cmd.allocSize);
char *tmpData = NULL;
uint32_t len = pSql->cmd.payloadLen;
if (len > 0) {
tmpData = calloc(1, len);
if (NULL == tmpData) {
return TSDB_CODE_CLI_OUT_OF_MEMORY;
}
// STagData is in binary format, strncpy is not available
memcpy(tmpData, pSql->cmd.payload, pSql->cmd.allocSize);
memcpy(tmpData, pSql->cmd.payload, len);
}
SSqlCmd * pCmd = &pSql->cmd;
......@@ -1489,9 +1490,9 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg = (char*)pInfoMsg + sizeof(SCMTableInfoMsg);
if (pSql->cmd.autoCreated) {
memcpy(pInfoMsg->tags, tmpData, sizeof(STagData));
pMsg += sizeof(STagData);
if (pSql->cmd.autoCreated && len > 0) {
memcpy(pInfoMsg->tags, tmpData, len);
pMsg += len;
}
pCmd->payloadLen = pMsg - (char*)pInfoMsg;;
......@@ -2375,7 +2376,7 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf
tscGetQueryInfoDetailSafely(&pNew->cmd, 0, &pNewQueryInfo);
pNew->cmd.autoCreated = pSql->cmd.autoCreated; // create table if not exists
if (TSDB_CODE_SUCCESS != tscAllocPayload(&pNew->cmd, TSDB_DEFAULT_PAYLOAD_SIZE)) {
if (TSDB_CODE_SUCCESS != tscAllocPayload(&pNew->cmd, TSDB_DEFAULT_PAYLOAD_SIZE + pSql->cmd.payloadLen)) {
tscError("%p malloc failed for payload to get table meta", pSql);
free(pNew);
......@@ -2386,7 +2387,8 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf
assert(pNew->cmd.numOfClause == 1 && pNewQueryInfo->numOfTables == 1);
strncpy(pNewMeterMetaInfo->name, pTableMetaInfo->name, tListLen(pNewMeterMetaInfo->name));
memcpy(pNew->cmd.payload, pSql->cmd.payload, TSDB_DEFAULT_PAYLOAD_SIZE); // tag information if table does not exists.
memcpy(pNew->cmd.payload, pSql->cmd.payload, pSql->cmd.payloadLen); // tag information if table does not exists.
pNew->cmd.payloadLen = pSql->cmd.payloadLen;
tscTrace("%p new pSqlObj:%p to get tableMeta, auto create:%d", pSql, pNew, pNew->cmd.autoCreated);
pNew->fp = tscTableMetaCallBack;
......
......@@ -1742,7 +1742,12 @@ static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) {
pCreateMsg->igExists = 1;
pCreateMsg->getMeta = 1;
pCreateMsg->contLen = htonl(contLen);
memcpy(pCreateMsg->schema, pInfo->tags, sizeof(STagData));
contLen = sizeof(STagData);
if (contLen > pMsg->contLen - sizeof(SCMTableInfoMsg)) {
contLen = pMsg->contLen - sizeof(SCMTableInfoMsg);
}
memcpy(pCreateMsg->schema, pInfo->tags, contLen);
SQueuedMsg *newMsg = mgmtCloneQueuedMsg(pMsg);
pMsg->pCont = newMsg->pCont;
......
###################################################################
# 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 taos
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self):
tdLog.debug("start to execute %s" % __file__)
tdLog.info("prepare cluster")
tdDnodes.stopAll()
tdDnodes.deploy(1)
tdDnodes.start(1)
self.conn = taos.connect(config=tdDnodes.getSimCfgPath())
tdSql.init(self.conn.cursor())
tdSql.execute('reset query cache')
tdSql.execute('create dnode 192.168.0.2')
tdDnodes.deploy(2)
tdDnodes.start(2)
self.conn = taos.connect(config=tdDnodes.getSimCfgPath())
tdSql.init(self.conn.cursor())
tdSql.execute('reset query cache')
tdSql.execute('create dnode 192.168.0.3')
tdDnodes.deploy(3)
tdDnodes.start(3)
def run(self):
tdSql.execute('create database db replica 3 days 7')
tdSql.execute('use db')
for tid in range(1, 11):
tdSql.execute('create table tb%d(ts timestamp, i int)' % tid)
tdLog.sleep(10)
tdLog.info("================= step1")
startTime = 1520000010000
for rid in range(1, 11):
for tid in range(1, 11):
tdSql.execute(
'insert into tb%d values(%ld, %d)' %
(tid, startTime, rid))
startTime += 1
tdSql.query('select * from tb1')
tdSql.checkRows(10)
tdLog.sleep(5)
tdLog.info("================= step2")
tdSql.execute('alter database db replica 2')
tdLog.sleep(10)
tdLog.info("================= step3")
for rid in range(1, 11):
for tid in range(1, 11):
tdSql.execute(
'insert into tb%d values(%ld, %d)' %
(tid, startTime, rid))
startTime += 1
tdSql.query('select * from tb1')
tdSql.checkRows(20)
tdLog.sleep(5)
tdLog.info("================= step4")
tdSql.execute('alter database db replica 1')
tdLog.sleep(10)
tdLog.info("================= step5")
for rid in range(1, 11):
for tid in range(1, 11):
tdSql.execute(
'insert into tb%d values(%ld, %d)' %
(tid, startTime, rid))
startTime += 1
tdSql.query('select * from tb1')
tdSql.checkRows(30)
tdLog.sleep(5)
tdLog.info("================= step6")
tdSql.execute('alter database db replica 2')
tdLog.sleep(10)
tdLog.info("================= step7")
for rid in range(1, 11):
for tid in range(1, 11):
tdSql.execute(
'insert into tb%d values(%ld, %d)' %
(tid, startTime, rid))
startTime += 1
tdSql.query('select * from tb1')
tdSql.checkRows(40)
tdLog.sleep(5)
tdLog.info("================= step8")
tdSql.execute('alter database db replica 3')
tdLog.sleep(10)
tdLog.info("================= step9")
for rid in range(1, 11):
for tid in range(1, 11):
tdSql.execute(
'insert into tb%d values(%ld, %d)' %
(tid, startTime, rid))
startTime += 1
tdSql.query('select * from tb1')
tdSql.checkRows(50)
tdLog.sleep(5)
def stop(self):
tdSql.close()
self.conn.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addCluster(__file__, TDTestCase())
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.types = [
"int",
"bigint",
"float",
"double",
"smallint",
"tinyint",
"binary(10)",
"nchar(10)",
"timestamp"]
self.rowNum = 300
self.ts = 1537146000000
self.step = 1000
self.sqlHead = "select count(*), count(c1) "
self.sqlTail = " from stb"
def addColumnAndCount(self):
for colIdx in range(len(self.types)):
tdSql.execute(
"alter table stb add column c%d %s" %
(colIdx + 2, self.types[colIdx]))
self.sqlHead = self.sqlHead + ",count(c%d) " % (colIdx + 2)
tdSql.query(self.sqlHead + self.sqlTail)
# count non-NULL values in each column
tdSql.checkData(0, 0, self.rowNum * (colIdx + 1))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 1))
for i in range(2, colIdx + 2):
print("check1: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 2))
# insert more rows
for k in range(self.rowNum):
self.ts += self.step
sql = "insert into tb values (%d, %d" % (self.ts, colIdx + 2)
for j in range(colIdx + 1):
sql += ", %d" % (colIdx + 2)
sql += ")"
tdSql.execute(sql)
# count non-NULL values in each column
tdSql.query(self.sqlHead + self.sqlTail)
tdSql.checkData(0, 0, self.rowNum * (colIdx + 2))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 2))
for i in range(2, colIdx + 2):
print("check2: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 3))
def dropColumnAndCount(self):
tdSql.query(self.sqlHead + self.sqlTail)
res = []
for i in range(len(self.types)):
res.append(tdSql.getData(0, i + 2))
print(res)
for colIdx in range(len(self.types), 0, -1):
tdSql.execute("alter table stb drop column c%d" % (colIdx + 2))
# self.sqlHead = self.sqlHead + ",count(c%d) " %(colIdx + 2)
tdSql.query(self.sqlHead + self.sqlTail)
# count non-NULL values in each column
tdSql.checkData(0, 0, self.rowNum * (colIdx + 1))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 1))
for i in range(2, colIdx + 2):
print("check1: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 2))
# insert more rows
for k in range(self.rowNum):
self.ts += self.step
sql = "insert into tb values (%d, %d" % (self.ts, colIdx + 2)
for j in range(colIdx + 1):
sql += ", %d" % (colIdx + 2)
sql += ")"
tdSql.execute(sql)
# count non-NULL values in each column
tdSql.query(self.sqlHead + self.sqlTail)
tdSql.checkData(0, 0, self.rowNum * (colIdx + 2))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 2))
for i in range(2, colIdx + 2):
print("check2: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 3))
def run(self):
# Setup params
db = "db"
# Create db
tdSql.execute("drop database if exists %s" % (db))
tdSql.execute("reset query cache")
tdSql.execute("create database %s maxrows 200 maxtables 4" % (db))
tdSql.execute("use %s" % (db))
# Create a table with one colunm of int type and insert 300 rows
tdLog.info("Create stb and tb")
tdSql.execute("create table stb (ts timestamp, c1 int) tags (tg1 int)")
tdSql.execute("create table tb using stb tags (0)")
tdLog.info("Insert %d rows into tb" % (self.rowNum))
for k in range(1, self.rowNum + 1):
self.ts += self.step
tdSql.execute("insert into tb values (%d, 1)" % (self.ts))
# Alter tb and add a column of smallint type, then query tb to see if
# all added column are NULL
self.addColumnAndCount()
tdDnodes.stop(1)
time.sleep(5)
tdDnodes.start(1)
time.sleep(5)
tdSql.query(self.sqlHead + self.sqlTail)
for i in range(2, len(self.types) + 2):
tdSql.checkData(0, i, self.rowNum * (len(self.types) + 2 - i))
self.dropColumnAndCount()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
#tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.types = [
"int",
"bigint",
"float",
"double",
"smallint",
"tinyint",
"binary(10)",
"nchar(10)",
"timestamp"]
self.rowNum = 300
self.ts = 1537146000000
self.step = 1000
self.sqlHead = "select count(*), count(c1) "
self.sqlTail = " from tb"
def addColumnAndCount(self):
for colIdx in range(len(self.types)):
tdSql.execute(
"alter table tb add column c%d %s" %
(colIdx + 2, self.types[colIdx]))
self.sqlHead = self.sqlHead + ",count(c%d) " % (colIdx + 2)
tdSql.query(self.sqlHead + self.sqlTail)
# count non-NULL values in each column
tdSql.checkData(0, 0, self.rowNum * (colIdx + 1))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 1))
for i in range(2, colIdx + 2):
print("check1: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 2))
# insert more rows
for k in range(self.rowNum):
self.ts += self.step
sql = "insert into tb values (%d, %d" % (self.ts, colIdx + 2)
for j in range(colIdx + 1):
sql += ", %d" % (colIdx + 2)
sql += ")"
tdSql.execute(sql)
# count non-NULL values in each column
tdSql.query(self.sqlHead + self.sqlTail)
tdSql.checkData(0, 0, self.rowNum * (colIdx + 2))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 2))
for i in range(2, colIdx + 2):
print("check2: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 3))
def dropColumnAndCount(self):
tdSql.query(self.sqlHead + self.sqlTail)
res = []
for i in range(len(self.types)):
res[i] = tdSql.getData(0, i + 2)
print(res.join)
for colIdx in range(len(self.types), 0, -1):
tdSql.execute("alter table tb drop column c%d" % (colIdx + 2))
# self.sqlHead = self.sqlHead + ",count(c%d) " %(colIdx + 2)
tdSql.query(self.sqlHead + self.sqlTail)
# count non-NULL values in each column
tdSql.checkData(0, 0, self.rowNum * (colIdx + 1))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 1))
for i in range(2, colIdx + 2):
print("check1: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 2))
# insert more rows
for k in range(self.rowNum):
self.ts += self.step
sql = "insert into tb values (%d, %d" % (self.ts, colIdx + 2)
for j in range(colIdx + 1):
sql += ", %d" % (colIdx + 2)
sql += ")"
tdSql.execute(sql)
# count non-NULL values in each column
tdSql.query(self.sqlHead + self.sqlTail)
tdSql.checkData(0, 0, self.rowNum * (colIdx + 2))
tdSql.checkData(0, 1, self.rowNum * (colIdx + 2))
for i in range(2, colIdx + 2):
print("check2: i=%d colIdx=%d" % (i, colIdx))
tdSql.checkData(0, i, self.rowNum * (colIdx - i + 3))
def run(self):
# Setup params
db = "db"
# Create db
tdSql.execute("drop database if exists %s" % (db))
tdSql.execute("reset query cache")
tdSql.execute("create database %s maxrows 200 maxtables 4" % (db))
tdSql.execute("use %s" % (db))
# Create a table with one colunm of int type and insert 300 rows
tdLog.info("Create table tb")
tdSql.execute("create table tb (ts timestamp, c1 int)")
tdLog.info("Insert %d rows into tb" % (self.rowNum))
for k in range(1, self.rowNum + 1):
self.ts += self.step
tdSql.execute("insert into tb values (%d, 1)" % (self.ts))
# Alter tb and add a column of smallint type, then query tb to see if
# all added column are NULL
self.addColumnAndCount()
tdDnodes.stop(1)
time.sleep(5)
tdDnodes.start(1)
time.sleep(5)
tdSql.query(self.sqlHead + self.sqlTail)
for i in range(2, len(self.types) + 2):
tdSql.checkData(0, i, self.rowNum * (len(self.types) + 2 - i))
self.dropColumnAndCount()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
#tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# 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 taos
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
tdSql.execute(
'create table st (ts timestamp, v1 int, v2 int, v3 int, v4 int, v5 int) tags (t int)')
totalTables = 100
batchSize = 500
totalBatch = 60
tdLog.info(
"create %d tables, insert %d rows per table" %
(totalTables, batchSize * totalBatch))
for t in range(0, totalTables):
tdSql.execute('create table t%d using st tags(%d)' % (t, t))
# 2019-06-10 00:00:00
beginTs = 1560096000000
interval = 10000
for r in range(0, totalBatch):
sql = 'insert into t%d values ' % (t)
for b in range(0, batchSize):
ts = beginTs + (r * batchSize + b) * interval
sql += '(%d, 1, 2, 3, 4, 5)' % (ts)
tdSql.execute(sql)
tdLog.info("insert data finished")
tdSql.execute('alter table st add column v6 int')
tdLog.sleep(5)
tdLog.info("alter table finished")
tdSql.query("select count(*) from t50")
tdSql.checkData(0, 0, (int)(batchSize * totalBatch))
tdLog.info("insert")
tdSql.execute(
"insert into t50 values ('2019-06-13 07:59:55.000', 1, 2, 3, 4, 5, 6)")
tdLog.info("import")
tdSql.execute(
"import into t50 values ('2019-06-13 07:59:55.000', 1, 2, 3, 4, 5, 6)")
tdLog.info("query")
tdSql.query("select count(*) from t50")
tdSql.checkData(0, 0, batchSize * totalBatch + 1)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -19,6 +19,8 @@ python3 ./test.py $1 -f table/column_num.py
python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -f table/tablename-boundary.py
# tag
python3 ./test.py $1 -f tag_lite/filter.py
python3 ./test.py $1 -f tag_lite/create-tags-boundary.py
python3 ./test.py $1 -f dbmgmt/database-name-boundary.py
......@@ -96,3 +98,4 @@ python3 ./test.py $1 -f user/pass_len.py
# table
#python3 ./test.py $1 -f table/del_stable.py
###################################################################
# 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 random
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class Test:
def __init__(self):
self.current_tb = ""
self.last_tb = ""
self.written = 0
def create_table(self):
tdLog.info("create a table")
self.current_tb = "tb%d" % int(round(time.time() * 1000))
tdLog.info("current table %s" % self.current_tb)
if (self.current_tb == self.last_tb):
return
else:
tdSql.execute(
'create table %s (ts timestamp, speed int)' %
self.current_tb)
self.last_tb = self.current_tb
self.written = 0
def insert_data(self):
tdLog.info("will insert data to table")
if (self.current_tb == ""):
tdLog.info("no table, create first")
self.create_table()
tdLog.info("insert data to table")
insertRows = 10
tdLog.info("insert %d rows to %s" % (insertRows, self.last_tb))
for i in range(0, insertRows):
ret = tdSql.execute(
'insert into %s values (now + %dm, %d)' %
(self.last_tb, i, i))
self.written = self.written + 1
tdLog.info("insert earlier data")
tdSql.execute('insert into %s values (now - 5m , 10)' % self.last_tb)
self.written = self.written + 1
tdSql.execute('insert into %s values (now - 6m , 10)' % self.last_tb)
self.written = self.written + 1
tdSql.execute('insert into %s values (now - 7m , 10)' % self.last_tb)
self.written = self.written + 1
tdSql.execute('insert into %s values (now - 8m , 10)' % self.last_tb)
self.written = self.written + 1
def query_data(self):
if (self.written > 0):
tdLog.info("query data from table")
tdSql.query("select * from %s" % self.last_tb)
tdSql.checkRows(self.written)
def create_stable(self):
tdLog.info("create a super table")
def restart_database(self):
tdLog.info("restart databae")
tdDnodes.stop(1)
tdDnodes.start(1)
tdLog.sleep(5)
def force_restart(self):
tdLog.info("force restart database")
tdDnodes.forcestop(1)
tdDnodes.start(1)
tdLog.sleep(5)
def drop_table(self):
if (self.current_tb != ""):
tdLog.info("drop current tb %s" % self.current_tb)
tdSql.execute("drop table %s" % self.current_tb)
self.current_tb = ""
self.last_tb = ""
self.written = 0
def reset_query_cache(self):
tdLog.info("reset query cache")
tdSql.execute("reset query cache")
tdLog.sleep(1)
def reset_database(self):
tdLog.info("reset database")
tdDnodes.forcestop(1)
tdDnodes.deploy(1)
self.current_tb = ""
self.last_tb = ""
self.written = 0
tdDnodes.start(1)
tdSql.prepare()
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
test = Test()
switch = {
1: test.create_table,
2: test.insert_data,
3: test.query_data,
4: test.create_stable,
5: test.restart_database,
6: test.force_restart,
7: test.drop_table,
8: test.reset_query_cache,
9: test.reset_database,
}
for x in range(1, 100):
r = random.randint(1, 9)
tdLog.notice("iteration %d run func %d" % (x, r))
switch.get(r, lambda: "ERROR")()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
#!/bin/bash
# insert
python3 ./test.py $1 -f insert/basic.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/int.py
......@@ -24,6 +25,7 @@ python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/multi.py
python3 ./test.py $1 -s && sleep 1
# table
python3 ./test.py $1 -f table/column_name.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/column_num.py
......@@ -31,6 +33,7 @@ python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -s && sleep 1
# import
python3 ./test.py $1 -f import_merge/importDataLastSub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHead.py
......@@ -43,3 +46,7 @@ python3 ./test.py $1 -f import_merge/importTail.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTRestart.py
python3 ./test.py $1 -s && sleep 1
#tag
python3 ./test.py $1 -f tag_lite/filter.py
python3 ./test.py $1 -s && sleep 1
###################################################################
# 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 taos
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
self.ntables = 10
self.rowsPerTable = 10
self.startTime = 1520000010000
tdDnodes.stop(1)
tdDnodes.deploy(1)
tdDnodes.start(1)
tdLog.info("================= step0")
tdSql.execute('reset query cache')
tdLog.info("drop database db if exits")
tdSql.execute('drop database if exists db')
tdLog.info("================= step1")
tdSql.execute('create database db maxtables 4')
tdLog.sleep(5)
tdSql.execute('use db')
tdLog.info("================= step1")
tdLog.info("create 1 super table")
tdSql.execute('create table stb (ts timestamp, i int) \
tags (tin int, tfl float, tbg bigint, tdo double, tbi binary(10), tbl bool)')
tdLog.info("================= step2")
tdLog.info("create %d tables" % self.ntables)
for tid in range(1, self.ntables + 1):
tdSql.execute(
'create table tb%d using stb tags(%d,%f,%ld,%f,\'%s\',%d)' %
(tid,
tid %
3,
1.2 *
tid,
self.startTime +
tid,
1.22 *
tid,
't' +
str(tid),
tid %
2))
tdLog.sleep(5)
tdLog.info("================= step3")
tdLog.info(
"insert %d data in to each %d tables" %
(self.rowsPerTable, self.ntables))
for rid in range(1, self.rowsPerTable + 1):
sqlcmd = ['insert into']
for tid in range(1, self.ntables + 1):
sqlcmd.append(
'tb%d values(%ld,%d)' %
(tid, self.startTime + rid, rid))
tdSql.execute(" ".join(sqlcmd))
tdSql.query('select count(*) from stb')
tdSql.checkData(0, 0, self.rowsPerTable * self.ntables)
tdLog.info("================= step4")
tdLog.info("drop one tag")
tdSql.execute('alter table stb drop tag tbi')
tdLog.info("insert %d data in to each %d tables" % (2, self.ntables))
for rid in range(self.rowsPerTable + 1, self.rowsPerTable + 3):
sqlcmd = ['insert into']
for tid in range(1, self.ntables + 1):
sqlcmd.append(
'tb%d values(%ld,%d)' %
(tid, self.startTime + rid, rid))
tdSql.execute(" ".join(sqlcmd))
self.rowsPerTable += 2
tdSql.query('select count(*) from stb')
tdSql.checkData(0, 0, self.rowsPerTable * self.ntables)
tdSql.query('describe tb1')
tdSql.checkRows(2 + 5)
tdLog.info("================= step5")
tdLog.info("add one tag")
tdSql.execute('alter table stb add tag tnc nchar(10)')
for tid in range(1, self.ntables + 1):
tdSql.execute('alter table tb%d set tag tnc=\"%s\"' %
(tid, str(tid * 1.2)))
tdLog.info("insert %d data in to each %d tables" % (2, self.ntables))
for rid in range(self.rowsPerTable + 1, self.rowsPerTable + 3):
sqlcmd = ['insert into']
for tid in range(1, self.ntables + 1):
sqlcmd.append(
'tb%d values(%ld,%d)' %
(tid, self.startTime + rid, rid))
tdSql.execute(" ".join(sqlcmd))
self.rowsPerTable += 2
tdSql.query('select count(*) from stb')
tdSql.checkData(0, 0, self.rowsPerTable * self.ntables)
tdSql.query('describe tb1')
tdSql.checkRows(2 + 6)
tdLog.info("================= step6")
tdLog.info("group and filter by tag1 int")
tdSql.query('select max(i) from stb where tbl=0 group by tin')
tdSql.checkRows(3)
tdSql.execute('reset query cache')
tdSql.query('select max(i) from stb where tbl=true group by tin')
tdSql.checkData(2, 0, self.rowsPerTable)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# 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
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
#TSIM: system sh/stop_dnodes.sh
#TSIM: system sh/deploy.sh -n dnode1 -i 1
#TSIM: system sh/exec.sh -n dnode1 -s start
#TSIM:
#TSIM: sleep 3000
#TSIM: sql connect
#TSIM:
#TSIM: print ======================== dnode1 start
tdLog.info('======================== dnode1 start')
#TSIM:
dbPrefix = "ta_fi_db"
tbPrefix = "ta_fi_tb"
mtPrefix = "ta_fi_mt"
#TSIM: $tbNum = 10
rowNum = 20
#TSIM: $totalNum = 200
#TSIM:
#TSIM: print =============== step1
tdLog.info('=============== step1')
i = 0
#TSIM: $db = $dbPrefix . $i
mt = "%s%d" % (mtPrefix, i)
#TSIM:
#TSIM: sql create database $db
#TSIM: sql use $db
#TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10))
tdLog.info("create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))" % mt)
tdSql.execute('create table %s (ts timestamp, tbcol int) TAGS(tgcol binary(10))' % mt)
#TSIM:
i = 0
while (i < 5):
tb = "tbPrefix%d" % i
tdLog.info("create table %s using %s tags( '0' )" % (tb, mt))
tdSql.execute("create table %s using %s tags( '0' )" % (tb, mt))
x = 0
while (x < rowNum):
ms = "%dm" % x
tdLog.info("insert into %s values (now + %s , %d)" % (tb, ms, x))
tdSql.execute("insert into %s values (now + %s , %d)" % (tb, ms, x))
x = x + 1
i = i + 1
while (i < 10):
tb = "%s%d" % (tbPrefix , i)
#TSIM: sql create table $tb using $mt tags( '1' )
tdLog.info("create table %s using %s tags( '1' )" % (tb, mt))
tdSql.execute("create table %s using %s tags( '1' )" % (tb, mt))
x = 0
while (x < rowNum):
ms = "%dm" % x
#TSIM: sql insert into $tb values (now + $ms , $x )
tdLog.info("insert into %s values (now + %s, %d )" % (tb, ms, x))
tdSql.execute("insert into %s values (now + %s, %d )" % (tb, ms, x))
x = x + 1
i = i + 1
#TSIM:
#TSIM: print =============== step2
tdLog.info('=============== step2')
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1'
tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = '1'" % mt)
tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tgcol = '1'" % mt)
#TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0, 0), tdSql.getData(0, 1), tdSql.getData(0, 2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0, 5), tdSql.getData(0, 6)))
#TSIM: if $data00 != 100 then
tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100)
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x step2
tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tg = '1' -x step2" % mt)
tdSql.error("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tg = '1'" % mt)
#TSIM: return -1
#TSIM: step2:
#TSIM:
#TSIM: print =============== step3
tdLog.info('=============== step3')
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where noexist = '1' -x step3
tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where noexist = '1' -x step3" % mt)
tdSql.error("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where noexist = '1'" % mt)
#TSIM: return -1
#TSIM: step3:
#TSIM:
#TSIM: print =============== step4
tdLog.info('=============== step4')
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1'
tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tbcol = '1'" % mt)
tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where tbcol = '1'" % mt)
#TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
#TSIM: return -1
#TSIM: endi
#TSIM: if $data00 != 10 then
tdLog.info('tdSql.checkData(0, 0, 10)')
tdSql.checkData(0, 0, 10)
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: print =============== step5
tdLog.info('=============== step5')
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt
tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % mt)
tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % mt)
#TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0,0), tdSql.getData(0,1), tdSql.getData(0,2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0,5 ), tdSql.getData(0, 6)))
#TSIM: if $data00 != 200 then
tdLog.info('tdSql.checkData(0, 0, 200)')
tdSql.checkData(0, 0, 200)
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: print =============== step6
tdLog.info('=============== step6')
#TSIM: sql select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -x step6
tdLog.info("select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s -x step6" % mt)
tdSql.error("select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s" % mt)
#TSIM: return -1
#TSIM: step6:
#TSIM:
#TSIM: print =============== step7
tdLog.info('=============== step7')
#TSIM: sql select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from $mt -x step7
tdLog.info("select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from %s -x step7" % mt)
tdSql.error("select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from %s" % mt)
#TSIM: return -1
#TSIM: step7:
#TSIM:
#TSIM: print =============== step8
tdLog.info('=============== step8')
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tbcol
tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s by tbcol" % mt)
tdSql.query("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tbcol" % mt)
#TSIM:
#TSIM: print =============== step9
tdLog.info('=============== step9')
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by noexist -x step9
tdLog.info("select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by noexist -x step9" % mt)
tdSql.error('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by noexist ' % mt)
#TSIM: return -1
#TSIM: step9:
#TSIM:
#TSIM: print =============== step10
tdLog.info('=============== step10')
#TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol
tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % mt)
tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol' % mt)
#TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
#TSIM: if $data00 != 100 then
tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100)
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: print =============== step11
tdLog.info('=============== step11')
#TSIM: sql select count(tbcol) as c from $mt group by tbcol
tdLog.info('select count(tbcol) as c from %s group by tbcol' % mt)
tdSql.query('select count(tbcol) as c from %s group by tbcol' % mt)
#TSIM:
#TSIM: print =============== step12
tdLog.info('=============== step12')
#TSIM: sql select count(tbcol) as c from $mt group by noexist -x step12
tdLog.info('select count(tbcol) as c from %s group by noexist -x step12' % mt)
tdSql.error('select count(tbcol) as c from %s group by noexist2' % mt)
#TSIM: return -1
#TSIM: step12:
#TSIM:
#TSIM: print =============== step13
tdLog.info('=============== step13')
#TSIM: sql select count(tbcol) as c from $mt group by tgcol
tdLog.info('select count(tbcol) as c from %s group by tgcol' % mt)
tdSql.query('select count(tbcol) as c from %s group by tgcol' % mt)
#TSIM: print $data00
tdLog.info('$data00')
#TSIM: if $data00 != 100 then
tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100)
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: print =============== step14
tdLog.info('=============== step14')
#TSIM: sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol
tdLog.info('select count(tbcol) as c from %s where ts > 1000 group by tgcol' % mt)
tdSql.query('select count(tbcol) as c from %s where ts > 1000 group by tgcol' % mt)
#TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
# tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0, 0), tdSql.getData(0, 1), tdSql.getData(0, 2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0, 5), tdSql.getData(0, 6)))
#TSIM: if $data00 != 100 then
tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100)
#TSIM: print expect 100, actual $data00
tdLog.info('expect 100, actual $data00')
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: print =============== step15
tdLog.info('=============== step15')
#TSIM: sql select count(tbcol) as c from $mt where noexist < 1 group by tgcol -x step15
tdLog.info('select count(tbcol) as c from %s where noexist < 1 group by tgcol -x step15' % mt)
tdSql.error('select count(tbcol) as c from %s where noexist < 1 group by tgcol5' % mt)
#TSIM: return -1
#TSIM: step15:
#TSIM:
#TSIM: print =============== step16
tdLog.info('=============== step16')
#TSIM: sql select count(tbcol) as c from $mt where tgcol = '1' group by tgcol
tdLog.info("select count(tbcol) as c from %s where tgcol = '1' group by tgcol" % mt)
tdSql.query("select count(tbcol) as c from %s where tgcol = '1' group by tgcol" % mt)
#TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
# tdLog.info("%s %s %s %s %s %s %s" % (tdSql.getData(0, 0), tdSql.getData(0, 1), tdSql.getData(0, 2), tdSql.getData(0, 3), tdSql.getData(0, 4), tdSql.getData(0, 5), tdSql.getData(0, 6)))
#TSIM: if $data00 != 100 then
tdLog.info('tdSql.checkData(0, 0, 100)')
tdSql.checkData(0, 0, 100)
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: print =============== clear
tdLog.info('=============== clear')
#TSIM: sql drop database $db
tdLog.info('drop database db')
tdSql.execute('drop database db')
#TSIM: sql show databases
tdLog.info('show databases')
tdSql.query('show databases')
#TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
#TSIM: return -1
#TSIM: endi
#TSIM:
#TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -49,10 +49,10 @@ class TDSql:
callerModule = inspect.getmodule(frame[0])
callerFilename = callerModule.__file__
tdLog.exit(
"%s failed: sql:%.40s, expect error not occured" %
"%s failed: sql:%s, expect error not occured" %
(callerFilename, sql))
else:
tdLog.info("sql:%.40s, expect error occured" % (sql))
tdLog.info("sql:%s, expect error occured" % (sql))
def query(self, sql):
self.sql = sql
......@@ -72,9 +72,9 @@ class TDSql:
callerModule = inspect.getmodule(frame[0])
callerFilename = callerModule.__file__
tdLog.exit(
"%s failed: sql:%.40s, queryRows:%d != expect:%d" %
"%s failed: sql:%s, queryRows:%d != expect:%d" %
(callerFilename, self.sql, self.queryRows, expectRows))
tdLog.info("sql:%.40s, queryRows:%d == expect:%d" %
tdLog.info("sql:%s, queryRows:%d == expect:%d" %
(self.sql, self.queryRows, expectRows))
def checkData(self, row, col, data):
......@@ -84,35 +84,35 @@ class TDSql:
if row < 0:
tdLog.exit(
"%s failed: sql:%.40s, row:%d is smaller than zero" %
"%s failed: sql:%s, row:%d is smaller than zero" %
(callerFilename, self.sql, row))
if col < 0:
tdLog.exit(
"%s failed: sql:%.40s, col:%d is smaller than zero" %
"%s failed: sql:%s, col:%d is smaller than zero" %
(callerFilename, self.sql, col))
if row >= self.queryRows:
if row > self.queryRows:
tdLog.exit(
"%s failed: sql:%.40s, row:%d is larger than queryRows:%d" %
"%s failed: sql:%s, row:%d is larger than queryRows:%d" %
(callerFilename, self.sql, row, self.queryRows))
if col >= self.queryCols:
if col > self.queryCols:
tdLog.exit(
"%s failed: sql:%.40s, col:%d is larger than queryRows:%d" %
"%s failed: sql:%s, col:%d is larger than queryCols:%d" %
(callerFilename, self.sql, col, self.queryCols))
if self.queryResult[row][col] != data:
tdLog.exit("%s failed: sql:%.40s row:%d col:%d data:%s != expect:%s" % (
tdLog.exit("%s failed: sql:%s row:%d col:%d data:%s != expect:%s" % (
callerFilename, self.sql, row, col, self.queryResult[row][col], data))
if data is None:
tdLog.info("sql:%.40s, row:%d col:%d data:%s == expect:%s" %
tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" %
(self.sql, row, col, self.queryResult[row][col], data))
elif isinstance(data, str):
tdLog.info("sql:%.40s, row:%d col:%d data:%s == expect:%s" %
tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" %
(self.sql, row, col, self.queryResult[row][col], data))
elif isinstance(data, datetime.date):
tdLog.info("sql:%.40s, row:%d col:%d data:%s == expect:%s" %
tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" %
(self.sql, row, col, self.queryResult[row][col], data))
else:
tdLog.info("sql:%.40s, row:%d col:%d data:%s == expect:%d" %
tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%d" %
(self.sql, row, col, self.queryResult[row][col], data))
def getData(self, row, col):
......@@ -122,19 +122,19 @@ class TDSql:
if row < 0:
tdLog.exit(
"%s failed: sql:%.40s, row:%d is smaller than zero" %
"%s failed: sql:%s, row:%d is smaller than zero" %
(callerFilename, self.sql, row))
if col < 0:
tdLog.exit(
"%s failed: sql:%.40s, col:%d is smaller than zero" %
"%s failed: sql:%s, col:%d is smaller than zero" %
(callerFilename, self.sql, col))
if row >= self.queryRows:
if row > self.queryRows:
tdLog.exit(
"%s failed: sql:%.40s, row:%d is larger than queryRows:%d" %
"%s failed: sql:%s, row:%d is larger than queryRows:%d" %
(callerFilename, self.sql, row, self.queryRows))
if col >= self.queryCols:
if col > self.queryCols:
tdLog.exit(
"%s failed: sql:%.40s, col:%d is larger than queryRows:%d" %
"%s failed: sql:%s, col:%d is larger than queryCols:%d" %
(callerFilename, self.sql, col, self.queryCols))
return self.queryResult[row][col]
......@@ -157,9 +157,9 @@ class TDSql:
callerModule = inspect.getmodule(frame[0])
callerFilename = callerModule.__file__
tdLog.exit("%s failed: sql:%.40s, affectedRows:%d != expect:%d" % (
tdLog.exit("%s failed: sql:%s, affectedRows:%d != expect:%d" % (
callerFilename, self.sql, self.affectedRows, expectAffectedRows))
tdLog.info("sql:%.40s, affectedRows:%d == expect:%d" %
tdLog.info("sql:%s, affectedRows:%d == expect:%d" %
(self.sql, self.affectedRows, expectAffectedRows))
......
#!/bin/bash
# insert
python3 ./test.py -g -f insert/basic.py
python3 ./test.py -g -s && sleep 1
python3 ./test.py -g -f insert/int.py
......@@ -24,6 +25,7 @@ python3 ./test.py -g -s && sleep 1
python3 ./test.py -g -f insert/multi.py
python3 ./test.py -g -s && sleep 1
# table
python3 ./test.py -g -f table/column_name.py
python3 ./test.py -g -s && sleep 1
python3 ./test.py -g -f table/column_num.py
......@@ -31,5 +33,10 @@ python3 ./test.py -g -s && sleep 1
python3 ./test.py -g -f table/db_table.py
python3 ./test.py -g -s && sleep 1
# import
python3 ./test.py -g -f import_merge/importDataLastSub.py
python3 ./test.py -g -s && sleep 1
#tag
python3 ./test.py $1 -f tag_lite/filter.py
python3 ./test.py $1 -s && sleep 1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册