Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6db6b7ef
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6db6b7ef
编写于
5月 18, 2022
作者:
W
wenzhouwww@live.cn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update case for unexpected use way
上级
2f957a08
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
112 addition
and
3 deletion
+112
-3
tests/system-test/0-others/udfTest.py
tests/system-test/0-others/udfTest.py
+112
-3
未找到文件。
tests/system-test/0-others/udfTest.py
浏览文件 @
6db6b7ef
from
distutils.log
import
error
import
taos
import
taos
import
sys
import
sys
import
time
import
time
...
@@ -468,10 +469,102 @@ class TDTestCase:
...
@@ -468,10 +469,102 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
169.661427555
)
tdSql
.
checkData
(
0
,
0
,
169.661427555
)
tdSql
.
checkData
(
0
,
1
,
169.661427555
)
tdSql
.
checkData
(
0
,
1
,
169.661427555
)
def
try_query_sql
(
self
):
sql_lists
=
[
"select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb"
,
"select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1"
,
"select udf2(num1) ,udf2(num2), udf2(num3) from tb"
,
"select udf2(num1)+100 ,udf2(num2)-100, udf2(num3)*100 ,udf2(num3)/100 from tb"
,
"select udf2(c1) ,udf2(c6) from stb1 "
,
"select udf2(c1)+100 ,udf2(c6)-100 ,udf2(c1)*100 ,udf2(c6)/100 from stb1 "
,
"select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from ct1"
,
"select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from stb1 "
,
"select udf1(num1) , max(num1) from tb;"
,
"select floor(num1) , max(num1) from tb;"
,
"select udf1(num1) , min(num1) from tb;"
,
"select ceil(num1) , min(num1) from tb;"
,
"select udf1(num1) , top(num1,1) from tb;"
,
"select udf1(num1) , bottom(num1,1) from tb;"
,
"select udf1(c1) , max(c1) from stb1;"
,
"select abs(c1) , max(c1) from stb1;"
,
"select udf1(c1) , min(c1) from stb1;"
,
"select floor(c1) , min(c1) from stb1;"
,
"select udf1(c1) , top(c1 ,1) from stb1;"
,
"select abs(c1) , top(c1 ,1) from stb1;"
,
"select udf1(c1) , bottom(c1,1) from stb1;"
,
"select ceil(c1) , bottom(c1,1) from stb1;"
,
"select udf1(num1) , abs(num1) from tb;"
,
"select floor(num1) , abs(num1) from tb;"
,
"select udf1(num1) , csum(num1) from tb;"
,
"select ceil(num1) , csum(num1) from tb;"
,
"select udf1(c1) , csum(c1) from stb1;"
,
"select floor(c1) , csum(c1) from stb1;"
,
"select udf1(c1) , abs(c1) from stb1;"
,
"select abs(c1) , ceil(c1) from stb1;"
,
"select abs(udf1(c1)) , abs(ceil(c1)) from stb1 order by ts;"
,
"select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;"
,
"select udf2(c1) from stb1 group by 1-udf1(c1)"
,
"select abs(udf1(c1)) , abs(ceil(c1)) from stb1 where c1 is null order by ts;"
,
"select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts"
,
"select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select udf1(c1) from ct1 group by c1"
,
"select udf1(c1) from stb1 group by c1"
,
"select c1,c2, udf1(c1,c2) from ct1 group by c1,c2"
,
"select c1,c2, udf1(c1,c2) from stb1 group by c1,c2"
,
"select udf2(c1) from ct1 group by c1"
,
"select udf2(c1) from stb1 group by c1"
,
"select c1,c2, udf2(c1,c6) from ct1 group by c1,c2"
,
"select c1,c2, udf2(c1,c6) from stb1 group by c1,c2"
,
"select udf2(c1) from stb1 group by udf1(c1)"
,
"select udf2(c1) from stb1 group by floor(c1)"
,
"select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)"
,
"select num1,num2,num3,udf1(num1,num2,num3) from tb"
,
"select c1,c6,udf1(c1,c6) from stb1 order by ts"
,
"select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;"
,
"select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"drop function udf1 "
,
"drop function udf2 "
,
"select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select count(*) from stb1"
,
"select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
]
tdSql
.
execute
(
"use db"
)
for
sql
in
sql_lists
:
try
:
tdSql
.
execute
(
sql
)
except
:
pass
def
unexpected_create
(
self
):
def
unexpected_create
(
self
):
tdLog
.
info
(
" create function with out bufsize "
)
tdSql
.
query
(
"drop function udf1 "
)
tdSql
.
query
(
"drop function udf2 "
)
# create function without buffer
tdSql
.
execute
(
"create function udf1 as '/tmp/udf/libudf1.so' outputtype int"
)
tdSql
.
execute
(
"create aggregate function udf2 as '/tmp/udf/libudf2.so' outputtype double"
)
# self.try_query_sql()
# create function without aggregate
tdLog
.
info
(
" create function with out aggregate "
)
tdSql
.
query
(
"drop function udf1 "
)
tdSql
.
query
(
"drop function udf2 "
)
# create function without buffer
tdSql
.
execute
(
"create aggregate function udf1 as '/tmp/udf/libudf1.so' outputtype int bufSize 8 "
)
tdSql
.
execute
(
"create function udf2 as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
# self.try_query_sql()
tdSql
.
query
(
"select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
)
def
loop_kill_udfd
(
self
):
def
loop_kill_udfd
(
self
):
...
@@ -507,7 +600,21 @@ class TDTestCase:
...
@@ -507,7 +600,21 @@ class TDTestCase:
# start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &"
# start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &"
# tdLog.info("start udfd : %s " % start_udfd)
# tdLog.info("start udfd : %s " % start_udfd)
def
test_function_name
(
self
):
tdSql
.
execute
(
" drop function udf1 "
)
tdSql
.
execute
(
" drop function udf2 "
)
tdSql
.
error
(
"create function max as '/tmp/udf/libudf1.so' outputtype int bufSize 8"
)
tdSql
.
error
(
"create aggregate function sum as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create function max as '/tmp/udf/libudf1.so' outputtype int bufSize 8"
)
tdSql
.
error
(
"create aggregate function sum as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function tbname as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function function as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function stable as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function union as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function 123 as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function 123db as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
tdSql
.
error
(
"create aggregate function mnode as '/tmp/udf/libudf2.so' outputtype double bufSize 8"
)
def
restart_taosd_query_udf
(
self
):
def
restart_taosd_query_udf
(
self
):
for
i
in
range
(
5
):
for
i
in
range
(
5
):
...
@@ -534,7 +641,9 @@ class TDTestCase:
...
@@ -534,7 +641,9 @@ class TDTestCase:
self
.
create_udf_function
()
self
.
create_udf_function
()
self
.
basic_udf_query
()
self
.
basic_udf_query
()
self
.
loop_kill_udfd
()
self
.
loop_kill_udfd
()
# self.restart_taosd_query_udf()
self
.
restart_taosd_query_udf
()
# self.unexpected_create()
# self.test_function_name()
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录