Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2371af19
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2371af19
编写于
11月 23, 2022
作者:
“
“happyguoxy”
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: refine query cases
上级
ef478749
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
19 deletion
+47
-19
tests/system-test/2-query/select_index.py
tests/system-test/2-query/select_index.py
+47
-19
未找到文件。
tests/system-test/2-query/select_index.py
浏览文件 @
2371af19
...
...
@@ -26,7 +26,7 @@ from util.dnodes import *
class
TDTestCase
:
updatecfgDict
=
{
'maxSQLLength'
:
1048576
,
'debugFlag'
:
143
,
"querySmaOptimize"
:
1
}
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
,
replicaVar
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
...
...
@@ -109,7 +109,7 @@ class TDTestCase:
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)
\
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s',
\
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
%
(
database
,
ts
+
i
*
1000
,
fake
.
random_int
(
min
=-
2147483647
,
max
=
2147483647
,
step
=
1
),
%
(
database
,
ts
+
i
*
1000
+
1
,
fake
.
random_int
(
min
=-
2147483647
,
max
=
2147483647
,
step
=
1
),
fake
.
random_int
(
min
=-
9223372036854775807
,
max
=
9223372036854775807
,
step
=
1
),
fake
.
random_int
(
min
=-
32767
,
max
=
32767
,
step
=
1
)
,
fake
.
random_int
(
min
=-
127
,
max
=
127
,
step
=
1
)
,
fake
.
pyfloat
()
,
fake
.
pyfloat
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
ts
+
i
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
...
...
@@ -118,7 +118,7 @@ class TDTestCase:
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)
\
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s',
\
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
%
(
database
,
ts
+
i
*
1000
,
fake
.
random_int
(
min
=-
2147483647
,
max
=
2147483647
,
step
=
1
)
,
%
(
database
,
ts
+
i
*
1000
+
1
,
fake
.
random_int
(
min
=-
2147483647
,
max
=
2147483647
,
step
=
1
)
,
fake
.
random_int
(
min
=-
9223372036854775807
,
max
=
9223372036854775807
,
step
=
1
)
,
fake
.
random_int
(
min
=-
32767
,
max
=
32767
,
step
=
1
)
,
fake
.
random_int
(
min
=-
127
,
max
=
127
,
step
=
1
)
,
fake
.
pyfloat
()
,
fake
.
pyfloat
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
ts
+
i
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
...
...
@@ -128,7 +128,7 @@ class TDTestCase:
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)
\
values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s',
\
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
%
(
database
,
ts
+
i
*
1000
,
fake
.
random_int
(
min
=
0
,
max
=
2147483647
,
step
=
1
),
%
(
database
,
ts
+
i
*
1000
+
2
,
fake
.
random_int
(
min
=
0
,
max
=
2147483647
,
step
=
1
),
fake
.
random_int
(
min
=
0
,
max
=
9223372036854775807
,
step
=
1
),
fake
.
random_int
(
min
=
0
,
max
=
32767
,
step
=
1
)
,
fake
.
random_int
(
min
=
0
,
max
=
127
,
step
=
1
)
,
fake
.
pyfloat
()
,
fake
.
pyfloat
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
ts
+
i
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
...
...
@@ -137,7 +137,7 @@ class TDTestCase:
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)
\
values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s',
\
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
%
(
database
,
ts
+
i
*
1000
,
fake
.
random_int
(
min
=
0
,
max
=
2147483647
,
step
=
1
),
%
(
database
,
ts
+
i
*
1000
+
2
,
fake
.
random_int
(
min
=
0
,
max
=
2147483647
,
step
=
1
),
fake
.
random_int
(
min
=
0
,
max
=
9223372036854775807
,
step
=
1
),
fake
.
random_int
(
min
=
0
,
max
=
32767
,
step
=
1
)
,
fake
.
random_int
(
min
=
0
,
max
=
127
,
step
=
1
)
,
fake
.
pyfloat
()
,
fake
.
pyfloat
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
ts
+
i
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
...
...
@@ -147,7 +147,7 @@ class TDTestCase:
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)
\
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s',
\
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
%
(
database
,
ts
+
i
*
1000
,
fake
.
random_int
(
min
=-
0
,
max
=
2147483647
,
step
=
1
),
%
(
database
,
ts
+
i
*
1000
+
3
,
fake
.
random_int
(
min
=-
0
,
max
=
2147483647
,
step
=
1
),
fake
.
random_int
(
min
=-
0
,
max
=
9223372036854775807
,
step
=
1
),
fake
.
random_int
(
min
=-
0
,
max
=
32767
,
step
=
1
)
,
fake
.
random_int
(
min
=-
0
,
max
=
127
,
step
=
1
)
,
fake
.
pyfloat
()
,
fake
.
pyfloat
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
ts
+
i
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
...
...
@@ -157,7 +157,7 @@ class TDTestCase:
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)
\
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s',
\
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
%
(
database
,
ts
+
i
*
1000
+
1
,
fake
.
random_int
(
min
=-
0
,
max
=
2147483647
,
step
=
1
),
%
(
database
,
ts
+
i
*
1000
+
4
,
fake
.
random_int
(
min
=-
0
,
max
=
2147483647
,
step
=
1
),
fake
.
random_int
(
min
=-
0
,
max
=
9223372036854775807
,
step
=
1
),
fake
.
random_int
(
min
=-
0
,
max
=
32767
,
step
=
1
)
,
fake
.
random_int
(
min
=-
0
,
max
=
127
,
step
=
1
)
,
fake
.
pyfloat
()
,
fake
.
pyfloat
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
ts
+
i
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
...
...
@@ -167,7 +167,7 @@ class TDTestCase:
q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)
\
values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s',
\
'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
%
(
database
,
ts
+
i
*
1000
+
10
,
fake
.
random_int
(
min
=-
0
,
max
=
2147483647
,
step
=
1
),
%
(
database
,
ts
+
i
*
1000
+
5
,
fake
.
random_int
(
min
=-
0
,
max
=
2147483647
,
step
=
1
),
fake
.
random_int
(
min
=-
0
,
max
=
9223372036854775807
,
step
=
1
),
fake
.
random_int
(
min
=-
0
,
max
=
32767
,
step
=
1
)
,
fake
.
random_int
(
min
=-
0
,
max
=
127
,
step
=
1
)
,
fake
.
pyfloat
()
,
fake
.
pyfloat
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
ts
+
i
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
fake
.
pystr
()
,
...
...
@@ -182,7 +182,7 @@ class TDTestCase:
fake
=
Faker
(
'zh_CN'
)
fake_data
=
fake
.
random_int
(
min
=
1
,
max
=
20
,
step
=
1
)
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
func
)
tdSql
.
execute
(
" create sma index
sma_index_name1 on stable_1 function(%s(%s)) interval(%dm); "
%
(
func
,
column
,
fake_data
))
tdSql
.
execute
(
" create sma index
%s.sma_index_name1 on %s.stable_1 function(%s(%s)) interval(%dm); "
%
(
database
,
database
,
func
,
column
,
fake_data
))
sql
=
" select %s(%s) from %s.stable_1 interval(1m) "
%
(
func
,
column
,
database
)
tdLog
.
info
(
sql
)
tdSql
.
query
(
sql
)
...
...
@@ -205,7 +205,7 @@ class TDTestCase:
tdLog
.
info
(
"
\n
=============drop index ====================
\n
"
)
tdSql
.
execute
(
" drop index
sma_index_name1;"
)
tdSql
.
execute
(
" drop index
%s.sma_index_name1;"
%
database
)
tdSql
.
query
(
sql
)
queryRows
=
len
(
tdSql
.
queryResult
)
...
...
@@ -214,7 +214,30 @@ class TDTestCase:
drop_index_value
=
tdSql
.
queryResult
[
i
][
0
]
self
.
value_check
(
flush_before_value
,
drop_index_value
)
def
constant_speical_check
(
self
,
database
,
func
,
column
):
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
column
)
sql_no_from
=
" select %s(%s) ; "
%
(
func
,
column
)
tdLog
.
info
(
sql_no_from
)
tdSql
.
query
(
sql_no_from
)
queryRows
=
len
(
tdSql
.
queryResult
)
for
i
in
range
(
queryRows
):
print
(
"row=%d, result=%s "
%
(
i
,
tdSql
.
queryResult
[
i
][
0
]))
flush_before_value_no_from
=
tdSql
.
queryResult
[
i
][
0
]
tdLog
.
info
(
"
\n
=============flush database ====================
\n
"
)
tdSql
.
execute
(
" flush database %s;"
%
database
)
tdSql
.
query
(
sql_no_from
)
queryRows
=
len
(
tdSql
.
queryResult
)
for
i
in
range
(
queryRows
):
print
(
"row=%d, result=%s "
%
(
i
,
tdSql
.
queryResult
[
i
][
0
]))
flush_after_value_no_from
=
tdSql
.
queryResult
[
i
][
0
]
self
.
value_check
(
flush_before_value_no_from
,
flush_after_value_no_from
)
def
constant_check
(
self
,
database
,
func
,
column
):
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
column
)
...
...
@@ -253,7 +276,7 @@ class TDTestCase:
print
(
"row=%d, result=%s "
%
(
i
,
tdSql
.
queryResult
[
i
][
0
]))
flush_after_value_no_from
=
tdSql
.
queryResult
[
i
][
0
]
self
.
value_check
(
flush_before_value_no_from
,
flush_after_value_no_from
)
#self.value_check(flush_before_value_no_from,flush_after_value_no_from)#越界后值不唯一
def
constant_table_check
(
self
,
database
,
func
,
column
):
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
column
)
...
...
@@ -292,7 +315,7 @@ class TDTestCase:
print
(
"row=%d, result=%s "
%
(
i
,
tdSql
.
queryResult
[
i
][
0
]))
flush_after_value_no_from
=
tdSql
.
queryResult
[
i
][
0
]
self
.
value_check
(
flush_before_value_no_from
,
flush_after_value_no_from
)
#self.value_check(flush_before_value_no_from,flush_after_value_no_from)#越界后值不唯一
def
constant_str_check
(
self
,
database
,
func
,
column
):
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
column
)
...
...
@@ -338,7 +361,7 @@ class TDTestCase:
def
derivative_sql
(
self
,
database
):
fake
=
Faker
(
'zh_CN'
)
fake_data
=
fake
.
random_int
(
min
=
-
9223372036854775807
,
max
=
9223372036854775807
,
step
=
1
)
fake_data
=
fake
.
random_int
(
min
=
1
,
max
=
10000000000000
,
step
=
1
)
tdLog
.
info
(
"
\n
=============derivative sql ====================
\n
"
)
sql
=
" select derivative(%s,%ds,0) from %s.stable_1 "
%
(
'q_smallint'
,
fake_data
,
database
)
self
.
derivative_data_check
(
"%s"
%
self
.
db
,
"%s"
%
sql
)
...
...
@@ -493,11 +516,11 @@ class TDTestCase:
def
value_check
(
self
,
flush_before_value
,
flush_after_value
):
#
if flush_before_value==flush_after_value:
#
tdLog.info(f"checkEqual success, flush_before_value={flush_before_value},flush_after_value={flush_after_value}")
#
else :
#
tdLog.exit(f"checkEqual error, flush_before_value=={flush_before_value},flush_after_value={flush_after_value}")
pass
if
flush_before_value
==
flush_after_value
:
tdLog
.
info
(
f
"checkEqual success, flush_before_value=
{
flush_before_value
}
,flush_after_value=
{
flush_after_value
}
"
)
else
:
tdLog
.
exit
(
f
"checkEqual error, flush_before_value==
{
flush_before_value
}
,flush_after_value=
{
flush_after_value
}
"
)
#
pass
def
run
(
self
):
fake
=
Faker
(
'zh_CN'
)
...
...
@@ -511,6 +534,11 @@ class TDTestCase:
self
.
dropandcreateDB_random
(
"%s"
%
self
.
db
,
1
,
2
)
self
.
constant_speical_check
(
"%s"
%
self
.
db
,
''
,
'%d'
%
fake_data
)
self
.
constant_speical_check
(
"%s"
%
self
.
db
,
''
,
'%f'
%
fake_float
)
self
.
constant_speical_check
(
"%s"
%
self
.
db
,
''
,
'
\'
%s
\'
'
%
fake_str
)
self
.
constant_speical_check
(
"%s"
%
self
.
db
,
''
,
'NULL'
)
#TD-19818
self
.
func_index_check
(
"%s"
%
self
.
db
,
'max'
,
'q_int'
)
self
.
func_index_check
(
"%s"
%
self
.
db
,
'max'
,
'q_bigint'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录