提交 0e88426c 编写于 作者: P Ping Xiao

[TD-2152] <test> add test case for join query

上级 b12cf2fe
...@@ -55,9 +55,12 @@ class RestfulInsert: ...@@ -55,9 +55,12 @@ class RestfulInsert:
def insertUnlimitedData(self, threadID): def insertUnlimitedData(self, threadID):
print("thread %d started" % threadID) print("thread %d started" % threadID)
tablesPerThread = int (self.numOfTables / self.numOfThreads) tablesPerThread = int (self.numOfTables / self.numOfThreads)
count = 0
while True: while True:
i = 0 i = 0
start = self.ts start = self.ts + count * self.batchSize
count = count + 1
for i in range(tablesPerThread): for i in range(tablesPerThread):
tableID = i + threadID * tablesPerThread tableID = i + threadID * tablesPerThread
...@@ -65,7 +68,7 @@ class RestfulInsert: ...@@ -65,7 +68,7 @@ class RestfulInsert:
data = "insert into %s.%s%d values" % (self.dbname, self.tableNamePerfix, tableID) data = "insert into %s.%s%d values" % (self.dbname, self.tableNamePerfix, tableID)
values = [] values = []
for k in range(self.batchSize): for k in range(self.batchSize):
values.append("(%d, %d, %d, %d)" % (start + j * self.batchSize + k, random.randint(1, 100), random.randint(1, 100), random.randint(1, 100))) values.append("(%d, %d, %d, %d)" % (start + k, random.randint(1, 100), random.randint(1, 100), random.randint(1, 100)))
if(self.outOfOrder == False): if(self.outOfOrder == False):
for k in range(len(values)): for k in range(len(values)):
......
...@@ -376,11 +376,9 @@ class TDTestCase: ...@@ -376,11 +376,9 @@ class TDTestCase:
tdSql.execute("insert into t1 values(1538548685000, 1) (1538548685001, 2) (1538548685002, 3)") tdSql.execute("insert into t1 values(1538548685000, 1) (1538548685001, 2) (1538548685002, 3)")
tdSql.execute("insert into t2 values(1538548685000, 4) (1538548685001, 5) (1538548685002, 6)") tdSql.execute("insert into t2 values(1538548685000, 4) (1538548685001, 5) (1538548685002, 6)")
tdSql.query("select * from t1 where tag1 like '%g'") tdSql.error("select * from t1 where tag1 like '%g'")
tdSql.checkRows(3)
tdSql.query("select * from t2 where tag1 like '%g'") tdSql.error("select * from t2 where tag1 like '%g'")
tdSql.checkRows(3)
tdSql.query("select * from meters where tag1 like '%g'") tdSql.query("select * from meters where tag1 like '%g'")
tdSql.checkRows(6) tdSql.checkRows(6)
...@@ -396,20 +394,16 @@ class TDTestCase: ...@@ -396,20 +394,16 @@ class TDTestCase:
tdSql.execute("insert into t5 values(1538548685000, 1) (1538548685001, 2) (1538548685002, 3)") tdSql.execute("insert into t5 values(1538548685000, 1) (1538548685001, 2) (1538548685002, 3)")
tdSql.execute("insert into t6 values(1538548685000, 1) (1538548685001, 2) (1538548685002, 3)") tdSql.execute("insert into t6 values(1538548685000, 1) (1538548685001, 2) (1538548685002, 3)")
tdSql.query("select * from t3 where tag1 like '%京'") tdSql.error("select * from t3 where tag1 like '%京'")
tdSql.checkRows(3)
tdSql.query("select * from t4 where tag1 like '%京'") tdSql.error("select * from t4 where tag1 like '%京'")
tdSql.checkRows(3)
tdSql.query("select * from meters1 where tag1 like '%京'") tdSql.query("select * from meters1 where tag1 like '%京'")
tdSql.checkRows(6) tdSql.checkRows(6)
tdSql.query("select * from t5 where tag1 like '%g'") tdSql.error("select * from t5 where tag1 like '%g'")
tdSql.checkRows(3)
tdSql.query("select * from t6 where tag1 like '%g'") tdSql.error("select * from t6 where tag1 like '%g'")
tdSql.checkRows(3)
tdSql.query("select * from meters1 where tag1 like '%g'") tdSql.query("select * from meters1 where tag1 like '%g'")
tdSql.checkRows(6) tdSql.checkRows(6)
......
...@@ -175,6 +175,8 @@ class TDTestCase: ...@@ -175,6 +175,8 @@ class TDTestCase:
tdSql.error("select count(join_mt0.c1), first(join_mt0.c1)-first(join_mt1.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts") tdSql.error("select count(join_mt0.c1), first(join_mt0.c1)-first(join_mt1.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts")
tdSql.error("select count(join_mt0.c1), first(join_mt0.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2 order by join_mt0.t1 desc slimit 3") tdSql.error("select count(join_mt0.c1), first(join_mt0.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2 order by join_mt0.t1 desc slimit 3")
tdSql.error("select count(join_mt0.c1), first(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2, join_mt1.t1 order by join_mt0.ts desc, join_mt1.ts asc limit 10;") tdSql.error("select count(join_mt0.c1), first(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2, join_mt1.t1 order by join_mt0.ts desc, join_mt1.ts asc limit 10;")
tdSql.error("select join_mt1.c1,join_mt0.c1 from join_mt1,join_mt0 where join_mt1.ts = join_mt0.ts and join_mt1.t1 = join_mt0.t1 order by t")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册