fix
This commit is contained in:
parent
3b4f730faa
commit
e3ad650969
|
@ -63,13 +63,13 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, 11)
|
tdSql.checkData(0, 0, 11)
|
||||||
|
|
||||||
tdSql.query("select count(col11) from test")
|
tdSql.query("select count(col11) from test")
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 11)
|
||||||
tdSql.query("select count(col12) from test")
|
tdSql.query("select count(col12) from test")
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 11)
|
||||||
tdSql.query("select count(col13) from test")
|
tdSql.query("select count(col13) from test")
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 11)
|
||||||
tdSql.query("select count(col14) from test")
|
tdSql.query("select count(col14) from test")
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 11)
|
||||||
|
|
||||||
#tdSql.execute("alter table test add column col10 int")
|
#tdSql.execute("alter table test add column col10 int")
|
||||||
#tdSql.query("select count(col10) from test")
|
#tdSql.query("select count(col10) from test")
|
||||||
|
|
|
@ -71,14 +71,14 @@ class TDTestCase:
|
||||||
tdSql.error("select diff(col8) from test")
|
tdSql.error("select diff(col8) from test")
|
||||||
tdSql.error("select diff(col8) from test1")
|
tdSql.error("select diff(col8) from test1")
|
||||||
tdSql.error("select diff(col9) from test")
|
tdSql.error("select diff(col9) from test")
|
||||||
tdSql.err("select diff(col11) from test1")
|
tdSql.error("select diff(col11) from test1")
|
||||||
tdSql.err("select diff(col12) from test1")
|
tdSql.error("select diff(col12) from test1")
|
||||||
tdSql.err("select diff(col13) from test1")
|
tdSql.error("select diff(col13) from test1")
|
||||||
tdSql.err("select diff(col14) from test1")
|
tdSql.error("select diff(col14) from test1")
|
||||||
tdSql.err("select diff(col11) from test")
|
tdSql.error("select diff(col11) from test")
|
||||||
tdSql.err("select diff(col12) from test")
|
tdSql.error("select diff(col12) from test")
|
||||||
tdSql.err("select diff(col13) from test")
|
tdSql.error("select diff(col13) from test")
|
||||||
tdSql.err("select diff(col14) from test")
|
tdSql.error("select diff(col14) from test")
|
||||||
|
|
||||||
tdSql.query("select diff(col1) from test1")
|
tdSql.query("select diff(col1) from test1")
|
||||||
tdSql.checkRows(10)
|
tdSql.checkRows(10)
|
||||||
|
|
|
@ -52,10 +52,6 @@ class TDTestCase:
|
||||||
tdSql.error("select leastsquares(col12, 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(col13, 1, 1) from test")
|
||||||
tdSql.error("select leastsquares(col14, 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.query("select leastsquares(col1, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
||||||
|
@ -69,6 +65,18 @@ class TDTestCase:
|
||||||
tdSql.query("select leastsquares(col4, 1, 1) from test1")
|
tdSql.query("select leastsquares(col4, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
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.query("select leastsquares(col5, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
|
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.query("select leastsquares(col4, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}')
|
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.query("select leastsquares(col5, 1, 1) from test1")
|
||||||
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
|
tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}')
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, 2.0)
|
tdSql.checkData(0, 0, 2.0)
|
||||||
|
|
||||||
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
|
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 + col11 + col12 + col13 + col14 from test1")
|
||||||
tdSql.checkRows(10)
|
tdSql.checkRows(11)
|
||||||
tdSql.checkData(0, 0, 7.2)
|
tdSql.checkData(0, 0, 7.2)
|
||||||
|
|
||||||
#tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
|
#tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11))
|
||||||
|
|
|
@ -55,6 +55,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 0)
|
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.query("select spread(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 0)
|
tdSql.checkData(0, 0, 0)
|
||||||
|
@ -73,14 +89,6 @@ class TDTestCase:
|
||||||
tdSql.error("select spread(col8) from test1")
|
tdSql.error("select spread(col8) from test1")
|
||||||
tdSql.error("select spread(col9) from test")
|
tdSql.error("select spread(col9) from test")
|
||||||
tdSql.error("select spread(col9) from test1")
|
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.query("select spread(col1) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
@ -98,6 +106,22 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 10)
|
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.query("select spread(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 9.1)
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
|
|
@ -36,16 +36,8 @@ class TDTestCase:
|
||||||
tdSql.error("select spread(col8) from test1")
|
tdSql.error("select spread(col8) from test1")
|
||||||
tdSql.error("select spread(col9) from test")
|
tdSql.error("select spread(col9) from test")
|
||||||
tdSql.error("select spread(col9) from test1")
|
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.query("select spread(col1) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 10)
|
tdSql.checkData(0, 0, 10)
|
||||||
|
|
||||||
|
@ -61,6 +53,23 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 10)
|
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.query("select spread(col5) from test1")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 9.1)
|
tdSql.checkData(0, 0, 9.1)
|
||||||
|
|
|
@ -1,108 +0,0 @@
|
||||||
# -*- 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, 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, 254)')
|
|
||||||
tdSql.checkData(0, 1, 254)
|
|
||||||
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())
|
|
|
@ -954,8 +954,6 @@ class TDTestCase:
|
||||||
tdSql.execute('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))
|
tdLog.info('alter table %s drop tag tgcol8' % (mt))
|
||||||
tdSql.execute('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:
|
||||||
# TSIM: sleep 5000
|
# TSIM: sleep 5000
|
||||||
# TSIM:
|
# TSIM:
|
||||||
|
@ -1643,7 +1641,7 @@ class TDTestCase:
|
||||||
# TSIM: print =============== step14
|
# TSIM: print =============== step14
|
||||||
tdLog.info('=============== step14')
|
tdLog.info('=============== step14')
|
||||||
# TSIM: $i = 14
|
# TSIM: $i = 14
|
||||||
i = 14
|
i = 20
|
||||||
# TSIM: $mt = $mtPrefix . $i
|
# TSIM: $mt = $mtPrefix . $i
|
||||||
mt = "%s%d" % (mtPrefix, i)
|
mt = "%s%d" % (mtPrefix, i)
|
||||||
# TSIM: $tb = $tbPrefix . $i
|
# TSIM: $tb = $tbPrefix . $i
|
||||||
|
|
Loading…
Reference in New Issue