Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
50db328e
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看板
未验证
提交
50db328e
编写于
8月 04, 2021
作者:
H
Hui Li
提交者:
GitHub
8月 04, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7156 from taosdata/test/TD-5515-d
Test/td 5515 d
上级
0ec022d2
d4736e64
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
309 addition
and
3 deletion
+309
-3
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/query/long_where_query.py
tests/pytest/query/long_where_query.py
+305
-0
tests/pytest/query/operator_cost.py
tests/pytest/query/operator_cost.py
+3
-3
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
50db328e
...
@@ -257,6 +257,7 @@ python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py
...
@@ -257,6 +257,7 @@ python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py
python3 ./test.py
-f
query/nestquery_last_row.py
python3 ./test.py
-f
query/nestquery_last_row.py
python3 ./test.py
-f
query/queryCnameDisplay.py
python3 ./test.py
-f
query/queryCnameDisplay.py
python3 ./test.py
-f
query/operator_cost.py
python3 ./test.py
-f
query/operator_cost.py
python3 ./test.py
-f
query/long_where_query.py
python3 test.py
-f
query/nestedQuery/queryWithSpread.py
python3 test.py
-f
query/nestedQuery/queryWithSpread.py
#stream
#stream
...
...
tests/pytest/query/long_where_query.py
0 → 100644
浏览文件 @
50db328e
###################################################################
# 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
random
import
string
import
os
import
time
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
from
util.dnodes
import
tdDnodes
class
TDTestCase
:
updatecfgDict
=
{
'maxSQLLength'
:
1048576
}
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
ts
=
1538548685000
self
.
num
=
100
def
get_random_string
(
self
,
length
):
letters
=
string
.
ascii_lowercase
result_str
=
''
.
join
(
random
.
choice
(
letters
)
for
i
in
range
(
length
))
return
result_str
def
run
(
self
):
tdSql
.
prepare
()
# test case for https://jira.taosdata.com:18080/browse/TD-5213
print
(
"==============step1, regular table=============="
)
startTime
=
time
.
time
()
sql
=
"create table regular_table_1(ts timestamp, "
for
i
in
range
(
4094
):
sql
+=
"col00000111112222233333444445555566666777778888899999000000l%d int, "
%
(
i
+
1
)
sql
+=
"col4095 binary(22))"
tdLog
.
info
(
len
(
sql
))
tdSql
.
execute
(
sql
)
tdLog
.
info
(
"========== test1.1 : test regular table in ( ) =========="
)
sql
=
'''insert into regular_table_1(ts,col00000111112222233333444445555566666777778888899999000000l1) values(now,1);'''
tdSql
.
execute
(
sql
)
sql
=
''' select * from regular_table_1 where col00000111112222233333444445555566666777778888899999000000l1 in (1); '''
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
for
i
in
range
(
self
.
num
):
sql
=
"insert into regular_table_1 values(%d, "
for
j
in
range
(
4094
):
str
=
"'%s', "
%
random
.
randint
(
0
,
1000
)
sql
+=
str
sql
+=
"'%s')"
%
self
.
get_random_string
(
22
)
tdSql
.
execute
(
sql
%
(
self
.
ts
+
i
))
time
.
sleep
(
1
)
tdSql
.
query
(
"select count(*) from regular_table_1"
)
tdSql
.
checkData
(
0
,
0
,
self
.
num
+
1
)
tdSql
.
query
(
"select * from regular_table_1"
)
tdSql
.
checkRows
(
self
.
num
+
1
)
tdSql
.
checkCols
(
4096
)
#maxSQLLength 1048576
sql
=
"select * from regular_table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for
i
in
range
(
2
,
128840
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1 ,12345) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkCols
(
4096
)
#maxSQLLength 1048577--error
sql
=
"select * from regular_table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for
i
in
range
(
2
,
128840
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1 ,123456) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
tdLog
.
info
(
"========== test1.2 : test regular table in (' ') =========="
)
sql
=
'''insert into regular_table_1(ts,col4095) values(now,1);'''
tdSql
.
execute
(
sql
)
sql
=
''' select * from regular_table_1 where col4095 in ('1',"1"); '''
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
4095
,
1
)
#maxSQLLength 1048576
sql
=
" select * from regular_table_1 where col4095 in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '1' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
4095
,
1
)
tdSql
.
checkCols
(
4096
)
#maxSQLLength 1048577--error
sql
=
" select * from regular_table_1 where col4095 in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '123' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
endTime
=
time
.
time
()
print
(
"total time %ds"
%
(
endTime
-
startTime
))
print
(
"==============step2, super table =============="
)
startTime
=
time
.
time
()
sql
=
"create stable stable_1(ts timestamp, "
for
i
in
range
(
4090
):
sql
+=
"col00000111112222233333444445555566666777778888899999000000l%d int, "
%
(
i
+
1
)
sql
+=
"col4091 binary(22))"
sql
+=
" tags (loc nchar(10),tag_1 int,tag_2 int,tag_3 int) "
tdLog
.
info
(
len
(
sql
))
tdSql
.
execute
(
sql
)
sql
=
'''create table table_1 using stable_1
tags('table_1' , '1' , '2' , '3' );'''
tdSql
.
execute
(
sql
)
tdLog
.
info
(
"========== test2.1 : test super table in ( ) =========="
)
sql
=
'''insert into table_1(ts,col00000111112222233333444445555566666777778888899999000000l1) values(now,1);'''
tdSql
.
execute
(
sql
)
sql
=
''' select * from stable_1 where col00000111112222233333444445555566666777778888899999000000l1 in (1); '''
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
sql
=
''' select * from table_1 where col00000111112222233333444445555566666777778888899999000000l1 in (1); '''
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
for
i
in
range
(
self
.
num
):
sql
=
"insert into table_1 values(%d, "
for
j
in
range
(
4090
):
str
=
"'%s', "
%
random
.
randint
(
0
,
1000
)
sql
+=
str
sql
+=
"'%s')"
%
self
.
get_random_string
(
22
)
tdSql
.
execute
(
sql
%
(
self
.
ts
+
i
))
time
.
sleep
(
1
)
tdSql
.
query
(
"select count(*) from table_1"
)
tdSql
.
checkData
(
0
,
0
,
self
.
num
+
1
)
tdSql
.
query
(
"select * from table_1"
)
tdSql
.
checkRows
(
self
.
num
+
1
)
tdSql
.
checkCols
(
4092
)
tdSql
.
query
(
"select count(*) from stable_1"
)
tdSql
.
checkData
(
0
,
0
,
self
.
num
+
1
)
tdSql
.
query
(
"select * from stable_1"
)
tdSql
.
checkRows
(
self
.
num
+
1
)
tdSql
.
checkCols
(
4096
)
#maxSQLLength 1048576
sql
=
"select * from table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for
i
in
range
(
128840
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1 ,12345) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkCols
(
4092
)
sql
=
"select * from stable_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for
i
in
range
(
128840
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1 ,1234) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkCols
(
4096
)
#TD-5640
sql
=
"select * from stable_1 where tag_1 in ("
for
i
in
range
(
128847
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1)order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkCols
(
4096
)
#maxSQLLength 1048577--error
sql
=
"select * from table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for
i
in
range
(
128840
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1 ,123456) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
sql
=
"select * from stable_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for
i
in
range
(
128840
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1 ,12345) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
sql
=
"select * from stable_1 where tag_1 in ("
for
i
in
range
(
128847
):
sql
+=
"%d , "
%
(
i
+
1
)
sql
+=
"1) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
tdLog
.
info
(
"========== tests2.2 : test super table in (' ') =========="
)
sql
=
'''insert into table_1(ts,col4091) values(now,1);'''
tdSql
.
execute
(
sql
)
sql
=
''' select * from table_1 where col4091 in ('1',"1"); '''
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
4091
,
1
)
#maxSQLLength 1048576
sql
=
" select * from table_1 where col4091 in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '1','123456' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
4091
,
1
)
tdSql
.
checkCols
(
4092
)
sql
=
" select * from stable_1 where col4091 in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '1','12345' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
4091
,
1
)
tdSql
.
checkCols
(
4096
)
#TD-5650
sql
=
" select * from stable_1 where loc in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '123','table_1' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
4092
,
'table_1'
)
tdSql
.
checkCols
(
4096
)
#maxSQLLength 1048577--error
sql
=
" select * from table_1 where col4091 in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '1','1234567' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
sql
=
" select * from stable_1 where col4091 in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '1','123456' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
sql
=
" select * from stable_1 where loc in ("
for
i
in
range
(
96328
):
sql
+=
" '%d' , "
%
(
i
+
1
)
sql
+=
" '1','1234567890' ) order by ts desc;"
#tdLog.info(sql)
tdLog
.
info
(
len
(
sql
))
tdSql
.
error
(
sql
)
endTime
=
time
.
time
()
print
(
"total time %ds"
%
(
endTime
-
startTime
))
os
.
system
(
"rm -rf query/long_where_query.py.sql"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/query/operator_cost.py
浏览文件 @
50db328e
...
@@ -207,9 +207,9 @@ class TDTestCase:
...
@@ -207,9 +207,9 @@ class TDTestCase:
sql
=
'''select distinct(t_ts) from stable_1;'''
sql
=
'''select distinct(t_ts) from stable_1;'''
tdSql
.
query
(
sql
)
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
3
)
#
sql = '''select distinct(tbname) from stable_1;'''
sql
=
'''select distinct(tbname) from stable_1;'''
#
tdSql.query(sql)
tdSql
.
query
(
sql
)
#
tdSql.checkRows(6)
tdSql
.
checkRows
(
6
)
tdLog
.
info
(
"========== operator=2(OP_DataBlocksOptScan) =========="
)
tdLog
.
info
(
"========== operator=2(OP_DataBlocksOptScan) =========="
)
sql
=
'''select last(q_int),first(q_int) from stable_1;'''
sql
=
'''select last(q_int),first(q_int) from stable_1;'''
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录