提交 60792713 编写于 作者: S shenglian zhou

Merge remote-tracking branch 'origin/develop' into szhou/fix/td-12608

......@@ -567,7 +567,7 @@ void bnCheckStatus() {
while (1) {
pIter = mnodeGetNextDnode(pIter, &pDnode);
if (pDnode == NULL) break;
if (tsAccessSquence - pDnode->lastAccess > 3) {
if (tsAccessSquence - pDnode->lastAccess > tsOfflineInterval) {
if (pDnode->status != TAOS_DN_STATUS_DROPPING && pDnode->status != TAOS_DN_STATUS_OFFLINE) {
pDnode->status = TAOS_DN_STATUS_OFFLINE;
pDnode->offlineReason = TAOS_DN_OFF_STATUS_MSG_TIMEOUT;
......
......@@ -7265,6 +7265,7 @@ int32_t validateDNodeConfig(SMiscInfo* pOptions) {
const int tokenMonitor = 3;
const int tokenDebugFlag = 4;
const int tokenDebugFlagEnd = 20;
const int tokenOfflineInterval = 21;
const SDNodeDynConfOption cfgOptions[] = {
{"resetLog", 8}, {"resetQueryCache", 15}, {"balance", 7}, {"monitor", 7},
{"debugFlag", 9}, {"monDebugFlag", 12}, {"vDebugFlag", 10}, {"mDebugFlag", 10},
......@@ -7272,6 +7273,7 @@ int32_t validateDNodeConfig(SMiscInfo* pOptions) {
{"uDebugFlag", 10}, {"tsdbDebugFlag", 13}, {"sDebugflag", 10}, {"rpcDebugFlag", 12},
{"dDebugFlag", 10}, {"mqttDebugFlag", 13}, {"wDebugFlag", 10}, {"tmrDebugFlag", 12},
{"cqDebugFlag", 11},
{"offlineInterval", 15},
};
SStrToken* pOptionToken = taosArrayGet(pOptions->a, 1);
......@@ -7303,6 +7305,14 @@ int32_t validateDNodeConfig(SMiscInfo* pOptions) {
return TSDB_CODE_TSC_INVALID_OPERATION; // options value is invalid
}
return TSDB_CODE_SUCCESS;
} else if ((strncasecmp(cfgOptions[tokenOfflineInterval].name, pOptionToken->z, pOptionToken->n) == 0) &&
(cfgOptions[tokenOfflineInterval].len == pOptionToken->n)) {
SStrToken* pValToken = taosArrayGet(pOptions->a, 2);
int32_t val = strtol(pValToken->z, NULL, 10);
if (val < 1 || val > 600) {
return TSDB_CODE_TSC_INVALID_OPERATION; // options value is invalid
}
return TSDB_CODE_SUCCESS;
} else {
SStrToken* pValToken = taosArrayGet(pOptions->a, 2);
......
......@@ -119,6 +119,7 @@ extern int32_t tsdbWalFlushSize;
extern int8_t tsEnableBalance;
extern int8_t tsAlternativeRole;
extern int32_t tsBalanceInterval;
extern int32_t tsOfflineInterval;
extern int32_t tsOfflineThreshold;
extern int32_t tsMnodeEqualVnodeNum;
extern int8_t tsEnableFlowCtrl;
......
......@@ -164,6 +164,7 @@ int32_t tsdbWalFlushSize = TSDB_DEFAULT_WAL_FLUSH_SIZE; // MB
int8_t tsEnableBalance = 1;
int8_t tsAlternativeRole = 0;
int32_t tsBalanceInterval = 300; // seconds
int32_t tsOfflineInterval = 3; // seconds
int32_t tsOfflineThreshold = 86400 * 10; // seconds of 10 days
int32_t tsMnodeEqualVnodeNum = 4;
int8_t tsEnableFlowCtrl = 1;
......@@ -653,6 +654,16 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "offlineInterval";
cfg.ptr = &tsOfflineInterval;
cfg.valType = TAOS_CFG_VTYPE_INT32;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 1;
cfg.maxValue = 600;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
// 0-any; 1-mnode; 2-vnode
cfg.option = "role";
cfg.ptr = &tsAlternativeRole;
......
Subproject commit 27751ba9ca17407425fb50a52cd68295794dedc3
Subproject commit ed92906f2d09d0bfa75598f4a019de06710cffb0
......@@ -20,7 +20,7 @@
extern "C" {
#endif
#define TSDB_CFG_MAX_NUM 130
#define TSDB_CFG_MAX_NUM 131
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-12526] taosdump supports big int
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 BIGINT) tags(bntag BIGINT)")
tdSql.execute("create table t1 using st tags(1)")
tdSql.execute("insert into t1 values(1640000000000, 1)")
tdSql.execute("create table t2 using st tags(9223372036854775807)")
tdSql.execute(
"insert into t2 values(1640000000000, 9223372036854775807)")
tdSql.execute("create table t3 using st tags(-9223372036854775807)")
tdSql.execute(
"insert into t3 values(1640000000000, -9223372036854775807)")
tdSql.execute("create table t4 using st tags(NULL)")
tdSql.execute("insert into t4 values(1640000000000, NULL)")
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(4)
tdSql.query("select * from st where bntag = 1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, 1)
tdSql.query("select * from st where bntag = 9223372036854775807")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 9223372036854775807)
tdSql.checkData(0, 2, 9223372036854775807)
tdSql.query("select * from st where bntag = -9223372036854775807")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, -9223372036854775807)
tdSql.checkData(0, 2, -9223372036854775807)
tdSql.query("select * from st where bntag is null")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.checkData(0, 1, None)
tdSql.checkData(0, 2, None)
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 os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-12526] taosdump supports bool
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 BOOL) tags(btag BOOL)")
tdSql.execute("create table t1 using st tags(true)")
tdSql.execute("insert into t1 values(1640000000000, true)")
tdSql.execute("create table t2 using st tags(false)")
tdSql.execute("insert into t2 values(1640000000000, false)")
tdSql.execute("create table t3 using st tags(NULL)")
tdSql.execute("insert into t3 values(1640000000000, NULL)")
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system("%staosdump --databases db -o %s" % (binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 't3')
tdSql.checkData(1, 0, 't2')
tdSql.checkData(2, 0, 't1')
tdSql.query("select btag from st")
tdSql.checkRows(3)
tdSql.checkData(0, 0, "False")
tdSql.checkData(1, 0, "True")
tdSql.checkData(2, 0, None)
tdSql.query("select * from st where btag = 'true'")
tdSql.checkRows(1)
tdSql.checkData(0, 1, "True")
tdSql.checkData(0, 2, "True")
tdSql.query("select * from st where btag = 'false'")
tdSql.checkRows(1)
tdSql.checkData(0, 1, "False")
tdSql.checkData(0, 2, "False")
tdSql.query("select * from st where btag is null")
tdSql.checkRows(1)
tdSql.checkData(0, 1, None)
tdSql.checkData(0, 2, None)
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 os
import math
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-12526] taosdump supports double
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 DOUBLE) tags(dbtag DOUBLE)")
tdSql.execute("create table t1 using st tags(1.0)")
tdSql.execute("insert into t1 values(1640000000000, 1.0)")
tdSql.execute("create table t2 using st tags(1.7E308)")
tdSql.execute("insert into t2 values(1640000000000, 1.7E308)")
tdSql.execute("create table t3 using st tags(-1.7E308)")
tdSql.execute("insert into t3 values(1640000000000, -1.7E308)")
tdSql.execute("create table t4 using st tags(NULL)")
tdSql.execute("insert into t4 values(1640000000000, NULL)")
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(4)
tdSql.query("select * from st where dbtag = 1.0")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
if not math.isclose(tdSql.getData(0, 1), 1.0):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 1), 1.0))
tdLog.exit("data is different")
if not math.isclose(tdSql.getData(0, 2), 1.0):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 2), 1.0))
tdLog.exit("data is different")
tdSql.query("select * from st where dbtag = 1.7E308")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
if not math.isclose(tdSql.getData(0, 1), 1.7E308):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 1), 1.7E308))
tdLog.exit("data is different")
if not math.isclose(tdSql.getData(0, 2), 1.7E308):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 2), 1.7E308))
tdLog.exit("data is different")
tdSql.query("select * from st where dbtag = -1.7E308")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
if not math.isclose(tdSql.getData(0, 1), -1.7E308):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 1), -1.7E308))
tdLog.exit("data is different")
if not math.isclose(tdSql.getData(0, 2), -1.7E308):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 2), -1.7E308))
tdLog.exit("data is different")
tdSql.query("select * from st where dbtag is null")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.checkData(0, 1, None)
tdSql.checkData(0, 2, None)
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 os
import math
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-12526] taosdump supports float
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 FLOAT) tags(ftag FLOAT)")
tdSql.execute("create table t1 using st tags(1.0)")
tdSql.execute("insert into t1 values(1640000000000, 1.0)")
tdSql.execute("create table t2 using st tags(3.40E+38)")
tdSql.execute("insert into t2 values(1640000000000, 3.40E+38)")
tdSql.execute("create table t3 using st tags(-3.40E+38)")
tdSql.execute("insert into t3 values(1640000000000, -3.40E+38)")
tdSql.execute("create table t4 using st tags(NULL)")
tdSql.execute("insert into t4 values(1640000000000, NULL)")
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(4)
tdSql.query("select * from st where ftag = 1.0")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
if not math.isclose(tdSql.getData(0, 1), 1.0):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 1), 1.0))
tdLog.exit("data is different")
if not math.isclose(tdSql.getData(0, 2), 1.0):
tdLog.exit("data is different")
tdSql.query("select * from st where ftag = 3.4E38")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
if not math.isclose(tdSql.getData(0, 1), 3.4E38,
rel_tol=1e-07, abs_tol=0.0):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 1), 3.4E38))
tdLog.exit("data is different")
if not math.isclose(tdSql.getData(0, 2), 3.4E38,
rel_tol=1e-07, abs_tol=0.0):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 2), 3.4E38))
tdLog.exit("data is different")
tdSql.query("select * from st where ftag = -3.4E38")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
if not math.isclose(tdSql.getData(0, 1), (-3.4E38),
rel_tol=1e-07, abs_tol=0.0):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 1), -3.4E38))
tdLog.exit("data is different")
if not math.isclose(tdSql.getData(0, 2), (-3.4E38),
rel_tol=1e-07, abs_tol=0.0):
tdLog.debug("getData(0, 1): %f, to compare %f" %
(tdSql.getData(0, 2), -3.4E38))
tdLog.exit("data is different")
tdSql.query("select * from st where ftag is null")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.checkData(0, 1, None)
tdSql.checkData(0, 2, None)
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 os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-12526] taosdump supports int
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 INT) tags(ntag INT)")
tdSql.execute("create table t1 using st tags(1)")
tdSql.execute("insert into t1 values(1640000000000, 1)")
tdSql.execute("create table t2 using st tags(2147483647)")
tdSql.execute("insert into t2 values(1640000000000, 2147483647)")
tdSql.execute("create table t3 using st tags(-2147483647)")
tdSql.execute("insert into t3 values(1640000000000, -2147483647)")
tdSql.execute("create table t4 using st tags(NULL)")
tdSql.execute("insert into t4 values(1640000000000, NULL)")
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(4)
tdSql.query("select * from st where ntag = 1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, 1)
tdSql.query("select * from st where ntag = 2147483647")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 2147483647)
tdSql.checkData(0, 2, 2147483647)
tdSql.query("select * from st where ntag = -2147483647")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, -2147483647)
tdSql.checkData(0, 2, -2147483647)
tdSql.query("select * from st where ntag is null")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.checkData(0, 1, None)
tdSql.checkData(0, 2, None)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -57,7 +57,8 @@ class TDTestCase:
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 int) tags(jtag JSON)")
tdSql.execute("create table t1 using st tags('{\"location\": \"beijing\"}')")
tdSql.execute(
"create table t1 using st tags('{\"location\": \"beijing\"}')")
tdSql.execute("insert into t1 values(1500000000000, 1)")
buildPath = self.getBuildPath()
......@@ -101,7 +102,6 @@ class TDTestCase:
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, '{\"location\":\"beijing\"}')
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-12526] taosdump supports small int
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 SMALLINT) tags(sntag SMALLINT)")
tdSql.execute("create table t1 using st tags(1)")
tdSql.execute("insert into t1 values(1640000000000, 1)")
tdSql.execute("create table t2 using st tags(32767)")
tdSql.execute("insert into t2 values(1640000000000, 32767)")
tdSql.execute("create table t3 using st tags(-32767)")
tdSql.execute("insert into t3 values(1640000000000, -32767)")
tdSql.execute("create table t4 using st tags(NULL)")
tdSql.execute("insert into t4 values(1640000000000, NULL)")
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(4)
tdSql.query("select * from st where sntag = 1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, 1)
tdSql.query("select * from st where sntag = 32767")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 32767)
tdSql.checkData(0, 2, 32767)
tdSql.query("select * from st where sntag = -32767")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, -32767)
tdSql.checkData(0, 2, -32767)
tdSql.query("select * from st where sntag is null")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.checkData(0, 1, None)
tdSql.checkData(0, 2, None)
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 os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-12526] taosdump supports tiny int
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 TINYINT) tags(tntag TINYINT)")
tdSql.execute("create table t1 using st tags(1)")
tdSql.execute("insert into t1 values(1640000000000, 1)")
tdSql.execute("create table t2 using st tags(127)")
tdSql.execute("insert into t2 values(1640000000000, 127)")
tdSql.execute("create table t3 using st tags(-127)")
tdSql.execute("insert into t3 values(1640000000000, -127)")
tdSql.execute("create table t4 using st tags(NULL)")
tdSql.execute("insert into t4 values(1640000000000, NULL)")
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(4)
tdSql.query("select * from st where tntag = 1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, 1)
tdSql.query("select * from st where tntag = 127")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, 127)
tdSql.checkData(0, 2, 127)
tdSql.query("select * from st where tntag = -127")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1640000000000)
tdSql.checkData(0, 1, -127)
tdSql.checkData(0, 2, -127)
tdSql.query("select * from st where tntag is null")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.checkData(0, 1, None)
tdSql.checkData(0, 2, None)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -16,14 +16,14 @@ python3 test.py -f tools/taosdemoTestWithJson.py
python3 test.py -f tools/taosdemoTestLimitOffset.py
python3 test.py -f tools/taosdemoTestTblAlt.py
python3 test.py -f tools/taosdemoTestSampleData.py
python3 test.py -f tools/taosdemoTestInterlace.py
#python3 test.py -f tools/taosdemoTestInterlace.py
# python3 test.py -f tools/taosdemoTestQuery.py
python3 ./test.py -f tools/taosdemoTestdatatype.py
#======================p2-end===============
#======================p3-start===============
# nano support
python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
#python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoQuery.py
python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanosubscribe.py
python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_step.py
......@@ -32,14 +32,14 @@ python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
#======================p3-end===============
#======================p4-start===============
python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py
#python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
#python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py
python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
#python3 test.py -f tools/taosdemoAllTest/TD-10539/create_taosdemo.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
#python3 test.py -f tools/taosdemoAllTest/TD-10539/creatfe_taosdemo.py
#python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py
......
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 4,
"thread_count_create_tbl": 4,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 100,
"num_of_records_per_req": 1000,
"max_sql_len": 1024000,
"chinese": "yes",
"databases": [{
"dbinfo": {
"name": "db",
"drop": "no",
"replica": 1,
"days": 10,
"cache": 50,
"blocks": 8,
"precision": "ms",
"keep": 36500,
"minRows": 100,
"maxRows": 4096,
"comp":2,
"walLevel":1,
"cachelast":0,
"quorum":1,
"fsync":3000,
"update": 0
},
"super_tables": [{
"name": "stb3",
"child_table_exists":"no",
"childtable_count": 40,
"childtable_prefix": "stb03_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"insert_rows": 100,
"childtable_limit": -1,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb4",
"child_table_exists":"no",
"childtable_count": 50,
"childtable_prefix": "stb04_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet",
"insert_rows": 100,
"childtable_limit": -1,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT", "count":2}]
},
{
"name": "stb5",
"child_table_exists":"no",
"childtable_count": 60,
"childtable_prefix": "stb05_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json",
"insert_rows": 100,
"childtable_limit": -1,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
}]
}]
}
......@@ -63,7 +63,7 @@
"name": "stb1",
"child_table_exists":"no",
"childtable_count": 20,
"childtable_prefix": "stb00_",
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
......@@ -89,7 +89,7 @@
"name": "stb2",
"child_table_exists":"no",
"childtable_count": 30,
"childtable_prefix": "stb00_",
"childtable_prefix": "stb02_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
......@@ -110,86 +110,6 @@
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb3",
"child_table_exists":"no",
"childtable_count": 40,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"insert_rows": 100,
"childtable_limit": -1,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb4",
"child_table_exists":"no",
"childtable_count": 50,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet",
"insert_rows": 100,
"childtable_limit": -1,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT", "count":2}]
},
{
"name": "stb5",
"child_table_exists":"no",
"childtable_count": 60,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json",
"insert_rows": 100,
"childtable_limit": -1,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
}]
}]
}
......@@ -52,324 +52,326 @@ class TDTestCase:
os.system("rm -rf ./insert*_res.txt*")
os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename )
# # insert: create one or mutiple tables per sql and insert multiple rows per sql
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 11)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 100)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 1100)
# tdSql.query("select count(*) from stb01_1")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 2000)
# # # restful connector insert data
# # os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath)
# # tdSql.execute("use db")
# # tdSql.query("select count (tbname) from stb0")
# # tdSql.checkData(0, 0, 10)
# # tdSql.query("select count (tbname) from stb1")
# # tdSql.checkData(0, 0, 10)
# # tdSql.query("select count(*) from stb00_0")
# # tdSql.checkData(0, 0, 10)
# # tdSql.query("select count(*) from stb0")
# # tdSql.checkData(0, 0, 100)
# # tdSql.query("select count(*) from stb01_1")
# # tdSql.checkData(0, 0, 20)
# # tdSql.query("select count(*) from stb1")
# # tdSql.checkData(0, 0, 200)
# # default values json files
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-default.json -y " % binPath)
# tdSql.query("show databases;")
# for i in range(tdSql.queryRows):
# if tdSql.queryResult[i][0] == 'db':
# tdSql.checkData(i, 2, 100)
# tdSql.checkData(i, 4, 1)
# tdSql.checkData(i, 6, 10)
# tdSql.checkData(i, 16, 'ms')
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 11)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1100)
tdSql.query("select count(*) from stb01_1")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 2000)
# restful connector insert data
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb01_1")
tdSql.checkData(0, 0, 20)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 200)
# default values json files
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-default.json -y " % binPath)
tdSql.query("show databases;")
for i in range(tdSql.queryRows):
if tdSql.queryResult[i][0] == 'db':
tdSql.checkData(i, 2, 100)
tdSql.checkData(i, 4, 1)
tdSql.checkData(i, 6, 10)
tdSql.checkData(i, 16, 'ms')
# # insert: create mutiple tables per sql and insert one rows per sql .
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 20)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 100)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 1000)
# tdSql.query("select count(*) from stb01_0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 4000)
# # insert: using parament "insert_interval to controls spped of insert.
# # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables")
# tdSql.checkData(0, 4, 10)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 2000)
# tdSql.query("show stables")
# tdSql.checkData(1, 4, 20)
# tdSql.query("select count(*) from stb01_0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 4000)
# # spend 2min30s for 3 testcases.
# # insert: drop and child_table_exists combination test
# # insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-nodbnodrop.json -y" % binPath)
# tdSql.error("show dbno.stables")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newdb.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 5)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 6)
# tdSql.query("select count (tbname) from stb2")
# tdSql.checkData(0, 0, 7)
# tdSql.query("select count (tbname) from stb3")
# tdSql.checkData(0, 0, 8)
# tdSql.query("select count (tbname) from stb4")
# tdSql.checkData(0, 0, 8)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-offset.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 50)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 240)
# tdSql.query("select count(*) from stb2")
# tdSql.checkData(0, 0, 220)
# tdSql.query("select count(*) from stb3")
# tdSql.checkData(0, 0, 180)
# tdSql.query("select count(*) from stb4")
# tdSql.checkData(0, 0, 160)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newtable.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 150)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 360)
# tdSql.query("select count(*) from stb2")
# tdSql.checkData(0, 0, 360)
# tdSql.query("select count(*) from stb3")
# tdSql.checkData(0, 0, 340)
# tdSql.query("select count(*) from stb4")
# tdSql.checkData(0, 0, 400)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-renewdb.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 50)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 120)
# tdSql.query("select count(*) from stb2")
# tdSql.checkData(0, 0, 140)
# tdSql.query("select count(*) from stb3")
# tdSql.checkData(0, 0, 160)
# tdSql.query("select count(*) from stb4")
# tdSql.checkData(0, 0, 160)
# # insert: let parament in json file is illegal, it'll expect error.
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertSigcolumnsNum4096.json -y " % binPath)
# tdSql.error("select * from db.stb0")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkData(0, 0, 10000)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkRows(0)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables like 'stb0%' ")
# tdSql.checkData(0, 2, 11)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath)
# tdSql.error("use db1")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkRows(1)
# tdSql.query("select count(*) from db.stb1")
# tdSql.checkRows(1)
# tdSql.error("select * from db.stb4")
# tdSql.error("select * from db.stb2")
# tdSql.query("select count(*) from db.stb3")
# tdSql.checkRows(1)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y " % binPath)
# tdSql.error("select * from db.stb4")
# tdSql.error("select * from db.stb2")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath)
# tdSql.error("select count(*) from db.stb0")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists blf")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath)
# tdSql.execute("use blf")
# tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
# tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
# tdSql.query("select first(ts) from blf.p_0_topics_2")
# tdSql.checkData(0, 0, "2019-10-01 00:00:00")
# tdSql.query("select last(ts) from blf.p_0_topics_6 ")
# tdSql.checkData(0, 0, "2020-09-29 23:59:00")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 5000000)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 5000000)
# # insert: timestamp and step
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-timestep.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 20)
# tdSql.query("select last(ts) from db.stb00_0")
# tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select last(ts) from db.stb01_0")
# tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 400)
# # # insert: disorder_ratio
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 1)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 1)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 10)
# # insert: sample json
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample-ts.json -y " % binPath)
# tdSql.execute("use dbtest123")
# tdSql.query("select c2 from stb0")
# tdSql.checkData(0, 0, 2147483647)
# tdSql.query("select c0 from stb0_0 order by ts")
# tdSql.checkData(3, 0, 4)
# tdSql.query("select count(*) from stb0 order by ts")
# tdSql.checkData(0, 0, 40)
# tdSql.query("select * from stb0_1 order by ts")
# tdSql.checkData(0, 0, '2021-10-28 15:34:44.735')
# tdSql.checkData(3, 0, '2021-10-31 15:34:44.735')
# tdSql.query("select * from stb1 where t1=-127")
# tdSql.checkRows(20)
# tdSql.query("select * from stb1 where t2=127")
# tdSql.checkRows(10)
# tdSql.query("select * from stb1 where t2=126")
# tdSql.checkRows(10)
# # insert: sample json
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample.json -y " % binPath)
# tdSql.execute("use dbtest123")
# tdSql.query("select c2 from stb0")
# tdSql.checkData(0, 0, 2147483647)
# tdSql.query("select * from stb1 where t1=-127")
# tdSql.checkRows(20)
# tdSql.query("select * from stb1 where t2=127")
# tdSql.checkRows(10)
# tdSql.query("select * from stb1 where t2=126")
# tdSql.checkRows(10)
# # insert: test interlace parament
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 100)
# tdSql.query("select count (*) from stb0")
# tdSql.checkData(0, 0, 15000)
# # # insert: auto_create
# tdSql.execute('drop database if exists db')
# tdSql.execute('create database db')
# tdSql.execute('use db')
# os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json " % binPath) # drop = no, child_table_exists, auto_create_table varies
# tdSql.execute('use db')
# tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123
# tdSql.checkRows(20)
# tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no
# tdSql.checkRows(20)
# tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes
# tdSql.checkRows(20)
# tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no
# tdSql.checkRows(0)
# tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123
# tdSql.checkRows(0)
# tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes
# tdSql.checkRows(0)
# tdSql.execute('drop database if exists db')
# os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies
# tdSql.execute('use db')
# tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes
# tdSql.checkRows(20)
# # insert: test chinese encoding
# # TD-11399、TD-10819
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables")
# for i in range(6):
# for j in range(6):
# if tdSql.queryResult[i][0] == 'stb%d'%j:
# # print(i,"stb%d"%j)
# tdSql.checkData(i, 4, (j+1)*10)
# for i in range(13):
# tdSql.query("select count(*) from stb%d"%i)
# tdSql.checkData(0, 0, (i+1)*100)
# insert: create mutiple tables per sql and insert one rows per sql .
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1000)
tdSql.query("select count(*) from stb01_0")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
# insert: using parament "insert_interval to controls spped of insert.
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkData(0, 4, 10)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 2000)
tdSql.query("show stables")
tdSql.checkData(1, 4, 20)
tdSql.query("select count(*) from stb01_0")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-nodbnodrop.json -y" % binPath)
tdSql.error("show dbno.stables")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newdb.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 5)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 6)
tdSql.query("select count (tbname) from stb2")
tdSql.checkData(0, 0, 7)
tdSql.query("select count (tbname) from stb3")
tdSql.checkData(0, 0, 8)
tdSql.query("select count (tbname) from stb4")
tdSql.checkData(0, 0, 8)
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-offset.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 240)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 220)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 180)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newtable.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 150)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 360)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 360)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 340)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 400)
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-renewdb.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 120)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 140)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)
# insert: let parament in json file is illegal, it'll expect error.
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertSigcolumnsNum4096.json -y " % binPath)
tdSql.error("select * from db.stb0")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y " % binPath)
tdSql.query("select count(*) from db.stb0")
tdSql.checkData(0, 0, 10000)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath)
tdSql.query("select count(*) from db.stb0")
tdSql.checkRows(0)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("show stables like 'stb0%' ")
tdSql.checkData(0, 2, 11)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath)
tdSql.error("use db1")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y " % binPath)
tdSql.query("select count(*) from db.stb0")
tdSql.checkRows(1)
tdSql.query("select count(*) from db.stb1")
tdSql.checkRows(1)
tdSql.error("select * from db.stb4")
tdSql.error("select * from db.stb2")
tdSql.query("select count(*) from db.stb3")
tdSql.checkRows(1)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y " % binPath)
tdSql.error("select * from db.stb4")
tdSql.error("select * from db.stb2")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath)
tdSql.error("select count(*) from db.stb0")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists blf")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath)
tdSql.execute("use blf")
tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
tdSql.query("select first(ts) from blf.p_0_topics_2")
tdSql.checkData(0, 0, "2019-10-01 00:00:00")
tdSql.query("select last(ts) from blf.p_0_topics_6 ")
tdSql.checkData(0, 0, "2020-09-29 23:59:00")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 5000000)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 5000000)
# insert: timestamp and step
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-timestep.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
tdSql.query("select last(ts) from db.stb00_0")
tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 200)
tdSql.query("select last(ts) from db.stb01_0")
tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 400)
# # insert: disorder_ratio
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 1)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 1)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 10)
# insert: sample json
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample-ts.json -y " % binPath)
tdSql.execute("use dbtest123")
tdSql.query("select c2 from stb0")
tdSql.checkData(0, 0, 2147483647)
tdSql.query("select c0 from stb0_0 order by ts")
tdSql.checkData(3, 0, 4)
tdSql.query("select count(*) from stb0 order by ts")
tdSql.checkData(0, 0, 40)
tdSql.query("select * from stb0_1 order by ts")
tdSql.checkData(0, 0, '2021-10-28 15:34:44.735')
tdSql.checkData(3, 0, '2021-10-31 15:34:44.735')
tdSql.query("select * from stb1 where t1=-127")
tdSql.checkRows(20)
tdSql.query("select * from stb1 where t2=127")
tdSql.checkRows(10)
tdSql.query("select * from stb1 where t2=126")
tdSql.checkRows(10)
# insert: sample json
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample.json -y " % binPath)
tdSql.execute("use dbtest123")
tdSql.query("select c2 from stb0")
tdSql.checkData(0, 0, 2147483647)
tdSql.query("select * from stb1 where t1=-127")
tdSql.checkRows(20)
tdSql.query("select * from stb1 where t2=127")
tdSql.checkRows(10)
tdSql.query("select * from stb1 where t2=126")
tdSql.checkRows(10)
# insert: test interlace parament
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count (*) from stb0")
tdSql.checkData(0, 0, 15000)
# # insert: auto_create
tdSql.execute('drop database if exists db')
tdSql.execute('create database db')
tdSql.execute('use db')
os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json " % binPath) # drop = no, child_table_exists, auto_create_table varies
tdSql.execute('use db')
tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123
tdSql.checkRows(20)
tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no
tdSql.checkRows(20)
tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes
tdSql.checkRows(20)
tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no
tdSql.checkRows(0)
tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123
tdSql.checkRows(0)
tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes
tdSql.checkRows(0)
tdSql.execute('drop database if exists db')
os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies
tdSql.execute('use db')
tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123
tdSql.checkRows(20)
tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no
tdSql.checkRows(20)
tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes
tdSql.checkRows(20)
tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no
tdSql.checkRows(20)
tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123
tdSql.checkRows(20)
tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes
tdSql.checkRows(20)
# insert: test chinese encoding
# TD-11399、TD-10819
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y " % binPath)
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese-sml.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("show stables")
for i in range(6):
for j in range(6):
if tdSql.queryResult[i][0] == 'stb%d'%j:
# print(i,"stb%d"%j)
tdSql.checkData(i, 4, (j+1)*10)
for i in range(6):
tdSql.query("select count(*) from stb%d"%i)
tdSql.checkData(0, 0, (i+1)*1000)
# rm useless files
os.system("rm -rf ./insert*_res.txt*")
......
......@@ -68,8 +68,9 @@ class TDTestCase:
binPath = buildPath + "/build/bin/"
os.system("rm /tmp/*.sql")
os.system("rm /tmp/*.avro*")
os.system(
"%staosdump --databases db -o /tmp -B 16384 -L 1048576" %
"%staosdump --databases db -o /tmp -B 16384" %
binPath)
tdSql.execute("drop database db")
......
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def caseDescription(self):
'''
case1 <authors>: wenzhouwww[TD-11943] :
this test case is an test case for unexpected coredump about taosd ;
root cause : the pExpr2 of sql select tbname, max(col)+5 from child_table has two functions, col_proj and scalar_expr.
for function col_proj (tbname column), it is a tag during master scan stage, the input data is not set.
'''
return
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
tdSql.query("select tbname ,max(value) from st;")
tdSql.checkRows(1)
tdSql.checkData(0,1,19)
tdSql.query("select tbname ,max(value)+5 from st;")
tdSql.checkRows(1)
tdSql.checkData(0,1,24)
tdSql.query("select tbname ,max(value) from sub_1;")
tdSql.checkRows(1)
tdSql.checkData(0,1,11)
tdSql.query("select tbname ,max(value)+5 from sub_1;")
tdSql.checkRows(1)
tdSql.checkData(0,1,16)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def caseDescription(self):
'''
case1 <wenzhouwww>: [TD-11969] :
this test case is an test case for unexpected coredump for taoshell ;
root cause : make TBNAME projection query so that error is raised when update functions for column projection.
'''
return
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
tdSql.error("select max(ts_inter) ,tbname from (select elapsed(ts) ts_inter ,tbname from st interval (1s) group by tbname) order by ts;")
tdSql.error("select max(ts_inter) ,tbname from (select elapsed(ts) ts_inter from st interval (1s) group by tbname) ;")
tdSql.error("select max(ts_inter) ,tbname from (select * from st interval (1s) group by tbname) ;")
tdSql.error("select max(ts_inter) ,tbname from (select elapsed(ts) ts_inter ,tbname from sub_1 interval (1s)) order by ts;")
tdSql.query("select ts , tbname ,max(value) from st group by tbname order by ts;")
tdSql.checkRows(10)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def caseDescription(self):
'''
case1 <authors>: wenzhouwww[TD-11978] :
this test case is an test case for unexpected coredump about taoshell ;
root cause : The function does not determine whether the input is empty
'''
return
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
tdSql.error("select elapsed(,) from sub_1;")
tdSql.error("select elapsed(,,) from sub_1;")
tdSql.error("select elapsed(,,1s) from sub_1;")
tdSql.error("select elapsed(,) from st group by tbname ;")
tdSql.error("select elapsed(,,) from st group by tbname;")
tdSql.error("select elapsed(,,1s) from st group by tbname;")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def caseDescription(self):
'''
case1 <wenzhouwww>:[TD-12014] :
this test case is an test case for taoshell crash , it will coredump when query such as "select 1*now from st "
'''
return
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
tdSql.error('select 1*now+2d-3m from st;')
tdSql.error('select 1*now+2d-3m from sub_1;')
tdSql.error('select 1-now+2d-3m from st;')
tdSql.error('select 1*now+2d-3m from st;')
tdSql.error('select 1/now+2d-3m from st;')
tdSql.error('select 1%now+2d-3m from st;')
tdSql.error('select 1*now+2d-3m from sub_1;')
tdSql.error('select elapsed(ts)+now from st group by tbname order by ts desc ;')
tdSql.error('select elapsed(ts)-now from st group by tbname order by ts desc ;')
tdSql.error('select elapsed(ts)*now from st group by tbname order by ts desc ;')
tdSql.error('select elapsed(ts)/now from st group by tbname order by ts desc ;')
tdSql.error('select elapsed(ts)%now from st group by tbname order by ts desc ;')
tdSql.error('select elapsed(ts)+now from sub_1 order by ts desc ;')
tdSql.error('select twa(value)+now from st order by ts desc ;')
tdSql.error('select max(value)*now from st ;')
tdSql.error('select max(value)*now from sub_1 ;')
tdSql.error('select max(value)*now+2d-3m from st;')
tdSql.query('select max(value) from st where ts < now -2d +3m ;')
tdSql.checkRows(1)
tdSql.query('select ts,value from st where ts < now -2d +3m ;')
tdSql.checkRows(10)
tdSql.query('select max(value) from sub_1 where ts < now -2d +3m ;')
tdSql.checkRows(1)
tdSql.query('select ts ,value from sub_1 where ts < now -2d +3m ;')
tdSql.checkRows(1)
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 random
import string
import os
import sys
import time
import taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
from util.dnodes import tdDnodes
from util.dnodes import *
import itertools
from itertools import product
from itertools import combinations
from faker import Faker
import subprocess
class TDTestCase:
def caseDescription(self):
'''
case1 <wenzhouwww>: [TD-12228] :
this test case is an test case for cache error , it will coredump taoshell .
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
os.system("rm -rf 2-query/TD-12228.py.sql")
def restartDnodes(self):
tdDnodes.stop(1)
tdDnodes.start(1)
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def dropandcreateDB_random(self,n):
self.ts = 1630000000000
self.num_random = 1000
fake = Faker('zh_CN')
for i in range(n):
tdSql.execute('''drop database if exists db ;''')
tdSql.execute('''create database db keep 36500;''')
tdSql.execute('''use db;''')
tdSql.execute('''create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
tdSql.execute('''create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
tdSql.execute('''create table table_1 using stable_1 tags('table_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''')
tdSql.execute('''create table table_2 using stable_1 tags('table_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\')''')
tdSql.execute('''create table table_3 using stable_1 tags('table_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\')''')
tdSql.execute('''create table table_21 using stable_2 tags('table_21' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''')
#regular table
tdSql.execute('''create table regular_table_1 \
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
tdSql.execute('''create table regular_table_2 \
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
tdSql.execute('''create table regular_table_3 \
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
for i in range(self.num_random):
tdSql.execute('''insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1),
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1) ,
fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1) ,
fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
tdSql.execute('''insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
fake.random_int(min=0, max=9223372036854775807, step=1),
fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
fake.random_int(min=0, max=9223372036854775807, step=1),
fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
tdSql.execute('''insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1),
fake.random_int(min=-9223372036854775807, max=0, step=1),
fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1),
fake.random_int(min=-9223372036854775807, max=0, step=1),
fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
tdSql.query("select count(*) from stable_1;")
tdSql.checkData(0,0,3000)
tdSql.query("select count(*) from regular_table_1;")
tdSql.checkData(0,0,1000)
def dropandcreateDB_null(self):
self.num_null = 100
self.ts = 1630000000000
tdSql.execute('''drop database if exists db ;''')
tdSql.execute('''create database db keep 36500;''')
tdSql.execute('''use db;''')
tdSql.execute('''create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(20) , q_nchar nchar(20) , q_ts timestamp ,
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)
tags(loc nchar(20) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(20) , t_nchar nchar(20) ,t_float float , t_double double , t_ts timestamp);''')
tdSql.execute('''create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(20) , q_nchar nchar(20) , q_ts timestamp ,
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp)
tags(loc nchar(20) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(20) , t_nchar nchar(20) ,t_float float , t_double double , t_ts timestamp);''')
tdSql.execute('''create table table_1 using stable_1 tags('table_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''')
tdSql.execute('''create table table_2 using stable_1 tags('table_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\')''')
tdSql.execute('''create table table_3 using stable_1 tags('table_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\')''')
tdSql.execute('''create table table_21 using stable_2 tags('table_21' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''')
tdSql.execute('''create table regular_table_1
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(20) , q_nchar nchar(20) , q_ts timestamp ,
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
tdSql.execute('''create table regular_table_2
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(20) , q_nchar nchar(20) , q_ts timestamp ,
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
tdSql.execute('''create table regular_table_3
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(20) , q_nchar nchar(20) , q_ts timestamp ,
q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
for i in range(self.num_null):
tdSql.execute('''insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*10000, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*3000, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*10000, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*3000 , i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_21 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*10000, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_21 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*3000, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*10000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*3000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*10000, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*3000 , 2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*10000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i, i, i, self.ts + i))
tdSql.execute('''insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*3000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*10000, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
% (self.ts + i*3000 , -2147483647+i, -9223372036854775807+i, -32767+i, -127+i, -i, -i, i, i, self.ts + i))
tdSql.query("select count(*) from stable_1;")
tdSql.checkData(0,0,570)
tdSql.query("select count(*) from regular_table_1;")
tdSql.checkData(0,0,190)
def result_0(self,sql):
tdLog.info(sql)
tdSql.query(sql)
tdSql.checkRows(0)
def dataequal(self, sql1,row1,col1, sql2,row2,col2):
self.sql1 = sql1
list1 =[]
tdSql.query(sql1)
for i1 in range(row1):
for j1 in range(col1):
list1.append(tdSql.getData(i1,j1))
tdSql.execute("reset query cache;")
self.sql2 = sql2
list2 =[]
tdSql.query(sql2)
for i2 in range(row2):
for j2 in range(col2):
list2.append(tdSql.getData(i2,j2))
if (list1 == list2) and len(list2)>0:
tdLog.info(("sql1:'%s' result = sql2:'%s' result") %(sql1,sql2))
else:
tdLog.info(("sql1:'%s' result != sql2:'%s' result") %(sql1,sql2))
return tdSql.checkEqual(list1,list2)
def data2in1(self, sql1,row1,col1, sql2,row2,col2):
self.sql1 = sql1
list1 =[]
tdSql.query(sql1)
for i1 in range(row1):
for j1 in range(col1):
list1.append(tdSql.getData(i1,j1))
tdSql.execute("reset query cache;")
self.sql2 = sql2
list2 =[]
tdSql.query(sql2)
for i2 in range(row2):
for j2 in range(col2):
list2.append(tdSql.getData(i2,j2))
if (set(list2) <= set(list1)) and len(list2)>0:
tdLog.info(("sql1:'%s' result include sql2:'%s' result") %(sql1,sql2))
else:
tdLog.info(("sql1:'%s' result not include sql2:'%s' result") %(sql1,sql2))
return tdSql.checkEqual(list1,list2)
def regular_where(self):
q_int_where = ['q_bigint >= -9223372036854775807 and ' , 'q_bigint <= 9223372036854775807 and ','q_smallint >= -32767 and ', 'q_smallint <= 32767 and ',
'q_tinyint >= -127 and ' , 'q_tinyint <= 127 and ' , 'q_int <= 2147483647 and ' , 'q_int >= -2147483647 and ',
'q_tinyint != 128 and ',
'q_bigint between -9223372036854775807 and 9223372036854775807 and ',' q_int between -2147483647 and 2147483647 and ',
'q_smallint between -32767 and 32767 and ', 'q_tinyint between -127 and 127 and ',
'q_bigint is not null and ' , 'q_int is not null and ' , 'q_smallint is not null and ' , 'q_tinyint is not null and ' ,]
q_fl_do_where = ['q_float >= -3.4E38 and ','q_float <= 3.4E38 and ', 'q_double >= -1.7E308 and ','q_double <= 1.7E308 and ',
'q_float between -3.4E38 and 3.4E38 and ','q_double between -1.7E308 and 1.7E308 and ' ,
'q_float is not null and ' ,'q_double is not null and ' ,]
q_nc_bi_bo_ts_where = [ 'q_bool is not null and ' ,'q_binary is not null and ' ,'q_nchar is not null and ' ,'q_ts is not null and ' ,]
q_where = random.sample(q_int_where,2) + random.sample(q_fl_do_where,1) + random.sample(q_nc_bi_bo_ts_where,1)
return q_where
def regular_where_all(self):
q_int_where_add = ['q_bigint >= 0 and ' , 'q_smallint >= 0 and ', 'q_tinyint >= 0 and ' , 'q_int >= 0 and ',
'q_bigint between 0 and 9223372036854775807 and ',' q_int between 0 and 2147483647 and ',
'q_smallint between 0 and 32767 and ', 'q_tinyint between 0 and 127 and ',
'q_bigint is not null and ' , 'q_int is not null and ' ,]
q_fl_do_where_add = ['q_float >= 0 and ', 'q_double >= 0 and ' , 'q_float between 0 and 3.4E38 and ','q_double between 0 and 1.7E308 and ' ,
'q_float is not null and ' ,]
q_nc_bi_bo_ts_where_add = ['q_nchar is not null and ' ,'q_ts is not null and ' ,]
q_where_add = random.sample(q_int_where_add,2) + random.sample(q_fl_do_where_add,1) + random.sample(q_nc_bi_bo_ts_where_add,1)
q_int_where_sub = ['q_bigint <= 0 and ' , 'q_smallint <= 0 and ', 'q_tinyint <= 0 and ' , 'q_int <= 0 and ',
'q_bigint between -9223372036854775807 and 0 and ',' q_int between -2147483647 and 0 and ',
'q_smallint between -32767 and 0 and ', 'q_tinyint between -127 and 0 and ',
'q_smallint is not null and ' , 'q_tinyint is not null and ' ,]
q_fl_do_where_sub = ['q_float <= 0 and ', 'q_double <= 0 and ' , 'q_float between -3.4E38 and 0 and ','q_double between -1.7E308 and 0 and ' ,
'q_double is not null and ' ,]
q_nc_bi_bo_ts_where_sub = ['q_bool is not null and ' ,'q_binary is not null and ' ,]
q_where_sub = random.sample(q_int_where_sub,2) + random.sample(q_fl_do_where_sub,1) + random.sample(q_nc_bi_bo_ts_where_sub,1)
return(q_where_add,q_where_sub)
def stable_where(self):
q_where = self.regular_where()
t_int_where = ['t_bigint >= -9223372036854775807 and ' , 't_bigint <= 9223372036854775807 and ','t_smallint >= -32767 and ', 't_smallint <= 32767 and ',
't_tinyint >= -127 and ' , 't_tinyint <= 127 and ' , 't_int <= 2147483647 and ' , 't_int >= -2147483647 and ',
't_tinyint != 128 and ',
't_bigint between -9223372036854775807 and 9223372036854775807 and ',' t_int between -2147483647 and 2147483647 and ',
't_smallint between -32767 and 32767 and ', 't_tinyint between -127 and 127 and ',
't_bigint is not null and ' , 't_int is not null and ' , 't_smallint is not null and ' , 't_tinyint is not null and ' ,]
t_fl_do_where = ['t_float >= -3.4E38 and ','t_float <= 3.4E38 and ', 't_double >= -1.7E308 and ','t_double <= 1.7E308 and ',
't_float between -3.4E38 and 3.4E38 and ','t_double between -1.7E308 and 1.7E308 and ' ,
't_float is not null and ' ,'t_double is not null and ' ,]
t_nc_bi_bo_ts_where = [ 't_bool is not null and ' ,'t_binary is not null and ' ,'t_nchar is not null and ' ,'t_ts is not null and ' ,]
t_where = random.sample(t_int_where,2) + random.sample(t_fl_do_where,1) + random.sample(t_nc_bi_bo_ts_where,1)
qt_where = q_where + t_where
return qt_where
def stable_where_all(self):
regular_where_all = self.regular_where_all()
t_int_where_add = ['t_bigint >= 0 and ' , 't_smallint >= 0 and ', 't_tinyint >= 0 and ' , 't_int >= 0 and ',
't_bigint between 1 and 9223372036854775807 and ',' t_int between 1 and 2147483647 and ',
't_smallint between 1 and 32767 and ', 't_tinyint between 1 and 127 and ',
't_bigint is not null and ' , 't_int is not null and ' ,]
t_fl_do_where_add = ['t_float >= 0 and ', 't_double >= 0 and ' , 't_float between 1 and 3.4E38 and ','t_double between 1 and 1.7E308 and ' ,
't_float is not null and ' ,]
t_nc_bi_bo_ts_where_add = ['t_nchar is not null and ' ,'t_ts is not null and ' ,]
qt_where_add = random.sample(t_int_where_add,1) + random.sample(t_fl_do_where_add,1) + random.sample(t_nc_bi_bo_ts_where_add,1) + random.sample(regular_where_all[0],2)
t_int_where_sub = ['t_bigint <= 0 and ' , 't_smallint <= 0 and ', 't_tinyint <= 0 and ' , 't_int <= 0 and ',
't_bigint between -9223372036854775807 and -1 and ',' t_int between -2147483647 and -1 and ',
't_smallint between -32767 and -1 and ', 't_tinyint between -127 and -1 and ',
't_smallint is not null and ' , 't_tinyint is not null and ' ,]
t_fl_do_where_sub = ['t_float <= 0 and ', 't_double <= 0 and ' , 't_float between -3.4E38 and -1 and ','t_double between -1.7E308 and -1 and ' ,
't_double is not null and ' ,]
t_nc_bi_bo_ts_where_sub = ['t_bool is not null and ' ,'t_binary is not null and ' ,]
qt_where_sub = random.sample(t_int_where_sub,1) + random.sample(t_fl_do_where_sub,1) + random.sample(t_nc_bi_bo_ts_where_sub,1) + random.sample(regular_where_all[1],2)
return(qt_where_add,qt_where_sub)
def run(self):
tdSql.prepare()
dcDB = self.dropandcreateDB_random(1)
stable_where_all = self.stable_where_all()
for i in range(2,len(stable_where_all[0])+1):
qt_where_add_new = list(combinations(stable_where_all[0],i))
for qt_where_add_new in qt_where_add_new:
qt_where_add_new = str(qt_where_add_new).replace("(","").replace(")","").replace("'","").replace("\"","").replace(",","").replace("=","")
for j in range(2,len(stable_where_all[1])+1):
qt_where_sub_new = list(combinations(stable_where_all[1],j))
for qt_where_sub_new in qt_where_sub_new:
qt_where_sub_new = str(qt_where_sub_new).replace("(","").replace(")","").replace("'","").replace("\"","").replace(",","").replace("=","")
conn1 = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/etc/taos/")
cur1 = conn1.cursor()
tdSql.init(cur1, True)
cur1.execute('use db ')
sql = 'select elapsed(ts,10s) from table_1 interval(10s) union all select elapsed(ts,10s) from table_2 interval(10s);'
cur1.execute(sql)
taos_path = self.getBuildPath()+"/build/bin"
for i in range(2):
try:
taos_cmd1 = "%s/taos -f 2-query/TD-12228.py.sql" %taos_path
print(taos_cmd1)
_ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
for i in range(10):
cur1.execute('use db ;')
sql = 'select elapsed(ts,10s) from table_1 interval(10s) union all select elapsed(ts,10s) from table_2 interval(10s);'
cur1.execute(sql)
except Exception as e:
raise e
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def caseDescription(self):
'''
case1 <author>:wenzhouwww [TD-12229] :
this test case is an test case for unexpected union all result for stable ;
Root Cause: when one subclause of union returns empty result, continue to check next subclause
'''
return
def prepare_data(self):
tdLog.info (" ====================================== prepare data ==================================================")
tdSql.execute('drop database if exists testdb ;')
tdSql.execute('create database testdb keep 36500;')
tdSql.execute('use testdb;')
tdSql.execute('create stable stable_1(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
q_double double , bin_chars binary(20)) tags(loc nchar(20) ,ind int,tstag timestamp);')
tdSql.execute('create stable stable_2(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
q_double double, bin_chars binary(20) ) tags(loc nchar(20),ind int,tstag timestamp);')
# create empty stables
tdSql.execute('create stable stable_empty(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
q_double double, bin_chars binary(20) ) tags(loc nchar(20),ind int,tstag timestamp);')
tdSql.execute('create stable stable_sub_empty(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
q_double double, bin_chars binary(20) ) tags(loc nchar(20),ind int,tstag timestamp);')
# create empty sub_talbes and regular tables
tdSql.execute('create table sub_empty_1 using stable_sub_empty tags("sub_empty_1",3,"2015-01-01 00:02:00")')
tdSql.execute('create table sub_empty_2 using stable_sub_empty tags("sub_empty_2",3,"2015-01-01 00:02:00")')
tdSql.execute('create table regular_empty (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , bin_chars binary(20)) ;')
tdSql.execute('create table sub_table1_1 using stable_1 tags("sub1_1",1,"2015-01-01 00:00:00")')
tdSql.execute('create table sub_table1_2 using stable_1 tags("sub1_2",2,"2015-01-01 00:01:00")')
tdSql.execute('create table sub_table1_3 using stable_1 tags("sub1_3",3,"2015-01-01 00:02:00")')
tdSql.execute('create table sub_table2_1 using stable_2 tags("sub2_1",1,"2015-01-01 00:00:00")')
tdSql.execute('create table sub_table2_2 using stable_2 tags("sub2_2",2,"2015-01-01 00:01:00")')
tdSql.execute('create table sub_table2_3 using stable_2 tags("sub2_3",3,"2015-01-01 00:02:00")')
tdSql.execute('create table regular_table_1 (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double, bin_chars binary(20)) ;')
tdSql.execute('create table regular_table_2 (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , bin_chars binary(20)) ;')
tdSql.execute('create table regular_table_3 (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , bin_chars binary(20)) ;')
tablenames = ["sub_table1_1","sub_table1_2","sub_table1_3","sub_table2_1","sub_table2_2","sub_table2_3","regular_table_1","regular_table_2","regular_table_3"]
tdLog.info("insert into records ")
for tablename in tablenames:
for i in range(self.num):
sql= 'insert into %s values(%d, %d,%d, %d, %d, %d, %f, %f, "%s")' % (tablename,self.ts + i*10000, self.ts + i*10,2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i,("bintest"+str(i)))
print(sql)
tdSql.execute(sql)
tdLog.info("=============================================data prepared done!=========================")
def basic_union(self):
# empty table
tdSql.query('select q_int from sub_empty_1 union all select q_int from sub_empty_2;')
tdSql.checkRows(0)
tdSql.error('select q_int from sub_empty_1 union all select q_int from stable_empty group by tbname;')
tdSql.error('select q_intfrom group by tbname union all select q_int from sub_empty_1 group by tbname;')
tdSql.query('select q_int from sub_empty_1 union all select q_int from stable_empty ;')
tdSql.checkRows(0)
tdSql.query('select q_int from stable_empty union all select q_int from sub_empty_1 ;')
tdSql.checkRows(0)
tdSql.query('select q_int from stable_1 union all select q_int from stable_empty ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from sub_empty_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from sub_table1_2 union all select q_int from stable_empty ;')
tdSql.checkRows(10)
tdSql.query('select q_int from sub_table1_2 union all select q_int from sub_empty_1 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from stable_empty union all select q_int from sub_table1_2 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from sub_empty_1 union all select q_int from sub_table1_2 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from regular_empty union all select q_int from stable_empty ;')
tdSql.checkRows(0)
tdSql.query('select q_int from regular_empty union all select q_int from sub_empty_1 ;')
tdSql.checkRows(0)
tdSql.query('select q_int from stable_empty union all select q_int from regular_empty ;')
tdSql.checkRows(0)
tdSql.query('select q_int from sub_empty_1 union all select q_int from regular_empty ;')
tdSql.checkRows(0)
tdSql.query('select q_int from regular_empty union all select q_int from regular_table_2 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from regular_empty union all select q_int from sub_empty_1 ;')
tdSql.checkRows(0)
tdSql.query('select q_int from stable_empty union all select q_int from regular_table_2 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from sub_empty_1 union all select q_int from regular_table_2 ;')
tdSql.checkRows(10)
# regular table
tdSql.query('select q_int from regular_table_3 union all select q_int from regular_table_2 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from regular_table_2 union all select q_int from regular_table_3 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from regular_table_3 union all select q_int from sub_empty_1 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from sub_table1_1 union all select q_int from regular_table_2 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from regular_table_2 union all select q_int from sub_table1_1 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from sub_empty_1 union all select q_int from regular_table_2 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from regular_table_2 union all select q_int from sub_empty_1 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from sub_empty_1 union all select q_int from stable_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from sub_empty_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from regular_table_1 union all select q_int from stable_1 ;')
tdSql.checkRows(40)
tdSql.query('select q_int from stable_1 union all select q_int from regular_table_1 ;')
tdSql.checkRows(40)
tdSql.query('select q_int from sub_empty_1 union all select q_int from regular_table_2 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from regular_table_2 union all select q_int from sub_empty_1 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from regular_table_1 union all select q_int from regular_table_2 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from regular_table_2 union all select q_int from regular_table_1 ;')
tdSql.checkRows(20)
# sub_table
tdSql.query('select q_int from sub_empty_1 union all select q_int from sub_table2_2 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from sub_table2_2 union all select q_int from sub_empty_1 ;')
tdSql.checkRows(10)
tdSql.query('select q_int from regular_table_1 union all select q_int from sub_table2_2 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from sub_table2_2 union all select q_int from regular_table_1 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from sub_table2_1 union all select q_int from sub_table2_2 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from sub_table2_2 union all select q_int from sub_table2_1 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from sub_table2_1 union all select q_int from sub_table2_2 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from sub_table2_2 union all select q_int from sub_table2_1 ;')
tdSql.checkRows(20)
tdSql.query('select q_int from sub_table2_2 union all select q_int from sub_table2_2 ;')
tdSql.checkRows(20)
# stable
tdSql.query('select q_int from stable_1 union all select q_int from sub_table2_2 ;')
tdSql.checkRows(40)
tdSql.query('select q_int from sub_table2_2 union all select q_int from stable_1 ;')
tdSql.checkRows(40)
tdSql.query('select q_int from stable_2 union all select q_int from stable_1 ;')
tdSql.checkRows(60)
tdSql.query('select q_int from stable_1 union all select q_int from stable_2 ;')
tdSql.checkRows(60)
tdSql.query('select q_int from stable_1 union all select q_int from stable_1 ;')
tdSql.checkRows(60)
tdSql.query('select q_int from stable_empty union all select q_int from stable_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from stable_empty ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_empty union all select q_int from stable_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from stable_empty ;')
tdSql.checkRows(30)
tdSql.query('select q_int from regular_empty union all select q_int from stable_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from regular_empty ;')
tdSql.checkRows(30)
tdSql.query('select q_int from regular_empty union all select q_int from stable_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from regular_empty ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from stable_empty ;')
tdSql.checkRows(30)
tdSql.query('select q_int from sub_empty_2 union all select q_int from stable_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from sub_empty_2 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from sub_empty_2 union all select q_int from stable_1 ;')
tdSql.checkRows(30)
tdSql.query('select q_int from stable_1 union all select q_int from sub_empty_2 ;')
tdSql.checkRows(30)
def query_with_union(self):
tdLog.info (" ====================================== elapsed mixup with union all =================================================")
# union all with empty
tdSql.query("select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from regular_table_2;")
tdSql.query("select elapsed(ts,10s) from regular_table_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) union all \
select elapsed(ts,10s) from regular_table_2 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.checkRows(1200)
tdSql.checkData(0,1,0.1)
tdSql.checkData(500,1,0)
tdSql.query("select elapsed(ts,10s) from sub_empty_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) union all \
select elapsed(ts,10s) from regular_table_2 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
tdSql.checkRows(600)
tdSql.checkData(0,1,0.1)
tdSql.checkData(500,0,0)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from sub_empty_2;')
tdSql.checkRows(0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from sub_empty_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from regular_table_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from sub_table1_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.query('select elapsed(ts,10s) from sub_table1_1 union all select elapsed(ts,10s) from sub_empty_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from regular_table_1;')
tdSql.checkRows(1)
tdSql.checkData(0,0,9)
tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_sub_empty group by tbname;')
tdSql.error('select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from stable_sub_empty group by tbname;')
tdSql.query('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) union all select elapsed(ts,10s) from sub_empty_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev);')
tdSql.checkRows(0)
tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_empty group by tbname;')
tdSql.error('select elapsed(ts,10s) from sub_empty_1 interval(1s) union all select elapsed(ts,10s) from stable_empty interval(1s) group by tbname;')
tdSql.error('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) union all select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) group by tbname;')
tdSql.query("select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_empty group by tbname ;")
tdSql.checkRows(0)
tdSql.query("select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_1 group by tbname ;")
tdSql.checkRows(3)
tdSql.query("select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_1 group by tbname ;")
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.checkData(5,0,9)
tdSql.query("select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_2 group by tbname ;")
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.checkData(5,0,9)
tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;')
tdSql.checkRows(360)
tdSql.checkData(0,1,1)
tdSql.checkData(50,1,0)
tdSql.query('select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_2 group by tbname ;')
tdSql.checkRows(3)
tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_empty group by tbname ;')
tdSql.checkRows(3)
tdSql.query('select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;')
tdSql.checkRows(180)
tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;')
tdSql.checkRows(180)
tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from sub_table2_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(120)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(60)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(60)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
# stable with stable
tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname;')
tdSql.checkRows(360)
tdSql.checkData(0,1,1)
tdSql.checkData(12,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) union all select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev);')
tdSql.checkRows(10)
tdSql.checkData(0,1,1)
tdSql.checkData(9,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) union all select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
tdSql.checkRows(70)
tdSql.checkData(0,1,1)
tdSql.checkData(9,1,0)
tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) order by ts desc union all select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) order by ts asc;')
tdSql.checkRows(70)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(9,1,1)
tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_2 group by tbname, ind order by ts asc ;')
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts asc ;')
tdSql.checkRows(6)
tdSql.checkData(0,0,9)
tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;')
tdSql.checkRows(210)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(9,1,1)
tdSql.query('select elapsed(ts,10s) from stable_2 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;')
tdSql.checkRows(210)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(9,1,1)
tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;')
tdSql.checkRows(210)
tdSql.checkData(0,1,0)
tdSql.checkData(1,1,1)
tdSql.checkData(9,1,1)
def run(self):
tdSql.prepare()
self.prepare_data()
self.basic_union()
self.query_with_union()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def caseDescription(self):
'''
case1 <wenzhouwww>: [TD-12344] :
this test case is an test case for unexpectd crash for session function , it will coredump taoshell ;
'''
return
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
break
return buildPath
def getcfgPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
print(selfPath)
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
cfgPath = projPath + "/sim/dnode1/cfg "
return cfgPath
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
cfg_path = self.getcfgPath()
print(cfg_path)
tdSql.execute('select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;')
datas = tdSql.getResult('select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;')
table_names = ["sub_%s"%str(i) for i in range(10)]
# print(table_names)
for index , table_name in enumerate(table_names):
tdSql.query("select elapsed(ts,10s) from testdb.%s where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) ;"%table_name)
# print(datas)
tdSql.checkData(0,1,datas[index][1])
for i in range(10):
taos_cmd1= "taos -c %s -s 'select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;' " % (cfg_path)
# print(taos_cmd1)
_ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def caseDescription(self):
'''
case1 <authors>: wenzhouwww[TD-12388] :
this test case is an test case for unit time params about elapsed function.
'''
return
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into sub_%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
tdSql.error("select elapsed(ts,now+1d-3m) from st group by tbname;")
tdSql.error("select elapsed(ts,now) from st group by tbname;")
tdSql.error("select elapsed(ts,now*10) from st group by tbname;")
tdSql.error("select elapsed(ts,now*2s) from st group by tbname;")
tdSql.error("select elapsed(ts,now*2s) from sub_1;")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def caseDescription(self):
'''
case1 <wenzhouwww>:[TD-12593] :
this test case is an value error about nest query and inner query sort .
'''
return
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
tdSql.query('select * from (select csum(value) from tb1 order by ts asc );')
tdSql.checkRows(4)
tdSql.checkData(0,1,11.000000000)
tdSql.checkData(1,1,22.000000000)
tdSql.checkData(2,1,33.000000000)
tdSql.checkData(3,1,44.000000000)
tdSql.query('select * from (select csum(value) from tb1 order by ts desc );')
tdSql.checkRows(4)
tdSql.checkData(0,1,44.000000000)
tdSql.checkData(1,1,33.000000000)
tdSql.checkData(2,1,22.000000000)
tdSql.checkData(3,1,11.000000000)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
###################################################################
# Copyright (c) 2020 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 -*-
from posixpath import split
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
self.num = 10
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def caseDescription(self):
'''
case1 <wenzhouwww>:[TD-12594] :
this test case is an value error about nest query and inner query sort for elapsed and twa .
'''
return
def run(self):
tdSql.prepare()
tdSql.execute("create database if not exists testdb keep 36500;")
tdSql.execute("use testdb;")
tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
for i in range(self.num):
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
tdSql.query('select elapsed(ts) from (select csum(value) from tb1 order by ts desc) interval(1s);')
tdSql.checkRows(1)
tdSql.checkData(0,1,9900.000000000)
tdSql.query('select twa(data) from (select csum(value) data from tb1 order by ts desc) interval(1s);')
tdSql.checkRows(1)
tdSql.checkData(0,1,16.833333333)
tdSql.query('select elapsed(ts) from (select csum(value) from tb1 order by ts asc) interval(1s);')
tdSql.checkRows(1)
tdSql.checkData(0,1,9900.000000000)
tdSql.query('select twa(data) from (select csum(value) data from tb1 order by ts asc) interval(1s);')
tdSql.checkRows(1)
tdSql.checkData(0,1,16.833333333)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
###################################################################
# 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
import time
import os
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
class TDTestCase:
def caseDescription(self):
'''
case1<xyguo>:[TD-10540]The escape char "`" can be used for both tag name and column name
case2<xyguo>:[TD-12435]create table as cause column error;
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
now = time.time()
self.ts = int(round(now * 1000))
def table1_checkall(self,sql):
tdLog.info(sql)
tdSql.query(sql)
tdSql.checkData(0,1,1)
tdSql.checkData(0,2,2)
tdSql.checkData(0,3,3)
tdSql.checkData(0,4,4)
tdSql.checkData(0,5,'True')
tdSql.checkData(0,6,6)
tdSql.checkData(0,7,7)
tdSql.checkData(0,8,8)
tdSql.checkData(0,9,9)
tdSql.checkData(0,10,'1970-01-01 08:00:00.010')
def table1_checkall_1(self,sql):
tdSql.query(sql)
tdSql.checkData(0,1,1)
def table1_checkall_2(self,sql):
self.table1_checkall_1(sql)
tdSql.checkData(0,2,2)
def table1_checkall_3(self,sql):
self.table1_checkall_2(sql)
tdSql.checkData(0,3,3)
def table1_checkall_4(self,sql):
self.table1_checkall_3(sql)
tdSql.checkData(0,4,4)
def table1_checkall_5(self,sql):
self.table1_checkall_4(sql)
tdSql.checkData(0,5,'True')
def table1_checkall_6(self,sql):
self.table1_checkall_5(sql)
tdSql.checkData(0,6,6)
def table1_checkall_7(self,sql):
self.table1_checkall_6(sql)
tdSql.checkData(0,7,7)
def table1_checkall_8(self,sql):
self.table1_checkall_7(sql)
tdSql.checkData(0,8,8)
def table1_checkall_9(self,sql):
self.table1_checkall_8(sql)
tdSql.checkData(0,9,9)
def table1_checkall_10(self,sql):
self.table1_checkall_9(sql)
tdSql.checkData(0,10,'1970-01-01 08:00:00.010')
def run(self):
testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf 5-taos-tools/%s.sql" % testcaseFilename )
os.system("rm db*")
os.system("rm dump_result.txt*")
tdSql.prepare()
print("==============step1")
print("prepare data")
tdSql.execute("create database db2")
tdSql.execute("use db2")
print("==============new version [escape character] for stable==============")
print("==============step1,#create db.stable,db.table; insert db.table; show db.table; select db.table; drop db.table;")
print("prepare data")
self.stb1 = "stable_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.tb1 = "table_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.col_base = "123~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.col_int = "stable_col_int%s" %self.col_base
print(self.col_int)
self.col_bigint = "stable_col_bigint%s" %self.col_base
self.col_smallint = "stable_col_smallint%s" %self.col_base
self.col_tinyint = "stable_col_tinyint%s" %self.col_base
self.col_bool = "stable_col_bool%s" %self.col_base
self.col_binary = "stable_col_binary%s" %self.col_base
self.col_nchar = "stable_col_nchar%s" %self.col_base
self.col_float = "stable_col_float%s" %self.col_base
self.col_double = "stable_col_double%s" %self.col_base
self.col_ts = "stable_col_ts%s" %self.col_base
self.tag_base = "abc~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.tag_int = "stable_tag_int%s" %self.tag_base
self.tag_bigint = "stable_tag_bigint%s" %self.tag_base
self.tag_smallint = "stable_tag_smallint%s" %self.tag_base
self.tag_tinyint = "stable_tag_tinyint%s" %self.tag_base
self.tag_bool = "stable_tag_bool%s" %self.tag_base
self.tag_binary = "stable_tag_binary%s" %self.tag_base
self.tag_nchar = "stable_tag_nchar%s" %self.tag_base
self.tag_float = "stable_tag_float%s" %self.tag_base
self.tag_double = "stable_tag_double%s" %self.tag_base
self.tag_ts = "stable_tag_ts%s" %self.tag_base
tdSql.execute('''create stable db.`%s` (ts timestamp, `%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool ,
`%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp)
tags(loc nchar(20), `%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool ,
`%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp);'''
%(self.stb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool,
self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts))
tdSql.query("describe db.`%s` ; " %self.stb1)
tdSql.checkRows(22)
tdSql.query("select _block_dist() from db.`%s` ; " %self.stb1)
tdSql.checkRows(0)
tdSql.query("show create stable db.`%s` ; " %self.stb1)
tdSql.checkData(0, 0, self.stb1)
tdSql.checkData(0, 1, "create table `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)\
TAGS (`loc` NCHAR(20),`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
%(self.stb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool,
self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts))
tdSql.execute("create table db.`table!1` using db.`%s` tags('table_1' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')" %self.stb1)
tdSql.query("describe db.`table!1` ; ")
tdSql.checkRows(22)
time.sleep(10)
tdSql.query("show create table db.`table!1` ; ")
tdSql.checkData(0, 0, "table!1")
tdSql.checkData(0, 1, "CREATE TABLE `table!1` USING `%s` TAGS (\"table_1\",0,0,0,0,false,\"0\",\"0\",0.000000,0.000000,\"0\")" %self.stb1)
tdSql.execute("insert into db.`table!1` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)")
sql = " select * from db.`table!1`; "
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`table!1`; '''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
time.sleep(1)
tdSql.execute('''insert into db.`table!1`(ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts) )
sql = " select * from db.`table!1`; "
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from db.`table!1`; ")
tdSql.checkData(0, 0, 2)
tdSql.query("select _block_dist() from db.`%s` ; " %self.stb1)
tdSql.checkRows(1)
tdSql.execute("create table db.`%s` using db.`%s` TAGS (\"table_2\",2,2,2,2,true,\"2\",\"2\",2.000000,2.000000,\"2\")" %(self.tb1,self.stb1))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.query("show create table db.`%s` ; " %self.tb1)
tdSql.checkData(0, 0, self.tb1)
tdSql.checkData(0, 1, "CREATE TABLE `%s` USING `%s` TAGS (\"table_2\",2,2,2,2,true,\"2\",\"2\",2.000000,2.000000,\"2\")" %(self.tb1,self.stb1))
tdSql.execute("insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.tb1)
sql = "select * from db.`%s` ; " %self.tb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s` ; '''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool, self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts, self.tb1)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
time.sleep(1)
tdSql.execute('''insert into db.`%s`(ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''\
%(self.tb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts) )
sql = " select * from db.`%s` ; " %self.tb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
sql = " select * from db.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
%(self.tb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from db.`%s`; " %self.tb1)
tdSql.checkData(0, 0, 2)
sql = "select * from db.`%s` ; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
tdSql.query("select count(*) from db.`%s`; " %self.stb1)
tdSql.checkData(0, 0, 4)
sql = "select * from (select * from db.`%s`) ; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
tdSql.query("select count(*) from (select * from db.`%s`) ; " %self.stb1)
tdSql.checkData(0, 0, 4)
sql = "select * from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`\
where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1, \
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
tdSql.query("show db.stables like 'stable_1%' ")
tdSql.checkRows(1)
tdSql.query("show db.tables like 'table%' ")
tdSql.checkRows(2)
self.cr_tb1 = "create_table_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
tdSql.execute("create table db.`%s` as select avg(`%s`) from db.`%s` where ts > now interval(1m) sliding(30s);" %(self.cr_tb1,self.col_bigint,self.stb1))
tdSql.query("show db.tables like 'create_table_%' ")
tdSql.checkRows(1)
print("==============drop\ add\ change\ modify column or tag")
print("==============drop==============")
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_ts))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(21)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_double))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(20)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_float))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(19)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_nchar))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(18)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_binary))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(17)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_bool))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(16)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_tinyint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(15)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_smallint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(14)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_bigint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(13)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_int))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(12)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_ts))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_9(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_double))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_8(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_float))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_7(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_nchar))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_6(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_binary))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_5(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_bool))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_4(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_tinyint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_3(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_smallint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_2(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_bigint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_1(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(3)
tdSql.error("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_int))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(3)
print("==============add==============")
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` bigint; " %(self.stb1, self.col_bigint))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` smallint; " %(self.stb1, self.col_smallint))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` tinyint; " %(self.stb1, self.col_tinyint))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` bool; " %(self.stb1, self.col_bool))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` binary(20); " %(self.stb1, self.col_binary))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(8)
tdSql.execute("insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %self.tb1)
sql = "select * from db.`%s` order by ts desc; " %self.tb1
datacheck = self.table1_checkall_5(sql)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` nchar(20); " %(self.stb1, self.col_nchar))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` float; " %(self.stb1, self.col_float))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` double; " %(self.stb1, self.col_double))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` timestamp; " %(self.stb1, self.col_ts))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(12)
tdSql.execute("insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.tb1)
sql = "select * from db.`%s` order by ts desc; " %self.tb1
datacheck = self.table1_checkall(sql)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` int; " %(self.stb1, self.tag_int))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(13)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` bigint; " %(self.stb1, self.tag_bigint))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(14)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` smallint; " %(self.stb1, self.tag_smallint))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(15)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` tinyint; " %(self.stb1, self.tag_tinyint))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(16)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` bool; " %(self.stb1, self.tag_bool))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(17)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` binary(20); " %(self.stb1, self.tag_binary))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(18)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` nchar(20); " %(self.stb1, self.tag_nchar))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(19)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` float; " %(self.stb1, self.tag_float))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(20)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` double; " %(self.stb1, self.tag_double))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(21)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` timestamp; " %(self.stb1, self.tag_ts))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
print("==============change==============")
self.tag_base_change = "abcdas"
self.tag_int_change = "stable_tag_int%s" %self.tag_base_change
self.tag_bigint_change = "stable_tag_bigint%s" %self.tag_base_change
self.tag_smallint_change = "stable_tag_smallint%s" %self.tag_base_change
self.tag_tinyint_change = "stable_tag_tinyint%s" %self.tag_base_change
self.tag_bool_change = "stable_tag_bool%s" %self.tag_base_change
self.tag_binary_change = "stable_tag_binary%s" %self.tag_base_change
self.tag_nchar_change = "stable_tag_nchar%s" %self.tag_base_change
self.tag_float_change = "stable_tag_float%s" %self.tag_base_change
self.tag_double_change = "stable_tag_double%s" %self.tag_base_change
self.tag_ts_change = "stable_tag_ts%s" %self.tag_base_change
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_int, self.tag_int_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_bigint, self.tag_bigint_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_smallint, self.tag_smallint_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_tinyint, self.tag_tinyint_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_bool, self.tag_bool_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_binary, self.tag_binary_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_nchar, self.tag_nchar_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_float, self.tag_float_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_double, self.tag_double_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_ts, self.tag_ts_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
print("==============modify==============")
# TD-10810
tdSql.execute("ALTER STABLE db.`%s` MODIFY TAG `%s` binary(30); ; " %(self.stb1, self.tag_binary_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER STABLE db.`%s` MODIFY TAG `%s` nchar(30); ; " %(self.stb1, self.tag_nchar_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER STABLE db.`%s` MODIFY COLUMN `%s` binary(30); ; " %(self.stb1, self.col_binary))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER STABLE db.`%s` MODIFY COLUMN `%s` nchar(30); ; " %(self.stb1, self.col_nchar))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
print("==============drop table\stable")
try:
tdSql.execute("drop table db.`%s` " %self.tb1)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from db.`%s`" %self.tb1)
tdSql.query("show db.stables like 'stable_1%' ")
tdSql.checkRows(1)
try:
tdSql.execute("drop table db.`%s` " %self.stb1)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from db.`%s`" %self.tb1)
tdSql.error("select * from db.`%s`" %self.stb1)
print("==============step2,#create stable,table; insert table; show table; select table; drop table")
self.stb2 = "stable_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
self.tb2 = "table_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
tdSql.execute("create stable `%s` (ts timestamp, i int) tags(j int);" %self.stb2)
tdSql.query("describe `%s` ; "%self.stb2)
tdSql.checkRows(3)
tdSql.query("select _block_dist() from `%s` ; " %self.stb2)
tdSql.checkRows(0)
tdSql.query("show create stable `%s` ; " %self.stb2)
tdSql.checkData(0, 0, self.stb2)
tdSql.checkData(0, 1, "create table `%s` (`ts` TIMESTAMP,`i` INT) TAGS (`j` INT)" %self.stb2)
tdSql.execute("create table `table!2` using `%s` tags(1)" %self.stb2)
tdSql.query("describe `table!2` ; ")
tdSql.checkRows(3)
time.sleep(10)
tdSql.query("show create table `table!2` ; ")
tdSql.checkData(0, 0, "table!2")
tdSql.checkData(0, 1, "CREATE TABLE `table!2` USING `%s` TAGS (1)" %self.stb2)
tdSql.execute("insert into `table!2` values(now, 1)")
tdSql.query("select * from `table!2`; ")
tdSql.checkRows(1)
tdSql.query("select count(*) from `table!2`; ")
tdSql.checkData(0, 0, 1)
tdSql.query("select _block_dist() from `%s` ; " %self.stb2)
tdSql.checkRows(1)
tdSql.execute("create table `%s` using `%s` tags(1)" %(self.tb2,self.stb2))
tdSql.query("describe `%s` ; " %self.tb2)
tdSql.checkRows(3)
tdSql.query("show create table `%s` ; " %self.tb2)
tdSql.checkData(0, 0, self.tb2)
tdSql.checkData(0, 1, "CREATE TABLE `%s` USING `%s` TAGS (1)" %(self.tb2,self.stb2))
tdSql.execute("insert into `%s` values(now, 1)" %self.tb2)
tdSql.query("select * from `%s` ; " %self.tb2)
tdSql.checkRows(1)
tdSql.query("select count(*) from `%s`; " %self.tb2)
tdSql.checkData(0, 0, 1)
tdSql.query("select * from `%s` ; " %self.stb2)
tdSql.checkRows(2)
tdSql.query("select count(*) from `%s`; " %self.stb2)
tdSql.checkData(0, 0, 2)
tdSql.query("select * from (select * from `%s`) ; " %self.stb2)
tdSql.checkRows(2)
tdSql.query("select count(*) from (select * from `%s` ); " %self.stb2)
tdSql.checkData(0, 0, 2)
tdSql.query("show stables like 'stable_2%' ")
tdSql.checkRows(1)
tdSql.query("show tables like 'table%' ")
tdSql.checkRows(2)
#TD-10536
self.cr_tb2 = "create_table_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
tdSql.execute("create table `%s` as select * from `%s` ;" %(self.cr_tb2,self.stb2))
tdSql.query("show db.tables like 'create_table_%' ")
tdSql.checkRows(1)
print("==============step3,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table")
self.regular_table = "regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
self.regular_col_base = "123@#$%^&*()-_+=[]{};:,<.>/?~!$%^"
self.col_int = "regular_table_col_int%s" %self.regular_col_base
print(self.col_int)
self.col_bigint = "regular_table_col_bigint%s" %self.regular_col_base
self.col_smallint = "regular_table_col_smallint%s" %self.regular_col_base
self.col_tinyint = "regular_table_col_tinyint%s" %self.regular_col_base
self.col_bool = "regular_table_col_bool%s" %self.regular_col_base
self.col_binary = "regular_table_col_binary%s" %self.regular_col_base
self.col_nchar = "regular_table_col_nchar%s" %self.regular_col_base
self.col_float = "regular_table_col_float%s" %self.regular_col_base
self.col_double = "regular_table_col_double%s" %self.regular_col_base
self.col_ts = "regular_table_col_ts%s" %self.regular_col_base
tdSql.execute("create table `%s` (ts timestamp,`%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool , \
`%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp) ;"\
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
tdSql.query("describe `%s` ; "%self.regular_table)
tdSql.checkRows(11)
tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
tdSql.checkRows(1)
tdSql.query("show create table `%s` ; " %self.regular_table)
tdSql.checkData(0, 0, self.regular_table)
tdSql.checkData(0, 1, "create table `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
tdSql.execute("insert into `%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.regular_table)
sql = "select * from `%s` ; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`; '''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
time.sleep(1)
tdSql.execute('''insert into db2.`%s` (ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''\
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts) )
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
sql = " select * from db2.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from `%s`; " %self.regular_table)
tdSql.checkData(0, 0, 2)
tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
tdSql.checkRows(1)
sql = "select * from (select * from `%s`) ; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`\
where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table, \
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from (select * from `%s` ); " %self.regular_table)
tdSql.checkData(0, 0, 2)
tdSql.query("show tables like 'regular_table%' ")
tdSql.checkRows(1)
self.crr_tb = "create_r_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
tdSql.execute("create table `%s` as select * from `%s` ;" %(self.crr_tb,self.regular_table))
tdSql.query("show db2.tables like 'create_r_table%' ")
tdSql.checkRows(1)
print("==============drop\ add\ change\ modify column ")
print("==============drop==============")
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_ts))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_9(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_double))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_8(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_float))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_7(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_nchar))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_6(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_binary))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_5(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_bool))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_4(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_tinyint))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_3(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_smallint))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_2(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(3)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_bigint))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_1(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(2)
tdSql.error("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_int))
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(2)
print("==============add==============")
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` bigint; " %(self.regular_table, self.col_bigint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(3)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` smallint; " %(self.regular_table, self.col_smallint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` tinyint; " %(self.regular_table, self.col_tinyint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` bool; " %(self.regular_table, self.col_bool))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` binary(20); " %(self.regular_table, self.col_binary))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(7)
tdSql.execute("insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %self.regular_table)
sql = "select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_5(sql)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` nchar(20); " %(self.regular_table, self.col_nchar))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` float; " %(self.regular_table, self.col_float))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` double; " %(self.regular_table, self.col_double))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` timestamp; " %(self.regular_table, self.col_ts))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(11)
tdSql.execute("insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.regular_table)
sql = "select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
print("==============change, regular not support==============")
print("==============modify==============")
# TD-10810
tdSql.execute("ALTER TABLE db2.`%s` MODIFY COLUMN `%s` binary(30); ; " %(self.regular_table, self.col_binary))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE `%s` MODIFY COLUMN `%s` nchar(30); ; " %(self.regular_table, self.col_nchar))
sql = " select * from `%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(11)
print("==============step4,#taosdump out ; drop db ; taosdumo in")
assert os.system("taosdump -D db2 ") == 0
tdSql.execute('''drop database if exists db2 ;''')
assert os.system("taosdump -i . -g") == 0
print("==============step5,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table")
self.regular_table = "regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
self.regular_col_base = "123@#$%^&*()-_+=[]{};:,<.>/?~!$%^"
self.col_int = "regular_table_col_int%s" %self.regular_col_base
print(self.col_int)
self.col_bigint = "regular_table_col_bigint%s" %self.regular_col_base
self.col_smallint = "regular_table_col_smallint%s" %self.regular_col_base
self.col_tinyint = "regular_table_col_tinyint%s" %self.regular_col_base
self.col_bool = "regular_table_col_bool%s" %self.regular_col_base
self.col_binary = "regular_table_col_binary%s" %self.regular_col_base
self.col_nchar = "regular_table_col_nchar%s" %self.regular_col_base
self.col_float = "regular_table_col_float%s" %self.regular_col_base
self.col_double = "regular_table_col_double%s" %self.regular_col_base
self.col_ts = "regular_table_col_ts%s" %self.regular_col_base
tdSql.query("describe `%s` ; "%self.regular_table)
tdSql.checkRows(11)
tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
tdSql.checkRows(1)
tdSql.query("show create table `%s` ; " %self.regular_table)
tdSql.checkData(0, 0, self.regular_table)
tdSql.checkData(0, 1, "create table `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(30),`%s` NCHAR(30),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
tdSql.execute("insert into `%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.regular_table)
sql = "select * from `%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(5)
sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s` order by ts desc; '''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(5)
time.sleep(1)
tdSql.execute('''insert into db2.`%s` (ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''\
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts) )
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(6)
sql = " select * from db2.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(3)
tdSql.query("select count(*) from `%s` order by ts desc; " %self.regular_table)
tdSql.checkData(0, 0, 6)
tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
tdSql.checkRows(1)
sql = "select * from (select * from `%s` order by ts desc) ; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(6)
sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`\
where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table, \
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(3)
tdSql.query("select count(*) from (select * from `%s` ); " %self.regular_table)
tdSql.checkData(0, 0, 6)
tdSql.query("show tables like 'regular_table%' ")
tdSql.checkRows(1)
tdSql.query("show db2.tables like 'create_r_table%' ")
tdSql.checkRows(1)
print("==============drop\ add\ change\ modify column ")
print("==============drop==============")
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_ts))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_9(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_double))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_8(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_float))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_7(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_nchar))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_6(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_binary))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_5(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_bool))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_4(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_tinyint))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_3(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_smallint))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_2(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(3)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_bigint))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_1(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(2)
tdSql.error("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_int))
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(2)
print("==============add==============")
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` bigint; " %(self.regular_table, self.col_bigint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(3)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` smallint; " %(self.regular_table, self.col_smallint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` tinyint; " %(self.regular_table, self.col_tinyint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` bool; " %(self.regular_table, self.col_bool))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` binary(20); " %(self.regular_table, self.col_binary))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(7)
tdSql.execute("insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %self.regular_table)
sql = "select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_5(sql)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` nchar(20); " %(self.regular_table, self.col_nchar))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` float; " %(self.regular_table, self.col_float))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` double; " %(self.regular_table, self.col_double))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` timestamp; " %(self.regular_table, self.col_ts))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(11)
tdSql.execute("insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.regular_table)
sql = "select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
print("==============change, regular not support==============")
print("==============modify==============")
# TD-10810
tdSql.execute("ALTER TABLE db2.`%s` MODIFY COLUMN `%s` binary(40); ; " %(self.regular_table, self.col_binary))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE `%s` MODIFY COLUMN `%s` nchar(40); ; " %(self.regular_table, self.col_nchar))
sql = " select * from `%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(11)
os.system("rm db*")
os.system("rm dump_result.txt*")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -2,4 +2,4 @@ python3 ./test.py -f 2-query/TD-11256.py
# python3 ./test.py -f 2-query/TD-11389.py
python3 ./test.py -f 2-query/TD-11945_crash.py
python3 ./test.py -f 2-query/TD-12340-12342.py
python3 ./test.py -f 2-query/TD-12204.py
python3 ./test.py -f 2-query/TD-12204.py
\ No newline at end of file
python3 ./test.py -f 5-taos-tools/basic.py
python3 ./test.py -f 5-taos-tools/TD-12478.py
python3 ./test.py -f 5-taos-tools/dump_col_tag.py
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册