未验证 提交 1b093a0d 编写于 作者: H huili 提交者: GitHub

Merge pull request #5313 from taosdata/test/jenkins

<test>add test case for unsigned type
......@@ -2013,6 +2013,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if ((getColumnIndexByName(pCmd, &pParamElem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS)) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
if (index.columnIndex == TSDB_TBNAME_COLUMN_INDEX) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6);
}
......
......@@ -19,6 +19,10 @@ class TDTestCase:
"double",
"smallint",
"tinyint",
"int unsigned",
"bigint unsigned",
"smallint unsigned",
"tinyint unsigned",
"binary(10)",
"nchar(10)",
"timestamp"]
......
......@@ -19,6 +19,10 @@ class TDTestCase:
"double",
"smallint",
"tinyint",
"int unsigned",
"bigint unsigned",
"smallint unsigned",
"tinyint unsigned",
"binary(10)",
"nchar(10)",
"timestamp"]
......
......@@ -66,6 +66,14 @@ class TDTestCase:
"alter table dt add column tbcol8 nchar(20)")
tdSql.execute(
"alter table dt add column tbcol9 binary(20)")
tdSql.execute(
"alter table dt add column tbcol10 tinyint unsigned")
tdSql.execute(
"alter table dt add column tbcol11 int unsigned")
tdSql.execute(
"alter table dt add column tbcol12 smallint unsigned")
tdSql.execute(
"alter table dt add column tbcol13 bigint unsigned")
# restart taosd
tdDnodes.forcestop(1)
......
......@@ -3,12 +3,16 @@ ulimit -c unlimited
python3 ./test.py -f insert/basic.py
python3 ./test.py -f insert/int.py
python3 ./test.py -f insert/unsignedInt.py
python3 ./test.py -f insert/float.py
python3 ./test.py -f insert/bigint.py
python3 ./test.py -f insert/unsignedBigint.py
python3 ./test.py -f insert/bool.py
python3 ./test.py -f insert/double.py
python3 ./test.py -f insert/smallint.py
python3 ./test.py -f insert/unsignedSmallint.py
python3 ./test.py -f insert/tinyint.py
python3 ./test.py -f insert/unsignedTinyint.py
python3 ./test.py -f insert/date.py
python3 ./test.py -f insert/binary.py
python3 ./test.py -f insert/nchar.py
......@@ -151,6 +155,7 @@ python3 ./test.py -f query/filterCombo.py
python3 ./test.py -f query/queryNormal.py
python3 ./test.py -f query/queryError.py
python3 ./test.py -f query/filterAllIntTypes.py
python3 ./test.py -f query/filterAllUnsignedIntTypes.py
python3 ./test.py -f query/filterFloatAndDouble.py
python3 ./test.py -f query/filterOtherTypes.py
python3 ./test.py -f query/querySort.py
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -63,7 +63,15 @@ class TDTestCase:
tdSql.query("select avg(col5) from test")
tdSql.checkData(0, 0, np.average(floatData))
tdSql.query("select avg(col6) from test")
tdSql.checkData(0, 0, np.average(floatData))
tdSql.checkData(0, 0, np.average(floatData))
tdSql.query("select avg(col11) from test")
tdSql.checkData(0, 0, np.average(intData))
tdSql.query("select avg(col12) from test")
tdSql.checkData(0, 0, np.average(intData))
tdSql.query("select avg(col13) from test")
tdSql.checkData(0, 0, np.average(intData))
tdSql.query("select avg(col14) from test")
tdSql.checkData(0, 0, np.average(intData))
def stop(self):
tdSql.close()
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
# col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
#tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
#tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
#tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -63,7 +63,15 @@ class TDTestCase:
tdSql.query("select avg(col5) from test")
tdSql.checkData(0, 0, np.average(floatData))
tdSql.query("select avg(col6) from test")
tdSql.checkData(0, 0, np.average(floatData))
tdSql.checkData(0, 0, np.average(floatData))
tdSql.query("select avg(col11) from test")
tdSql.checkData(0, 0, np.average(intData))
tdSql.query("select avg(col12) from test")
tdSql.checkData(0, 0, np.average(intData))
tdSql.query("select avg(col13) from test")
tdSql.checkData(0, 0, np.average(intData))
tdSql.query("select avg(col14) from test")
tdSql.checkData(0, 0, np.average(intData))
def stop(self):
tdSql.close()
......
......@@ -31,11 +31,11 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# bottom verifacation
tdSql.error("select bottom(ts, 10) from test")
......@@ -84,6 +84,26 @@ class TDTestCase:
tdSql.checkRows(2)
tdSql.checkData(0, 1, 0.1)
tdSql.checkData(1, 1, 1.1)
tdSql.query("select bottom(col11, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col12, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col13, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col14, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
#TD-2457 bottom + interval + order by
tdSql.error('select top(col2,1) from test interval(1y) order by col2;')
......
......@@ -31,11 +31,11 @@ class TDTestCase:
tdSql.execute("use db")
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
# col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
#tdSql.execute("create table test1 using test tags('beijing')")
#for i in range(self.rowNum):
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# bottom verifacation
tdSql.error("select bottom(ts, 10) from test")
......@@ -75,6 +75,26 @@ class TDTestCase:
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col11, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col12, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col13, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col14, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 1)
tdSql.checkData(1, 1, 2)
tdSql.query("select bottom(col5, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 0.1)
......
......@@ -31,11 +31,11 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# Count verifacation
tdSql.query("select count(*) from test")
......@@ -62,11 +62,20 @@ class TDTestCase:
tdSql.query("select count(col9) from test")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(col11) from test")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(col12) from test")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(col13) from test")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(col14) from test")
tdSql.checkData(0, 0, 10)
tdSql.execute("alter table test add column col10 int")
tdSql.query("select count(col10) from test")
tdSql.checkRows(0)
tdSql.execute("insert into test1 values(now, 1, 2, 3, 4, 1.1, 2.2, false, 'test', 'test' 1)")
tdSql.execute("insert into test1 values(now, 1, 2, 3, 4, 1.1, 2.2, false, 'test', 'test' , 1, 1, 1, 1, 1)")
tdSql.query("select count(col10) from test")
tdSql.checkData(0, 0, 1)
......
......@@ -31,11 +31,11 @@ class TDTestCase:
tdSql.execute("use db")
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
# col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
#tdSql.execute("create table test1 using test tags('beijing')")
#for i in range(self.rowNum):
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# Count verifacation
tdSql.query("select count(*) from test")
......@@ -62,6 +62,15 @@ class TDTestCase:
tdSql.query("select count(col9) from test")
tdSql.checkData(0, 0, 11)
tdSql.query("select count(col11) from test")
tdSql.checkData(0, 0, 11)
tdSql.query("select count(col12) from test")
tdSql.checkData(0, 0, 11)
tdSql.query("select count(col13) from test")
tdSql.checkData(0, 0, 11)
tdSql.query("select count(col14) from test")
tdSql.checkData(0, 0, 11)
#tdSql.execute("alter table test add column col10 int")
#tdSql.query("select count(col10) from test")
#tdSql.checkRows(0)
......
......@@ -31,9 +31,9 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ', 0, 0, 0, 0)" % (self.ts - 1))
# diff verifacation
tdSql.query("select diff(col1) from test1")
......@@ -55,8 +55,8 @@ class TDTestCase:
tdSql.checkRows(0)
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.error("select diff(ts) from test")
tdSql.error("select diff(ts) from test1")
......@@ -72,7 +72,16 @@ class TDTestCase:
tdSql.error("select diff(col8) from test1")
tdSql.error("select diff(col9) from test")
tdSql.error("select diff(col9) from test1")
tdSql.error("select diff(col11) from test1")
tdSql.error("select diff(col12) from test1")
tdSql.error("select diff(col13) from test1")
tdSql.error("select diff(col14) from test1")
tdSql.error("select diff(col11) from test")
tdSql.error("select diff(col12) from test")
tdSql.error("select diff(col13) from test")
tdSql.error("select diff(col14) from test")
tdSql.query("select diff(col1) from test1")
tdSql.checkRows(10)
......
......@@ -31,7 +31,7 @@ class TDTestCase:
tdSql.execute("use db")
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
# col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
#tdSql.execute("create table test1 using test tags('beijing')")
#tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
......@@ -55,8 +55,8 @@ class TDTestCase:
#tdSql.checkRows(0)
#for i in range(self.rowNum):
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
# % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.error("select diff(ts) from test")
tdSql.error("select diff(ts) from test1")
......@@ -71,7 +71,14 @@ class TDTestCase:
tdSql.error("select diff(col8) from test")
tdSql.error("select diff(col8) from test1")
tdSql.error("select diff(col9) from test")
tdSql.error("select diff(col9) from test1")
tdSql.error("select diff(col11) from test1")
tdSql.error("select diff(col12) from test1")
tdSql.error("select diff(col13) from test1")
tdSql.error("select diff(col14) from test1")
tdSql.error("select diff(col11) from test")
tdSql.error("select diff(col12) from test")
tdSql.error("select diff(col13) from test")
tdSql.error("select diff(col14) from test")
tdSql.query("select diff(col1) from test1")
tdSql.checkRows(10)
......
......@@ -31,7 +31,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
......@@ -52,6 +52,18 @@ class TDTestCase:
tdSql.query("select first(col4) from test1")
tdSql.checkRows(0)
tdSql.query("select first(col11) from test1")
tdSql.checkRows(0)
tdSql.query("select first(col12) from test1")
tdSql.checkRows(0)
tdSql.query("select first(col13) from test1")
tdSql.checkRows(0)
tdSql.query("select first(col14) from test1")
tdSql.checkRows(0)
tdSql.query("select first(col5) from test1")
tdSql.checkRows(0)
......@@ -68,8 +80,8 @@ class TDTestCase:
tdSql.checkRows(0)
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.query("select first(*) from test1")
tdSql.checkRows(1)
......@@ -91,6 +103,22 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1)
tdSql.query("select first(col11) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1)
tdSql.query("select first(col12) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1)
tdSql.query("select first(col13) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1)
tdSql.query("select first(col14) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 1)
tdSql.query("select first(col5) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0.1)
......
......@@ -31,7 +31,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
......@@ -52,6 +52,18 @@ class TDTestCase:
tdSql.query("select last(col4) from test1")
tdSql.checkRows(0)
tdSql.query("select last(col11) from test1")
tdSql.checkRows(0)
tdSql.query("select last(col12) from test1")
tdSql.checkRows(0)
tdSql.query("select last(col13) from test1")
tdSql.checkRows(0)
tdSql.query("select last(col14) from test1")
tdSql.checkRows(0)
tdSql.query("select last(col5) from test1")
tdSql.checkRows(0)
......@@ -68,8 +80,8 @@ class TDTestCase:
tdSql.checkRows(0)
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.query("select last(*) from test1")
tdSql.checkRows(1)
......@@ -91,6 +103,22 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last(col11) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last(col12) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last(col13) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last(col14) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last(col5) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 9.1)
......
......@@ -31,7 +31,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
......@@ -56,6 +56,22 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select last_row(col11) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select last_row(col12) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select last_row(col13) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select last_row(col14) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
tdSql.query("select last_row(col5) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
......@@ -77,8 +93,8 @@ class TDTestCase:
tdSql.checkData(0, 0, None)
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.query("select last_row(*) from test1")
tdSql.checkRows(1)
......@@ -100,6 +116,22 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last_row(col11) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last_row(col12) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last_row(col13) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last_row(col14) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select last_row(col5) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 9.1)
......
......@@ -31,11 +31,11 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# leastsquares verifacation
tdSql.error("select leastsquares(ts, 1, 1) from test1")
......@@ -48,6 +48,10 @@ class TDTestCase:
tdSql.error("select leastsquares(col7, 1, 1) from test1")
tdSql.error("select leastsquares(col8, 1, 1) from test1")
tdSql.error("select leastsquares(col9, 1, 1) from test1")
tdSql.error("select leastsquares(col11, 1, 1) from test")
tdSql.error("select leastsquares(col12, 1, 1) from test")
tdSql.error("select leastsquares(col13, 1, 1) from test")
tdSql.error("select leastsquares(col14, 1, 1) from test")
tdSql.query("select leastsquares(col1, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
......@@ -61,6 +65,18 @@ class TDTestCase:
tdSql.query("select leastsquares(col4, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col11, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col12, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col13, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col14, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col5, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
......
......@@ -54,6 +54,18 @@ class TDTestCase:
tdSql.query("select leastsquares(col4, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col11, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col12, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col13, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col14, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
tdSql.query("select leastsquares(col5, 1, 1) from test1")
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -63,6 +63,18 @@ class TDTestCase:
tdSql.query("select max(col4) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col11) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col12) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col13) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col14) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col5) from test1")
tdSql.checkData(0, 0, np.max(floatData))
......
......@@ -34,7 +34,7 @@ class TDTestCase:
floatData = []
#tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
# col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
# col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
#tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
intData.append(i + 1)
......@@ -61,6 +61,18 @@ class TDTestCase:
tdSql.query("select max(col4) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col11) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col12) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col13) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col14) from test1")
tdSql.checkData(0, 0, np.max(intData))
tdSql.query("select max(col5) from test1")
tdSql.checkData(0, 0, np.max(floatData))
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -63,6 +63,18 @@ class TDTestCase:
tdSql.query("select min(col4) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col11) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col12) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col13) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col14) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col5) from test1")
tdSql.checkData(0, 0, np.min(floatData))
......
......@@ -58,6 +58,18 @@ class TDTestCase:
tdSql.query("select min(col4) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col11) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col12) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col13) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col14) from test1")
tdSql.checkData(0, 0, np.min(intData))
tdSql.query("select min(col5) from test1")
tdSql.checkData(0, 0, np.min(floatData))
......
......@@ -31,11 +31,11 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# min verifacation
tdSql.error("select ts + col1 from test")
......@@ -51,9 +51,9 @@ class TDTestCase:
tdSql.checkRows(10)
tdSql.checkData(0, 0, 2.0)
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
tdSql.checkRows(10)
tdSql.checkData(0, 0, 3.2)
tdSql.checkData(0, 0, 7.2)
tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
tdSql.query("select col1 + col2 from test1")
......@@ -64,7 +64,7 @@ class TDTestCase:
tdSql.checkRows(11)
tdSql.checkData(10, 0, None)
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
tdSql.checkRows(11)
tdSql.checkData(10, 0, None)
......
......@@ -44,9 +44,9 @@ class TDTestCase:
tdSql.checkRows(11)
tdSql.checkData(0, 0, 2.0)
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
tdSql.checkRows(11)
tdSql.checkData(0, 0, 3.2)
tdSql.checkData(0, 0, 7.2)
#tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
tdSql.query("select col1 + col2 from test1")
......@@ -57,7 +57,7 @@ class TDTestCase:
tdSql.checkRows(11)
tdSql.checkData(10, 0, None)
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
tdSql.checkRows(11)
tdSql.checkData(10, 0, None)
......
......@@ -34,10 +34,10 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
for i in range(self.rowNum):
tdSql.execute("insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -103,6 +103,58 @@ class TDTestCase:
tdSql.query("select apercentile(col4, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col11, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col11, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col11, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col11, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col11, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col11, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col12, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col12, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col12, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col12, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col12, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col12, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col13, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col13, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col13, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col13, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col13, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col13, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col14, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col14, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col14, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col14, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col14, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col14, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col5, 0) from test")
print("query result: %s" % tdSql.getData(0, 0))
print("array result: %s" % np.percentile(floatData, 0))
......
......@@ -99,6 +99,58 @@ class TDTestCase:
tdSql.query("select apercentile(col4, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col11, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col11, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col11, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col11, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col11, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col11, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col12, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col12, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col12, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col12, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col12, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col12, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col13, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col13, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col13, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col13, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col13, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col13, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col14, 0) from test")
tdSql.checkData(0, 0, np.percentile(intData, 0))
tdSql.query("select apercentile(col14, 0) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col14, 50) from test")
tdSql.checkData(0, 0, np.percentile(intData, 50))
tdSql.query("select apercentile(col14, 50) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col14, 100) from test")
tdSql.checkData(0, 0, np.percentile(intData, 100))
tdSql.query("select apercentile(col14, 100) from test")
print("apercentile result: %s" % tdSql.getData(0, 0))
tdSql.query("select percentile(col5, 0) from test")
print("query result: %s" % tdSql.getData(0, 0))
print("array result: %s" % np.percentile(floatData, 0))
......
......@@ -31,9 +31,9 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ', 0, 0, 0, 0)" % (self.ts - 1))
# spread verifacation
tdSql.query("select spread(ts) from test1")
......@@ -55,6 +55,22 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.query("select spread(col11) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.query("select spread(col12) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.query("select spread(col13) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.query("select spread(col14) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.query("select spread(col5) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
......@@ -64,8 +80,8 @@ class TDTestCase:
tdSql.checkData(0, 0, 0)
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.error("select spread(col7) from test")
tdSql.error("select spread(col7) from test1")
......@@ -90,6 +106,22 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col11) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col12) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col13) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col14) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col5) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 9.1)
......
......@@ -36,7 +36,7 @@ class TDTestCase:
tdSql.error("select spread(col8) from test1")
tdSql.error("select spread(col9) from test")
tdSql.error("select spread(col9) from test1")
tdSql.query("select spread(col1) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
......@@ -53,6 +53,23 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col11) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col12) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col13) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col14) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.query("select spread(col5) from test1")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 9.1)
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -68,6 +68,18 @@ class TDTestCase:
tdSql.query("select stddev(col4) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col11) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col12) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col13) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col14) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col5) from test1")
tdSql.checkData(0, 0, np.std(floatData))
......
......@@ -55,6 +55,18 @@ class TDTestCase:
tdSql.query("select stddev(col4) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col11) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col12) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col13) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col14) from test1")
tdSql.checkData(0, 0, np.std(intData))
tdSql.query("select stddev(col5) from test1")
tdSql.checkData(0, 0, np.std(floatData))
......
......@@ -32,25 +32,31 @@ class TDTestCase:
self.clist4 = []
self.clist5 = []
self.clist6 = []
self.clist11 = []
self.clist12 = []
self.clist13 = []
self.clist14 = []
def getData(self):
for i in range(tdSql.queryRows):
for j in range(6):
exec('self.clist{}.append(tdSql.queryResult[i][j+1])'.format(j+1))
for j in range(11,15):
exec('self.clist{}.append(tdSql.queryResult[i][j-1])'.format(j))
def run(self):
tdSql.prepare()
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(cid int,gbid binary(20),loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(cid int,gbid binary(20),loc nchar(20))''')
tdSql.execute("create table test1 using test tags(1,'beijing','北京')")
tdSql.execute("create table test2 using test tags(2,'shanghai','深圳')")
tdSql.execute("create table test3 using test tags(2,'shenzhen','深圳')")
tdSql.execute("create table test4 using test tags(1,'shanghai','上海')")
for j in range(4):
for i in range(self.rowNum):
tdSql.execute("insert into test%d values(now-%dh, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (j+1,i, i + 1, i + 1, i + 1, i + 1, i + i * 0.1, i * 1.5, i % 2, i + 1, i + 1))
tdSql.execute("insert into test%d values(now-%dh, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (j+1,i, i + 1, i + 1, i + 1, i + 1, i + i * 0.1, i * 1.5, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
# stddev verifacation
tdSql.error("select stddev(ts) from test")
......@@ -70,6 +76,10 @@ class TDTestCase:
exec('tdSql.query("select stddev(col{}) from test {}")'.format(i+1,condition))
exec('tdSql.checkData(0, 0, np.std(self.clist{}))'.format(i+1))
exec('self.clist{}.clear()'.format(i+1))
for i in range(11,15):
exec('tdSql.query("select stddev(col{}) from test {}")'.format(i,condition))
exec('tdSql.checkData(0, 0, np.std(self.clist{}))'.format(i))
exec('self.clist{}.clear()'.format(i))
print('step 2')
con_group_list = {
' cid = 2 and ts >=now - 1d and ts <now group by tbname':2,
......@@ -82,6 +92,10 @@ class TDTestCase:
exec('tdSql.query("select stddev(col{}) from test where {}")'.format(i+1,key))
for j in range(value):
tdSql.checkData(j, 0, result[i])
for i in range(11,15):
exec('tdSql.query("select stddev(col{}) from test where {}")'.format(i,key))
for j in range(value):
tdSql.checkData(j, 0, result[0])
def stop(self):
tdSql.close()
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -56,6 +56,14 @@ class TDTestCase:
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col4) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col11) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col12) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col13) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col14) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col5) from test")
tdSql.checkData(0, 0, np.sum(floatData))
tdSql.query("select sum(col6) from test")
......
......@@ -51,6 +51,13 @@ class TDTestCase:
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col4) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col11) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col12) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col13) from test")
tdSql.checkData(0, 0, np.sum(intData))
tdSql.query("select sum(col14) from test")
tdSql.query("select sum(col5) from test")
tdSql.checkData(0, 0, np.sum(floatData))
tdSql.query("select sum(col6) from test")
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -59,6 +59,14 @@ class TDTestCase:
tdSql.error("select top(col7, 10) from test")
tdSql.error("select top(col8, 10) from test")
tdSql.error("select top(col9, 10) from test")
tdSql.error("select top(col11, 0) from test")
tdSql.error("select top(col11, 101) from test")
tdSql.error("select top(col12, 0) from test")
tdSql.error("select top(col12, 101) from test")
tdSql.error("select top(col13, 0) from test")
tdSql.error("select top(col13, 101) from test")
tdSql.error("select top(col14, 0) from test")
tdSql.error("select top(col14, 101) from test")
tdSql.query("select top(col1, 2) from test")
tdSql.checkRows(2)
......@@ -80,6 +88,26 @@ class TDTestCase:
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col11, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col12, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col13, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col14, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col5, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 8.1)
......
......@@ -75,6 +75,26 @@ class TDTestCase:
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col11, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col12, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col13, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col14, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 9)
tdSql.checkData(1, 1, 10)
tdSql.query("select top(col5, 2) from test")
tdSql.checkRows(2)
tdSql.checkData(0, 1, 8.1)
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -52,7 +52,15 @@ class TDTestCase:
tdSql.error("select twa(col3) from test")
tdSql.error("select twa(col4) from test")
tdSql.error("select twa(col4) from test")
tdSql.error("select twa(col11) from test")
tdSql.error("select twa(col12) from test")
tdSql.error("select twa(col13) from test")
tdSql.error("select twa(col14) from test")
tdSql.error("select twa(col5) from test")
......@@ -79,6 +87,18 @@ class TDTestCase:
tdSql.error("select twa(col4) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col4) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col11) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col11) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col12) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col12) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col13) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col13) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col14) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col14) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col5) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col5) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
......
......@@ -34,11 +34,11 @@ class TDTestCase:
floatData = []
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''')
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using test tags('beijing')")
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
intData.append(i + 1)
floatData.append(i + 0.1)
......@@ -52,7 +52,15 @@ class TDTestCase:
tdSql.error("select twa(col3) from test")
tdSql.error("select twa(col4) from test")
tdSql.error("select twa(col4) from test")
tdSql.error("select twa(col11) from test")
tdSql.error("select twa(col12) from test")
tdSql.error("select twa(col13) from test")
tdSql.error("select twa(col14) from test")
tdSql.error("select twa(col5) from test")
......@@ -79,6 +87,18 @@ class TDTestCase:
tdSql.error("select twa(col4) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col4) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col11) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col11) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col12) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col12) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col13) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col13) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col14) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col14) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.error("select twa(col5) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
tdSql.query("select twa(col5) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum))
......
......@@ -36,7 +36,7 @@ class TDTestCase:
(i, i))
tdLog.info("insert earlier data")
tdSql.execute('insert into tb values (now - 5m , 10)')
tdSql.execute('insert into tb values (now - 5m , NULL)')
tdSql.execute('insert into tb values (now - 6m , 10)')
tdSql.execute('insert into tb values (now - 7m , NULL)')
tdSql.execute('insert into tb values (now - 8m , 254)')
......
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
tdLog.info('=============== step1')
tdLog.info('create table tb (ts timestamp, speed bigint unsigned)')
tdSql.execute('create table tb (ts timestamp, speed bigint unsigned)')
tdLog.info("insert into tb values (now, NULL)")
tdSql.execute("insert into tb values (now, NULL)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step2')
tdLog.info("insert into tb values (now+1m, -1) -x step2")
tdSql.error("insert into tb values (now+1m, -1) ")
tdLog.info("insert into tb values (now+1m, NULL)")
tdSql.execute("insert into tb values (now+1m, NULL)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(2)')
tdSql.checkRows(2)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step3')
tdLog.info("insert into tb values (now+2m, 18446744073709551614)")
tdSql.execute("insert into tb values (now+2m, 18446744073709551614)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(3)')
tdSql.checkRows(3)
tdLog.info('tdSql.checkData(0, 1, 18446744073709551614)')
tdSql.checkData(0, 1, 18446744073709551614)
tdLog.info('=============== step4')
tdLog.info("insert into tb values (now+3m, 18446744073709551615) -x step4")
tdSql.error("insert into tb values (now+3m, 18446744073709551615)")
tdLog.info("insert into tb values (now+3m, NULL)")
tdSql.execute("insert into tb values (now+3m, NULL)")
tdLog.info('select * from tb')
tdSql.query('select * from tb')
tdLog.info('tdSql.checkRow(4)')
tdSql.checkRows(4)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step5')
tdLog.info("insert into tb values (now+4m, a2)")
tdSql.error("insert into tb values (now+4m, a2)")
tdLog.info("insert into tb values (now-4m, -1)")
tdSql.error("insert into tb values (now-4m, -1)")
tdLog.info("insert into tb values (now+4m, 0)")
tdSql.execute("insert into tb values (now+4m, 0)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
tdLog.info('tdSql.checkData(0, 1, 0)')
tdSql.checkData(0, 1, 0)
tdLog.info('=============== step6')
tdLog.info("insert into tb values (now+5m, 2a)")
tdSql.error("insert into tb values (now+5m, 2a)")
tdLog.info("insert into tb values (now+5m, 2)")
tdSql.execute("insert into tb values (now+5m, 2)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(6)')
tdSql.checkRows(6)
tdLog.info('tdSql.checkData(0, 1, 2)')
tdSql.checkData(0, 1, 2)
tdLog.info('=============== step7')
tdLog.info("insert into tb values (now+6m, 2a'1)")
tdSql.error("insert into tb values (now+6m, 2a'1)")
tdLog.info("insert into tb values (now+6m, 2)")
tdSql.execute("insert into tb values (now+6m, 2)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(7)')
tdSql.checkRows(7)
tdLog.info('tdSql.checkData(0, 1, 2)')
tdSql.checkData(0, 1, 2)
tdLog.info('drop database db')
tdSql.execute('drop database db')
tdLog.info('show databases')
tdSql.query('show databases')
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
tdLog.info('=============== step1')
tdLog.info('create table tb (ts timestamp, speed int unsigned)')
tdSql.execute('create table tb (ts timestamp, speed int unsigned)')
tdLog.info("insert into tb values (now, NULL)")
tdSql.execute("insert into tb values (now, NULL)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step2')
tdLog.info("insert into tb values (now+1m, -1) -x step2")
tdSql.error("insert into tb values (now+1m, -1) ")
tdLog.info("insert into tb values (now+1m, NULL)")
tdSql.execute("insert into tb values (now+1m, NULL)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(2)')
tdSql.checkRows(2)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step3')
tdLog.info("insert into tb values (now+2m, 4294967294)")
tdSql.execute("insert into tb values (now+2m, 4294967294)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(3)')
tdSql.checkRows(3)
tdLog.info('tdSql.checkData(0, 1, 4294967294)')
tdSql.checkData(0, 1, 4294967294)
tdLog.info('=============== step4')
tdLog.info("insert into tb values (now+3m, 4294967295) -x step4")
tdSql.error("insert into tb values (now+3m, 4294967295)")
tdLog.info("insert into tb values (now+3m, NULL)")
tdSql.execute("insert into tb values (now+3m, NULL)")
tdLog.info('select * from tb')
tdSql.query('select * from tb')
tdLog.info('tdSql.checkRow(4)')
tdSql.checkRows(4)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step5')
tdLog.info("insert into tb values (now+4m, a2)")
tdSql.error("insert into tb values (now+4m, a2)")
tdLog.info("insert into tb values (now-4m, -1)")
tdSql.error("insert into tb values (now-4m, -1)")
tdLog.info("insert into tb values (now+4m, 0)")
tdSql.execute("insert into tb values (now+4m, 0)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
tdLog.info('tdSql.checkData(0, 1, 0)')
tdSql.checkData(0, 1, 0)
tdLog.info('=============== step6')
tdLog.info("insert into tb values (now+5m, 2a)")
tdSql.error("insert into tb values (now+5m, 2a)")
tdLog.info("insert into tb values (now+5m, 2)")
tdSql.execute("insert into tb values (now+5m, 2)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(6)')
tdSql.checkRows(6)
tdLog.info('tdSql.checkData(0, 1, 2)')
tdSql.checkData(0, 1, 2)
tdLog.info('=============== step7')
tdLog.info("insert into tb values (now+6m, 2a'1)")
tdSql.error("insert into tb values (now+6m, 2a'1)")
tdLog.info("insert into tb values (now+6m, 2)")
tdSql.execute("insert into tb values (now+6m, 2)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(7)')
tdSql.checkRows(7)
tdLog.info('tdSql.checkData(0, 1, 2)')
tdSql.checkData(0, 1, 2)
tdLog.info('drop database db')
tdSql.execute('drop database db')
tdLog.info('show databases')
tdSql.query('show databases')
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
tdLog.info('=============== step1')
tdLog.info('create table tb (ts timestamp, speed smallint unsigned)')
tdSql.execute('create table tb (ts timestamp, speed smallint unsigned)')
tdLog.info("insert into tb values (now, NULL)")
tdSql.execute("insert into tb values (now, NULL)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step2')
tdLog.info("insert into tb values (now+1m, -1) -x step2")
tdSql.error("insert into tb values (now+1m, -1) ")
tdLog.info("insert into tb values (now+1m, NULL)")
tdSql.execute("insert into tb values (now+1m, NULL)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(2)')
tdSql.checkRows(2)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step3')
tdLog.info("insert into tb values (now+2m, 65534)")
tdSql.execute("insert into tb values (now+2m, 65534)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(3)')
tdSql.checkRows(3)
tdLog.info('tdSql.checkData(0, 1, 65534)')
tdSql.checkData(0, 1, 65534)
tdLog.info('=============== step4')
tdLog.info("insert into tb values (now+3m, 65535) -x step4")
tdSql.error("insert into tb values (now+3m, 65535)")
tdLog.info("insert into tb values (now+3m, NULL)")
tdSql.execute("insert into tb values (now+3m, NULL)")
tdLog.info('select * from tb')
tdSql.query('select * from tb')
tdLog.info('tdSql.checkRow(4)')
tdSql.checkRows(4)
tdLog.info('tdSql.checkData(0, 1, null)')
tdSql.checkData(0, 1, None)
tdLog.info('=============== step5')
tdLog.info("insert into tb values (now+4m, a2)")
tdSql.error("insert into tb values (now+4m, a2)")
tdLog.info("insert into tb values (now-4m, -1)")
tdSql.error("insert into tb values (now-4m, -1)")
tdLog.info("insert into tb values (now+4m, 0)")
tdSql.execute("insert into tb values (now+4m, 0)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
tdLog.info('tdSql.checkData(0, 1, 0)')
tdSql.checkData(0, 1, 0)
tdLog.info('=============== step6')
tdLog.info("insert into tb values (now+5m, 2a)")
tdSql.error("insert into tb values (now+5m, 2a)")
tdLog.info("insert into tb values (now+5m, 2)")
tdSql.execute("insert into tb values (now+5m, 2)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(6)')
tdSql.checkRows(6)
tdLog.info('tdSql.checkData(0, 1, 2)')
tdSql.checkData(0, 1, 2)
tdLog.info('=============== step7')
tdLog.info("insert into tb values (now+6m, 2a'1)")
tdSql.error("insert into tb values (now+6m, 2a'1)")
tdLog.info("insert into tb values (now+6m, 2)")
tdSql.execute("insert into tb values (now+6m, 2)")
tdLog.info('select * from tb order by ts desc')
tdSql.query('select * from tb order by ts desc')
tdLog.info('tdSql.checkRow(7)')
tdSql.checkRows(7)
tdLog.info('tdSql.checkData(0, 1, 2)')
tdSql.checkData(0, 1, 2)
tdLog.info('drop database db')
tdSql.execute('drop database db')
tdLog.info('show databases')
tdSql.query('show databases')
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# convert end
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -95,7 +95,7 @@ class TDTestCase:
tdSql.query('show databases')
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# convert end
def stop(self):
tdSql.close()
......
......@@ -30,4 +30,10 @@ python3 ./test.py -f query/last_cache.py
python3 ./test.py -f query/last_row_cache.py
python3 ./test.py -f account/account_create.py
python3 ./test.py -f alter/alter_table.py
python3 ./test.py -f query/queryGroupbySort.py
\ No newline at end of file
python3 ./test.py -f query/queryGroupbySort.py
python3 ./test.py -f insert/unsignedInt.py
python3 ./test.py -f insert/unsignedBigint.py
python3 ./test.py -f insert/unsignedSmallint.py
python3 ./test.py -f insert/unsignedTinyint.py
python3 ./test.py -f query/filterAllUnsignedIntTypes.py
\ 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
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.powers = [8, 16, 32, 64]
self.types = ["tinyint", "smallint", "int", "bigint"]
self.rowNum = 10
self.ts = 1537146000000
def run(self):
tdSql.prepare()
for i in range(len(self.powers)):
curType = self.types[i]
print("======= Verify filter for %s type =========" % (curType))
tdLog.debug(
"create table st%s(ts timestamp, num %s unsigned) tags(id %s unsigned)" %
(curType, curType, curType))
tdSql.execute(
"create table st%s(ts timestamp, num %s unsigned) tags(id %s unsigned)" %
(curType, curType, curType))
# create 10 tables, insert 10 rows for each table
for j in range(self.rowNum):
tdSql.execute(
"create table st%s%d using st%s tags(%d)" %
(curType, j + 1, curType, j + 1))
for k in range(self.rowNum):
tdSql.execute(
"insert into st%s%d values(%d, %d)" %
(curType, j + 1, self.ts + k + 1, j * 10 + k + 1))
tdSql.error("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 11, pow(2, self.powers[i]) - 1 ))
tdSql.execute("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 12, pow(2, self.powers[i]) - 2 ))
tdSql.error("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 13, -1 ))
tdSql.execute("insert into st%s10 values(%d, %d)" %
(curType, self.ts + 14, 0 ))
# select all data
# tdSql.query("select * from st%s " % curType)
# tdSql.checkRows(102)
# > for int type on column
tdSql.query("select * from st%s where num > 50" % curType)
tdSql.checkRows(51)
# >= for int type on column
tdSql.query("select * from st%s where num >= 50" % curType)
tdSql.checkRows(52)
# = for int type on column
tdSql.query("select * from st%s where num = 50" % curType)
tdSql.checkRows(1)
# < for int type on column
tdSql.query("select * from st%s where num < 50" % curType)
tdSql.checkRows(50)
# <= for int type on column
tdSql.query("select * from st%s where num <= 50" % curType)
tdSql.checkRows(51)
# <> for int type on column
tdSql.query("select * from st%s where num <> 50" % curType)
tdSql.checkRows(101)
# != for int type on column
tdSql.query("select * from st%s where num != 50" % curType)
tdSql.checkRows(101)
# range for int type on column
tdSql.query(
"select * from st%s where num > 50 and num < 100" %
curType)
tdSql.checkRows(49)
tdSql.query(
"select * from st%s where num >= 50 and num < 100" %
curType)
tdSql.checkRows(50)
tdSql.query(
"select * from st%s where num > 50 and num <= 100" %
curType)
tdSql.checkRows(50)
tdSql.query(
"select * from st%s where num >= 50 and num <= 100" %
curType)
tdSql.checkRows(51)
# > for int type on tag
tdSql.query("select * from st%s where id > 5" % curType)
tdSql.checkRows(52)
# >= for int type on tag
tdSql.query("select * from st%s where id >= 5" % curType)
tdSql.checkRows(62)
# = for int type on tag
tdSql.query("select * from st%s where id = 5" % curType)
tdSql.checkRows(10)
# < for int type on tag
tdSql.query("select * from st%s where id < 5" % curType)
tdSql.checkRows(40)
# <= for int type on tag
tdSql.query("select * from st%s where id <= 5" % curType)
tdSql.checkRows(50)
# <> for int type on tag
tdSql.query("select * from st%s where id <> 5" % curType)
tdSql.checkRows(92)
# != for int type on tag
tdSql.query("select * from st%s where id != 5" % curType)
tdSql.checkRows(92)
# != for int type on tag
tdSql.query("select * from st%s where id != 5" % curType)
tdSql.checkRows(92)
# range for int type on tag
tdSql.query("select * from st%s where id > 5 and id < 7" % curType)
tdSql.checkRows(10)
tdSql.query(
"select * from st%s where id >= 5 and id < 7" %
curType)
tdSql.checkRows(20)
tdSql.query(
"select * from st%s where id > 5 and id <= 7" %
curType)
tdSql.checkRows(20)
tdSql.query(
"select * from st%s where id >= 5 and id <= 7" %
curType)
tdSql.checkRows(30)
print(
"======= Verify filter for %s type finished =========" %
curType)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -25,7 +25,7 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.types = ["tinyint", "smallint", "int", "bigint", "float", "double", "bool", "binary(10)", "nchar(10)"]
self.types = ["tinyint", "smallint", "int", "bigint", "float", "double", "bool", "binary(10)", "nchar(10)", "tinyint unsigned", "smallint unsigned", "int unsigned", "bigint unsigned"]
self.ts = 1537146000000
def checkNullValue(self, result):
......
......@@ -73,19 +73,19 @@ class TDTestCase:
print("======= step 1: create table and insert data =========")
tdLog.debug(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''')
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20), tbcol11 tinyint unsigned, tbcol12 smallint unsigned, tbcol13 int unsigned, tbcol14 bigint unsigned) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20), tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned)''')
tdSql.execute(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''')
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20), tbcol11 tinyint unsigned, tbcol12 smallint unsigned, tbcol13 int unsigned, tbcol14 bigint unsigned) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20), tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned)''')
for i in range(self.rowNum):
tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % (
i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1))
tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d', %d, %d, %d, %d)" % (
i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
for j in range(self.rowNum):
tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % (
i + 1, self.ts + 10 * (i + 1) + j + 1, j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1))
tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (
i + 1, self.ts + 10 * (i + 1) + j + 1, j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1, i + 1, i + 1, i + 1, i + 1))
print("======= step 2: verify order for each column =========")
# sort for timestamp in asc order
......
......@@ -141,6 +141,98 @@ class TDTestCase:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
tdLog.info('=============== step2-1')
# TSIM: $i = 2
i = 21
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int unsigned)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int unsigned)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog.info('alter table %s add tag tgcol4 int unsigned' % (mt))
tdSql.execute('alter table %s add tag tgcol4 int unsigned' % (mt))
tdLog.info('select * from %s where tgcol4=6' % (mt))
tdSql.query('select * from %s where tgcol4=6' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4 =4
tdLog.info('alter table %s set tag tgcol4 =4' % (tb))
tdSql.execute('alter table %s set tag tgcol4 =4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step2:
# TSIM:
......@@ -235,6 +327,96 @@ class TDTestCase:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
tdLog.info('=============== step3-1')
# TSIM: $i = 3
i = 31
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint unsigned, tgcol2 tinyint unsigned)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint unsigned, tgcol2 tinyint unsigned)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 tinyint
tdLog.info('alter table %s add tag tgcol4 tinyint unsigned' % (mt))
tdSql.execute('alter table %s add tag tgcol4 tinyint unsigned' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step3:
# TSIM:
......@@ -353,6 +535,120 @@ class TDTestCase:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
tdLog.info('=============== step4-1')
# TSIM: $i = 4
i = 41
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float)
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint unsigned, tgcol2 float)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint unsigned, tgcol2 float)' %
(mt))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog.info('select * from %s where tgcol2 = 2' % (mt))
tdSql.query('select * from %s where tgcol2 = 2' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog.info('tdSql.checkData(0, 3, 2.00000)')
tdSql.checkData(0, 3, 2.00000)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql describe $tb
tdLog.info('describe %s' % (tb))
tdSql.query('describe %s' % (tb))
# TSIM: if $data21 != BIGINT then
tdLog.info('tdSql.checkDataType(2, 1, "BIGINT UNSIGNED")')
tdSql.checkDataType(2, 1, "BIGINT")
# TSIM: return -1
# TSIM: endi
# TSIM: if $data31 != FLOAT then
tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")')
tdSql.checkDataType(3, 1, "FLOAT")
# TSIM: return -1
# TSIM: endi
# TSIM: if $data23 != 1 then
tdLog.info('tdSql.checkData(2, 3, TAG)')
tdSql.checkData(2, 3, "TAG")
# TSIM: return -1
# TSIM: endi
# TSIM: if $data33 != 2.000000 then
tdLog.info('tdSql.checkData(3, 3, 2.000000)')
tdSql.checkData(3, 3, "TAG")
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog.info('alter table %s drop tag tgcol2' % (mt))
tdSql.execute('alter table %s drop tag tgcol2' % (mt))
# TSIM: sql alter table $mt add tag tgcol4 float
tdLog.info('alter table %s add tag tgcol4 float' % (mt))
tdSql.execute('alter table %s add tag tgcol4 float' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog.info('select * from %s where tgcol4 = 4' % (mt))
tdSql.query('select * from %s where tgcol4 = 4' % (mt))
# TSIM: print $data01 $data02 $data03
tdLog.info('$data01 $data02 $data03')
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, 1)')
tdSql.checkData(0, 2, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog.info('tdSql.checkData(0, 3, 4.00000)')
tdSql.checkData(0, 3, 4.00000)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
tdSql.error('select * from %s where tgcol2 = 1' % (mt))
# TSIM: return -1
# TSIM: step4:
# TSIM:
......@@ -408,12 +704,18 @@ class TDTestCase:
# TSIM: sql alter table $mt add tag tgcol4 smallint
tdLog.info('alter table %s add tag tgcol4 smallint' % (mt))
tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt))
# TSIM: sql alter table $mt add tag tgcol5 smallint unsigned
tdLog.info('alter table %s add tag tgcol5 smallint unsigned' % (mt))
tdSql.execute('alter table %s add tag tgcol5 smallint unsigned' % (mt))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog.info('alter table %s set tag tgcol4=4' % (tb))
tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog.info('alter table %s set tag tgcol5=5' % (tb))
tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
# TSIM: sql reset query cache
tdLog.info('reset query cache')
tdSql.execute('reset query cache')
......@@ -441,6 +743,11 @@ class TDTestCase:
# TSIM: if $data03 != 4 then
tdLog.info('tdSql.checkData(0, 3, 4)')
tdSql.checkData(0, 3, 4)
tdSql.query('select * from %s where tgcol5 = 5' % (mt))
tdSql.checkRows(1)
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, 1.000000000)
tdSql.checkData(0, 4, 5)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -869,6 +869,91 @@ class TDTestCase:
# TSIM: sql alter table $mt drop tag tgcol6
tdLog.info('alter table %s drop tag tgcol6' % (mt))
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
tdLog.info('=============== step14')
# TSIM: $i = 14
i = 14
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
tb = "%s%d" % (tbPrefix, i)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
# double, tgcol6 binary(20))
tdLog.info(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int unsigned, tgcol3 smallint unsigned, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20), tgcol7 tinyint unsigned, tgcol8 bigint unsigned)' %
(mt))
tdSql.execute(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int unsigned, tgcol3 smallint unsigned, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20), tgcol7 tinyint unsigned, tgcol8 bigint unsigned)' %
(mt))
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog.info(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6", 7, 8 )' %
(tb, mt))
tdSql.execute(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6", 7, 8 )' %
(tb, mt))
# TSIM: sql insert into $tb values(now, 1)
tdLog.info('insert into %s values(now, 1)' % (tb))
tdSql.execute('insert into %s values(now, 1)' % (tb))
# TSIM: sql select * from $mt where tgcol1 = '1'
tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog.info('tdSql.checkData(0, 1, 1)')
tdSql.checkData(0, 1, 1)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog.info('tdSql.checkData(0, 2, "1")')
tdSql.checkData(0, 2, "1")
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2 then
tdLog.info('tdSql.checkData(0, 3, 2)')
tdSql.checkData(0, 3, 2)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data04 != 3 then
tdLog.info('tdSql.checkData(0, 4, 3)')
tdSql.checkData(0, 4, 3)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data05 != 4 then
tdLog.info('tdSql.checkData(0, 5, "4")')
tdSql.checkData(0, 5, "4")
# TSIM: return -1
# TSIM: endi
# TSIM: if $data06 != 5.000000000 then
tdLog.info('tdSql.checkData(0, 6, 5.000000000)')
tdSql.checkData(0, 6, 5.000000000)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data07 != 6 then
tdLog.info('tdSql.checkData(0, 7, "6")')
tdSql.checkData(0, 7, "6")
tdLog.info('tdSql.checkData(0, 8, 7)')
tdSql.checkData(0, 8, 7)
tdLog.info('tdSql.checkData(0, 9, 8)')
tdSql.checkData(0, 9, 8)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol3
tdLog.info('alter table %s drop tag tgcol3' % (mt))
tdSql.execute('alter table %s drop tag tgcol3' % (mt))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog.info('alter table %s drop tag tgcol4' % (mt))
tdSql.execute('alter table %s drop tag tgcol4' % (mt))
# TSIM: sql alter table $mt drop tag tgcol6
tdLog.info('alter table %s drop tag tgcol6' % (mt))
tdSql.execute('alter table %s drop tag tgcol6' % (mt))
tdLog.info('alter table %s drop tag tgcol8' % (mt))
tdSql.execute('alter table %s drop tag tgcol8' % (mt))
# TSIM:
# TSIM: sleep 5000
# TSIM:
......@@ -1556,7 +1641,7 @@ class TDTestCase:
# TSIM: print =============== step14
tdLog.info('=============== step14')
# TSIM: $i = 14
i = 14
i = 20
# TSIM: $mt = $mtPrefix . $i
mt = "%s%d" % (mtPrefix, i)
# TSIM: $tb = $tbPrefix . $i
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册