Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4e14b375
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4e14b375
编写于
10月 27, 2022
作者:
H
Hui Li
提交者:
GitHub
10月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17720 from taosdata/test/TD-19854_2
test: refine query cases
上级
4023dc6e
0398c7e2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
78 addition
and
8 deletion
+78
-8
tests/system-test/2-query/select_index.py
tests/system-test/2-query/select_index.py
+78
-8
未找到文件。
tests/system-test/2-query/select_index.py
浏览文件 @
4e14b375
...
...
@@ -219,12 +219,21 @@ class TDTestCase:
def
constant_check
(
self
,
database
,
func
,
column
):
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
column
)
sql
=
" select %s(%s) from %s.stable_1 "
%
(
func
,
column
,
database
)
sql_no_from
=
" select %s(%s) "
%
(
func
,
column
)
tdLog
.
info
(
sql
)
tdSql
.
query
(
sql
)
queryRows
=
len
(
tdSql
.
queryResult
)
for
i
in
range
(
queryRows
):
print
(
"row=%d, result=%s "
%
(
i
,
tdSql
.
queryResult
[
i
][
0
]))
flush_before_value
=
tdSql
.
queryResult
[
i
][
0
]
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
"
)
...
...
@@ -238,15 +247,32 @@ class TDTestCase:
self
.
value_check
(
flush_before_value
,
flush_after_value
)
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_table_check
(
self
,
database
,
func
,
column
):
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
column
)
sql
=
" select %s(%s) from %s.bj_stable_1_1 "
%
(
func
,
column
,
database
)
sql_no_from
=
" select %s(%s) "
%
(
func
,
column
)
tdLog
.
info
(
sql
)
tdSql
.
query
(
sql
)
queryRows
=
len
(
tdSql
.
queryResult
)
for
i
in
range
(
queryRows
):
print
(
"row=%d, result=%s "
%
(
i
,
tdSql
.
queryResult
[
i
][
0
]))
flush_before_value
=
tdSql
.
queryResult
[
i
][
0
]
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
"
)
...
...
@@ -260,6 +286,14 @@ class TDTestCase:
self
.
value_check
(
flush_before_value
,
flush_after_value
)
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_str_check
(
self
,
database
,
func
,
column
):
tdLog
.
info
(
"
\n
=============constant(%s)_check ====================
\n
"
%
column
)
sql
=
" select %s('%s') from %s.stable_1 "
%
(
func
,
column
,
database
)
...
...
@@ -295,6 +329,13 @@ class TDTestCase:
tdSql
.
error
(
error_sql
)
error_sql1
=
" select %s('%s') from %s.stable_1 "
%
(
func
,
column
,
database
)
tdLog
.
info
(
error_sql1
)
tdSql
.
error
(
error_sql1
)
error_sql2
=
" select %s('%s') from %s.bj_stable_1_1 "
%
(
func
,
column
,
database
)
tdLog
.
info
(
error_sql2
)
tdSql
.
error
(
error_sql2
)
def
derivative_sql
(
self
,
database
):
fake
=
Faker
(
'zh_CN'
)
fake_data
=
fake
.
random_int
(
min
=-
9223372036854775807
,
max
=
9223372036854775807
,
step
=
1
)
...
...
@@ -452,10 +493,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
}
"
)
# 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'
)
...
...
@@ -588,6 +630,22 @@ class TDTestCase:
self
.
constant_check
(
"%s"
%
self
.
db
,
'hyperloglog'
,
'(cast(%d as double))'
%
fake_data
)
self
.
constant_check
(
"%s"
%
self
.
db
,
'hyperloglog'
,
'(cast(%f as double))'
%
fake_float
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'%d'
%
fake_data
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'%f'
%
fake_float
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'%s'
%
fake_str
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%d as int))'
%
fake_data
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%f as int))'
%
fake_float
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%d as smallint))'
%
fake_data
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%f as smallint))'
%
fake_float
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%d as bigint))'
%
fake_data
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%f as bigint))'
%
fake_float
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%d as tinyint))'
%
fake_data
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%f as tinyint))'
%
fake_float
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%d as float))'
%
fake_data
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%f as float))'
%
fake_float
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%d as double))'
%
fake_data
)
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'elapsed'
,
'(cast(%f as double))'
%
fake_float
)
percentile_data
=
fake
.
random_int
(
min
=-
0
,
max
=
100
,
step
=
1
)
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'percentile'
,
'%d,%d'
%
(
fake_data
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'percentile'
,
'%f,%d'
%
(
fake_float
,
percentile_data
))
...
...
@@ -621,10 +679,22 @@ class TDTestCase:
self
.
constant_check
(
"%s"
%
self
.
db
,
'apercentile'
,
'(cast(%d as double)),%d'
%
(
fake_data
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'apercentile'
,
'(cast(%f as double)),%d'
%
(
fake_float
,
percentile_data
))
# percentile_data = fake.random_int(min=-0, max=1, step=1)
# self.constant_table_check("%s" %self.db,'histogram','%d' %fake_data,'user_input','[-10000,0,10000]','%d' %percentile_data)
# self.constant_check("%s" %self.db,'histogram','%f,%d' %(fake_float,percentile_data))
# self.constant_error_check("%s" %self.db,'histogram','%s,%d' %(fake_str,percentile_data))
percentile_data
=
fake
.
random_int
(
min
=-
0
,
max
=
1
,
step
=
1
)
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'histogram'
,
"%d,'user_input','[-10000,0,10000]',%d"
%
(
fake_data
,
percentile_data
))
self
.
constant_check
(
"%s"
%
self
.
db
,
'histogram'
,
"%f,'user_input','[-10000,0,10000]',%d"
%
(
fake_float
,
percentile_data
))
self
.
constant_error_check
(
"%s"
%
self
.
db
,
'histogram'
,
"%s,'user_input','[-10000,0,10000]',%d"
%
(
fake_str
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%d as int)),'user_input','[-10000,0,10000]',%d"
%
(
fake_data
,
percentile_data
))
self
.
constant_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%f as int)),'user_input','[-10000,0,10000]',%d"
%
(
fake_float
,
percentile_data
))
self
.
constant_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%d as smallint)),'user_input','[-10000,0,10000]',%d"
%
(
fake_data
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%f as smallint)),'user_input','[-10000,0,10000]',%d"
%
(
fake_float
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%d as bigint)),'user_input','[-10000,0,10000]',%d"
%
(
fake_data
,
percentile_data
))
self
.
constant_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%f as bigint)),'user_input','[-10000,0,10000]',%d"
%
(
fake_float
,
percentile_data
))
self
.
constant_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%d as tinyint)),'user_input','[-10000,0,10000]',%d"
%
(
fake_data
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%f as tinyint)),'user_input','[-10000,0,10000]',%d"
%
(
fake_float
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%d as float)),'user_input','[-10000,0,10000]',%d"
%
(
fake_data
,
percentile_data
))
self
.
constant_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%f as float)),'user_input','[-10000,0,10000]',%d"
%
(
fake_float
,
percentile_data
))
self
.
constant_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%d as double)),'user_input','[-10000,0,10000]',%d"
%
(
fake_data
,
percentile_data
))
self
.
constant_table_check
(
"%s"
%
self
.
db
,
'histogram'
,
"(cast(%f as double)),'user_input','[-10000,0,10000]',%d"
%
(
fake_float
,
percentile_data
))
#TD-19843
self
.
derivative_sql
(
"%s"
%
self
.
db
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录