Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0cc8f92d
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看板
未验证
提交
0cc8f92d
编写于
4月 24, 2023
作者:
wmmhello
提交者:
GitHub
4月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'main' into fix/TD-22671
上级
af5bcb80
a0e1ea96
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
2514 addition
and
39 deletion
+2514
-39
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+4
-0
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+1
-1
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+10
-0
tests/system-test/0-others/compatibility.py
tests/system-test/0-others/compatibility.py
+3
-3
tests/system-test/1-insert/database_pre_suf.py
tests/system-test/1-insert/database_pre_suf.py
+229
-35
tests/system-test/2-query/select_null.py
tests/system-test/2-query/select_null.py
+446
-0
tests/system-test/2-query/slimit.py
tests/system-test/2-query/slimit.py
+1821
-0
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
0cc8f92d
...
...
@@ -88,6 +88,10 @@ void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double
}
void
*
destroyLastBlockLoadInfo
(
SSttBlockLoadInfo
*
pLoadInfo
)
{
if
(
pLoadInfo
==
NULL
)
{
return
NULL
;
}
for
(
int32_t
i
=
0
;
i
<
pLoadInfo
->
numOfStt
;
++
i
)
{
pLoadInfo
[
i
].
currentLoadBlockIndex
=
1
;
pLoadInfo
[
i
].
blockIndex
[
0
]
=
-
1
;
...
...
source/libs/stream/src/stream.c
浏览文件 @
0cc8f92d
...
...
@@ -52,7 +52,7 @@ void streamCleanUp() {
void
streamSchedByTimer
(
void
*
param
,
void
*
tmrId
)
{
SStreamTask
*
pTask
=
(
void
*
)
param
;
if
(
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
if
(
streamTaskShouldStop
(
&
pTask
->
status
)
)
{
streamMetaReleaseTask
(
NULL
,
pTask
);
return
;
}
...
...
tests/parallel_test/cases.task
浏览文件 @
0cc8f92d
...
...
@@ -51,6 +51,16 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_26.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3
...
...
tests/system-test/0-others/compatibility.py
浏览文件 @
0cc8f92d
...
...
@@ -17,12 +17,12 @@ from util.dnodes import TDDnode
from
util.cluster
import
*
import
subprocess
BASEVERSION
=
"3.0.
1.8
"
BASEVERSION
=
"3.0.
2.3
"
class
TDTestCase
:
def
caseDescription
(
self
):
'''
f
'''
3.0 data compatibility test
case1: basedata version is
3.0.1.8
case1: basedata version is
{
BASEVERSION
}
'''
return
...
...
tests/system-test/1-insert/database_pre_suf.py
浏览文件 @
0cc8f92d
此差异已折叠。
点击以展开。
tests/system-test/2-query/select_null.py
0 → 100755
浏览文件 @
0cc8f92d
###################################################################
# 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
os
import
time
import
taos
import
subprocess
from
faker
import
Faker
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
from
util.dnodes
import
tdDnodes
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
testcasePath
=
os
.
path
.
split
(
__file__
)[
0
]
self
.
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf %s/%s.sql"
%
(
self
.
testcasePath
,
self
.
testcaseFilename
))
self
.
db
=
"sel_null"
def
insert_data
(
self
,
database
,
vgroups
):
num_random
=
10
tdSql
.
execute
(
'''drop database if exists %s ;'''
%
database
)
tdSql
.
execute
(
'''create database %s keep 36500 vgroups %d PRECISION 'us';'''
%
(
database
,
vgroups
))
tdSql
.
execute
(
'''use %s;'''
%
database
)
tdSql
.
execute
(
'''create stable %s.stb0 (ts timestamp , c0 int , c1 double , c0null int , c1null double ) tags( t0 tinyint , t1 varchar(16) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint , t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);'''
%
database
)
for
i
in
range
(
5
):
tdSql
.
execute
(
'''create table %s.stb0_%d using %s.stb0 tags(%d,'varchar%d',%d,%d, %d, %d,%d,'binary%d','nchar%d',%d,%d,%d ) ;'''
%
(
database
,
i
,
database
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
))
# insert data
for
i
in
range
(
num_random
):
for
j
in
range
(
50
):
tdSql
.
execute
(
'''insert into %s.stb0_0 (ts , c1 , c0) values(now, %d, %d) ;'''
%
(
database
,
j
,
j
))
tdSql
.
execute
(
'''insert into %s.stb0_1 (ts , c1 , c0) values(now, %d, %d) ;'''
%
(
database
,
j
,
j
))
tdSql
.
execute
(
'''insert into %s.stb0_2 (ts , c1 , c0) values(now, %d, %d) ;'''
%
(
database
,
j
,
j
))
tdSql
.
execute
(
'''insert into %s.stb0_3 (ts , c1 , c0) values(now, %d, %d) ;'''
%
(
database
,
j
,
j
))
tdSql
.
execute
(
'''insert into %s.stb0_4 (ts , c1 , c0) values(now, %d, %d) ;'''
%
(
database
,
j
,
j
))
tdSql
.
query
(
"select count(*) from %s.stb0;"
%
database
)
tdSql
.
checkData
(
0
,
0
,
5
*
num_random
*
50
)
tdSql
.
query
(
"select count(*) from %s.stb0_0;"
%
database
)
tdSql
.
checkData
(
0
,
0
,
num_random
*
50
)
def
ts_3085
(
self
,
database
):
sql
=
"select count(c0null) from(select * from %s.stb0 limit 20,4) "
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
offset
=
random
.
randint
(
10
,
100
)
for
i
in
range
(
offset
):
sql
=
"select count(c0null) from(select * from %s.stb0 limit %d,%d) "
%
(
database
,
offset
,
i
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select count(c1null) from(select * from %s.stb0 limit %d,%d) "
%
(
database
,
offset
,
i
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select count(c0) from(select * from %s.stb0 limit %d,%d) "
%
(
database
,
offset
,
i
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
i
)
sql
=
"select count(c1) from(select * from %s.stb0 limit %d,%d) "
%
(
database
,
offset
,
i
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
i
)
sql
=
"select count(t0) from(select * from %s.stb0 limit %d,%d) "
%
(
database
,
offset
,
i
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
i
)
sql
=
"select count(t1) from(select * from %s.stb0 limit %d,%d) "
%
(
database
,
offset
,
i
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
i
)
def
ts_2974_max
(
self
,
database
):
sql
=
"select max(c0) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
49
)
sql
=
"select max(c0),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
49
)
sql
=
"select max(c1) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
49
)
sql
=
"select max(c1),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
49
)
sql
=
"select max(c0null) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select max(c0null),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select max(c1null) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select max(c1null),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select max(t0) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t0),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t1) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t1),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t_bool) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t_bool),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t_binary) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t_binary),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t_nchar) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t_nchar),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select max(t_int) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_int),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_int) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_int),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_int) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_int),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_bigint) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_bigint),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_smallint) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_smallint),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_tinyint) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_tinyint),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_float) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_float),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_double) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"select max(t_double),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
4
)
def
ts_2974_min
(
self
,
database
):
sql
=
"select min(c0) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(c0),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(c1) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(c1),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(c0null) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select min(c0null),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select min(c1null) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select min(c1null),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
"None"
)
sql
=
"select min(t0) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t0),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t1) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t1),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t_bool) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t_bool),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t_binary) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t_binary),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t_nchar) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t_nchar),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select min(t_int) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_int),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_int) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_int),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_int) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_int),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_bigint) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_bigint),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_smallint) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_smallint),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_tinyint) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_tinyint),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_float) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_float),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_double) from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
sql
=
"select min(t_double),ts from %s.stb0 where ts<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
0
)
def
ts_2601
(
self
,
database
):
tdSql
.
query
(
"alter local 'keepcolumnname' '0';"
)
sql
=
"select ts,c0 from (select last(*) from %s.stb0 where ts<now);"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"select ts,c0 from (select last(*) from %s.stb0 where ts<now order by ts );"
%
(
database
)
tdSql
.
error
(
sql
)
tdSql
.
query
(
"alter local 'keepcolumnname' '1';"
)
sql
=
"select ts,c0 from (select last(*) from %s.stb0 where ts<now);"
%
(
database
)
tdSql
.
query
(
sql
)
sql
=
"select ts,c0 from (select last(*) from %s.stb0 where ts<now order by ts );"
%
(
database
)
tdSql
.
query
(
sql
)
def
ts_3108
(
self
,
database
):
sql
=
"select count(*) from %s.stb0 where to_unixtimestamp('2023-01-01 00:00:00.000')<now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
2500
)
sql
=
"select count(*) from %s.stb0 where to_unixtimestamp('2023-01-01 00:00:00.000')>now;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
"select count(*) from %s.stb0 where to_unixtimestamp('2024-01-01 00:00:00.000')<now+1y;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
2500
)
sql
=
"select count(*) from %s.stb0 where to_unixtimestamp('2024-01-01 00:00:00.000')>now+1y;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
def
ts_3110
(
self
,
database
):
sql1
=
"select * from %s.stb0 order by ts desc limit 2;"
%
(
database
)
tdSql
.
query
(
sql1
)
data1_0_0
=
tdSql
.
getData
(
0
,
0
)
data1_1_0
=
tdSql
.
getData
(
1
,
0
)
sql2
=
"select * from (select * from %s.stb0 order by ts desc limit 2) order by ts;"
%
(
database
)
tdSql
.
query
(
sql2
)
data2_0_0
=
tdSql
.
getData
(
0
,
0
)
data2_1_0
=
tdSql
.
getData
(
1
,
0
)
if
(
data1_0_0
==
data2_1_0
)
and
(
data1_1_0
==
data2_0_0
):
tdLog
.
info
(
"ts_3110: success"
)
else
:
tdLog
.
exit
(
"ts_3110: sql1 result:'%s' not equal sql2 result:'%s'"
%
(
sql1
,
sql2
))
def
ts_3036
(
self
,
database
):
sql1
=
"select ts , c0 , c1 , c0null , c1null from (select ts , c0 , c1 , c0null , c1null from %s.stb0_0 where ts between now -1d and now +1d
\
union all select ts , c0 , c1 , c0null , c1null from %s.stb0_1 where ts between now -1d and now +1d
\
union all select ts , c0 , c1 , c0null , c1null from %s.stb0_2 where ts between now -1d and now +1d ) tt
\
where ts < now order by tt.ts desc limit 2;"
%
(
database
,
database
,
database
)
tdSql
.
query
(
sql1
)
data1_0_0
=
tdSql
.
getData
(
0
,
0
)
data1_1_0
=
tdSql
.
getData
(
1
,
0
)
sql2
=
"select ts , c0 , c1 , c0null , c1null from (select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts > now
\
union all select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts = now
\
union all select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts < now ) tt
\
where tt.ts between now -1d and now +1d and tt.tb in ('stb0_0','stb0_1','stb0_2') order by tt.ts desc limit 2;"
%
(
database
,
database
,
database
)
tdSql
.
query
(
sql2
)
data2_0_0
=
tdSql
.
getData
(
0
,
0
)
data2_1_0
=
tdSql
.
getData
(
1
,
0
)
sql3
=
"select ts , c0 , c1 , c0null , c1null from %s.stb0
\
where ts between now -1d and now +1d and tbname in ('stb0_0','stb0_1','stb0_2') order by ts desc limit 2;"
%
(
database
)
tdSql
.
query
(
sql3
)
data3_0_0
=
tdSql
.
getData
(
0
,
0
)
data3_1_0
=
tdSql
.
getData
(
1
,
0
)
if
(
data1_0_0
==
data2_0_0
==
data3_0_0
)
and
(
data1_1_0
==
data2_1_0
==
data3_1_0
):
tdLog
.
info
(
"ts_3036: success"
)
else
:
tdLog
.
exit
(
"ts_3036: sql1 result:'%s' not equal sql2 result:'%s' or not equal sql3 result:'%s'"
%
(
sql1
,
sql2
,
sql3
))
def
ts_23569
(
self
,
database
):
tdSql
.
query
(
"alter local 'keepcolumnname' '0';"
)
sql
=
"alter table %s.stb0 drop tag t10;"
%
(
database
)
tdSql
.
error
(
sql
)
error_msg
=
tdSql
.
error
(
sql
)
include_msg
=
'Invalid tag name'
if
include_msg
in
error_msg
:
tdLog
.
info
(
"ts_23569: success"
)
else
:
tdLog
.
exit
(
"ts_23569: include_msg:'%s' not in error_msg:'%s'"
%
(
include_msg
,
error_msg
))
tdSql
.
query
(
"alter local 'keepcolumnname' '1';"
)
sql
=
"alter table %s.stb0 drop tag t10;"
%
(
database
)
tdSql
.
error
(
sql
)
error_msg
=
tdSql
.
error
(
sql
)
include_msg
=
'Invalid tag name'
if
include_msg
in
error_msg
:
tdLog
.
info
(
"ts_23569: success"
)
else
:
tdLog
.
exit
(
"ts_23569: include_msg:'%s' not in error_msg:'%s'"
%
(
include_msg
,
error_msg
))
def
ts_23505
(
self
,
database
):
sql
=
"create table %s.`12345` (`567` timestamp,num int);"
%
(
database
)
tdSql
.
execute
(
sql
)
sql
=
"insert into %s.12345 values (now,1);"
%
(
database
)
tdSql
.
error
(
sql
)
sql
=
"insert into %s.`12345` values (now,1);"
%
(
database
)
tdSql
.
execute
(
sql
)
sql
=
"select * from %s.`12345` order by `567` desc limit 2;"
%
(
database
)
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
1
,
1
)
sql
=
"drop table %s.`12345` ;"
%
(
database
)
tdSql
.
execute
(
sql
)
sql
=
"select * from %s.`12345` order by `567` desc limit 2;"
%
(
database
)
tdSql
.
error
(
sql
)
def
run
(
self
):
startTime
=
time
.
time
()
os
.
system
(
"rm -rf %s/%s.sql"
%
(
self
.
testcasePath
,
self
.
testcaseFilename
))
self
.
insert_data
(
"%s"
%
self
.
db
,
2
)
self
.
ts_3085
(
"%s"
%
self
.
db
)
self
.
ts_2974_max
(
"%s"
%
self
.
db
)
self
.
ts_2974_min
(
"%s"
%
self
.
db
)
self
.
ts_2601
(
"%s"
%
self
.
db
)
self
.
ts_23569
(
"%s"
%
self
.
db
)
self
.
ts_3108
(
"%s"
%
self
.
db
)
self
.
ts_3110
(
"%s"
%
self
.
db
)
self
.
ts_23505
(
"%s"
%
self
.
db
)
self
.
ts_3036
(
"%s"
%
self
.
db
)
tdSql
.
query
(
"flush database %s"
%
self
.
db
)
self
.
ts_2974_max
(
"%s"
%
self
.
db
)
self
.
ts_2974_min
(
"%s"
%
self
.
db
)
self
.
ts_3085
(
"%s"
%
self
.
db
)
self
.
ts_2601
(
"%s"
%
self
.
db
)
self
.
ts_23569
(
"%s"
%
self
.
db
)
self
.
ts_3108
(
"%s"
%
self
.
db
)
self
.
ts_3110
(
"%s"
%
self
.
db
)
self
.
ts_23505
(
"%s"
%
self
.
db
)
self
.
ts_3036
(
"%s"
%
self
.
db
)
endTime
=
time
.
time
()
print
(
"total time %ds"
%
(
endTime
-
startTime
))
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/2-query/slimit.py
0 → 100644
浏览文件 @
0cc8f92d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录