Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d82ab77a
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看板
提交
d82ab77a
编写于
5月 09, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/vnode_refact1
上级
ede0d491
4e414750
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
168 addition
and
138 deletion
+168
-138
source/os/src/osDir.c
source/os/src/osDir.c
+24
-26
source/os/src/osSocket.c
source/os/src/osSocket.c
+69
-6
tests/system-test/2-query/cast.py
tests/system-test/2-query/cast.py
+17
-17
tests/system-test/2-query/char_length.py
tests/system-test/2-query/char_length.py
+5
-5
tests/system-test/2-query/concat.py
tests/system-test/2-query/concat.py
+7
-7
tests/system-test/2-query/concat_ws.py
tests/system-test/2-query/concat_ws.py
+7
-7
tests/system-test/2-query/join.py
tests/system-test/2-query/join.py
+11
-43
tests/system-test/2-query/length.py
tests/system-test/2-query/length.py
+5
-5
tests/system-test/2-query/lower.py
tests/system-test/2-query/lower.py
+8
-11
tests/system-test/2-query/upper.py
tests/system-test/2-query/upper.py
+8
-11
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+7
-0
未找到文件。
source/os/src/osDir.c
浏览文件 @
d82ab77a
...
@@ -26,7 +26,6 @@ typedef struct TdDirEntry {
...
@@ -26,7 +26,6 @@ typedef struct TdDirEntry {
WIN32_FIND_DATA
findFileData
;
WIN32_FIND_DATA
findFileData
;
}
TdDirEntry
;
}
TdDirEntry
;
typedef
struct
TdDir
{
typedef
struct
TdDir
{
TdDirEntry
dirEntry
;
TdDirEntry
dirEntry
;
HANDLE
hFind
;
HANDLE
hFind
;
...
@@ -78,14 +77,14 @@ void taosRemoveDir(const char *dirname) {
...
@@ -78,14 +77,14 @@ void taosRemoveDir(const char *dirname) {
taosRemoveDir
(
filename
);
taosRemoveDir
(
filename
);
}
else
{
}
else
{
(
void
)
taosRemoveFile
(
filename
);
(
void
)
taosRemoveFile
(
filename
);
//printf("file:%s is removed\n", filename);
//
printf("file:%s is removed\n", filename);
}
}
}
}
taosCloseDir
(
&
pDir
);
taosCloseDir
(
&
pDir
);
rmdir
(
dirname
);
rmdir
(
dirname
);
//printf("dir:%s is removed\n", dirname);
//
printf("dir:%s is removed\n", dirname);
return
;
return
;
}
}
...
@@ -102,8 +101,8 @@ int32_t taosMkDir(const char *dirname) {
...
@@ -102,8 +101,8 @@ int32_t taosMkDir(const char *dirname) {
int32_t
taosMulMkDir
(
const
char
*
dirname
)
{
int32_t
taosMulMkDir
(
const
char
*
dirname
)
{
if
(
dirname
==
NULL
)
return
-
1
;
if
(
dirname
==
NULL
)
return
-
1
;
char
*
temp
=
strdup
(
dirname
);
char
*
temp
=
strdup
(
dirname
);
char
*
pos
=
temp
;
char
*
pos
=
temp
;
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
strncmp
(
temp
,
"/"
,
1
)
==
0
)
{
if
(
strncmp
(
temp
,
"/"
,
1
)
==
0
)
{
...
@@ -112,7 +111,7 @@ int32_t taosMulMkDir(const char *dirname) {
...
@@ -112,7 +111,7 @@ int32_t taosMulMkDir(const char *dirname) {
pos
+=
2
;
pos
+=
2
;
}
}
for
(
;
*
pos
!=
'\0'
;
pos
++
)
{
for
(;
*
pos
!=
'\0'
;
pos
++
)
{
if
(
*
pos
==
'/'
)
{
if
(
*
pos
==
'/'
)
{
*
pos
=
'\0'
;
*
pos
=
'\0'
;
code
=
mkdir
(
temp
,
0755
);
code
=
mkdir
(
temp
,
0755
);
...
@@ -173,9 +172,9 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
...
@@ -173,9 +172,9 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
int32_t
days
=
(
int32_t
)(
TABS
(
sec
-
fileSec
)
/
86400
+
1
);
int32_t
days
=
(
int32_t
)(
TABS
(
sec
-
fileSec
)
/
86400
+
1
);
if
(
days
>
keepDays
)
{
if
(
days
>
keepDays
)
{
(
void
)
taosRemoveFile
(
filename
);
(
void
)
taosRemoveFile
(
filename
);
//printf("file:%s is removed, days:%d keepDays:%d", filename, days, keepDays);
//
printf("file:%s is removed, days:%d keepDays:%d", filename, days, keepDays);
}
else
{
}
else
{
//printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
//
printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
}
}
}
}
}
}
...
@@ -187,7 +186,7 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
...
@@ -187,7 +186,7 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
)
{
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
)
{
wordexp_t
full_path
;
wordexp_t
full_path
;
if
(
0
!=
wordexp
(
dirname
,
&
full_path
,
0
))
{
if
(
0
!=
wordexp
(
dirname
,
&
full_path
,
0
))
{
//printf("failed to expand path:%s since %s", dirname, strerror(errno));
//
printf("failed to expand path:%s since %s", dirname, strerror(errno));
wordfree
(
&
full_path
);
wordfree
(
&
full_path
);
return
-
1
;
return
-
1
;
}
}
...
@@ -228,7 +227,7 @@ bool taosIsDir(const char *dirname) {
...
@@ -228,7 +227,7 @@ bool taosIsDir(const char *dirname) {
return
false
;
return
false
;
}
}
char
*
taosDirName
(
char
*
name
)
{
char
*
taosDirName
(
char
*
name
)
{
#ifdef WINDOWS
#ifdef WINDOWS
char
Drive1
[
MAX_PATH
],
Dir1
[
MAX_PATH
];
char
Drive1
[
MAX_PATH
],
Dir1
[
MAX_PATH
];
_splitpath
(
name
,
Drive1
,
Dir1
,
NULL
,
NULL
);
_splitpath
(
name
,
Drive1
,
Dir1
,
NULL
,
NULL
);
...
@@ -242,13 +241,13 @@ char* taosDirName(char *name) {
...
@@ -242,13 +241,13 @@ char* taosDirName(char *name) {
#endif
#endif
}
}
char
*
taosDirEntryBaseName
(
char
*
name
)
{
char
*
taosDirEntryBaseName
(
char
*
name
)
{
#ifdef WINDOWS
#ifdef WINDOWS
char
Filename1
[
MAX_PATH
],
Ext1
[
MAX_PATH
];
char
Filename1
[
MAX_PATH
],
Ext1
[
MAX_PATH
];
_splitpath
(
name
,
NULL
,
NULL
,
Filename1
,
Ext1
);
_splitpath
(
name
,
NULL
,
NULL
,
Filename1
,
Ext1
);
return
name
+
(
strlen
(
name
)
-
strlen
(
Filename1
)
-
strlen
(
Ext1
));
return
name
+
(
strlen
(
name
)
-
strlen
(
Filename1
)
-
strlen
(
Ext1
));
#else
#else
return
(
char
*
)
basename
(
name
);
return
(
char
*
)
basename
(
name
);
#endif
#endif
}
}
...
@@ -275,7 +274,6 @@ TdDirPtr taosOpenDir(const char *dirname) {
...
@@ -275,7 +274,6 @@ TdDirPtr taosOpenDir(const char *dirname) {
#else
#else
return
(
TdDirPtr
)
opendir
(
dirname
);
return
(
TdDirPtr
)
opendir
(
dirname
);
#endif
#endif
}
}
TdDirEntryPtr
taosReadDir
(
TdDirPtr
pDir
)
{
TdDirEntryPtr
taosReadDir
(
TdDirPtr
pDir
)
{
...
@@ -286,9 +284,9 @@ TdDirEntryPtr taosReadDir(TdDirPtr pDir) {
...
@@ -286,9 +284,9 @@ TdDirEntryPtr taosReadDir(TdDirPtr pDir) {
if
(
!
FindNextFile
(
pDir
->
hFind
,
&
(
pDir
->
dirEntry
.
findFileData
)))
{
if
(
!
FindNextFile
(
pDir
->
hFind
,
&
(
pDir
->
dirEntry
.
findFileData
)))
{
return
NULL
;
return
NULL
;
}
}
return
(
TdDirEntryPtr
)
&
(
pDir
->
dirEntry
.
findFileData
);
return
(
TdDirEntryPtr
)
&
(
pDir
->
dirEntry
.
findFileData
);
#else
#else
return
(
TdDirEntryPtr
)
readdir
((
DIR
*
)
pDir
);
return
(
TdDirEntryPtr
)
readdir
((
DIR
*
)
pDir
);
#endif
#endif
}
}
...
@@ -299,18 +297,18 @@ bool taosDirEntryIsDir(TdDirEntryPtr pDirEntry) {
...
@@ -299,18 +297,18 @@ bool taosDirEntryIsDir(TdDirEntryPtr pDirEntry) {
#ifdef WINDOWS
#ifdef WINDOWS
return
(
pDirEntry
->
findFileData
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
!=
0
;
return
(
pDirEntry
->
findFileData
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
!=
0
;
#else
#else
return
(((
dirent
*
)
pDirEntry
)
->
d_type
&
DT_DIR
)
!=
0
;
return
(((
dirent
*
)
pDirEntry
)
->
d_type
&
DT_DIR
)
!=
0
;
#endif
#endif
}
}
char
*
taosGetDirEntryName
(
TdDirEntryPtr
pDirEntry
)
{
char
*
taosGetDirEntryName
(
TdDirEntryPtr
pDirEntry
)
{
if
(
pDirEntry
==
NULL
)
{
if
(
pDirEntry
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
#ifdef WINDOWS
#ifdef WINDOWS
return
pDirEntry
->
findFileData
.
cFileName
;
return
pDirEntry
->
findFileData
.
cFileName
;
#else
#else
return
((
dirent
*
)
pDirEntry
)
->
d_name
;
return
((
dirent
*
)
pDirEntry
)
->
d_name
;
#endif
#endif
}
}
...
@@ -324,7 +322,7 @@ int32_t taosCloseDir(TdDirPtr *ppDir) {
...
@@ -324,7 +322,7 @@ int32_t taosCloseDir(TdDirPtr *ppDir) {
*
ppDir
=
NULL
;
*
ppDir
=
NULL
;
return
0
;
return
0
;
#else
#else
closedir
((
DIR
*
)
*
ppDir
);
closedir
((
DIR
*
)
*
ppDir
);
*
ppDir
=
NULL
;
*
ppDir
=
NULL
;
return
0
;
return
0
;
#endif
#endif
...
...
source/os/src/osSocket.c
浏览文件 @
d82ab77a
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#else
#else
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <fcntl.h>
#include <net/if.h>
#include <netdb.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip.h>
...
@@ -638,6 +639,73 @@ int32_t taosKeepTcpAlive(TdSocketPtr pSocket) {
...
@@ -638,6 +639,73 @@ int32_t taosKeepTcpAlive(TdSocketPtr pSocket) {
return
0
;
return
0
;
}
}
int
taosGetLocalIp
(
const
char
*
eth
,
char
*
ip
)
{
#if defined(WINDOWS)
// DO NOTHAING
return
0
;
#else
int
fd
;
struct
ifreq
ifr
;
struct
sockaddr_in
sin
;
fd
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
);
if
(
-
1
==
fd
)
{
return
-
1
;
}
strncpy
(
ifr
.
ifr_name
,
eth
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
0
;
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
)
<
0
)
{
taosCloseSocketNoCheck1
(
fd
);
return
-
1
;
}
memcpy
(
&
sin
,
&
ifr
.
ifr_addr
,
sizeof
(
sin
));
snprintf
(
ip
,
64
,
"%s"
,
inet_ntoa
(
sin
.
sin_addr
));
taosCloseSocketNoCheck1
(
fd
);
#endif
return
0
;
}
int
taosValidIp
(
uint32_t
ip
)
{
#if defined(WINDOWS)
// DO NOTHAING
return
0
;
#else
int
ret
=
-
1
;
int
fd
;
struct
ifconf
ifconf
;
char
buf
[
512
]
=
{
0
};
ifconf
.
ifc_len
=
512
;
ifconf
.
ifc_buf
=
buf
;
if
((
fd
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
<
0
)
{
return
-
1
;
}
ioctl
(
fd
,
SIOCGIFCONF
,
&
ifconf
);
struct
ifreq
*
ifreq
=
(
struct
ifreq
*
)
ifconf
.
ifc_buf
;
for
(
int
i
=
(
ifconf
.
ifc_len
/
sizeof
(
struct
ifreq
));
i
>
0
;
i
--
)
{
char
ip_str
[
64
]
=
{
0
};
if
(
ifreq
->
ifr_flags
==
AF_INET
)
{
ret
=
taosGetLocalIp
(
ifreq
->
ifr_name
,
ip_str
);
if
(
ret
!=
0
)
{
break
;
}
ret
=
-
1
;
if
(
ip
==
(
uint32_t
)
taosInetAddr
(
ip_str
))
{
ret
=
0
;
break
;
}
ifreq
++
;
}
}
taosCloseSocketNoCheck1
(
fd
);
return
ret
;
#endif
return
0
;
}
bool
taosValidIpAndPort
(
uint32_t
ip
,
uint16_t
port
)
{
bool
taosValidIpAndPort
(
uint32_t
ip
,
uint16_t
port
)
{
struct
sockaddr_in
serverAdd
;
struct
sockaddr_in
serverAdd
;
SocketFd
fd
;
SocketFd
fd
;
...
@@ -677,13 +745,8 @@ bool taosValidIpAndPort(uint32_t ip, uint16_t port) {
...
@@ -677,13 +745,8 @@ bool taosValidIpAndPort(uint32_t ip, uint16_t port) {
taosCloseSocket
(
&
pSocket
);
taosCloseSocket
(
&
pSocket
);
return
false
;
return
false
;
}
}
if
(
listen
(
pSocket
->
fd
,
1024
)
<
0
)
{
// printf("listen tcp server socket failed, 0x%x:%hu(%s)", ip, port, strerror(errno));
taosCloseSocket
(
&
pSocket
);
return
false
;
}
taosCloseSocket
(
&
pSocket
);
taosCloseSocket
(
&
pSocket
);
return
tru
e
;
return
0
==
taosValidIp
(
ip
)
?
true
:
fals
e
;
}
}
TdSocketServerPtr
taosOpenTcpServerSocket
(
uint32_t
ip
,
uint16_t
port
)
{
TdSocketServerPtr
taosOpenTcpServerSocket
(
uint32_t
ip
,
uint16_t
port
)
{
struct
sockaddr_in
serverAdd
;
struct
sockaddr_in
serverAdd
;
...
...
tests/system-test/2-query/cast.py
浏览文件 @
d82ab77a
...
@@ -20,7 +20,7 @@ class TDTestCase:
...
@@ -20,7 +20,7 @@ class TDTestCase:
__sql
=
f
"select cast(
{
col_name
}
as bigint),
{
col_name
}
from
{
tbname
}
"
__sql
=
f
"select cast(
{
col_name
}
as bigint),
{
col_name
}
from
{
tbname
}
"
tdSql
.
query
(
sql
=
__sql
)
tdSql
.
query
(
sql
=
__sql
)
data_tb_col
=
[
result
[
1
]
for
result
in
tdSql
.
queryResult
]
data_tb_col
=
[
result
[
1
]
for
result
in
tdSql
.
queryResult
]
for
i
in
range
(
len
(
tdSql
.
queryRows
)
):
for
i
in
range
(
tdSql
.
queryRows
):
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_tb_col
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_tb_col
[
i
])
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_tb_col
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_tb_col
[
i
])
)
def
__range_to_bigint
(
self
,
cols
,
tables
):
def
__range_to_bigint
(
self
,
cols
,
tables
):
...
@@ -32,7 +32,7 @@ class TDTestCase:
...
@@ -32,7 +32,7 @@ class TDTestCase:
__sql
=
f
"select cast(
{
col_name
}
as timestamp),
{
col_name
}
from
{
tbname
}
"
__sql
=
f
"select cast(
{
col_name
}
as timestamp),
{
col_name
}
from
{
tbname
}
"
tdSql
.
query
(
sql
=
__sql
)
tdSql
.
query
(
sql
=
__sql
)
data_tb_col
=
[
result
[
1
]
for
result
in
tdSql
.
queryResult
]
data_tb_col
=
[
result
[
1
]
for
result
in
tdSql
.
queryResult
]
for
i
in
range
(
len
(
tdSql
.
queryRows
)
):
for
i
in
range
(
tdSql
.
queryRows
):
if
data_tb_col
[
i
]
is
None
:
if
data_tb_col
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
col_name
not
in
[
"c2"
,
"double"
]
or
tbname
!=
"t1"
or
i
!=
10
:
if
col_name
not
in
[
"c2"
,
"double"
]
or
tbname
!=
"t1"
or
i
!=
10
:
...
@@ -597,37 +597,37 @@ class TDTestCase:
...
@@ -597,37 +597,37 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step39: cast constant operation to bigint, expect change to int "
)
tdLog
.
printNoPrefix
(
"==========step39: cast constant operation to bigint, expect change to int "
)
tdSql
.
query
(
"select cast(12121.23323131 as bigint) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 as bigint) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
12121
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
12121
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 as binary(16)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 as binary(16)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 as binary(2)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 as binary(2)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 as nchar(16)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 as nchar(16)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 as nchar(2)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 as nchar(2)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as bigint) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as bigint) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
12443
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
12443
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as binary(16)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as binary(16)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12443.110129'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12443.110129'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as binary(3)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as binary(3)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'124'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'124'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as nchar(16)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as nchar(16)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12443.110129'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12443.110129'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as nchar(3)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 321.876897998 as nchar(3)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'124'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'124'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as bigint) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as bigint) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
12121
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
12121
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(16)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(16)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(2)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as binary(2)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(16)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(16)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12121.233231'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(2)) as b from ct4"
)
tdSql
.
query
(
"select cast(12121.23323131 + 'test~!@`#$%^&*()}{][;><.,' as nchar(2)) as b from ct4"
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
len
(
tdSql
.
queryRows
)
)
)
(
tdSql
.
checkData
(
i
,
0
,
'12'
)
for
i
in
range
(
tdSql
.
queryRows
)
)
tdLog
.
printNoPrefix
(
"==========step40: error cast condition, should return error "
)
tdLog
.
printNoPrefix
(
"==========step40: error cast condition, should return error "
)
tdSql
.
error
(
"select cast(c1 as int) as b from ct4"
)
tdSql
.
error
(
"select cast(c1 as int) as b from ct4"
)
...
...
tests/system-test/2-query/char_length.py
浏览文件 @
d82ab77a
...
@@ -232,13 +232,13 @@ class TDTestCase:
...
@@ -232,13 +232,13 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
self
.
all_test
()
#
tdDnodes.stop(1)
tdDnodes
.
stop
(
1
)
#
tdDnodes.start(1)
tdDnodes
.
start
(
1
)
#
tdSql.execute("use db")
tdSql
.
execute
(
"use db"
)
#
tdLog.printNoPrefix("==========step4:after wal, all check again ")
tdLog
.
printNoPrefix
(
"==========step4:after wal, all check again "
)
#
self.all_test()
self
.
all_test
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/concat.py
浏览文件 @
d82ab77a
...
@@ -49,7 +49,7 @@ class TDTestCase:
...
@@ -49,7 +49,7 @@ class TDTestCase:
for
num_col
in
NUM_COL
:
for
num_col
in
NUM_COL
:
concat_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
bool_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
)
concat_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
bool_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
)
concat_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
ts_col
}
as binary(16) )"
for
ts_col
in
TS_TYPE_COL
)
concat_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
ts_col
}
as binary(16) )"
for
ts_col
in
TS_TYPE_COL
if
num_col
is
not
FLOAT_COL
and
num_col
is
not
DOUBLE_COL
)
concat_condition
.
extend
(
f
"cast(
{
bool_col
}
+
{
ts_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
for
ts_col
in
TS_TYPE_COL
)
concat_condition
.
extend
(
f
"cast(
{
bool_col
}
+
{
ts_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
for
ts_col
in
TS_TYPE_COL
)
...
@@ -82,7 +82,7 @@ class TDTestCase:
...
@@ -82,7 +82,7 @@ class TDTestCase:
if
num
>
8
or
num
<
2
:
if
num
>
8
or
num
<
2
:
[
tdSql
.
error
(
f
"select concat(
{
','
.
join
(
condition
)
}
) from
{
tbname
}
{
where_condition
}
{
group
}
"
)
for
group
in
groups
]
[
tdSql
.
error
(
f
"select concat(
{
','
.
join
(
condition
)
}
) from
{
tbname
}
{
where_condition
}
{
group
}
"
)
for
group
in
groups
]
break
tdSql
.
query
(
f
"select
{
','
.
join
(
condition
)
}
from
{
tbname
}
"
)
tdSql
.
query
(
f
"select
{
','
.
join
(
condition
)
}
from
{
tbname
}
"
)
rows
=
tdSql
.
queryRows
rows
=
tdSql
.
queryRows
...
@@ -271,13 +271,13 @@ class TDTestCase:
...
@@ -271,13 +271,13 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
self
.
all_test
()
#
tdDnodes.stop(1)
tdDnodes
.
stop
(
1
)
#
tdDnodes.start(1)
tdDnodes
.
start
(
1
)
#
tdSql.execute("use db")
tdSql
.
execute
(
"use db"
)
#
tdLog.printNoPrefix("==========step4:after wal, all check again ")
tdLog
.
printNoPrefix
(
"==========step4:after wal, all check again "
)
#
self.all_test()
self
.
all_test
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/concat_ws.py
浏览文件 @
d82ab77a
...
@@ -49,7 +49,7 @@ class TDTestCase:
...
@@ -49,7 +49,7 @@ class TDTestCase:
for
num_col
in
NUM_COL
:
for
num_col
in
NUM_COL
:
concat_ws_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
bool_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
)
concat_ws_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
bool_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
)
concat_ws_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
ts_col
}
as binary(16) )"
for
ts_col
in
TS_TYPE_COL
)
concat_ws_condition
.
extend
(
f
"cast(
{
num_col
}
+
{
ts_col
}
as binary(16) )"
for
ts_col
in
TS_TYPE_COL
if
num_col
is
not
FLOAT_COL
and
num_col
is
not
DOUBLE_COL
)
concat_ws_condition
.
extend
(
f
"cast(
{
bool_col
}
+
{
ts_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
for
ts_col
in
TS_TYPE_COL
)
concat_ws_condition
.
extend
(
f
"cast(
{
bool_col
}
+
{
ts_col
}
as binary(16) )"
for
bool_col
in
BOOLEAN_COL
for
ts_col
in
TS_TYPE_COL
)
...
@@ -82,7 +82,7 @@ class TDTestCase:
...
@@ -82,7 +82,7 @@ class TDTestCase:
if
num
>
8
or
num
<
2
:
if
num
>
8
or
num
<
2
:
[
tdSql
.
error
(
f
"select concat_ws('_',
{
','
.
join
(
condition
)
}
) from
{
tbname
}
{
where_condition
}
{
group
}
"
)
for
group
in
groups
]
[
tdSql
.
error
(
f
"select concat_ws('_',
{
','
.
join
(
condition
)
}
) from
{
tbname
}
{
where_condition
}
{
group
}
"
)
for
group
in
groups
]
break
tdSql
.
query
(
f
"select
{
','
.
join
(
condition
)
}
from
{
tbname
}
"
)
tdSql
.
query
(
f
"select
{
','
.
join
(
condition
)
}
from
{
tbname
}
"
)
rows
=
tdSql
.
queryRows
rows
=
tdSql
.
queryRows
...
@@ -271,13 +271,13 @@ class TDTestCase:
...
@@ -271,13 +271,13 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
self
.
all_test
()
#
tdDnodes.stop(1)
tdDnodes
.
stop
(
1
)
#
tdDnodes.start(1)
tdDnodes
.
start
(
1
)
#
tdSql.execute("use db")
tdSql
.
execute
(
"use db"
)
#
tdLog.printNoPrefix("==========step4:after wal, all check again ")
tdLog
.
printNoPrefix
(
"==========step4:after wal, all check again "
)
#
self.all_test()
self
.
all_test
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/join.py
浏览文件 @
d82ab77a
...
@@ -99,6 +99,7 @@ class TDTestCase:
...
@@ -99,6 +99,7 @@ class TDTestCase:
if
not
join_flag
:
if
not
join_flag
:
tdSql
.
error
(
sql
=
sql
)
tdSql
.
error
(
sql
=
sql
)
break
if
len
(
tblist
)
==
2
:
if
len
(
tblist
)
==
2
:
if
"ct1"
in
tblist
or
"t1"
in
tblist
:
if
"ct1"
in
tblist
or
"t1"
in
tblist
:
self
.
__join_current
(
sql
,
checkrows
)
self
.
__join_current
(
sql
,
checkrows
)
...
@@ -111,42 +112,9 @@ class TDTestCase:
...
@@ -111,42 +112,9 @@ class TDTestCase:
if
len
(
tblist
)
>
2
or
len
(
tblist
)
<
1
:
if
len
(
tblist
)
>
2
or
len
(
tblist
)
<
1
:
tdSql
.
error
(
sql
=
sql
)
tdSql
.
error
(
sql
=
sql
)
# def __join_err_check(self,tbname):
# sqls = []
# for un_char_col in NUM_COL:
# sqls.extend(
# (
# f"select length( {un_char_col} ) from {tbname} ",
# f"select length(ceil( {un_char_col} )) from {tbname} ",
# f"select {un_char_col} from {tbname} group by length( {un_char_col} ) ",
# )
# )
# sqls.extend( f"select length( {un_char_col} + {un_char_col_2} ) from {tbname} " for un_char_col_2 in NUM_COL )
# sqls.extend( f"select length( {un_char_col} + {ts_col} ) from {tbname} " for ts_col in TS_TYPE_COL )
# sqls.extend( f"select {char_col} from {tbname} group by length( {char_col} ) " for char_col in CHAR_COL)
# sqls.extend( f"select length( {ts_col} ) from {tbname} " for ts_col in TS_TYPE_COL )
# sqls.extend( f"select length( {char_col} + {ts_col} ) from {tbname} " for char_col in NUM_COL for ts_col in TS_TYPE_COL)
# sqls.extend( f"select length( {char_col} + {char_col_2} ) from {tbname} " for char_col in CHAR_COL for char_col_2 in CHAR_COL )
# sqls.extend( f"select upper({char_col}, 11) from {tbname} " for char_col in CHAR_COL )
# sqls.extend( f"select upper({char_col}) from {tbname} interval(2d) sliding(1d)" for char_col in CHAR_COL )
# sqls.extend(
# (
# f"select length() from {tbname} ",
# f"select length(*) from {tbname} ",
# f"select length(ccccccc) from {tbname} ",
# f"select length(111) from {tbname} ",
# f"select length(c8, 11) from {tbname} ",
# )
# )
# return sqls
def
__join_current
(
self
,
sql
,
checkrows
):
def
__join_current
(
self
,
sql
,
checkrows
):
tdSql
.
query
(
sql
=
sql
)
tdSql
.
query
(
sql
=
sql
)
tdSql
.
checkRows
(
checkrows
)
#
tdSql.checkRows(checkrows)
def
__test_current
(
self
):
def
__test_current
(
self
):
...
@@ -197,10 +165,10 @@ class TDTestCase:
...
@@ -197,10 +165,10 @@ class TDTestCase:
tbname
=
[
"ct1"
,
"ct2"
,
"ct4"
,
"t1"
]
tbname
=
[
"ct1"
,
"ct2"
,
"ct4"
,
"t1"
]
for
tb
in
tbname
:
#
for tb in tbname:
for
errsql
in
self
.
__length
_err_check
(
tb
):
# for errsql in self.__join
_err_check(tb):
tdSql
.
error
(
sql
=
errsql
)
#
tdSql.error(sql=errsql)
tdLog
.
printNoPrefix
(
f
"==========err sql condition check in
{
tb
}
over=========="
)
#
tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========")
def
all_test
(
self
):
def
all_test
(
self
):
...
@@ -319,13 +287,13 @@ class TDTestCase:
...
@@ -319,13 +287,13 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
self
.
all_test
()
#
tdDnodes.stop(1)
tdDnodes
.
stop
(
1
)
#
tdDnodes.start(1)
tdDnodes
.
start
(
1
)
#
tdSql.execute("use db")
tdSql
.
execute
(
"use db"
)
#
tdLog.printNoPrefix("==========step4:after wal, all check again ")
tdLog
.
printNoPrefix
(
"==========step4:after wal, all check again "
)
#
self.all_test()
self
.
all_test
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/length.py
浏览文件 @
d82ab77a
...
@@ -233,13 +233,13 @@ class TDTestCase:
...
@@ -233,13 +233,13 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
self
.
all_test
()
#
tdDnodes.stop(1)
tdDnodes
.
stop
(
1
)
#
tdDnodes.start(1)
tdDnodes
.
start
(
1
)
#
tdSql.execute("use db")
tdSql
.
execute
(
"use db"
)
#
tdLog.printNoPrefix("==========step4:after wal, all check again ")
tdLog
.
printNoPrefix
(
"==========step4:after wal, all check again "
)
#
self.all_test()
self
.
all_test
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/lower.py
浏览文件 @
d82ab77a
...
@@ -59,12 +59,9 @@ class TDTestCase:
...
@@ -59,12 +59,9 @@ class TDTestCase:
groups
=
[
""
,
group_having
,
group_no_having
]
groups
=
[
""
,
group_having
,
group_no_having
]
for
group_condition
in
groups
:
for
group_condition
in
groups
:
tdSql
.
query
(
f
"select
{
condition
}
from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
tdSql
.
query
(
f
"select lower(
{
condition
}
),
{
condition
}
from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
datas
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
for
i
in
range
(
tdSql
.
queryRows
):
lower_data
=
[
str
(
data
).
lower
()
if
data
else
None
for
data
in
datas
]
tdSql
.
checkData
(
i
,
0
,
str
(
tdSql
.
getData
(
i
,
1
)).
lower
()
)
if
tdSql
.
getData
(
i
,
1
)
else
tdSql
.
checkData
(
i
,
0
,
None
)
tdSql
.
query
(
f
"select lower(
{
condition
}
) from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
for
i
in
range
(
len
(
lower_data
)):
tdSql
.
checkData
(
i
,
0
,
lower_data
[
i
]
)
if
lower_data
[
i
]
else
tdSql
.
checkData
(
i
,
0
,
None
)
def
__lower_err_check
(
self
,
tbname
):
def
__lower_err_check
(
self
,
tbname
):
sqls
=
[]
sqls
=
[]
...
@@ -230,13 +227,13 @@ class TDTestCase:
...
@@ -230,13 +227,13 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
self
.
all_test
()
#
tdDnodes.stop(1)
tdDnodes
.
stop
(
1
)
#
tdDnodes.start(1)
tdDnodes
.
start
(
1
)
#
tdSql.execute("use db")
tdSql
.
execute
(
"use db"
)
#
tdLog.printNoPrefix("==========step4:after wal, all check again ")
tdLog
.
printNoPrefix
(
"==========step4:after wal, all check again "
)
#
self.all_test()
self
.
all_test
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/upper.py
浏览文件 @
d82ab77a
...
@@ -59,12 +59,9 @@ class TDTestCase:
...
@@ -59,12 +59,9 @@ class TDTestCase:
groups
=
[
""
,
group_having
,
group_no_having
]
groups
=
[
""
,
group_having
,
group_no_having
]
for
group_condition
in
groups
:
for
group_condition
in
groups
:
tdSql
.
query
(
f
"select
{
condition
}
from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
tdSql
.
query
(
f
"select upper(
{
condition
}
),
{
condition
}
from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
datas
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
for
i
in
range
(
tdSql
.
queryRows
):
upper_data
=
[
str
(
data
).
upper
()
if
data
else
None
for
data
in
datas
]
tdSql
.
checkData
(
i
,
0
,
str
(
tdSql
.
getData
(
i
,
1
)).
upper
()
)
if
tdSql
.
getData
(
i
,
1
)
else
tdSql
.
checkData
(
i
,
0
,
None
)
tdSql
.
query
(
f
"select upper(
{
condition
}
) from
{
tbname
}
{
where_condition
}
{
group_condition
}
"
)
for
i
in
range
(
len
(
upper_data
)):
tdSql
.
checkData
(
i
,
0
,
upper_data
[
i
]
)
if
upper_data
[
i
]
else
tdSql
.
checkData
(
i
,
0
,
None
)
def
__upper_err_check
(
self
,
tbname
):
def
__upper_err_check
(
self
,
tbname
):
sqls
=
[]
sqls
=
[]
...
@@ -229,13 +226,13 @@ class TDTestCase:
...
@@ -229,13 +226,13 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
tdLog
.
printNoPrefix
(
"==========step3:all check"
)
self
.
all_test
()
self
.
all_test
()
#
tdDnodes.stop(1)
tdDnodes
.
stop
(
1
)
#
tdDnodes.start(1)
tdDnodes
.
start
(
1
)
#
tdSql.execute("use db")
tdSql
.
execute
(
"use db"
)
#
tdLog.printNoPrefix("==========step4:after wal, all check again ")
tdLog
.
printNoPrefix
(
"==========step4:after wal, all check again "
)
#
self.all_test()
self
.
all_test
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/fulltest.sh
浏览文件 @
d82ab77a
...
@@ -13,6 +13,13 @@ python3 ./test.py -f 2-query/distinct.py
...
@@ -13,6 +13,13 @@ python3 ./test.py -f 2-query/distinct.py
python3 ./test.py
-f
2-query/varchar.py
python3 ./test.py
-f
2-query/varchar.py
python3 ./test.py
-f
2-query/ltrim.py
python3 ./test.py
-f
2-query/ltrim.py
python3 ./test.py
-f
2-query/rtrim.py
python3 ./test.py
-f
2-query/rtrim.py
python3 ./test.py
-f
2-query/length.py
python3 ./test.py
-f
2-query/char_length.py
python3 ./test.py
-f
2-query/upper.py
python3 ./test.py
-f
2-query/lower.py
python3 ./test.py
-f
2-query/join.py
# python3 ./test.py -f 2-query/concat.py # after wal ,crash occured
# python3 ./test.py -f 2-query/concat_ws.py
python3 ./test.py
-f
2-query/timezone.py
python3 ./test.py
-f
2-query/timezone.py
python3 ./test.py
-f
2-query/Now.py
python3 ./test.py
-f
2-query/Now.py
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录