few variables need reset after prepare called.
This commit is contained in:
parent
6e250f58ef
commit
ab47133213
|
@ -87,7 +87,7 @@ class TDTestCase:
|
||||||
|
|
||||||
# <> for timestamp type
|
# <> for timestamp type
|
||||||
tdSql.query("select * from db.st where ts <> '2020-05-13 10:00:00.002'")
|
tdSql.query("select * from db.st where ts <> '2020-05-13 10:00:00.002'")
|
||||||
#tdSql.checkRows(4)
|
# tdSql.checkRows(4)
|
||||||
|
|
||||||
# <> for numeric type
|
# <> for numeric type
|
||||||
tdSql.query("select * from db.st where tagtype <> 2")
|
tdSql.query("select * from db.st where tagtype <> 2")
|
||||||
|
@ -96,7 +96,7 @@ class TDTestCase:
|
||||||
# <> for nchar type
|
# <> for nchar type
|
||||||
tdSql.query("select * from db.st where name <> 'first'")
|
tdSql.query("select * from db.st where name <> 'first'")
|
||||||
tdSql.checkRows(4)
|
tdSql.checkRows(4)
|
||||||
|
|
||||||
# % for nchar type
|
# % for nchar type
|
||||||
tdSql.query("select * from db.st where name like 'fi%'")
|
tdSql.query("select * from db.st where name like 'fi%'")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
|
|
|
@ -42,14 +42,17 @@ class TDTestCase:
|
||||||
('2020-05-13 10:00:00.005', 3, 'third')""")
|
('2020-05-13 10:00:00.005', 3, 'third')""")
|
||||||
|
|
||||||
# query with filter condition A OR condition B
|
# query with filter condition A OR condition B
|
||||||
tdSql.query("select * from db.st where ts > '2020-05-13 10:00:00.002' AND tagtype < 2")
|
tdSql.query(
|
||||||
|
"select * from db.st where ts > '2020-05-13 10:00:00.002' AND tagtype < 2")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
# query with filter condition A OR condition B, error expected
|
# query with filter condition A OR condition B, error expected
|
||||||
tdSql.error("select * from db.st where ts > '2020-05-13 10:00:00.002' OR tagtype < 2")
|
tdSql.error(
|
||||||
|
"select * from db.st where ts > '2020-05-13 10:00:00.002' OR tagtype < 2")
|
||||||
|
|
||||||
# illegal condition
|
# illegal condition
|
||||||
tdSql.error("select * from db.st where ts != '2020-05-13 10:00:00.002' OR tagtype < 2")
|
tdSql.error(
|
||||||
|
"select * from db.st where ts != '2020-05-13 10:00:00.002' OR tagtype < 2")
|
||||||
tdSql.error("select * from db.st where tagtype <> 1 OR tagtype < 2")
|
tdSql.error("select * from db.st where tagtype <> 1 OR tagtype < 2")
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|
|
@ -41,18 +41,17 @@ class TDTestCase:
|
||||||
('2020-05-13 10:00:00.002', 3, 'third') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first'), ('2020-05-13 10:00:00.004', 2, 'second'),
|
('2020-05-13 10:00:00.002', 3, 'third') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first'), ('2020-05-13 10:00:00.004', 2, 'second'),
|
||||||
('2020-05-13 10:00:00.005', 3, 'third')""")
|
('2020-05-13 10:00:00.005', 3, 'third')""")
|
||||||
|
|
||||||
|
|
||||||
# query first .. as ..
|
# query first .. as ..
|
||||||
tdSql.error("select first(*) as one from st")
|
tdSql.error("select first(*) as one from st")
|
||||||
|
|
||||||
# query last .. as ..
|
# query last .. as ..
|
||||||
tdSql.error("select last(*) as latest from st")
|
tdSql.error("select last(*) as latest from st")
|
||||||
|
|
||||||
# query last row .. as ..
|
# query last row .. as ..
|
||||||
tdSql.error("select last_row as latest from st")
|
tdSql.error("select last_row as latest from st")
|
||||||
|
|
||||||
# query distinct on normal colnum
|
# query distinct on normal colnum
|
||||||
tdSql.error("select distinct tagtype from st")
|
tdSql.error("select distinct tagtype from st")
|
||||||
|
|
||||||
# query .. order by non-time field
|
# query .. order by non-time field
|
||||||
tdSql.error("select * from st order by name")
|
tdSql.error("select * from st order by name")
|
||||||
|
|
|
@ -28,17 +28,20 @@ class TDTestCase:
|
||||||
|
|
||||||
print("==============step1")
|
print("==============step1")
|
||||||
|
|
||||||
tdSql.execute("create table stb1 (ts timestamp, c1 int, c2 float) tags(t1 int, t2 binary(10), t3 nchar(10))")
|
tdSql.execute(
|
||||||
tdSql.execute("insert into tb1 using stb1 tags(1,'tb1', '表1') values ('2020-04-18 15:00:00.000', 1, 0.1), ('2020-04-18 15:00:01.000', 2, 0.1)")
|
"create table stb1 (ts timestamp, c1 int, c2 float) tags(t1 int, t2 binary(10), t3 nchar(10))")
|
||||||
tdSql.execute("insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)")
|
tdSql.execute(
|
||||||
|
"insert into tb1 using stb1 tags(1,'tb1', '表1') values ('2020-04-18 15:00:00.000', 1, 0.1), ('2020-04-18 15:00:01.000', 2, 0.1)")
|
||||||
# inner join --- bug
|
tdSql.execute(
|
||||||
|
"insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)")
|
||||||
|
|
||||||
|
# inner join --- bug
|
||||||
tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts")
|
tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
# join 3 tables -- bug exists
|
# join 3 tables -- bug exists
|
||||||
tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id")
|
tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id")
|
||||||
|
|
||||||
# query show stable
|
# query show stable
|
||||||
tdSql.query("show stables")
|
tdSql.query("show stables")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
@ -51,15 +54,15 @@ class TDTestCase:
|
||||||
tdSql.query("select count(*) from stb1")
|
tdSql.query("select count(*) from stb1")
|
||||||
tdSql.checkData(0, 0, 4)
|
tdSql.checkData(0, 0, 4)
|
||||||
|
|
||||||
# query first
|
# query first
|
||||||
tdSql.query("select first(*) from stb1")
|
tdSql.query("select first(*) from stb1")
|
||||||
tdSql.checkData(0, 1, 1)
|
tdSql.checkData(0, 1, 1)
|
||||||
|
|
||||||
# query last
|
# query last
|
||||||
tdSql.query("select last(*) from stb1")
|
tdSql.query("select last(*) from stb1")
|
||||||
tdSql.checkData(0, 1, 4)
|
tdSql.checkData(0, 1, 4)
|
||||||
|
|
||||||
# query last_row
|
# query last_row
|
||||||
tdSql.query("select last_row(*) from stb1")
|
tdSql.query("select last_row(*) from stb1")
|
||||||
tdSql.checkData(0, 1, 4)
|
tdSql.checkData(0, 1, 4)
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ class TDTestCase:
|
||||||
# query first ... as
|
# query first ... as
|
||||||
tdSql.query("select first(*) as begin from stb1")
|
tdSql.query("select first(*) as begin from stb1")
|
||||||
tdSql.checkData(0, 1, 1)
|
tdSql.checkData(0, 1, 1)
|
||||||
|
|
||||||
# query last ... as
|
# query last ... as
|
||||||
tdSql.query("select last(*) as end from stb1")
|
tdSql.query("select last(*) as end from stb1")
|
||||||
tdSql.checkData(0, 1, 4)
|
tdSql.checkData(0, 1, 4)
|
||||||
|
@ -93,7 +96,7 @@ class TDTestCase:
|
||||||
|
|
||||||
# query ... alias for table ---- bug
|
# query ... alias for table ---- bug
|
||||||
tdSql.query("select t.ts from tb1 t")
|
tdSql.query("select t.ts from tb1 t")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
# query ... tbname
|
# query ... tbname
|
||||||
tdSql.query("select tbname from stb1")
|
tdSql.query("select tbname from stb1")
|
||||||
|
|
|
@ -111,7 +111,6 @@ class Test (threading.Thread):
|
||||||
last_tb)
|
last_tb)
|
||||||
written = written + 1
|
written = written + 1
|
||||||
|
|
||||||
|
|
||||||
def drop_stable(self):
|
def drop_stable(self):
|
||||||
tdLog.info("drop_stable")
|
tdLog.info("drop_stable")
|
||||||
global last_stb
|
global last_stb
|
||||||
|
@ -152,7 +151,6 @@ class Test (threading.Thread):
|
||||||
last_tb = ""
|
last_tb = ""
|
||||||
written = 0
|
written = 0
|
||||||
|
|
||||||
|
|
||||||
def query_data_from_stable(self):
|
def query_data_from_stable(self):
|
||||||
tdLog.info("query_data_from_stable")
|
tdLog.info("query_data_from_stable")
|
||||||
global last_stb
|
global last_stb
|
||||||
|
@ -164,7 +162,6 @@ class Test (threading.Thread):
|
||||||
tdLog.info("will query data from super table")
|
tdLog.info("will query data from super table")
|
||||||
tdSql.execute('select * from %s' % last_stb)
|
tdSql.execute('select * from %s' % last_stb)
|
||||||
|
|
||||||
|
|
||||||
def reset_query_cache(self):
|
def reset_query_cache(self):
|
||||||
tdLog.info("reset_query_cache")
|
tdLog.info("reset_query_cache")
|
||||||
global last_tb
|
global last_tb
|
||||||
|
@ -232,7 +229,7 @@ class Test (threading.Thread):
|
||||||
self.threadLock.acquire()
|
self.threadLock.acquire()
|
||||||
tdLog.notice("first thread")
|
tdLog.notice("first thread")
|
||||||
randDataOp = random.randint(1, 3)
|
randDataOp = random.randint(1, 3)
|
||||||
dataOp.get(randDataOp , lambda: "ERROR")()
|
dataOp.get(randDataOp, lambda: "ERROR")()
|
||||||
self.threadLock.release()
|
self.threadLock.release()
|
||||||
|
|
||||||
elif (self.threadId == 2):
|
elif (self.threadId == 2):
|
||||||
|
|
|
@ -111,7 +111,6 @@ class Test (threading.Thread):
|
||||||
last_tb)
|
last_tb)
|
||||||
written = written + 1
|
written = written + 1
|
||||||
|
|
||||||
|
|
||||||
def drop_stable(self):
|
def drop_stable(self):
|
||||||
tdLog.info("drop_stable")
|
tdLog.info("drop_stable")
|
||||||
global last_stb
|
global last_stb
|
||||||
|
@ -154,7 +153,6 @@ class Test (threading.Thread):
|
||||||
last_tb = ""
|
last_tb = ""
|
||||||
written = 0
|
written = 0
|
||||||
|
|
||||||
|
|
||||||
def query_data_from_stable(self):
|
def query_data_from_stable(self):
|
||||||
tdLog.info("query_data_from_stable")
|
tdLog.info("query_data_from_stable")
|
||||||
global last_stb
|
global last_stb
|
||||||
|
@ -166,7 +164,6 @@ class Test (threading.Thread):
|
||||||
tdLog.info("will query data from super table")
|
tdLog.info("will query data from super table")
|
||||||
tdSql.execute('select * from %s' % last_stb)
|
tdSql.execute('select * from %s' % last_stb)
|
||||||
|
|
||||||
|
|
||||||
def reset_query_cache(self):
|
def reset_query_cache(self):
|
||||||
tdLog.info("reset_query_cache")
|
tdLog.info("reset_query_cache")
|
||||||
global last_tb
|
global last_tb
|
||||||
|
@ -230,7 +227,7 @@ class Test (threading.Thread):
|
||||||
self.threadLock.acquire()
|
self.threadLock.acquire()
|
||||||
tdLog.notice("first thread")
|
tdLog.notice("first thread")
|
||||||
randDataOp = random.randint(1, 3)
|
randDataOp = random.randint(1, 3)
|
||||||
dataOp.get(randDataOp , lambda: "ERROR")()
|
dataOp.get(randDataOp, lambda: "ERROR")()
|
||||||
self.threadLock.release()
|
self.threadLock.release()
|
||||||
|
|
||||||
elif (self.threadId == 2):
|
elif (self.threadId == 2):
|
||||||
|
|
|
@ -112,7 +112,6 @@ class Test:
|
||||||
tdSql.execute('drop table %s' % self.last_stb)
|
tdSql.execute('drop table %s' % self.last_stb)
|
||||||
self.last_stb = ""
|
self.last_stb = ""
|
||||||
|
|
||||||
|
|
||||||
def query_data_from_stable(self):
|
def query_data_from_stable(self):
|
||||||
tdLog.info("query_data_from_stable")
|
tdLog.info("query_data_from_stable")
|
||||||
if (self.last_stb == ""):
|
if (self.last_stb == ""):
|
||||||
|
@ -122,20 +121,21 @@ class Test:
|
||||||
tdLog.info("will query data from super table")
|
tdLog.info("will query data from super table")
|
||||||
tdSql.execute('select * from %s' % self.last_stb)
|
tdSql.execute('select * from %s' % self.last_stb)
|
||||||
|
|
||||||
|
|
||||||
def restart_database(self):
|
def restart_database(self):
|
||||||
tdLog.info("restart_databae")
|
tdLog.info("restart_databae")
|
||||||
tdDnodes.stop(1)
|
tdDnodes.stop(1)
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
tdLog.sleep(5)
|
tdLog.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
def force_restart_database(self):
|
def force_restart_database(self):
|
||||||
tdLog.info("force_restart_database")
|
tdLog.info("force_restart_database")
|
||||||
tdDnodes.forcestop(1)
|
tdDnodes.forcestop(1)
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
tdLog.sleep(5)
|
tdLog.sleep(5)
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
self.last_tb = ""
|
||||||
|
self.last_stb = ""
|
||||||
|
self.written = 0
|
||||||
|
|
||||||
def drop_table(self):
|
def drop_table(self):
|
||||||
tdLog.info("drop_table")
|
tdLog.info("drop_table")
|
||||||
|
@ -159,6 +159,9 @@ class Test:
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
tdLog.sleep(5)
|
tdLog.sleep(5)
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
self.last_tb = ""
|
||||||
|
self.last_stb = ""
|
||||||
|
self.written = 0
|
||||||
|
|
||||||
def delete_datafiles(self):
|
def delete_datafiles(self):
|
||||||
tdLog.info("delete_datafiles")
|
tdLog.info("delete_datafiles")
|
||||||
|
@ -173,6 +176,9 @@ class Test:
|
||||||
tdDnodes.start(1)
|
tdDnodes.start(1)
|
||||||
tdLog.sleep(10)
|
tdLog.sleep(10)
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
|
self.last_tb = ""
|
||||||
|
self.last_stb = ""
|
||||||
|
self.written = 0
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
|
|
Loading…
Reference in New Issue