Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0fe2b96b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
0fe2b96b
编写于
4月 01, 2021
作者:
H
huili
提交者:
GitHub
4月 01, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5543 from taosdata/feature/TD-1380
[TD-3274]<test> add case for TD-3274
上级
24f134f4
e3f4c903
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
165 addition
and
61 deletion
+165
-61
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+2
-0
tests/pytest/query/bug3351.py
tests/pytest/query/bug3351.py
+74
-0
tests/pytest/query/query1970YearsAf.py
tests/pytest/query/query1970YearsAf.py
+89
-61
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
0fe2b96b
...
...
@@ -213,6 +213,8 @@ python3 ./test.py -f query/bug2119.py
python3 ./test.py
-f
query/isNullTest.py
python3 ./test.py
-f
query/queryWithTaosdKilled.py
python3 ./test.py
-f
query/floatCompare.py
python3 ./test.py
-f
query/query1970YearsAf.py
python3 ./test.py
-f
query/bug3351.py
python3 ./test.py
-f
query/bug3375.py
...
...
tests/pytest/query/bug3351.py
0 → 100644
浏览文件 @
0fe2b96b
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database if not exists db keep 36500"
)
tdSql
.
execute
(
"use db"
)
tdLog
.
printNoPrefix
(
"==========step1:create table && insert data"
)
tdSql
.
execute
(
"create table stb1 (ts timestamp, c1 int) TAGS(t1 int)"
)
tdSql
.
execute
(
"create table t0 using stb1 tags(1)"
)
tdSql
.
execute
(
"insert into t0 values (-865000000, 1)"
)
tdSql
.
execute
(
"insert into t0 values (-864000000, 2)"
)
tdSql
.
execute
(
"insert into t0 values (-863000000, 3)"
)
tdSql
.
execute
(
"insert into t0 values (-15230000, 4)"
)
tdSql
.
execute
(
"insert into t0 values (-15220000, 5)"
)
tdSql
.
execute
(
"insert into t0 values (-15210000, 6)"
)
tdLog
.
printNoPrefix
(
"==========step2:query"
)
# bug1:when ts > -864000000, return 0 rows;
# bug2:when ts = -15220000, return 0 rows.
tdSql
.
query
(
'select * from t0 where ts < -864000000'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from t0 where ts <= -864000000'
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
'select * from t0 where ts = -864000000'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from t0 where ts > -864000000'
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
'select * from t0 where ts >= -864000000'
)
tdSql
.
checkRows
(
5
)
tdSql
.
query
(
'select * from t0 where ts < -15220000'
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
'select * from t0 where ts <= -15220000'
)
tdSql
.
checkRows
(
5
)
tdSql
.
query
(
'select * from t0 where ts = -15220000'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from t0 where ts > -15220000'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
'select * from t0 where ts >= -15220000'
)
tdSql
.
checkRows
(
2
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/query/query1970YearsAf.py
浏览文件 @
0fe2b96b
...
...
@@ -22,25 +22,34 @@ import datetime
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.dnodes
import
*
from
util.dnodes
import
TDDnode
class
TDTestCase
:
def
__init__
(
self
):
self
.
path
=
""
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
def
get
CfgDir
(
self
,
path
):
def
get
cfgPath
(
self
,
path
):
binPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
binPath
=
binPath
+
"/../../../debug/"
tdLog
.
debug
(
"binPath %s"
%
(
binPath
)
)
tdLog
.
debug
(
f
"binPath
{
binPath
}
"
)
binPath
=
os
.
path
.
realpath
(
binPath
)
tdLog
.
debug
(
"binPath real path %s"
%
(
binPath
))
tdLog
.
debug
(
f
"binPath real path
{
binPath
}
"
)
if
path
==
""
:
self
.
path
=
os
.
path
.
abspath
(
binPath
+
"../../"
)
else
:
self
.
path
=
os
.
path
.
realpath
(
path
)
return
self
.
path
self
.
cfgDir
=
"%s/sim/psim/cfg"
%
(
self
.
path
)
def
getCfgDir
(
self
):
self
.
getcfgPath
(
self
.
path
)
self
.
cfgDir
=
f
"
{
self
.
path
}
/sim/psim/cfg"
return
self
.
cfgDir
def
creatcfg
(
self
):
...
...
@@ -63,7 +72,7 @@ class TDTestCase:
"update"
:
0
}
#
设置创建的超级表格式
#
set stable schema
stable1
=
{
"name"
:
"stb2"
,
"child_table_exists"
:
"no"
,
...
...
@@ -75,35 +84,49 @@ class TDTestCase:
"insert_rows"
:
5000
,
"multi_thread_write_one_tbl"
:
"no"
,
"number_of_tbl_in_one_sql"
:
0
,
"rows_per_tbl"
:
1
000
,
"rows_per_tbl"
:
1
,
"max_sql_len"
:
65480
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1900
0000
,
"start_timestamp"
:
"1969-
01-0
1 00:00:00.000"
,
"timestamp_step"
:
2
0000
,
"start_timestamp"
:
"1969-
12-3
1 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[
{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
10
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
6
}
{
"type"
:
"INT"
,
"count"
:
2
},
{
"type"
:
"DOUBLE"
,
"count"
:
2
},
{
"type"
:
"BIGINT"
,
"count"
:
2
},
{
"type"
:
"FLOAT"
,
"count"
:
2
},
{
"type"
:
"SMALLINT"
,
"count"
:
2
},
{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BOOL"
,
"count"
:
2
},
{
"type"
:
"NCHAR"
,
"len"
:
3
,
"count"
:
1
},
{
"type"
:
"BINARY"
,
"len"
:
8
,
"count"
:
1
}
],
"tags"
:
[
{
"type"
:
"INT"
,
"count"
:
2
},
{
"type"
:
"DOUBLE"
,
"count"
:
2
},
{
"type"
:
"BIGINT"
,
"count"
:
2
},
{
"type"
:
"FLOAT"
,
"count"
:
2
},
{
"type"
:
"SMALLINT"
,
"count"
:
2
},
{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}
{
"type"
:
"BOOL"
,
"count"
:
2
},
{
"type"
:
"NCHAR"
,
"len"
:
3
,
"count"
:
1
},
{
"type"
:
"BINARY"
,
"len"
:
8
,
"count"
:
1
}
]
}
# 需要创建多个超级表时,只需创建不同的超级表格式并添加至super_tables
super_tables
=
[
stable1
]
# create different stables like stable1 and add to list super_tables
super_tables
=
[]
super_tables
.
append
(
stable1
)
database
=
{
"dbinfo"
:
dbinfo
,
"super_tables"
:
super_tables
}
cfgdir
=
self
.
getCfgDir
(
""
)
cfgdir
=
self
.
getCfgDir
()
create_table
=
{
"filetype"
:
"insert"
,
"cfgdir"
:
cfgdir
,
...
...
@@ -121,105 +144,110 @@ class TDTestCase:
}
return
create_table
def
inserttab
le
(
self
):
def
createinsertfi
le
(
self
):
create_table
=
self
.
creatcfg
()
date
=
datetime
.
datetime
.
now
().
strftime
(
"%Y%m%d%H%M"
)
file_create_table
=
f
"/tmp/insert_
{
date
}
.json"
with
open
(
file_create_table
,
'w'
)
as
f
:
json
.
dump
(
create_table
,
f
)
return
file_create_table
create_table_cmd
=
f
"taosdemo -f
{
file_create_table
}
"
def
inserttable
(
self
,
filepath
):
create_table_cmd
=
f
"taosdemo -f
{
filepath
}
> /dev/null 2>&1"
_
=
subprocess
.
check_output
(
create_table_cmd
,
shell
=
True
).
decode
(
"utf-8"
)
def
run
(
self
):
s
=
'reset query cache'
tdSql
.
execute
(
s
)
s
=
'create database if not exists db'
tdSql
.
execute
(
s
)
s
=
'use db'
tdSql
.
execute
(
s
)
tdLog
.
info
(
"==========step1:create table stable and child table,then insert data automatically"
)
self
.
inserttable
()
# tdSql.execute(
# '''create table if not exists supt
# (ts timestamp, c1 int, c2 float, c3 bigint, c4 double, c5 smallint, c6 tinyint)
# tags(location binary(64), type int, isused bool , family nchar(64))'''
# )
# tdSql.execute("create table t1 using supt tags('beijing', 1, 1, '自行车')")
# tdSql.execute("create table t2 using supt tags('shanghai', 2, 0, '拖拉机')")
# tdSql.execute(
# f"insert into t1 values (-31564800000, 6, 5, 4, 3, 2, 1)"
# )
tdLog
.
info
(
"==========step2:query join"
)
def
sqlsquery
(
self
):
# stable query
tdSql
.
query
(
"select * from stb2 where stb2.ts < '1970-01-01 00:00:00.000' "
)
tdSql
.
checkRows
(
166
00
)
tdSql
.
checkRows
(
432
00
)
tdSql
.
query
(
"select * from stb2 where stb2.ts >= '1970-01-01 00:00:00.000' "
)
tdSql
.
checkRows
(
334
00
)
tdSql
.
checkRows
(
68
00
)
tdSql
.
query
(
"select * from stb2 where stb2.ts > '1969-12-
01 00:00:00.000' and stb2.ts <'1970-01-31 00
:00:00.000' "
"select * from stb2 where stb2.ts > '1969-12-
31 23:00:00.000' and stb2.ts <'1970-01-01 01
:00:00.000' "
)
tdSql
.
checkRows
(
278
0
)
tdSql
.
checkRows
(
359
0
)
# child-table query
# child-table
s
query
tdSql
.
query
(
"select * from t0 where t0.ts < '1970-01-01 00:00:00.000' "
)
tdSql
.
checkRows
(
166
0
)
tdSql
.
checkRows
(
432
0
)
tdSql
.
query
(
"select * from t1 where t1.ts >= '1970-01-01 00:00:00.000' "
)
tdSql
.
checkRows
(
334
0
)
tdSql
.
checkRows
(
68
0
)
tdSql
.
query
(
"select * from t9 where t9.ts > '1969-12-
01 00:00:00.000' and t9.ts <'1970-01-31 00
:00:00.000' "
"select * from t9 where t9.ts > '1969-12-
31 22:00:00.000' and t9.ts <'1970-01-01 02
:00:00.000' "
)
tdSql
.
checkRows
(
278
)
tdSql
.
checkRows
(
719
)
tdSql
.
query
(
"select * from t0,t1 where t0.ts=t1.ts and t1.ts >= '1970-01-01 00:00:00.000' "
)
tdSql
.
checkRows
(
334
0
)
tdSql
.
checkRows
(
68
0
)
tdSql
.
query
(
"select diff(col1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' "
)
tdSql
.
checkRows
(
333
9
)
tdSql
.
checkRows
(
67
9
)
tdSql
.
query
(
"select t0,col1 from stb2 where stb2.ts < '1970-01-01 00:00:00.000' order by ts"
)
tdSql
.
checkRows
(
166
00
)
tdSql
.
checkRows
(
432
00
)
# query with timestamp in 'where ...'
tdSql
.
query
(
"select * from stb2 where stb2.ts > -28800000 "
)
tdSql
.
checkRows
(
3340
0
)
tdSql
.
checkRows
(
679
0
)
tdSql
.
query
(
"select * from stb2 where stb2.ts > -28800000 and stb2.ts < '1970-01-01 08:00:00.000' "
)
tdSql
.
checkRows
(
2
0
)
tdSql
.
checkRows
(
679
0
)
tdSql
.
query
(
"select * from stb2 where stb2.ts < -28800000 and stb2.ts > '1969-12-31
16
:00:00.000' "
"select * from stb2 where stb2.ts < -28800000 and stb2.ts > '1969-12-31
22
:00:00.000' "
)
tdSql
.
checkRows
(
3590
)
def
run
(
self
):
s
=
'reset query cache'
tdSql
.
execute
(
s
)
s
=
'create database if not exists db'
tdSql
.
execute
(
s
)
s
=
'use db'
tdSql
.
execute
(
s
)
tdLog
.
info
(
"==========step1:create table stable and child table,then insert data automatically"
)
insertfile
=
self
.
createinsertfile
()
self
.
inserttable
(
insertfile
)
tdLog
.
info
(
"==========step2:query join"
)
self
.
sqlsquery
()
# after wal and sync, check again
tdSql
.
query
(
"show dnodes"
)
index
=
tdSql
.
getData
(
0
,
0
)
tdDnodes
.
stop
(
index
)
tdDnodes
.
start
(
index
)
tdLog
.
info
(
"==========step3: query join again"
)
self
.
sqlsquery
()
# delete temporary file
rm_cmd
=
f
"rm -f /tmp/insert* > /dev/null 2>&1"
_
=
subprocess
.
check_output
(
rm_cmd
,
shell
=
True
).
decode
(
"utf-8"
)
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录