未验证 提交 150269b6 编写于 作者: W wenzhouwww 提交者: GitHub

Merge pull request #14077 from taosdata/test/sample_for_selective

test : add case for selective query about sample function 
...@@ -624,8 +624,7 @@ class TDTestCase: ...@@ -624,8 +624,7 @@ class TDTestCase:
tdLog.info(" sample data is in datas groups ,successed sql is : %s" % sample_query ) tdLog.info(" sample data is in datas groups ,successed sql is : %s" % sample_query )
else: else:
tdLog.exit(" sample data is not in datas groups ,failed sql is : %s" % sample_query ) tdLog.exit(" sample data is not in datas groups ,failed sql is : %s" % sample_query )
def basic_sample_query(self): def basic_sample_query(self):
tdSql.execute(" drop database if exists db ") tdSql.execute(" drop database if exists db ")
tdSql.execute(" create database if not exists db duration 300 ") tdSql.execute(" create database if not exists db duration 300 ")
...@@ -760,6 +759,14 @@ class TDTestCase: ...@@ -760,6 +759,14 @@ class TDTestCase:
self.check_sample("select sample( c1 ,3 ) from t1 where c1 between 1 and 10" ,"select c1 from t1 where c1 between 1 and 10") self.check_sample("select sample( c1 ,3 ) from t1 where c1 between 1 and 10" ,"select c1 from t1 where c1 between 1 and 10")
tdSql.query("select sample(c1,2) ,c2,c3 ,c5 from stb1")
tdSql.checkRows(2)
tdSql.checkCols(4)
self.check_sample("select sample( c1 ,3 ),c2,c3,c4,c5 from t1 where c1 between 1 and 10" ,"select c1,c2,c3,c4,c5 from t1 where c1 between 1 and 10")
self.check_sample("select sample( c1 ,3 ),c2,c3,c4,c5 from stb1 where c1 between 1 and 10" ,"select c1,c2,c3,c4,c5 from stb1 where c1 between 1 and 10")
self.check_sample("select sample( c1 ,3 ),t1 from stb1 where c1 between 1 and 10" ,"select c1,t1 from stb1 where c1 between 1 and 10")
# join # join
tdSql.query("select sample( ct4.c1 , 1 ) from ct1, ct4 where ct4.ts=ct1.ts") tdSql.query("select sample( ct4.c1 , 1 ) from ct1, ct4 where ct4.ts=ct1.ts")
...@@ -772,8 +779,8 @@ class TDTestCase: ...@@ -772,8 +779,8 @@ class TDTestCase:
self.check_sample("select sample(c1,2) from stb1 partition by tbname" , "select c1 from stb1 partition by tbname") self.check_sample("select sample(c1,2) from stb1 partition by tbname" , "select c1 from stb1 partition by tbname")
# nest query # nest query
# tdSql.query("select sample(c1,2) from (select c1 from t1); ") tdSql.query("select sample(c1,2) from (select c1 from t1); ")
# tdSql.checkRows(2) tdSql.checkRows(2)
# union all # union all
tdSql.query("select sample(c1,2) from t1 union all select sample(c1,3) from t1") tdSql.query("select sample(c1,2) from t1 union all select sample(c1,3) from t1")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册