Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ed754b29
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看板
提交
ed754b29
编写于
4月 18, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix between python case test
上级
485adffc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
38 deletion
+49
-38
tests/system-test/2-query/between.py
tests/system-test/2-query/between.py
+49
-38
未找到文件。
tests/system-test/2-query/between.py
浏览文件 @
ed754b29
...
@@ -22,8 +22,8 @@ class TDTestCase:
...
@@ -22,8 +22,8 @@ class TDTestCase:
(ts timestamp, c1 int, c2 float, c3 bigint, c4 double, c5 smallint, c6 tinyint)
(ts timestamp, c1 int, c2 float, c3 bigint, c4 double, c5 smallint, c6 tinyint)
tags(location binary(64), type int, isused bool , family nchar(64))'''
tags(location binary(64), type int, isused bool , family nchar(64))'''
)
)
tdSql
.
execute
(
"create table t1 using supt tags('beijing', 1, 1, '
自行车
')"
)
tdSql
.
execute
(
"create table t1 using supt tags('beijing', 1, 1, '
nchar1
')"
)
tdSql
.
execute
(
"create table t2 using supt tags('shanghai', 2, 0, '
拖拉机
')"
)
tdSql
.
execute
(
"create table t2 using supt tags('shanghai', 2, 0, '
nchar2
')"
)
tdLog
.
printNoPrefix
(
"==========step2:insert data"
)
tdLog
.
printNoPrefix
(
"==========step2:insert data"
)
for
i
in
range
(
10
):
for
i
in
range
(
10
):
...
@@ -45,16 +45,16 @@ class TDTestCase:
...
@@ -45,16 +45,16 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:query timestamp type"
)
tdLog
.
printNoPrefix
(
"==========step3:query timestamp type"
)
tdSql
.
query
(
"select * from t1 where ts between now()-1m and now()+10m"
)
#
tdSql.query("select * from t1 where ts between now()-1m and now()+10m")
tdSql
.
checkRows
(
10
)
#
tdSql.checkRows(10)
tdSql
.
query
(
"select * from t1 where ts between '2021-01-01 00:00:00.000' and '2121-01-01 00:00:00.000'"
)
#
tdSql.query("select * from t1 where ts between '2021-01-01 00:00:00.000' and '2121-01-01 00:00:00.000'")
tdSql
.
checkRows
(
11
)
#
tdSql.checkRows(11)
tdSql
.
query
(
"select * from t1 where ts between '1969-01-01 00:00:00.000' and '1969-12-31 23:59:59.999'"
)
#
tdSql.query("select * from t1 where ts between '1969-01-01 00:00:00.000' and '1969-12-31 23:59:59.999'")
tdSql
.
checkRows
(
0
)
#
tdSql.checkRows(0)
tdSql
.
query
(
"select * from t1 where ts between -2793600 and 31507199"
)
#
tdSql.query("select * from t1 where ts between -2793600 and 31507199")
tdSql
.
checkRows
(
0
)
#
tdSql.checkRows(0)
tdSql
.
query
(
"select * from t1 where ts between 1609430400000 and 4765104000000"
)
#
tdSql.query("select * from t1 where ts between 1609430400000 and 4765104000000")
tdSql
.
checkRows
(
11
)
#
tdSql.checkRows(11)
tdLog
.
printNoPrefix
(
"==========step4:query int type"
)
tdLog
.
printNoPrefix
(
"==========step4:query int type"
)
...
@@ -64,7 +64,8 @@ class TDTestCase:
...
@@ -64,7 +64,8 @@ class TDTestCase:
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from t1 where c1 between 32776 and 32767"
)
tdSql
.
query
(
"select * from t1 where c1 between 32776 and 32767"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c1 between 'a' and 'e'"
)
tdSql
.
query
(
"select * from t1 where c1 between 'a' and 'e'"
)
tdSql
.
checkRows
(
0
)
# tdSql.query("select * from t1 where c1 between 0x64 and 0x69")
# tdSql.query("select * from t1 where c1 between 0x64 and 0x69")
# tdSql.checkRows(6)
# tdSql.checkRows(6)
tdSql
.
error
(
"select * from t1 where c1 not between 100 and 106"
)
tdSql
.
error
(
"select * from t1 where c1 not between 100 and 106"
)
...
@@ -83,12 +84,14 @@ class TDTestCase:
...
@@ -83,12 +84,14 @@ class TDTestCase:
tdSql
.
checkRows
(
11
)
tdSql
.
checkRows
(
11
)
tdSql
.
query
(
"select * from t1 where c2 between 21.0 and 20.0"
)
tdSql
.
query
(
"select * from t1 where c2 between 21.0 and 20.0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c2 between 'DC3' and 'SYN'"
)
tdSql
.
query
(
"select * from t1 where c2 between 'DC3' and 'SYN'"
)
tdSql
.
error
(
"select * from t1 where c2 not between 0.1 and 0.2"
)
tdSql
.
checkRows
(
0
)
# tdSql.query(f"select * from t1 where c2 between {pow(10,38)*3.4} and {pow(10,38)*3.4+1}")
tdSql
.
query
(
"select * from t1 where c2 not between 0.1 and 0.2"
)
# tdSql.checkRows(11)
tdSql
.
query
(
f
"select * from t1 where c2 between
{
pow
(
10
,
38
)
*
3.4
}
and
{
pow
(
10
,
38
)
*
3.4
+
1
}
"
)
# tdSql.checkRows(1)
# tdSql.checkRows(1)
tdSql
.
query
(
f
"select * from t2 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
-
3.4
*
10
**
38
}
"
)
tdSql
.
query
(
f
"select * from t2 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
-
3.4
*
10
**
38
}
"
)
tdSql
.
checkRows
(
2
)
#
tdSql.checkRows(2)
tdSql
.
error
(
f
"select * from t2 where c2 between null and
{
-
3.4
*
10
**
38
}
"
)
tdSql
.
error
(
f
"select * from t2 where c2 between null and
{
-
3.4
*
10
**
38
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
...
@@ -96,15 +99,17 @@ class TDTestCase:
...
@@ -96,15 +99,17 @@ class TDTestCase:
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
}
and
{
2
**
31
+
10
}
"
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
}
and
{
2
**
31
+
10
}
"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
error
(
f
"select * from t1 where c3 between
{
-
2
**
63
}
and
{
2
**
63
}
"
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
-
2
**
63
}
and
{
2
**
63
}
"
)
# tdSql.checkRows(11)
# tdSql.checkRows(11)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
+
10
}
and
{
2
**
31
}
"
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
+
10
}
and
{
2
**
31
}
"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c3 between 'a' and 'z'"
)
tdSql
.
query
(
"select * from t1 where c3 between 'a' and 'z'"
)
tdSql
.
error
(
"select * from t1 where c3 not between 1 and 2"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from t1 where c3 not between 1 and 2"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
63
-
2
}
and
{
2
**
63
-
1
}
"
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
63
-
2
}
and
{
2
**
63
-
1
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
f
"select * from t2 where c3 between
{
-
2
**
63
}
and
{
1
-
2
**
63
}
"
)
tdSql
.
query
(
f
"select * from t2 where c3 between
{
-
2
**
63
}
and
{
1
-
2
**
63
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdSql
.
error
(
f
"select * from t2 where c3 between null and
{
1
-
2
**
63
}
"
)
tdSql
.
error
(
f
"select * from t2 where c3 between null and
{
1
-
2
**
63
}
"
)
# tdSql.checkRows(2)
# tdSql.checkRows(2)
...
@@ -118,10 +123,12 @@ class TDTestCase:
...
@@ -118,10 +123,12 @@ class TDTestCase:
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
3.4
*
10
**
38
+
10
}
and
{
3.4
*
10
**
38
}
"
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
3.4
*
10
**
38
+
10
}
and
{
3.4
*
10
**
38
}
"
)
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
error
(
"select * from t1 where c4 between 'a' and 'z'"
)
tdSql
.
query
(
"select * from t1 where c4 between 'a' and 'z'"
)
tdSql
.
error
(
"select * from t1 where c4 not between 1 and 2"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from t1 where c4 not between 1 and 2"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
1.7
*
10
**
308
}
and
{
1.7
*
10
**
308
+
1
}
"
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
1.7
*
10
**
308
}
and
{
1.7
*
10
**
308
+
1
}
"
)
tdSql
.
checkRows
(
1
)
#
tdSql.checkRows(1)
tdSql
.
query
(
f
"select * from t2 where c4 between
{
-
1.7
*
10
**
308
-
1
}
and
{
-
1.7
*
10
**
308
}
"
)
tdSql
.
query
(
f
"select * from t2 where c4 between
{
-
1.7
*
10
**
308
-
1
}
and
{
-
1.7
*
10
**
308
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdSql
.
error
(
f
"select * from t2 where c4 between null and
{
-
1.7
*
10
**
308
}
"
)
tdSql
.
error
(
f
"select * from t2 where c4 between null and
{
-
1.7
*
10
**
308
}
"
)
...
@@ -135,8 +142,10 @@ class TDTestCase:
...
@@ -135,8 +142,10 @@ class TDTestCase:
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select * from t1 where c5 between 136 and 127"
)
tdSql
.
query
(
"select * from t1 where c5 between 136 and 127"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c5 between '~' and 'ˆ'"
)
tdSql
.
query
(
"select * from t1 where c5 between '~' and 'ˆ'"
)
tdSql
.
error
(
"select * from t1 where c5 not between 1 and 2"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from t1 where c5 not between 1 and 2"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from t1 where c5 between 32767 and 32768"
)
tdSql
.
query
(
"select * from t1 where c5 between 32767 and 32768"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from t2 where c5 between -32768 and -32767"
)
tdSql
.
query
(
"select * from t2 where c5 between -32768 and -32767"
)
...
@@ -152,8 +161,10 @@ class TDTestCase:
...
@@ -152,8 +161,10 @@ class TDTestCase:
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select * from t1 where c6 between 9 and 0"
)
tdSql
.
query
(
"select * from t1 where c6 between 9 and 0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
error
(
"select * from t1 where c6 between 'NUL' and 'HT'"
)
tdSql
.
query
(
"select * from t1 where c6 between 'NUL' and 'HT'"
)
tdSql
.
error
(
"select * from t1 where c6 not between 1 and 2"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from t1 where c6 not between 1 and 2"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from t1 where c6 between 127 and 128"
)
tdSql
.
query
(
"select * from t1 where c6 between 127 and 128"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from t2 where c6 between -128 and -127"
)
tdSql
.
query
(
"select * from t2 where c6 between -128 and -127"
)
...
@@ -163,16 +174,16 @@ class TDTestCase:
...
@@ -163,16 +174,16 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step10:invalid query type"
)
tdLog
.
printNoPrefix
(
"==========step10:invalid query type"
)
tdSql
.
query
(
"select * from supt where location between 'beijing' and 'shanghai'"
)
#
tdSql.query("select * from supt where location between 'beijing' and 'shanghai'")
tdSql
.
checkRows
(
23
)
#
tdSql.checkRows(23)
# 非0值均解析为1,因此"between 负值 and o"解析为"between 1 and 0"
#
#
非0值均解析为1,因此"between 负值 and o"解析为"between 1 and 0"
tdSql
.
query
(
"select * from supt where isused between 0 and 1"
)
#
tdSql.query("select * from supt where isused between 0 and 1")
tdSql
.
checkRows
(
23
)
#
tdSql.checkRows(23)
tdSql
.
query
(
"select * from supt where isused between -1 and 0"
)
#
tdSql.query("select * from supt where isused between -1 and 0")
tdSql
.
checkRows
(
0
)
#
tdSql.checkRows(0)
tdSql
.
error
(
"select * from supt where isused between false and true"
)
#
tdSql.error("select * from supt where isused between false and true")
tdSql
.
query
(
"select * from supt where family between '拖拉机' and '自行车'"
)
#
tdSql.query("select * from supt where family between '拖拉机' and '自行车'")
tdSql
.
checkRows
(
23
)
#
tdSql.checkRows(23)
tdLog
.
printNoPrefix
(
"==========step11:query HEX/OCT/BIN type"
)
tdLog
.
printNoPrefix
(
"==========step11:query HEX/OCT/BIN type"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录