Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
303936b8
T
TDengine
项目概览
Rattenking
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
303936b8
编写于
1月 04, 2021
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2601][TD-2609][TD-2624]<test> add test case
上级
632c3b50
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
131 addition
and
1 deletion
+131
-1
tests/pytest/functions/all_null_value.py
tests/pytest/functions/all_null_value.py
+90
-0
tests/pytest/functions/function_percentile.py
tests/pytest/functions/function_percentile.py
+8
-0
tests/pytest/functions/function_twa_test2.py
tests/pytest/functions/function_twa_test2.py
+16
-0
tests/pytest/query/queryInterval.py
tests/pytest/query/queryInterval.py
+17
-1
未找到文件。
tests/pytest/functions/all_null_value.py
0 → 100644
浏览文件 @
303936b8
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
rowNum
=
10
self
.
ts
=
1537146000000
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"create table st(ts timestamp, c1 int, c2 int)"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into st values(%d, null, null)"
%
(
self
.
ts
+
i
))
tdSql
.
query
(
"select avg(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select max(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select min(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select bottom(c1, 1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select top(c1, 1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select diff(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select first(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select last(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select last_row(c1) from st"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select count(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select leastsquares(c1, 1, 1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select c1 + c2 from st"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select spread(c1) from st"
)
tdSql
.
checkRows
(
0
)
# tdSql.query("select stddev(c1) from st")
# tdSql.checkRows(0)
tdSql
.
query
(
"select sum(c1) from st"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select twa(c1) from st"
)
tdSql
.
checkRows
(
0
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/functions/function_percentile.py
浏览文件 @
303936b8
...
...
@@ -142,6 +142,14 @@ class TDTestCase:
tdSql
.
error
(
"select percentile(voltage, 20) from meters"
)
tdSql
.
query
(
"select apercentile(voltage, 20) from meters"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
# Test case for: https://jira.taosdata.com:18080/browse/TD-2609
tdSql
.
execute
(
"create table st(ts timestamp, k int)"
)
tdSql
.
execute
(
"insert into st values(now, -100)"
)
tdSql
.
query
(
"select apercentile(k, 20) from st"
)
tdSql
.
checkData
(
0
,
0
,
-
100.00
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/functions/function_twa_test2.py
浏览文件 @
303936b8
...
...
@@ -132,6 +132,22 @@ class TDTestCase:
tdSql
.
query
(
'select twa(c) from t4 interval(10s)'
)
tdSql
.
checkData
(
0
,
1
,
10.999
)
# Test case: https://jira.taosdata.com:18080/browse/TD-2624
tdSql
.
execute
(
"create database test keep 7300"
)
tdSql
.
execute
(
"use test"
)
tdSql
.
execute
(
"create table st(ts timestamp, k int)"
)
tdSql
.
execute
(
"insert into st values('2011-01-02 18:42:45.326', -1)"
)
tdSql
.
execute
(
"insert into st values('2020-07-30 17:44:06.283', 0)"
)
tdSql
.
execute
(
"insert into st values('2020-07-30 17:44:19.578', 9999999)"
)
tdSql
.
execute
(
"insert into st values('2020-07-30 17:46:06.417', NULL)"
)
tdSql
.
execute
(
"insert into st values('2020-11-09 18:42:25.538', 0)"
)
tdSql
.
execute
(
"insert into st values('2020-12-29 17:43:11.641', 0)"
)
tdSql
.
execute
(
"insert into st values('2020-12-29 18:43:17.129', 0)"
)
tdSql
.
execute
(
"insert into st values('2020-12-29 18:46:19.109', NULL)"
)
tdSql
.
execute
(
"insert into st values('2021-01-03 18:40:40.065', 0)"
)
tdSql
.
query
(
"select twa(k),first(ts) as taos1 from st where k <50 interval(17s)"
)
tdSql
.
checkRows
(
6
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/query/queryInterval.py
浏览文件 @
303936b8
...
...
@@ -24,7 +24,7 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
ts
=
1593548685000
self
.
ts
=
1593548685000
def
run
(
self
):
tdSql
.
prepare
()
...
...
@@ -84,6 +84,22 @@ class TDTestCase:
tdDnodes
.
start
(
1
)
tdSql
.
query
(
"select last(*) from t interval(1s)"
)
tdSql
.
checkRows
(
10000
)
# test case for https://jira.taosdata.com:18080/browse/TD-2601
newTs
=
1601481600000
tdSql
.
execute
(
"create database test2"
)
tdSql
.
execute
(
"use test2"
)
tdSql
.
execute
(
"create table t (ts timestamp, voltage int)"
)
for
i
in
range
(
100
):
tdSql
.
execute
(
"insert into t values(%d, %d)"
%
(
newTs
+
i
*
10000000
,
i
))
tdSql
.
query
(
"select sum(voltage) from t where ts >='2020-10-01 00:00:00' and ts <='2020-12-01 00:00:00' interval(1n) fill(NULL)"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
1
,
4950
)
tdSql
.
checkData
(
1
,
1
,
None
)
tdSql
.
checkData
(
2
,
1
,
None
)
def
stop
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录