Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9c219df2
T
TDengine
项目概览
慢慢CG
/
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看板
提交
9c219df2
编写于
9月 16, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
td-1245: add test cases for interval offset
上级
6fa86bfb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
229 addition
and
4 deletion
+229
-4
tests/pytest/query/intervalOffset.py
tests/pytest/query/intervalOffset.py
+225
-0
tests/pytest/query/natualInterval.py
tests/pytest/query/natualInterval.py
+4
-4
未找到文件。
tests/pytest/query/intervalOffset.py
0 → 100644
浏览文件 @
9c219df2
###################################################################
# Copyright (c) 2020 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
())
def
general
(
self
):
tdSql
.
execute
(
"create table meters(ts timestamp, s int) tags(id int)"
)
tdSql
.
execute
(
"create table t0 using meters tags(0)"
)
tdSql
.
execute
(
"create table t1 using meters tags(1)"
)
tdSql
.
execute
(
"create table t2 using meters tags(2)"
)
tdSql
.
execute
(
"create table t3 using meters tags(3)"
)
tdSql
.
execute
(
"create table t4 using meters tags(4)"
)
tdSql
.
execute
(
"insert into t0 values('2019-01-01 00:00:00', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:00:01', 1)"
)
tdSql
.
execute
(
"insert into t2 values('2019-01-01 00:01:00', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:01:01', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:01:02', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:01:03', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:01:30', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:01:50', 1)"
)
tdSql
.
execute
(
"insert into t2 values('2019-01-01 00:02:00', 1)"
)
tdSql
.
execute
(
"insert into t3 values('2019-01-01 00:02:02', 1)"
)
tdSql
.
execute
(
"insert into t3 values('2019-01-01 00:02:59', 1)"
)
tdSql
.
execute
(
"insert into t4 values('2019-01-01 00:02:59', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:03:10', 1)"
)
tdSql
.
execute
(
"insert into t2 values('2019-01-01 00:08:00', 1)"
)
tdSql
.
execute
(
"insert into t1 values('2019-01-01 00:08:00', 1)"
)
tdSql
.
query
(
"select count(*) from meters interval(1m, 1s)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
2
,
1
,
6
)
tdSql
.
checkData
(
3
,
1
,
3
)
tdSql
.
checkData
(
4
,
1
,
1
)
tdSql
.
checkData
(
5
,
1
,
2
)
tdSql
.
query
(
"select count(*) from meters interval(1m, 2s)"
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
2
,
1
,
5
)
tdSql
.
checkData
(
3
,
1
,
3
)
tdSql
.
checkData
(
4
,
1
,
1
)
tdSql
.
checkData
(
5
,
1
,
2
)
tdSql
.
query
(
"select count(*) from meters interval(90s, 1500a)"
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdSql
.
checkData
(
1
,
1
,
5
)
tdSql
.
checkData
(
2
,
1
,
5
)
tdSql
.
checkData
(
3
,
1
,
1
)
tdSql
.
checkData
(
4
,
1
,
2
)
def
singleTable
(
self
):
tdSql
.
execute
(
"create table car(ts timestamp, s int)"
)
tdSql
.
execute
(
"insert into car values('2019-01-01 00:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2019-05-13 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2019-12-31 23:59:59', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-01-01 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-01-02 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-01-03 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-01-04 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-01-05 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-01-31 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-02-01 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-02-02 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-02-29 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-03-01 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-03-02 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-03-15 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-03-31 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car values('2020-05-01 12:00:00', 1)"
)
tdSql
.
query
(
"select count(*) from car interval(1n, 10d)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
6
)
tdSql
.
checkData
(
3
,
1
,
3
)
tdSql
.
checkData
(
4
,
1
,
3
)
tdSql
.
checkData
(
5
,
1
,
2
)
tdSql
.
checkData
(
6
,
1
,
1
)
tdSql
.
query
(
"select count(*) from car interval(1n, 10d) order by ts desc"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
2
,
1
,
3
)
tdSql
.
checkData
(
3
,
1
,
3
)
tdSql
.
checkData
(
4
,
1
,
6
)
tdSql
.
checkData
(
5
,
1
,
1
)
tdSql
.
checkData
(
6
,
1
,
1
)
tdSql
.
query
(
"select count(*) from car interval(2n, 5d)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
6
)
tdSql
.
checkData
(
3
,
1
,
6
)
tdSql
.
checkData
(
4
,
1
,
3
)
tdSql
.
query
(
"select count(*) from car interval(2n) order by ts desc"
)
tdSql
.
checkData
(
0
,
1
,
3
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
6
)
tdSql
.
checkData
(
3
,
1
,
1
)
tdSql
.
checkData
(
4
,
1
,
1
)
tdSql
.
query
(
"select count(*) from car interval(1y, 1n)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
8
)
tdSql
.
checkData
(
2
,
1
,
8
)
tdSql
.
query
(
"select count(*) from car interval(1y, 2n)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
11
)
tdSql
.
checkData
(
2
,
1
,
5
)
tdSql
.
query
(
"select count(*) from car where ts > '2019-05-14 00:00:00' interval(1y, 5d)"
)
tdSql
.
checkData
(
0
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
9
)
def
superTable
(
self
):
tdSql
.
execute
(
"create table cars(ts timestamp, s int) tags(id int)"
)
tdSql
.
execute
(
"create table car0 using cars tags(0)"
)
tdSql
.
execute
(
"create table car1 using cars tags(1)"
)
tdSql
.
execute
(
"create table car2 using cars tags(2)"
)
tdSql
.
execute
(
"create table car3 using cars tags(3)"
)
tdSql
.
execute
(
"create table car4 using cars tags(4)"
)
tdSql
.
execute
(
"insert into car0 values('2019-01-01 00:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2019-05-13 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car2 values('2019-12-31 23:59:59', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2020-01-01 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2020-01-02 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2020-01-03 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2020-01-04 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2020-01-05 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2020-01-31 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2020-02-01 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car2 values('2020-02-02 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car2 values('2020-02-29 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car3 values('2020-03-01 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car3 values('2020-03-02 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car3 values('2020-03-15 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car4 values('2020-03-31 12:00:00', 1)"
)
tdSql
.
execute
(
"insert into car3 values('2020-05-01 12:00:00', 1)"
)
tdSql
.
query
(
"select count(*) from cars interval(1n, 10d)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
6
)
tdSql
.
checkData
(
3
,
1
,
3
)
tdSql
.
checkData
(
4
,
1
,
3
)
tdSql
.
checkData
(
5
,
1
,
2
)
tdSql
.
checkData
(
6
,
1
,
1
)
tdSql
.
query
(
"select count(*) from cars interval(1n, 10d) order by ts desc"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
2
,
1
,
3
)
tdSql
.
checkData
(
3
,
1
,
3
)
tdSql
.
checkData
(
4
,
1
,
6
)
tdSql
.
checkData
(
5
,
1
,
1
)
tdSql
.
checkData
(
6
,
1
,
1
)
tdSql
.
query
(
"select count(*) from cars interval(2n, 5d)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
6
)
tdSql
.
checkData
(
3
,
1
,
6
)
tdSql
.
checkData
(
4
,
1
,
3
)
tdSql
.
query
(
"select count(*) from cars interval(2n) order by ts desc"
)
tdSql
.
checkData
(
0
,
1
,
3
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
6
)
tdSql
.
checkData
(
3
,
1
,
1
)
tdSql
.
checkData
(
4
,
1
,
1
)
tdSql
.
query
(
"select count(*) from cars interval(1y, 1n)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
8
)
tdSql
.
checkData
(
2
,
1
,
8
)
tdSql
.
query
(
"select count(*) from cars interval(1y, 2n)"
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
11
)
tdSql
.
checkData
(
2
,
1
,
5
)
tdSql
.
query
(
"select count(*) from cars where ts > '2019-05-14 00:00:00' interval(1y, 5d)"
)
tdSql
.
checkData
(
0
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
9
)
def
run
(
self
):
tdSql
.
prepare
()
self
.
general
()
self
.
singleTable
()
self
.
superTable
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/query/natualInterval.py
浏览文件 @
9c219df2
...
...
@@ -89,10 +89,10 @@ class TDTestCase:
def
superTable
(
self
):
tdSql
.
execute
(
"create table cars(ts timestamp, s int) tags(id int)"
)
tdSql
.
execute
(
"create table car0 using cars tags(0)"
)
tdSql
.
execute
(
"create table car1 using cars tags(
0
)"
)
tdSql
.
execute
(
"create table car2 using cars tags(
0
)"
)
tdSql
.
execute
(
"create table car3 using cars tags(
0
)"
)
tdSql
.
execute
(
"create table car4 using cars tags(
0
)"
)
tdSql
.
execute
(
"create table car1 using cars tags(
1
)"
)
tdSql
.
execute
(
"create table car2 using cars tags(
2
)"
)
tdSql
.
execute
(
"create table car3 using cars tags(
3
)"
)
tdSql
.
execute
(
"create table car4 using cars tags(
4
)"
)
tdSql
.
execute
(
"insert into car0 values('2019-01-01 00:00:00', 1)"
)
tdSql
.
execute
(
"insert into car1 values('2019-05-13 12:00:00', 1)"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录