[TD-2742]<test>modify case for unsigned
This commit is contained in:
parent
0bcecce064
commit
0b4f0680d3
|
@ -154,6 +154,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
|
||||
|
|
|
@ -54,18 +54,6 @@ class TDTestCase:
|
|||
tdSql.query("select diff(col6) from test1")
|
||||
tdSql.checkRows(0)
|
||||
|
||||
tdSql.query("select diff(col11) from test1")
|
||||
tdSql.checkRows(0)
|
||||
|
||||
tdSql.query("select diff(col12) from test1")
|
||||
tdSql.checkRows(0)
|
||||
|
||||
tdSql.query("select diff(col13) from test1")
|
||||
tdSql.checkRows(0)
|
||||
|
||||
tdSql.query("select diff(col14) from test1")
|
||||
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', %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))
|
||||
|
@ -84,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)
|
||||
|
||||
|
@ -97,18 +94,6 @@ class TDTestCase:
|
|||
tdSql.query("select diff(col4) from test1")
|
||||
tdSql.checkRows(10)
|
||||
|
||||
tdSql.query("select diff(col11) from test1")
|
||||
tdSql.checkRows(10)
|
||||
|
||||
tdSql.query("select diff(col12) from test1")
|
||||
tdSql.checkRows(10)
|
||||
|
||||
tdSql.query("select diff(col13) from test1")
|
||||
tdSql.checkRows(10)
|
||||
|
||||
tdSql.query("select diff(col14) from test1")
|
||||
tdSql.checkRows(10)
|
||||
|
||||
tdSql.query("select diff(col5) from test1")
|
||||
tdSql.checkRows(10)
|
||||
|
||||
|
|
|
@ -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.err("select diff(col11) from test1")
|
||||
tdSql.err("select diff(col12) from test1")
|
||||
tdSql.err("select diff(col13) from test1")
|
||||
tdSql.err("select diff(col14) from test1")
|
||||
tdSql.err("select diff(col11) from test")
|
||||
tdSql.err("select diff(col12) from test")
|
||||
tdSql.err("select diff(col13) from test")
|
||||
tdSql.err("select diff(col14) from test")
|
||||
|
||||
tdSql.query("select diff(col1) from test1")
|
||||
tdSql.checkRows(10)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
@ -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)
|
||||
|
|
|
@ -48,6 +48,14 @@ 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.error("select leastsquares(col11, 1, 1) from test1")
|
||||
tdSql.error("select leastsquares(col12, 1, 1) from test1")
|
||||
tdSql.error("select leastsquares(col13, 1, 1) from test1")
|
||||
tdSql.error("select leastsquares(col14, 1, 1) from test1")
|
||||
|
||||
tdSql.query("select leastsquares(col1, 1, 1) from test1")
|
||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -33,7 +33,7 @@ class TDTestCase:
|
|||
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), 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")
|
||||
|
@ -73,6 +73,14 @@ class TDTestCase:
|
|||
tdSql.error("select spread(col8) from test1")
|
||||
tdSql.error("select spread(col9) from test")
|
||||
tdSql.error("select spread(col9) from test1")
|
||||
tdSql.error("select spread(col11) from test")
|
||||
tdSql.error("select spread(col11) from test1")
|
||||
tdSql.error("select spread(col12) from test")
|
||||
tdSql.error("select spread(col12) from test1")
|
||||
tdSql.error("select spread(col13) from test")
|
||||
tdSql.error("select spread(col13) from test1")
|
||||
tdSql.error("select spread(col14) from test")
|
||||
tdSql.error("select spread(col14) from test1")
|
||||
|
||||
tdSql.query("select spread(col1) from test1")
|
||||
tdSql.checkRows(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))
|
||||
|
||||
|
|
|
@ -32,11 +32,17 @@ 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()
|
||||
|
@ -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()
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -35,4 +35,5 @@ 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 insert/unsignedTinyint.py
|
||||
python3 ./test.py -f query/filterAllUnsignedIntTypes.py
|
|
@ -0,0 +1,176 @@
|
|||
###################################################################
|
||||
# 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,93 @@ 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))
|
||||
tdLog.info('alter table %s drop tag tgcol9' % (mt))
|
||||
tdSql.execute('alter table %s drop tag tgcol9' % (mt))
|
||||
# TSIM:
|
||||
# TSIM: sleep 5000
|
||||
# TSIM:
|
||||
|
|
Loading…
Reference in New Issue