Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dd22c929
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dd22c929
编写于
6月 13, 2022
作者:
W
wenzhouwww@live.cn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update sample function for new feature
上级
13907386
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
24 deletion
+33
-24
tests/system-test/2-query/sample.py
tests/system-test/2-query/sample.py
+33
-24
未找到文件。
tests/system-test/2-query/sample.py
浏览文件 @
dd22c929
...
...
@@ -331,10 +331,14 @@ class TDTestCase:
# self.checksample(**case9)
# case10 = {"alias": ", _c0"}
# self.checksample(**case10)
case11
=
{
"alias"
:
", st1"
}
self
.
checksample
(
**
case11
)
case12
=
{
"alias"
:
", c1"
}
self
.
checksample
(
**
case12
)
# case11 = {"alias": ", st1"}
# self.checksample(**case11)
tdSql
.
query
(
"select sample( c1 , 1 ) , st1 from t1"
)
# case12 = {"alias": ", c1"}
# self.checksample(**case12)
tdSql
.
query
(
"select sample( c1 , 1 ) , c1 from t1"
)
# case13~15: with single condition
case13
=
{
"condition"
:
"where c1 <= 10"
}
...
...
@@ -491,21 +495,26 @@ class TDTestCase:
# self.checksample(**err40) # mix with arithmetic 1
# tdSql.query(" select sample(c1 , 1) + 2 from t1 ")
err41
=
{
"alias"
:
"+ avg(c1)"
}
self
.
checksample
(
**
err41
)
# mix with arithmetic 2
err42
=
{
"alias"
:
", c1"
}
self
.
checksample
(
**
err42
)
# mix with other col
# self.checksample(**err41) # mix with arithmetic 2
# err42 = {"alias": ", c1"}
# self.checksample(**err42)
tdSql
.
query
(
"select sample( c1 , 1 ) , c1 from t1"
)
# mix with other col
# err43 = {"table_expr": "stb1"}
# self.checksample(**err43) # select stb directly
err44
=
{
"col"
:
"stb1.c1"
,
"table_expr"
:
"stb1, stb2"
,
"condition"
:
"where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
}
self
.
checksample
(
**
err44
)
# stb join
err45
=
{
"condition"
:
"where ts>0 and ts < now interval(1h) fill(next)"
}
self
.
checksample
(
**
err45
)
# interval
# err44 = {
# "col": "stb1.c1",
# "table_expr": "stb1, stb2",
# "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
# }
# self.checksample(**err44) # stb join
tdSql
.
query
(
"select sample( stb1.c1 , 1 ) from stb1, stb2 where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
)
# err45 = {
# "condition": "where ts>0 and ts < now interval(1h) fill(next)"
# }
# self.checksample(**err45) # interval
tdSql
.
query
(
"select sample( c1 , 1 ) from t1 where ts>0 and ts < now interval(1h) fill(next)"
)
err46
=
{
"table_expr"
:
"t1"
,
"condition"
:
"group by c6"
...
...
@@ -728,8 +737,8 @@ class TDTestCase:
tdSql
.
query
(
" select sample(c10 , 20 ) from ct4 "
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
" select sample(t1 , 20 ) from ct1 "
)
tdSql
.
checkRows
(
13
)
#
tdSql.query(" select sample(t1 , 20 ) from ct1 ")
#
tdSql.checkRows(13)
# filter data
tdSql
.
query
(
" select sample(c1, 20 ) from t1 where c1 is null "
)
...
...
@@ -775,15 +784,15 @@ class TDTestCase:
# not support mix with other function
tdSql
.
error
(
"select top(c1,2) , sample(c1,2) from ct1"
)
tdSql
.
error
(
"select max(c1) , sample(c1,2) from ct1"
)
tdSql
.
error
(
"select c1 , sample(c1,2) from ct1"
)
tdSql
.
query
(
"select c1 , sample(c1,2) from ct1"
)
# bug for mix with scalar
# tdSql.error
("select 123 , sample(c1,100) from ct1")
# tdSql.error
("select sample(c1,100)+2 from ct1")
# tdSql.error
("select abs(sample(c1,100)) from ct1")
tdSql
.
query
(
"select 123 , sample(c1,100) from ct1"
)
tdSql
.
query
(
"select sample(c1,100)+2 from ct1"
)
tdSql
.
query
(
"select abs(sample(c1,100)) from ct1"
)
def
sample_test_run
(
self
)
:
tdLog
.
printNoPrefix
(
"==========
TD-10594
=========="
)
tdLog
.
printNoPrefix
(
"==========
support sample function
=========="
)
tbnum
=
10
nowtime
=
int
(
round
(
time
.
time
()
*
1000
))
per_table_rows
=
10
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录