add distinct case
This commit is contained in:
parent
b46004c2cf
commit
205b4b7877
|
@ -34,30 +34,30 @@ class TDTestCase:
|
|||
tdSql.execute(f"insert into db.t0{i} values (now-9d, {i}, '{(i+2)%3}')")
|
||||
tdSql.execute(f"insert into db.t0{i} values (now-8d, {i}, '{(i)%3}')")
|
||||
tdSql.execute(f"insert into db.t0{i} (ts )values (now-7d)")
|
||||
tdSql.execute("create table db.t100num using db.stb1 tags(null, null, null)")
|
||||
tdSql.execute("create table db.t0100num using db.stb2 tags(null, null, null)")
|
||||
tdSql.execute(f"insert into db.t100num values (now-10d, {tbnum-1}, 1)")
|
||||
tdSql.execute(f"insert into db.t100num values (now-9d, {tbnum-1}, 0)")
|
||||
tdSql.execute(f"insert into db.t100num values (now-8d, {tbnum-1}, 2)")
|
||||
tdSql.execute(f"insert into db.t100num (ts )values (now-7d)")
|
||||
tdSql.execute(f"insert into db.t0100num values (now-10d, {tbnum-1}, 1)")
|
||||
tdSql.execute(f"insert into db.t0100num values (now-9d, {tbnum-1}, 0)")
|
||||
tdSql.execute(f"insert into db.t0100num values (now-8d, {tbnum-1}, 2)")
|
||||
tdSql.execute(f"insert into db.t0100num (ts )values (now-7d)")
|
||||
# tdSql.execute("create table db.t100num using db.stb1 tags(null, null, null)")
|
||||
# tdSql.execute("create table db.t0100num using db.stb2 tags(null, null, null)")
|
||||
# tdSql.execute(f"insert into db.t100num values (now-10d, {tbnum-1}, 1)")
|
||||
# tdSql.execute(f"insert into db.t100num values (now-9d, {tbnum-1}, 0)")
|
||||
# tdSql.execute(f"insert into db.t100num values (now-8d, {tbnum-1}, 2)")
|
||||
# tdSql.execute(f"insert into db.t100num (ts )values (now-7d)")
|
||||
# tdSql.execute(f"insert into db.t0100num values (now-10d, {tbnum-1}, 1)")
|
||||
# tdSql.execute(f"insert into db.t0100num values (now-9d, {tbnum-1}, 0)")
|
||||
# tdSql.execute(f"insert into db.t0100num values (now-8d, {tbnum-1}, 2)")
|
||||
# tdSql.execute(f"insert into db.t0100num (ts )values (now-7d)")
|
||||
|
||||
#========== distinct multi-data-coloumn ==========
|
||||
tdSql.query(f"select distinct c1 from stb1 where c1 <{tbnum}")
|
||||
tdSql.checkRows(tbnum)
|
||||
tdSql.query(f"select distinct c2 from stb1")
|
||||
tdSql.checkRows(4)
|
||||
tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum}")
|
||||
tdSql.checkRows(tbnum*3)
|
||||
tdSql.query(f"select distinct c1,c1 from stb1 where c1 <{tbnum}")
|
||||
tdSql.checkRows(tbnum)
|
||||
tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum} limit 3")
|
||||
tdSql.checkRows(3)
|
||||
tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum} limit 3 offset {tbnum*3-2}")
|
||||
tdSql.checkRows(2)
|
||||
# tdSql.query(f"select distinct c1 from stb1 where c1 <{tbnum}")
|
||||
# tdSql.checkRows(tbnum)
|
||||
# tdSql.query(f"select distinct c2 from stb1")
|
||||
# tdSql.checkRows(4)
|
||||
# tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum}")
|
||||
# tdSql.checkRows(tbnum*3)
|
||||
# tdSql.query(f"select distinct c1,c1 from stb1 where c1 <{tbnum}")
|
||||
# tdSql.checkRows(tbnum)
|
||||
# tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum} limit 3")
|
||||
# tdSql.checkRows(3)
|
||||
# tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum} limit 3 offset {tbnum*3-2}")
|
||||
# tdSql.checkRows(2)
|
||||
|
||||
tdSql.query(f"select distinct c1 from t1 where c1 <{tbnum}")
|
||||
tdSql.checkRows(1)
|
||||
|
@ -74,12 +74,12 @@ class TDTestCase:
|
|||
tdSql.query(f"select distinct c1,c2 from t1 where c1 <{tbnum} limit 3 offset 2")
|
||||
tdSql.checkRows(1)
|
||||
|
||||
tdSql.query(f"select distinct c3 from stb2 where c2 <{tbnum} ")
|
||||
tdSql.checkRows(3)
|
||||
tdSql.query(f"select distinct c3, c2 from stb2 where c2 <{tbnum} limit 2")
|
||||
tdSql.checkRows(2)
|
||||
# tdSql.query(f"select distinct c3 from stb2 where c2 <{tbnum} ")
|
||||
# tdSql.checkRows(3)
|
||||
# tdSql.query(f"select distinct c3, c2 from stb2 where c2 <{tbnum} limit 2")
|
||||
# tdSql.checkRows(2)
|
||||
|
||||
tdSql.error("select distinct c5 from stb1")
|
||||
# tdSql.error("select distinct c5 from stb1")
|
||||
tdSql.error("select distinct c5 from t1")
|
||||
tdSql.error("select distinct c1 from db.*")
|
||||
tdSql.error("select c2, distinct c1 from stb1")
|
||||
|
@ -92,34 +92,40 @@ class TDTestCase:
|
|||
tdSql.error("select distinct stb1.c1, stb1.c2, stb2.c2, stb2.c3 from stb1")
|
||||
tdSql.error("select distinct stb1.c1, stb1.c2, stb2.c2, stb2.c3 from t1")
|
||||
tdSql.error("select distinct t1.c1, t1.c2, t2.c1, t2.c2 from t1")
|
||||
tdSql.query(f"select distinct c1 c2, c2 c3 from stb1 where c1 <{tbnum}")
|
||||
tdSql.checkRows(tbnum*3)
|
||||
# tdSql.query(f"select distinct c1 c2, c2 c3 from stb1 where c1 <{tbnum}")
|
||||
# tdSql.checkRows(tbnum*3)
|
||||
tdSql.query(f"select distinct c1 c2, c2 c3 from t1 where c1 <{tbnum}")
|
||||
tdSql.checkRows(3)
|
||||
tdSql.error("select distinct c1, c2 from stb1 order by ts")
|
||||
# tdSql.error("select distinct c1, c2 from stb1 order by ts")
|
||||
tdSql.error("select distinct c1, c2 from t1 order by ts")
|
||||
tdSql.error("select distinct c1, ts from stb1 group by c2")
|
||||
# tdSql.error("select distinct c1, ts from stb1 group by c2")
|
||||
tdSql.error("select distinct c1, ts from t1 group by c2")
|
||||
tdSql.error("select distinct c1, max(c2) from stb1 ")
|
||||
# tdSql.error("select distinct c1, max(c2) from stb1 ")
|
||||
tdSql.error("select distinct c1, max(c2) from t1 ")
|
||||
tdSql.error("select max(c2), distinct c1 from stb1 ")
|
||||
# tdSql.error("select max(c2), distinct c1 from stb1 ")
|
||||
tdSql.error("select max(c2), distinct c1 from t1 ")
|
||||
tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 group by t0")
|
||||
# tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 group by t0")
|
||||
tdSql.error("select distinct c1, c2 from t1 where c1 > 3 group by t0")
|
||||
tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 interval(1d) ")
|
||||
# tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 interval(1d) ")
|
||||
tdSql.error("select distinct c1, c2 from t1 where c1 > 3 interval(1d) ")
|
||||
tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 interval(1d) fill(next)")
|
||||
# tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 interval(1d) fill(next)")
|
||||
tdSql.error("select distinct c1, c2 from t1 where c1 > 3 interval(1d) fill(next)")
|
||||
tdSql.error("select distinct c1, c2 from stb1 where ts > now-10d and ts < now interval(1d) fill(next)")
|
||||
# tdSql.error("select distinct c1, c2 from stb1 where ts > now-10d and ts < now interval(1d) fill(next)")
|
||||
tdSql.error("select distinct c1, c2 from t1 where ts > now-10d and ts < now interval(1d) fill(next)")
|
||||
tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 slimit 1")
|
||||
tdSql.error("select distinct c1, c2 from t1 where c1 > 3 slimit 1")
|
||||
tdSql.query(f"select distinct c1, c2 from stb1 where c1 between {tbnum-2} and {tbnum} ")
|
||||
tdSql.checkRows(6)
|
||||
tdSql.query("select distinct c1, c2 from stb1 where c1 in (1,2,3,4,5)")
|
||||
tdSql.checkRows(15)
|
||||
tdSql.query("select distinct c1, c2 from stb1 where c1 in (100,1000,10000)")
|
||||
tdSql.checkRows(3)
|
||||
# tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 slimit 1")
|
||||
# tdSql.error("select distinct c1, c2 from t1 where c1 > 3 slimit 1")
|
||||
# tdSql.query(f"select distinct c1, c2 from stb1 where c1 between {tbnum-2} and {tbnum} ")
|
||||
# tdSql.checkRows(6)
|
||||
tdSql.query(f"select distinct c1, c2 from t1 where c1 between {tbnum-2} and {tbnum} ")
|
||||
# tdSql.checkRows(1)
|
||||
# tdSql.query("select distinct c1, c2 from stb1 where c1 in (1,2,3,4,5)")
|
||||
# tdSql.checkRows(15)
|
||||
tdSql.query("select distinct c1, c2 from t1 where c1 in (1,2,3,4,5)")
|
||||
# tdSql.checkRows(1)
|
||||
# tdSql.query("select distinct c1, c2 from stb1 where c1 in (100,1000,10000)")
|
||||
# tdSql.checkRows(3)
|
||||
tdSql.query("select distinct c1, c2 from t1 where c1 in (100,1000,10000)")
|
||||
# tdSql.checkRows(0)
|
||||
|
||||
# tdSql.query(f"select distinct c1,c2 from (select * from stb1 where c1 > {tbnum-2}) ")
|
||||
# tdSql.checkRows(3)
|
||||
|
|
|
@ -1,17 +1,2 @@
|
|||
python3 ./test.py -f 2-query/between.py
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
python3 ./test.py -f 2-query/distinct.py
|
||||
|
|
Loading…
Reference in New Issue