Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
41f1f90c
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
41f1f90c
编写于
6月 17, 2021
作者:
H
Hui Li
提交者:
GitHub
6月 17, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6521 from taosdata/td4568and4541
Td4568and4541
上级
d43197b9
ad46ff86
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
1110 addition
and
0 deletion
+1110
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+2
-0
tests/pytest/insert/in_function.py
tests/pytest/insert/in_function.py
+726
-0
tests/pytest/insert/modify_column.py
tests/pytest/insert/modify_column.py
+382
-0
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
41f1f90c
...
...
@@ -25,6 +25,8 @@ python3 ./test.py -f insert/special_character_show.py
python3 bug2265.py
python3 ./test.py
-f
insert/bug3654.py
python3 ./test.py
-f
insert/insertDynamicColBeforeVal.py
python3 ./test.py
-f
insert/in_function.py
python3 ./test.py
-f
insert/modify_column.py
#table
python3 ./test.py
-f
table/alter_wal0.py
...
...
tests/pytest/insert/in_function.py
0 → 100644
浏览文件 @
41f1f90c
###################################################################
# 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
sys
import
datetime
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
# test case for https://jira.taosdata.com:18080/browse/TD-4568
tdLog
.
info
(
"=============== step1,check bool and tinyint data type"
)
tdLog
.
info
(
"=============== step1.1,drop table && create table"
)
cmd1
=
'drop table if exists in_bool_tinyint_1 ;'
cmd2
=
'drop table if exists in_bool_tinyint_2 ;'
cmd3
=
'drop table if exists in_bool_tinyint_3 ;'
cmd10
=
'drop table if exists in_stable_1 ;'
cmd11
=
'create stable in_stable_1(ts timestamp,in_bool bool,in_tinyint tinyint) tags (tin_bool bool,tin_tinyint tinyint) ;'
cmd12
=
'create table in_bool_tinyint_1 using in_stable_1 tags(
\'
true
\'
,
\'
127
\'
) ; '
cmd13
=
'create table in_bool_tinyint_2 using in_stable_1 tags(
\'
false
\'
,
\'
-127
\'
) ; '
cmd14
=
'create table in_bool_tinyint_3 using in_stable_1 tags(
\'
false
\'
,
\'
0
\'
) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd10
)
tdSql
.
execute
(
cmd10
)
tdLog
.
info
(
cmd11
)
tdSql
.
execute
(
cmd11
)
tdLog
.
info
(
cmd12
)
tdSql
.
execute
(
cmd12
)
tdLog
.
info
(
cmd13
)
tdSql
.
execute
(
cmd13
)
tdLog
.
info
(
cmd14
)
tdSql
.
execute
(
cmd14
)
tdLog
.
info
(
"=============== step1.2,insert stable right data and check in function"
)
cmd1
=
'insert into in_bool_tinyint_1 values(now,
\'
true
\'
,
\'
-127
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from in_stable_1 where in_bool in (true) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
tdSql
.
checkData
(
0
,
3
,
'True'
)
tdSql
.
checkData
(
0
,
4
,
'127'
)
tdSql
.
query
(
'select * from in_stable_1 where in_tinyint in (-127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
tdSql
.
checkData
(
0
,
3
,
'True'
)
tdSql
.
checkData
(
0
,
4
,
'127'
)
tdSql
.
query
(
'select * from in_stable_1 where tin_bool in (true) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
tdSql
.
checkData
(
0
,
3
,
'True'
)
tdSql
.
checkData
(
0
,
4
,
'127'
)
tdSql
.
query
(
'select * from in_stable_1 where tin_tinyint in (127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
tdSql
.
checkData
(
0
,
3
,
'True'
)
tdSql
.
checkData
(
0
,
4
,
'127'
)
tdSql
.
query
(
'select * from in_bool_tinyint_1 where in_bool in (true) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
tdSql
.
query
(
'select * from in_bool_tinyint_1 where in_tinyint in (-127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
cmd2
=
'insert into in_bool_tinyint_2 values(now,
\'
false
\'
,
\'
127
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from in_stable_1 where in_bool in (false) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
tdSql
.
checkData
(
0
,
3
,
'False'
)
tdSql
.
checkData
(
0
,
4
,
'-127'
)
tdSql
.
query
(
'select * from in_stable_1 where in_tinyint in (127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
tdSql
.
checkData
(
0
,
3
,
'False'
)
tdSql
.
checkData
(
0
,
4
,
'-127'
)
tdSql
.
query
(
'select * from in_stable_1 where tin_bool in (false) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
tdSql
.
checkData
(
0
,
3
,
'False'
)
tdSql
.
checkData
(
0
,
4
,
'-127'
)
tdSql
.
query
(
'select * from in_stable_1 where tin_tinyint in (-127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
tdSql
.
checkData
(
0
,
3
,
'False'
)
tdSql
.
checkData
(
0
,
4
,
'-127'
)
tdSql
.
query
(
'select * from in_bool_tinyint_2 where in_bool in (false) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
tdSql
.
query
(
'select * from in_bool_tinyint_2 where in_tinyint in (127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
cmd3
=
'insert into in_bool_tinyint_3 values(now,
\'
true
\'
,
\'
0
\'
) ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdSql
.
query
(
'select * from in_stable_1 where in_tinyint in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'False'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
query
(
'select * from in_stable_1 where tin_tinyint in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'False'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
query
(
'select * from in_bool_tinyint_3 where in_bool in (true) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
query
(
'select * from in_bool_tinyint_3 where in_tinyint in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdLog
.
info
(
"=============== step1.3,drop normal table && create table"
)
cmd1
=
'drop table if exists normal_in_bool_tinyint_1 ;'
cmd2
=
'create table normal_in_bool_tinyint_1 (ts timestamp,in_bool bool,in_tinyint tinyint) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
"=============== step1.4,insert normal table right data and check in function"
)
cmd1
=
'insert into normal_in_bool_tinyint_1 values(now,
\'
true
\'
,
\'
-127
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from normal_in_bool_tinyint_1 where in_bool in (true) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
tdSql
.
query
(
'select * from normal_in_bool_tinyint_1 where in_tinyint in (-127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'-127'
)
cmd2
=
'insert into normal_in_bool_tinyint_1 values(now,
\'
false
\'
,
\'
127
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from normal_in_bool_tinyint_1 where in_bool in (false) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
tdSql
.
query
(
'select * from normal_in_bool_tinyint_1 where in_tinyint in (127) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'False'
)
tdSql
.
checkData
(
0
,
2
,
'127'
)
cmd3
=
'insert into normal_in_bool_tinyint_1 values(now,
\'
true
\'
,
\'
0
\'
) ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdSql
.
query
(
'select * from normal_in_bool_tinyint_1 where in_tinyint in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'True'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdLog
.
info
(
"=============== step2,check int、smallint and bigint data type"
)
tdLog
.
info
(
"=============== step2.1,drop table && create table"
)
cmd1
=
'drop table if exists in_int_smallint_bigint_1 ;'
cmd2
=
'drop table if exists in_int_smallint_bigint_2 ;'
cmd3
=
'drop table if exists in_int_smallint_bigint_3 ;'
cmd10
=
'drop table if exists in_stable_2 ;'
cmd11
=
'create stable in_stable_2(ts timestamp,in_int int,in_small smallint , in_big bigint) tags (tin_int int,tin_small smallint , tin_big bigint) ;'
cmd12
=
'create table in_int_smallint_bigint_1 using in_stable_2 tags(
\'
2147483647
\'
,
\'
-32767
\'
,
\'
0
\'
) ; '
cmd13
=
'create table in_int_smallint_bigint_2 using in_stable_2 tags(
\'
-2147483647
\'
,
\'
0
\'
,
\'
9223372036854775807
\'
) ; '
cmd14
=
'create table in_int_smallint_bigint_3 using in_stable_2 tags(
\'
0
\'
,
\'
32767
\'
,
\'
-9223372036854775807
\'
) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd10
)
tdSql
.
execute
(
cmd10
)
tdLog
.
info
(
cmd11
)
tdSql
.
execute
(
cmd11
)
tdLog
.
info
(
cmd12
)
tdSql
.
execute
(
cmd12
)
tdLog
.
info
(
cmd13
)
tdSql
.
execute
(
cmd13
)
tdLog
.
info
(
cmd14
)
tdSql
.
execute
(
cmd14
)
tdLog
.
info
(
"=============== step2.2,insert stable right data and check in function"
)
cmd1
=
'insert into in_int_smallint_bigint_1 values(now,
\'
2147483647
\'
,
\'
-32767
\'
,
\'
0
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from in_stable_2 where in_int in (2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'-32767'
)
tdSql
.
checkData
(
0
,
6
,
'0'
)
tdSql
.
query
(
'select * from in_stable_2 where in_small in (-32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'-32767'
)
tdSql
.
checkData
(
0
,
6
,
'0'
)
tdSql
.
query
(
'select * from in_stable_2 where in_big in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'-32767'
)
tdSql
.
checkData
(
0
,
6
,
'0'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_int in (2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'-32767'
)
tdSql
.
checkData
(
0
,
6
,
'0'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_small in (-32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'-32767'
)
tdSql
.
checkData
(
0
,
6
,
'0'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_big in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'-32767'
)
tdSql
.
checkData
(
0
,
6
,
'0'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_1 where in_int in (2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_1 where in_small in (-32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_1 where in_big in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
cmd2
=
'insert into in_int_smallint_bigint_2 values(now,
\'
-2147483647
\'
,
\'
0
\'
,
\'
9223372036854775807
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from in_stable_2 where in_int in (-2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'0'
)
tdSql
.
checkData
(
0
,
6
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where in_small in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'0'
)
tdSql
.
checkData
(
0
,
6
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where in_big in (9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'0'
)
tdSql
.
checkData
(
0
,
6
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_int in (-2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'0'
)
tdSql
.
checkData
(
0
,
6
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_small in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'0'
)
tdSql
.
checkData
(
0
,
6
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_big in (9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
5
,
'0'
)
tdSql
.
checkData
(
0
,
6
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_2 where in_int in (-2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_2 where in_small in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_2 where in_big in (9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
cmd3
=
'insert into in_int_smallint_bigint_3 values(now,
\'
0
\'
,
\'
32767
\'
,
\'
-9223372036854775807
\'
) ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdSql
.
query
(
'select * from in_stable_2 where in_int in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
checkData
(
0
,
5
,
'32767'
)
tdSql
.
checkData
(
0
,
6
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where in_small in (32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
checkData
(
0
,
5
,
'32767'
)
tdSql
.
checkData
(
0
,
6
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where in_big in (-9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
checkData
(
0
,
5
,
'32767'
)
tdSql
.
checkData
(
0
,
6
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_int in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
checkData
(
0
,
5
,
'32767'
)
tdSql
.
checkData
(
0
,
6
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_small in (32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
checkData
(
0
,
5
,
'32767'
)
tdSql
.
checkData
(
0
,
6
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_stable_2 where tin_big in (-9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
checkData
(
0
,
5
,
'32767'
)
tdSql
.
checkData
(
0
,
6
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_3 where in_int in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_3 where in_small in (32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from in_int_smallint_bigint_3 where in_big in (-9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdLog
.
info
(
"=============== step2.3,drop normal table && create table"
)
cmd1
=
'drop table if exists normal_int_smallint_bigint_1 ;'
cmd2
=
'create table normal_int_smallint_bigint_1 (ts timestamp,in_int int,in_small smallint , in_big bigint) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
"=============== step2.4,insert normal table right data and check in function"
)
cmd1
=
'insert into normal_int_smallint_bigint_1 values(now,
\'
2147483647
\'
,
\'
-32767
\'
,
\'
0
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_int in (2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_small in (-32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_big in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'-32767'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
cmd2
=
'insert into normal_int_smallint_bigint_1 values(now,
\'
-2147483647
\'
,
\'
0
\'
,
\'
9223372036854775807
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_int in (-2147483647) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_small in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_big in (9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'-2147483647'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'9223372036854775807'
)
cmd3
=
'insert into normal_int_smallint_bigint_1 values(now,
\'
0
\'
,
\'
32767
\'
,
\'
-9223372036854775807
\'
) ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_int in (0) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_small in (32767) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdSql
.
query
(
'select * from normal_int_smallint_bigint_1 where in_big in (-9223372036854775807) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'32767'
)
tdSql
.
checkData
(
0
,
3
,
'-9223372036854775807'
)
tdLog
.
info
(
"=============== step3,check binary and nchar data type"
)
tdLog
.
info
(
"=============== step3.1,drop table && create table"
)
cmd1
=
'drop table if exists in_binary_nchar_1 ;'
cmd2
=
'drop table if exists in_binary_nchar_2 ;'
cmd3
=
'drop table if exists in_binary_nchar_3 ;'
cmd10
=
'drop table if exists in_stable_3 ;'
cmd11
=
'create stable in_stable_3(ts timestamp,in_binary binary(8),in_nchar nchar(12)) tags (tin_binary binary(16),tin_nchar nchar(20)) ;'
cmd12
=
'create table in_binary_nchar_1 using in_stable_3 tags(
\'
0
\'
,
\'
0
\'
) ; '
cmd13
=
'create table in_binary_nchar_2 using in_stable_3 tags(
\'
TDengine
\'
,
\'
北京涛思数据科技有限公司
\'
) ; '
cmd14
=
'create table in_binary_nchar_3 using in_stable_3 tags(
\'
taosdataTDengine
\'
,
\'
北京涛思数据科技有限公司TDengine
\'
) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd10
)
tdSql
.
execute
(
cmd10
)
tdLog
.
info
(
cmd11
)
tdSql
.
execute
(
cmd11
)
tdLog
.
info
(
cmd12
)
tdSql
.
execute
(
cmd12
)
tdLog
.
info
(
cmd13
)
tdSql
.
execute
(
cmd13
)
tdLog
.
info
(
cmd14
)
tdSql
.
execute
(
cmd14
)
tdLog
.
info
(
"=============== step3.2,insert stable right data and check in function"
)
cmd1
=
'insert into in_binary_nchar_1 values(now,
\'
0
\'
,
\'
0
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from in_stable_3 where in_binary in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
query
(
'select * from in_stable_3 where in_nchar in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
query
(
'select * from in_stable_3 where tin_binary in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
query
(
'select * from in_stable_3 where tin_nchar in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
checkData
(
0
,
3
,
'0'
)
tdSql
.
checkData
(
0
,
4
,
'0'
)
tdSql
.
query
(
'select * from in_binary_nchar_1 where in_binary in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
query
(
'select * from in_binary_nchar_1 where in_nchar in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
cmd2
=
'insert into in_binary_nchar_2 values(now,
\'
TAOS
\'
,
\'
涛思数据TAOSdata
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from in_stable_3 where in_binary in (
\'
TAOS
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
tdSql
.
checkData
(
0
,
3
,
'TDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司'
)
tdSql
.
query
(
'select * from in_stable_3 where in_nchar in (
\'
涛思数据TAOSdata
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
tdSql
.
checkData
(
0
,
3
,
'TDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司'
)
tdSql
.
query
(
'select * from in_stable_3 where tin_binary in (
\'
TDengine
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
tdSql
.
checkData
(
0
,
3
,
'TDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司'
)
tdSql
.
query
(
'select * from in_stable_3 where tin_nchar in (
\'
北京涛思数据科技有限公司
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
tdSql
.
checkData
(
0
,
3
,
'TDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司'
)
tdSql
.
query
(
'select * from in_binary_nchar_2 where in_binary in (
\'
TAOS
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
tdSql
.
query
(
'select * from in_binary_nchar_2 where in_nchar in (
\'
涛思数据TAOSdata
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
cmd3
=
'insert into in_binary_nchar_3 values(now,
\'
TDengine
\'
,
\'
北京涛思数据科技有限公司
\'
) ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdSql
.
query
(
'select * from in_stable_3 where in_binary in (
\'
TDengine
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdSql
.
checkData
(
0
,
3
,
'taosdataTDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司TDengine'
)
tdSql
.
query
(
'select * from in_stable_3 where in_nchar in (
\'
北京涛思数据科技有限公司
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdSql
.
checkData
(
0
,
3
,
'taosdataTDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司TDengine'
)
tdSql
.
query
(
'select * from in_stable_3 where tin_binary in (
\'
taosdataTDengine
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdSql
.
checkData
(
0
,
3
,
'taosdataTDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司TDengine'
)
tdSql
.
query
(
'select * from in_stable_3 where tin_nchar in (
\'
北京涛思数据科技有限公司TDengine
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdSql
.
checkData
(
0
,
3
,
'taosdataTDengine'
)
tdSql
.
checkData
(
0
,
4
,
'北京涛思数据科技有限公司TDengine'
)
tdSql
.
query
(
'select * from in_binary_nchar_3 where in_binary in (
\'
TDengine
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdSql
.
query
(
'select * from in_binary_nchar_3 where in_nchar in (
\'
北京涛思数据科技有限公司
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdLog
.
info
(
"=============== step3.3,drop normal table && create table"
)
cmd1
=
'drop table if exists normal_in_binary_nchar_1 ;'
cmd2
=
'create table normal_in_binary_nchar_1 (ts timestamp,in_binary binary(8),in_nchar nchar(12)) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
"=============== step3.4,insert normal table right data and check in function"
)
cmd1
=
'insert into normal_in_binary_nchar_1 values(now,
\'
0
\'
,
\'
0
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from normal_in_binary_nchar_1 where in_binary in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
tdSql
.
query
(
'select * from normal_in_binary_nchar_1 where in_nchar in (
\'
0
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'0'
)
tdSql
.
checkData
(
0
,
2
,
'0'
)
cmd2
=
'insert into normal_in_binary_nchar_1 values(now,
\'
TAOS
\'
,
\'
涛思数据TAOSdata
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from normal_in_binary_nchar_1 where in_binary in (
\'
TAOS
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
tdSql
.
query
(
'select * from normal_in_binary_nchar_1 where in_nchar in (
\'
涛思数据TAOSdata
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TAOS'
)
tdSql
.
checkData
(
0
,
2
,
'涛思数据TAOSdata'
)
cmd3
=
'insert into normal_in_binary_nchar_1 values(now,
\'
TDengine
\'
,
\'
北京涛思数据科技有限公司
\'
) ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdSql
.
query
(
'select * from normal_in_binary_nchar_1 where in_binary in (
\'
TDengine
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdSql
.
query
(
'select * from normal_in_binary_nchar_1 where in_nchar in (
\'
北京涛思数据科技有限公司
\'
) order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'TDengine'
)
tdSql
.
checkData
(
0
,
2
,
'北京涛思数据科技有限公司'
)
tdLog
.
info
(
"=============== step4,check float and double data type,not support"
)
tdLog
.
info
(
"=============== step4.1,drop table && create table"
)
cmd1
=
'drop table if exists in_float_double_1 ;'
cmd10
=
'drop table if exists in_stable_4 ;'
cmd11
=
'create stable in_stable_4(ts timestamp,in_float float,in_double double) tags (tin_float float,tin_double double) ;'
cmd12
=
'create table in_float_double_1 using in_stable_4 tags(
\'
666
\'
,
\'
88888
\'
) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd10
)
tdSql
.
execute
(
cmd10
)
tdLog
.
info
(
cmd11
)
tdSql
.
execute
(
cmd11
)
tdLog
.
info
(
cmd12
)
tdSql
.
execute
(
cmd12
)
tdLog
.
info
(
"=============== step4.2,insert stable right data and check in function"
)
cmd1
=
'insert into in_float_double_1 values(now,
\'
888
\'
,
\'
66666
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
cmd2
=
'select * from in_stable_4 where in_float in (
\'
888
\'
);'
tdLog
.
info
(
cmd2
)
tdSql
.
error
(
cmd2
)
try
:
tdSql
.
execute
(
cmd2
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
cmd3
=
'select * from in_stable_4 where in_double in (
\'
66666
\'
);'
tdLog
.
info
(
cmd3
)
tdSql
.
error
(
cmd3
)
try
:
tdSql
.
execute
(
cmd3
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
cmd4
=
'select * from in_stable_4 where tin_float in (
\'
666
\'
);'
tdLog
.
info
(
cmd4
)
tdSql
.
error
(
cmd4
)
try
:
tdSql
.
execute
(
cmd4
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
cmd5
=
'select * from in_stable_4 where tin_double in (
\'
88888
\'
);'
tdLog
.
info
(
cmd5
)
tdSql
.
error
(
cmd5
)
try
:
tdSql
.
execute
(
cmd5
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
cmd6
=
'select * from in_float_double_1 where in_float in (
\'
888
\'
);'
tdLog
.
info
(
cmd6
)
tdSql
.
error
(
cmd6
)
try
:
tdSql
.
execute
(
cmd6
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
cmd7
=
'select * from in_float_double_1 where in_double in (
\'
66666
\'
);'
tdLog
.
info
(
cmd7
)
tdSql
.
error
(
cmd7
)
try
:
tdSql
.
execute
(
cmd7
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
tdLog
.
info
(
"=============== step4.3,drop normal table && create table"
)
cmd1
=
'drop table if exists normal_in_float_double_1 ;'
cmd2
=
'create table normal_in_float_double_1 (ts timestamp,in_float float,in_double double) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
"=============== step4.4,insert normal table right data and check in function"
)
cmd1
=
'insert into normal_in_float_double_1 values(now,
\'
888
\'
,
\'
666666
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
cmd2
=
'select * from normal_in_float_double_1 where in_float in (
\'
888
\'
);'
tdLog
.
info
(
cmd2
)
tdSql
.
error
(
cmd2
)
try
:
tdSql
.
execute
(
cmd2
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
cmd3
=
'select * from normal_in_float_double_1 where in_double in (
\'
66666
\'
);'
tdLog
.
info
(
cmd3
)
tdSql
.
error
(
cmd3
)
try
:
tdSql
.
execute
(
cmd3
)
tdLog
.
exit
(
"invalid operation: not supported filter condition"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: not supported filter condition"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/modify_column.py
0 → 100644
浏览文件 @
41f1f90c
###################################################################
# 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
sys
import
datetime
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
# test case for https://jira.taosdata.com:18080/browse/TD-4541
tdLog
.
info
(
"=============== step1,check normal table"
)
tdLog
.
info
(
"=============== step1.1,drop table && create table"
)
cmd1
=
'drop table if exists length11 ;'
cmd2
=
'create table length11 (ts timestamp,lengthbia binary(10),lengthnchar nchar(20));'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
"=============== step1.2,insert table right data"
)
cmd1
=
'insert into length11 values(now,
\'
aaaaaaaaaa
\'
,
\'
bbbbbbbbbbbbbbbbbbbb
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from length11 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb'
)
tdLog
.
info
(
"=============== step1.3,insert table wrong data"
)
cmd1
=
'insert into length11 values(now,
\'
aaaaaaaaaa1
\'
,
\'
bbbbbbbbbbbbbbbbbbbb1
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
error
(
cmd1
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"string data overflow"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"insert wrong data error catched"
)
tdSql
.
query
(
'select * from length11 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb'
)
tdLog
.
info
(
"=============== step1.4,modify columu length "
)
cmd1
=
'alter table length11 modify column lengthbia binary(10) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
error
(
cmd1
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd2
=
'alter table length11 modify column lengthnchar nchar(20);'
tdLog
.
info
(
cmd2
)
tdSql
.
error
(
cmd2
)
try
:
tdSql
.
execute
(
cmd2
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd3
=
'alter table length11 modify column lengthbia binary(11) ;'
cmd4
=
'describe length11 ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd4
)
tdSql
.
execute
(
cmd4
)
tdSql
.
query
(
'describe length11 ;'
)
tdSql
.
checkData
(
1
,
2
,
11
)
cmd5
=
'alter table length11 modify column lengthnchar nchar(21);'
cmd6
=
'describe length11 ;'
tdLog
.
info
(
cmd5
)
tdSql
.
execute
(
cmd5
)
tdLog
.
info
(
cmd6
)
tdSql
.
execute
(
cmd6
)
tdSql
.
query
(
'describe length11 ;'
)
tdSql
.
checkData
(
2
,
2
,
21
)
tdSql
.
query
(
'select * from length11 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb'
)
tdLog
.
info
(
"=============== step1.5,insert table right data"
)
cmd1
=
'insert into length11 values(now,
\'
aaaaaaaaaa1
\'
,
\'
bbbbbbbbbbbbbbbbbbbb1
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from length11 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdLog
.
info
(
"=============== step2,check stable table and tag"
)
tdLog
.
info
(
"=============== step2.1,drop table && create table"
)
cmd1
=
'drop table if exists length1 ;'
cmd2
=
'drop table if exists length2 ;'
cmd3
=
'drop table if exists length2 ;'
cmd4
=
'drop table if exists lengthsta1 ;'
cmd5
=
'create stable lengthsta1(ts timestamp,lengthbia binary(10),lengthnchar nchar(20)) tags (tlengthbia binary(15),tlengthnchar nchar(25)) ;'
cmd6
=
'create table length1 using lengthsta1 tags(
\'
aaaaabbbbbaaaaa
\'
,
\'
bbbbbaaaaabbbbbaaaaabbbbb
\'
) ; '
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd4
)
tdSql
.
execute
(
cmd4
)
tdLog
.
info
(
cmd5
)
tdSql
.
execute
(
cmd5
)
tdLog
.
info
(
cmd6
)
tdSql
.
execute
(
cmd6
)
tdLog
.
info
(
"=============== step2.2,insert table right data"
)
cmd1
=
'insert into length1 values(now,
\'
aaaaaaaaaa
\'
,
\'
bbbbbbbbbbbbbbbbbbbb
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from length1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb'
)
tdLog
.
info
(
"=============== step2.3,insert table wrong data"
)
cmd1
=
'insert into length1 values(now,
\'
aaaaaaaaaa1
\'
,
\'
bbbbbbbbbbbbbbbbbbbb1
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
error
(
cmd1
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"string data overflow"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"insert wrong data error catched"
)
tdSql
.
query
(
'select * from length1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb'
)
tdLog
.
info
(
"=============== step2.4,modify columu length "
)
cmd0
=
'alter table length1 modify column lengthbia binary(10) ;'
tdLog
.
info
(
cmd0
)
tdSql
.
error
(
cmd0
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"invalid operation: column can only be modified by super table"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: column can only be modified by super table"
)
cmd1
=
'alter table lengthsta1 modify column lengthbia binary(10) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
error
(
cmd1
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd2
=
'alter table lengthsta1 modify column lengthnchar nchar(20);'
tdLog
.
info
(
cmd2
)
tdSql
.
error
(
cmd2
)
try
:
tdSql
.
execute
(
cmd2
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd3
=
'alter table lengthsta1 modify column lengthbia binary(11) ;'
cmd4
=
'describe lengthsta1 ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd4
)
tdSql
.
execute
(
cmd4
)
tdSql
.
query
(
'describe length1 ;'
)
tdSql
.
checkData
(
1
,
2
,
11
)
cmd5
=
'alter table lengthsta1 modify column lengthnchar nchar(21);'
cmd6
=
'describe lengthsta1 ;'
tdLog
.
info
(
cmd5
)
tdSql
.
execute
(
cmd5
)
tdLog
.
info
(
cmd6
)
tdSql
.
execute
(
cmd6
)
tdSql
.
query
(
'describe lengthsta1 ;'
)
tdSql
.
checkData
(
2
,
2
,
21
)
tdSql
.
query
(
'select * from lengthsta1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb'
)
tdLog
.
info
(
"=============== step2.5,insert table right data"
)
cmd1
=
'insert into length1 values(now,
\'
aaaaaaaaaa1
\'
,
\'
bbbbbbbbbbbbbbbbbbbb1
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'select * from length1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdLog
.
info
(
"=============== step2.6,create table wrong tag"
)
cmd1
=
'create table length2 using lengthsta1 tags(
\'
aaaaabbbbbaaaaa1
\'
,
\'
bbbbbaaaaabbbbbaaaaabbbbb1
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
error
(
cmd1
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"invalid operation: tag value too long"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid operation: tag value too long"
)
tdSql
.
query
(
'select * from lengthsta1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdLog
.
info
(
"=============== step2.7,modify tag columu length "
)
cmd1
=
'alter table lengthsta1 modify tag tlengthbia binary(15) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
error
(
cmd1
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd2
=
'alter table lengthsta1 modify tag tlengthnchar nchar(25);'
tdLog
.
info
(
cmd2
)
tdSql
.
error
(
cmd2
)
try
:
tdSql
.
execute
(
cmd2
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd3
=
'alter table lengthsta1 modify tag tlengthbia binary(16) ;'
cmd4
=
'describe lengthsta1 ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd4
)
tdSql
.
execute
(
cmd4
)
tdSql
.
query
(
'describe lengthsta1 ;'
)
tdSql
.
checkData
(
3
,
2
,
16
)
cmd5
=
'alter table lengthsta1 modify tag tlengthnchar nchar(26);'
cmd6
=
'describe lengthsta1 ;'
tdLog
.
info
(
cmd5
)
tdSql
.
execute
(
cmd5
)
tdLog
.
info
(
cmd6
)
tdSql
.
execute
(
cmd6
)
tdSql
.
query
(
'describe lengthsta1 ;'
)
tdSql
.
checkData
(
4
,
2
,
26
)
tdSql
.
query
(
'select * from lengthsta1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdSql
.
checkData
(
0
,
3
,
'aaaaabbbbbaaaaa'
)
tdSql
.
checkData
(
0
,
4
,
'bbbbbaaaaabbbbbaaaaabbbbb'
)
tdLog
.
info
(
"=============== step2.8,creat tag right data and insert data"
)
cmd1
=
'create table length2 using lengthsta1 tags(
\'
aaaaabbbbbaaaaa1
\'
,
\'
bbbbbaaaaabbbbbaaaaabbbbb1
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'describe length2 ;'
)
tdSql
.
checkData
(
3
,
2
,
16
)
tdSql
.
checkData
(
4
,
2
,
26
)
cmd2
=
'insert into length2 values(now,
\'
aaaaaaaaaa1
\'
,
\'
bbbbbbbbbbbbbbbbbbbb1
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from length2 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdSql
.
query
(
'select * from lengthsta1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdSql
.
checkData
(
0
,
3
,
'aaaaabbbbbaaaaa1'
)
tdSql
.
checkData
(
0
,
4
,
'bbbbbaaaaabbbbbaaaaabbbbb1'
)
tdLog
.
info
(
"=============== step2.9,modify tag columu length again "
)
cmd1
=
'alter table lengthsta1 modify tag tlengthbia binary(16) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
error
(
cmd1
)
try
:
tdSql
.
execute
(
cmd1
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd2
=
'alter table lengthsta1 modify tag tlengthnchar nchar(26);'
tdLog
.
info
(
cmd2
)
tdSql
.
error
(
cmd2
)
try
:
tdSql
.
execute
(
cmd2
)
tdLog
.
exit
(
"new column length should be bigger than old one"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"new column length should be bigger than old one"
)
cmd3
=
'alter table lengthsta1 modify tag tlengthbia binary(20) ;'
cmd4
=
'describe lengthsta1 ;'
tdLog
.
info
(
cmd3
)
tdSql
.
execute
(
cmd3
)
tdLog
.
info
(
cmd4
)
tdSql
.
execute
(
cmd4
)
tdSql
.
query
(
'describe lengthsta1 ;'
)
tdSql
.
checkData
(
3
,
2
,
20
)
cmd5
=
'alter table lengthsta1 modify tag tlengthnchar nchar(30);'
cmd6
=
'describe lengthsta1 ;'
tdLog
.
info
(
cmd5
)
tdSql
.
execute
(
cmd5
)
tdLog
.
info
(
cmd6
)
tdSql
.
execute
(
cmd6
)
tdSql
.
query
(
'describe lengthsta1 ;'
)
tdSql
.
checkData
(
4
,
2
,
30
)
tdSql
.
query
(
'select * from lengthsta1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdSql
.
checkData
(
0
,
3
,
'aaaaabbbbbaaaaa1'
)
tdSql
.
checkData
(
0
,
4
,
'bbbbbaaaaabbbbbaaaaabbbbb1'
)
tdLog
.
info
(
"=============== step2.10,creat tag right data and insert data again"
)
cmd1
=
'create table length3 using lengthsta1 tags(
\'
aaaaabbbbbaaaaabbbbb
\'
,
\'
bbbbbaaaaabbbbbaaaaabbbbbaaaaa
\'
) ;'
tdLog
.
info
(
cmd1
)
tdSql
.
execute
(
cmd1
)
tdSql
.
query
(
'describe length3 ;'
)
tdSql
.
checkData
(
3
,
2
,
20
)
tdSql
.
checkData
(
4
,
2
,
30
)
cmd2
=
'insert into length3 values(now,
\'
aaaaaaaaaa1
\'
,
\'
bbbbbbbbbbbbbbbbbbbb1
\'
) ;'
tdLog
.
info
(
cmd2
)
tdSql
.
execute
(
cmd2
)
tdSql
.
query
(
'select * from length3 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdSql
.
query
(
'select * from lengthsta1 order by ts desc'
)
tdSql
.
checkData
(
0
,
1
,
'aaaaaaaaaa1'
)
tdSql
.
checkData
(
0
,
2
,
'bbbbbbbbbbbbbbbbbbbb1'
)
tdSql
.
checkData
(
0
,
3
,
'aaaaabbbbbaaaaabbbbb'
)
tdSql
.
checkData
(
0
,
4
,
'bbbbbaaaaabbbbbaaaaabbbbbaaaaa'
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录