Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
789c0474
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
789c0474
编写于
3月 08, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-207]<fix>(query): add querySort.py after merge develop
上级
592ed087
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
3 deletion
+41
-3
tests/pytest/query/querySort.py
tests/pytest/query/querySort.py
+41
-3
未找到文件。
tests/pytest/query/querySort.py
浏览文件 @
789c0474
...
@@ -18,6 +18,8 @@ from util.cases import *
...
@@ -18,6 +18,8 @@ from util.cases import *
from
util.sql
import
*
from
util.sql
import
*
import
numpy
as
np
import
numpy
as
np
# constant define
WAITS
=
5
# wait seconds
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
...
@@ -67,9 +69,7 @@ class TDTestCase:
...
@@ -67,9 +69,7 @@ class TDTestCase:
"%s failed: sql:%s, the order provided for col:%d is not correct"
%
"%s failed: sql:%s, the order provided for col:%d is not correct"
%
(
callerFilename
,
tdSql
.
sql
,
col
))
(
callerFilename
,
tdSql
.
sql
,
col
))
def
run
(
self
):
def
test_base
(
self
):
tdSql
.
prepare
()
print
(
"======= step 1: create table and insert data ========="
)
print
(
"======= step 1: create table and insert data ========="
)
tdLog
.
debug
(
tdLog
.
debug
(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
...
@@ -183,6 +183,44 @@ class TDTestCase:
...
@@ -183,6 +183,44 @@ class TDTestCase:
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
def
create_insert_data
(
self
):
sql
=
"create table sb(ts timestamp, i1 int) tags(t_b1 binary(32), t_n1 nchar(64));"
tdSql
.
execute
(
sql
)
for
i
in
range
(
20
):
value
=
"%s%s%s"
%
(
chr
(
64
+
i
),
chr
(
64
+
i
),
chr
(
65
+
i
))
if
i
%
10
==
5
:
value
+=
"_%s"
%
(
chr
(
66
+
i
))
if
i
%
10
==
0
:
value
+=
"_%s"
%
(
chr
(
67
+
i
))
sql
=
"insert into b%d using sb tags('A%s', 'B%s') values(now, %d);"
%
(
i
,
value
,
value
,
i
+
1000
)
tdSql
.
execute
(
sql
)
def
test_groupby_order
(
self
):
# create and insert data
print
(
"======= group order step 1: create table and insert data ========="
)
self
.
create_insert_data
()
# do query
print
(
"======= group order step 2: do query ========="
)
# ASC
sql
=
"select count(*) from sb group by t_b1 order by t_b1 asc;"
tdSql
.
execute
(
sql
)
tdSql
.
waitedQuery
(
sql
,
20
,
WAITS
)
tdSql
.
checkData
(
0
,
1
,
"A@@A_C"
)
tdSql
.
checkData
(
5
,
1
,
"AEEF_G"
)
tdSql
.
checkData
(
19
,
1
,
"ASST"
)
#DESC
sql
=
"select count(*) from sb group by t_b1 order by t_b1 desc;"
tdSql
.
execute
(
sql
)
tdSql
.
waitedQuery
(
sql
,
20
,
WAITS
)
tdSql
.
checkData
(
19
,
1
,
"A@@A_C"
)
tdSql
.
checkData
(
4
,
1
,
"AOOP_Q"
)
tdSql
.
checkData
(
0
,
1
,
"ASST"
)
def
run
(
self
):
tdSql
.
prepare
()
self
.
test_base
()
self
.
test_groupby_order
()
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录