Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
27b7eecc
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看板
提交
27b7eecc
编写于
8月 02, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of github.com:taosdata/TDengine into dev
上级
505527c3
699e28bc
变更
26
展开全部
隐藏空白更改
内联
并排
Showing
26 changed file
with
757 addition
and
176 deletion
+757
-176
packaging/tools/install.sh
packaging/tools/install.sh
+22
-6
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+37
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-1
src/inc/taos.h
src/inc/taos.h
+4
-6
src/inc/tcq.h
src/inc/tcq.h
+1
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+286
-114
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+1
-1
src/plugins/http/src/httpJson.c
src/plugins/http/src/httpJson.c
+1
-1
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+5
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-0
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+11
-4
src/sync/inc/syncTcp.h
src/sync/inc/syncTcp.h
+1
-1
src/sync/src/syncArbitrator.c
src/sync/src/syncArbitrator.c
+3
-3
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+5
-4
src/sync/src/syncTcp.c
src/sync/src/syncTcp.c
+1
-1
src/vnode/src/vnodeMgmt.c
src/vnode/src/vnodeMgmt.c
+5
-3
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/insert/metadataUpdate.py
tests/pytest/insert/metadataUpdate.py
+9
-16
tests/pytest/query/queryInterval.py
tests/pytest/query/queryInterval.py
+46
-0
tests/pytest/query/queryStableJoin.py
tests/pytest/query/queryStableJoin.py
+300
-0
tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
...ytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
+0
-4
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
...ytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
+6
-4
tests/pytest/tools/taosdemoTestTblAlt.py
tests/pytest/tools/taosdemoTestTblAlt.py
+2
-2
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+5
-0
未找到文件。
packaging/tools/install.sh
浏览文件 @
27b7eecc
...
@@ -54,6 +54,7 @@ if command -v sudo > /dev/null; then
...
@@ -54,6 +54,7 @@ if command -v sudo > /dev/null; then
fi
fi
update_flag
=
0
update_flag
=
0
prompt_force
=
0
initd_mod
=
0
initd_mod
=
0
service_mod
=
2
service_mod
=
2
...
@@ -780,7 +781,18 @@ function is_version_compatible() {
...
@@ -780,7 +781,18 @@ function is_version_compatible() {
min_compatible_version
=
$(
${
script_dir
}
/bin/taosd
-V
|
head
-1
|
cut
-d
' '
-f
5
)
min_compatible_version
=
$(
${
script_dir
}
/bin/taosd
-V
|
head
-1
|
cut
-d
' '
-f
5
)
fi
fi
# [TD-5628] prompt to execute taosd --force-keep-file if upgrade from lower version within 2.0.16.0
exist_version
=
$(
/usr/local/taos/bin/taosd
-V
|
head
-1
|
cut
-d
' '
-f
3
)
vercomp
$exist_version
"2.0.16.0"
case
$?
in
2
)
prompt_force
=
1
;;
esac
vercomp
$curr_version
$min_compatible_version
vercomp
$curr_version
$min_compatible_version
echo
""
# avoid $? value not update
case
$?
in
case
$?
in
0
)
return
0
;;
0
)
return
0
;;
1
)
return
0
;;
1
)
return
0
;;
...
@@ -789,6 +801,12 @@ function is_version_compatible() {
...
@@ -789,6 +801,12 @@ function is_version_compatible() {
}
}
function
update_TDengine
()
{
function
update_TDengine
()
{
# Check if version compatible
if
!
is_version_compatible
;
then
echo
-e
"
${
RED
}
Version incompatible
${
NC
}
"
return
1
fi
# Start to update
# Start to update
if
[
!
-e
taos.tar.gz
]
;
then
if
[
!
-e
taos.tar.gz
]
;
then
echo
"File taos.tar.gz does not exist"
echo
"File taos.tar.gz does not exist"
...
@@ -797,12 +815,6 @@ function update_TDengine() {
...
@@ -797,12 +815,6 @@ function update_TDengine() {
tar
-zxf
taos.tar.gz
tar
-zxf
taos.tar.gz
install_jemalloc
install_jemalloc
# Check if version compatible
if
!
is_version_compatible
;
then
echo
-e
"
${
RED
}
Version incompatible
${
NC
}
"
return
1
fi
echo
-e
"
${
GREEN
}
Start to update TDengine...
${
NC
}
"
echo
-e
"
${
GREEN
}
Start to update TDengine...
${
NC
}
"
# Stop the service if running
# Stop the service if running
if
pidof taosd &> /dev/null
;
then
if
pidof taosd &> /dev/null
;
then
...
@@ -875,6 +887,10 @@ function update_TDengine() {
...
@@ -875,6 +887,10 @@ function update_TDengine() {
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: use
${
GREEN_UNDERLINE
}
taos -h
$serverFqdn
${
NC
}
in shell
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: use
${
GREEN_UNDERLINE
}
taos -h
$serverFqdn
${
NC
}
in shell
${
NC
}
"
fi
fi
if
((
${
prompt_force
}
==
1
))
;
then
echo
""
echo
-e
"
${
RED
}
Please run 'taosd --force-keep-file' at first time for the exist TDengine
$exist_version
!
${
NC
}
"
fi
echo
echo
echo
-e
"
\0
33[44;32;1mTDengine is updated successfully!
${
NC
}
"
echo
-e
"
\0
33[44;32;1mTDengine is updated successfully!
${
NC
}
"
else
else
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
27b7eecc
...
@@ -484,7 +484,7 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema, SSm
...
@@ -484,7 +484,7 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema, SSm
size_t
tagIndex
=
taosArrayGetSize
(
schema
->
tags
)
-
1
;
size_t
tagIndex
=
taosArrayGetSize
(
schema
->
tags
)
-
1
;
taosHashPut
(
schema
->
tagHash
,
field
.
name
,
strlen
(
field
.
name
),
&
tagIndex
,
sizeof
(
tagIndex
));
taosHashPut
(
schema
->
tagHash
,
field
.
name
,
strlen
(
field
.
name
),
&
tagIndex
,
sizeof
(
tagIndex
));
}
}
tscDebug
(
"SML:0x%"
PRIx64
"
load table meta succeed.
%s, columns number: %d, tag number: %d, precision: %d"
,
tscDebug
(
"SML:0x%"
PRIx64
"
load table meta succeed. table name:
%s, columns number: %d, tag number: %d, precision: %d"
,
info
->
id
,
tableName
,
tableMeta
->
tableInfo
.
numOfColumns
,
tableMeta
->
tableInfo
.
numOfTags
,
schema
->
precision
);
info
->
id
,
tableName
,
tableMeta
->
tableInfo
.
numOfColumns
,
tableMeta
->
tableInfo
.
numOfTags
,
schema
->
precision
);
free
(
tableMeta
);
tableMeta
=
NULL
;
free
(
tableMeta
);
tableMeta
=
NULL
;
return
code
;
return
code
;
...
...
src/client/src/tscServer.c
浏览文件 @
27b7eecc
...
@@ -337,11 +337,16 @@ int tscSendMsgToServer(SSqlObj *pSql) {
...
@@ -337,11 +337,16 @@ int tscSendMsgToServer(SSqlObj *pSql) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpcEpSet
*
pEpSet
)
{
static
void
doProcessMsgFromServer
(
SSchedMsg
*
pSchedMsg
)
{
SRpcMsg
*
rpcMsg
=
pSchedMsg
->
ahandle
;
SRpcEpSet
*
pEpSet
=
pSchedMsg
->
thandle
;
TSDB_CACHE_PTR_TYPE
handle
=
(
TSDB_CACHE_PTR_TYPE
)
rpcMsg
->
ahandle
;
TSDB_CACHE_PTR_TYPE
handle
=
(
TSDB_CACHE_PTR_TYPE
)
rpcMsg
->
ahandle
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
handle
);
SSqlObj
*
pSql
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
handle
);
if
(
pSql
==
NULL
)
{
if
(
pSql
==
NULL
)
{
rpcFreeCont
(
rpcMsg
->
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
free
(
rpcMsg
);
free
(
pEpSet
);
return
;
return
;
}
}
...
@@ -359,6 +364,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -359,6 +364,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
taosRemoveRef
(
tscObjRef
,
handle
);
taosRemoveRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
rpcFreeCont
(
rpcMsg
->
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
free
(
rpcMsg
);
free
(
pEpSet
);
return
;
return
;
}
}
...
@@ -370,6 +377,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -370,6 +377,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
taosRemoveRef
(
tscObjRef
,
handle
);
taosRemoveRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
rpcFreeCont
(
rpcMsg
->
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
free
(
rpcMsg
);
free
(
pEpSet
);
return
;
return
;
}
}
...
@@ -425,6 +434,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -425,6 +434,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
if
(
rpcMsg
->
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
if
(
rpcMsg
->
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
taosReleaseRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
rpcFreeCont
(
rpcMsg
->
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
free
(
rpcMsg
);
free
(
pEpSet
);
return
;
return
;
}
}
}
}
...
@@ -432,7 +443,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -432,7 +443,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
}
}
pRes
->
rspLen
=
0
;
pRes
->
rspLen
=
0
;
if
(
pRes
->
code
==
TSDB_CODE_TSC_QUERY_CANCELLED
)
{
if
(
pRes
->
code
==
TSDB_CODE_TSC_QUERY_CANCELLED
)
{
tscDebug
(
"0x%"
PRIx64
" query is cancelled, code:%s"
,
pSql
->
self
,
tstrerror
(
pRes
->
code
));
tscDebug
(
"0x%"
PRIx64
" query is cancelled, code:%s"
,
pSql
->
self
,
tstrerror
(
pRes
->
code
));
}
else
{
}
else
{
...
@@ -481,7 +492,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -481,7 +492,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
tscDebug
(
"0x%"
PRIx64
" SQL cmd:%s, code:%s rspLen:%d"
,
pSql
->
self
,
sqlCmd
[
pCmd
->
command
],
tstrerror
(
pRes
->
code
),
pRes
->
rspLen
);
tscDebug
(
"0x%"
PRIx64
" SQL cmd:%s, code:%s rspLen:%d"
,
pSql
->
self
,
sqlCmd
[
pCmd
->
command
],
tstrerror
(
pRes
->
code
),
pRes
->
rspLen
);
}
}
}
}
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
tscProcessMsgRsp
[
pCmd
->
command
])
{
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
tscProcessMsgRsp
[
pCmd
->
command
])
{
rpcMsg
->
code
=
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
rpcMsg
->
code
=
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
}
}
...
@@ -502,6 +513,29 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -502,6 +513,29 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
taosReleaseRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
rpcFreeCont
(
rpcMsg
->
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
free
(
rpcMsg
);
free
(
pEpSet
);
}
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpcEpSet
*
pEpSet
)
{
SSchedMsg
schedMsg
=
{
0
};
schedMsg
.
fp
=
doProcessMsgFromServer
;
SRpcMsg
*
rpcMsgCopy
=
calloc
(
1
,
sizeof
(
SRpcMsg
));
memcpy
(
rpcMsgCopy
,
rpcMsg
,
sizeof
(
struct
SRpcMsg
));
schedMsg
.
ahandle
=
(
void
*
)
rpcMsgCopy
;
SRpcEpSet
*
pEpSetCopy
=
NULL
;
if
(
pEpSet
!=
NULL
)
{
pEpSetCopy
=
calloc
(
1
,
sizeof
(
SRpcEpSet
));
memcpy
(
pEpSetCopy
,
pEpSet
,
sizeof
(
SRpcEpSet
));
}
schedMsg
.
thandle
=
(
void
*
)
pEpSetCopy
;
schedMsg
.
msg
=
NULL
;
taosScheduleTask
(
tscQhandle
,
&
schedMsg
);
}
}
int
doBuildAndSendMsg
(
SSqlObj
*
pSql
)
{
int
doBuildAndSendMsg
(
SSqlObj
*
pSql
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
27b7eecc
...
@@ -3183,6 +3183,7 @@ static void freeQueryInfoImpl(SQueryInfo* pQueryInfo) {
...
@@ -3183,6 +3183,7 @@ static void freeQueryInfoImpl(SQueryInfo* pQueryInfo) {
pQueryInfo
->
fillType
=
0
;
pQueryInfo
->
fillType
=
0
;
tfree
(
pQueryInfo
->
fillVal
);
tfree
(
pQueryInfo
->
fillVal
);
pQueryInfo
->
fillType
=
0
;
tfree
(
pQueryInfo
->
buf
);
tfree
(
pQueryInfo
->
buf
);
taosArrayDestroy
(
pQueryInfo
->
pUpstream
);
taosArrayDestroy
(
pQueryInfo
->
pUpstream
);
...
...
src/common/src/tglobal.c
浏览文件 @
27b7eecc
...
@@ -38,7 +38,7 @@ uint16_t tsDnodeDnodePort = 6035; // udp/tcp
...
@@ -38,7 +38,7 @@ uint16_t tsDnodeDnodePort = 6035; // udp/tcp
uint16_t
tsSyncPort
=
6040
;
uint16_t
tsSyncPort
=
6040
;
uint16_t
tsArbitratorPort
=
6042
;
uint16_t
tsArbitratorPort
=
6042
;
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsNumOfMnodes
=
3
;
int32_t
tsNumOfMnodes
=
1
;
int8_t
tsEnableVnodeBak
=
1
;
int8_t
tsEnableVnodeBak
=
1
;
int8_t
tsEnableTelemetryReporting
=
1
;
int8_t
tsEnableTelemetryReporting
=
1
;
int8_t
tsArbOnline
=
0
;
int8_t
tsArbOnline
=
0
;
...
...
src/inc/taos.h
浏览文件 @
27b7eecc
...
@@ -110,19 +110,18 @@ typedef struct TAOS_MULTI_BIND {
...
@@ -110,19 +110,18 @@ typedef struct TAOS_MULTI_BIND {
int
num
;
int
num
;
}
TAOS_MULTI_BIND
;
}
TAOS_MULTI_BIND
;
DLL_EXPORT
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
DLL_EXPORT
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
DLL_EXPORT
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
DLL_EXPORT
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
DLL_EXPORT
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
);
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
...
@@ -141,7 +140,6 @@ DLL_EXPORT int taos_select_db(TAOS *taos, const char *db);
...
@@ -141,7 +140,6 @@ DLL_EXPORT int taos_select_db(TAOS *taos, const char *db);
DLL_EXPORT
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
);
DLL_EXPORT
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
);
DLL_EXPORT
void
taos_stop_query
(
TAOS_RES
*
res
);
DLL_EXPORT
void
taos_stop_query
(
TAOS_RES
*
res
);
DLL_EXPORT
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
);
DLL_EXPORT
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
);
DLL_EXPORT
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
DLL_EXPORT
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
DLL_EXPORT
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
...
...
src/inc/tcq.h
浏览文件 @
27b7eecc
...
@@ -27,7 +27,7 @@ typedef struct {
...
@@ -27,7 +27,7 @@ typedef struct {
int32_t
vgId
;
int32_t
vgId
;
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
char
pass
[
TSDB_KEY_LEN
];
char
db
[
TSDB_ACCT_ID_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_ID_LEN
+
TSDB_DB_NAME_LEN
];
// size must same with SVnodeObj.db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN]
FCqWrite
cqWrite
;
FCqWrite
cqWrite
;
}
SCqCfg
;
}
SCqCfg
;
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
27b7eecc
此差异已折叠。
点击以展开。
src/kit/taosdump/taosdump.c
浏览文件 @
27b7eecc
...
@@ -1264,7 +1264,7 @@ static int taosGetTableDes(
...
@@ -1264,7 +1264,7 @@ static int taosGetTableDes(
fields
[
TSDB_DESCRIBE_METRIC_FIELD_INDEX
].
bytes
+
1
));
fields
[
TSDB_DESCRIBE_METRIC_FIELD_INDEX
].
bytes
+
1
));
tstrncpy
(
tableDes
->
cols
[
count
].
type
,
tstrncpy
(
tableDes
->
cols
[
count
].
type
,
(
char
*
)
row
[
TSDB_DESCRIBE_METRIC_TYPE_INDEX
],
(
char
*
)
row
[
TSDB_DESCRIBE_METRIC_TYPE_INDEX
],
min
(
16
,
fields
[
TSDB_DESCRIBE_METRIC_TYPE_INDEX
].
bytes
)
+
1
);
min
(
16
,
fields
[
TSDB_DESCRIBE_METRIC_TYPE_INDEX
].
bytes
+
1
)
);
tableDes
->
cols
[
count
].
length
=
tableDes
->
cols
[
count
].
length
=
*
((
int
*
)
row
[
TSDB_DESCRIBE_METRIC_LENGTH_INDEX
]);
*
((
int
*
)
row
[
TSDB_DESCRIBE_METRIC_LENGTH_INDEX
]);
tstrncpy
(
tableDes
->
cols
[
count
].
note
,
tstrncpy
(
tableDes
->
cols
[
count
].
note
,
...
...
src/plugins/http/src/httpJson.c
浏览文件 @
27b7eecc
...
@@ -268,7 +268,7 @@ void httpJsonTimestamp(JsonBuf* buf, int64_t t, int32_t timePrecision) {
...
@@ -268,7 +268,7 @@ void httpJsonTimestamp(JsonBuf* buf, int64_t t, int32_t timePrecision) {
int32_t
fractionLen
;
int32_t
fractionLen
;
char
*
format
=
NULL
;
char
*
format
=
NULL
;
time_t
quot
=
0
;
time_t
quot
=
0
;
long
mod
=
0
;
int64_t
mod
=
0
;
switch
(
timePrecision
)
{
switch
(
timePrecision
)
{
case
TSDB_TIME_PRECISION_MILLI
:
{
case
TSDB_TIME_PRECISION_MILLI
:
{
...
...
src/query/src/qAggMain.c
浏览文件 @
27b7eecc
...
@@ -4132,6 +4132,11 @@ void blockinfo_func_finalizer(SQLFunctionCtx* pCtx) {
...
@@ -4132,6 +4132,11 @@ void blockinfo_func_finalizer(SQLFunctionCtx* pCtx) {
pDist
->
rowSize
=
(
uint16_t
)
pCtx
->
param
[
0
].
i64
;
pDist
->
rowSize
=
(
uint16_t
)
pCtx
->
param
[
0
].
i64
;
generateBlockDistResult
(
pDist
,
pCtx
->
pOutput
);
generateBlockDistResult
(
pDist
,
pCtx
->
pOutput
);
if
(
pDist
->
dataBlockInfos
!=
NULL
)
{
taosArrayDestroy
(
pDist
->
dataBlockInfos
);
pDist
->
dataBlockInfos
=
NULL
;
}
// cannot set the numOfIteratedElems again since it is set during previous iteration
// cannot set the numOfIteratedElems again since it is set during previous iteration
pResInfo
->
numOfRes
=
1
;
pResInfo
->
numOfRes
=
1
;
pResInfo
->
hasResult
=
DATA_SET_FLAG
;
pResInfo
->
hasResult
=
DATA_SET_FLAG
;
...
...
src/query/src/qExecutor.c
浏览文件 @
27b7eecc
...
@@ -5561,6 +5561,8 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) {
...
@@ -5561,6 +5561,8 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) {
break
;
break
;
}
}
setTagValue
(
pOperator
,
pRuntimeEnv
->
current
->
pTable
,
pIntervalInfo
->
pCtx
,
pOperator
->
numOfOutput
);
// the pDataBlock are always the same one, no need to call this again
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pIntervalInfo
->
pCtx
,
pBlock
,
pQueryAttr
->
order
.
order
);
setInputDataBlock
(
pOperator
,
pIntervalInfo
->
pCtx
,
pBlock
,
pQueryAttr
->
order
.
order
);
hashIntervalAgg
(
pOperator
,
&
pIntervalInfo
->
resultRowInfo
,
pBlock
,
0
);
hashIntervalAgg
(
pOperator
,
&
pIntervalInfo
->
resultRowInfo
,
pBlock
,
0
);
...
...
src/query/src/qExtbuffer.c
浏览文件 @
27b7eecc
...
@@ -391,11 +391,18 @@ int32_t columnValueAscendingComparator(char *f1, char *f2, int32_t type, int32_t
...
@@ -391,11 +391,18 @@ int32_t columnValueAscendingComparator(char *f1, char *f2, int32_t type, int32_t
};
};
case
TSDB_DATA_TYPE_NCHAR
:
{
// todo handle the var string compare
case
TSDB_DATA_TYPE_NCHAR
:
{
// todo handle the var string compare
int32_t
ret
=
tasoUcs4Compare
(
f1
,
f2
,
bytes
);
int32_t
len1
=
varDataLen
(
f1
);
if
(
ret
==
0
)
{
int32_t
len2
=
varDataLen
(
f2
);
return
0
;
if
(
len1
!=
len2
)
{
return
len1
>
len2
?
1
:
-
1
;
}
else
{
int32_t
ret
=
tasoUcs4Compare
(
varDataVal
(
f1
),
varDataVal
(
f2
),
len1
);
if
(
ret
==
0
)
{
return
0
;
}
return
(
ret
<
0
)
?
-
1
:
1
;
}
}
return
(
ret
<
0
)
?
-
1
:
1
;
};
};
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
...
...
src/sync/inc/syncTcp.h
浏览文件 @
27b7eecc
...
@@ -25,7 +25,7 @@ typedef struct {
...
@@ -25,7 +25,7 @@ typedef struct {
uint32_t
serverIp
;
uint32_t
serverIp
;
int16_t
port
;
int16_t
port
;
int32_t
bufferSize
;
int32_t
bufferSize
;
void
(
*
processBrokenLink
)(
int64_t
handleId
);
void
(
*
processBrokenLink
)(
int64_t
handleId
,
int32_t
closedByApp
);
int32_t
(
*
processIncomingMsg
)(
int64_t
handleId
,
void
*
buffer
);
int32_t
(
*
processIncomingMsg
)(
int64_t
handleId
,
void
*
buffer
);
void
(
*
processIncomingConn
)(
SOCKET
fd
,
uint32_t
ip
);
void
(
*
processIncomingConn
)(
SOCKET
fd
,
uint32_t
ip
);
}
SPoolInfo
;
}
SPoolInfo
;
...
...
src/sync/src/syncArbitrator.c
浏览文件 @
27b7eecc
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
extern
void
syncProcessTestMsg
(
SSyncMsg
*
pMsg
,
SOCKET
connFd
);
extern
void
syncProcessTestMsg
(
SSyncMsg
*
pMsg
,
SOCKET
connFd
);
static
void
arbSignalHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
);
static
void
arbSignalHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
);
static
void
arbProcessIncommingConnection
(
SOCKET
connFd
,
uint32_t
sourceIp
);
static
void
arbProcessIncommingConnection
(
SOCKET
connFd
,
uint32_t
sourceIp
);
static
void
arbProcessBrokenLink
(
int64_t
rid
);
static
void
arbProcessBrokenLink
(
int64_t
rid
,
int32_t
closedByApp
);
static
int32_t
arbProcessPeerMsg
(
int64_t
rid
,
void
*
buffer
);
static
int32_t
arbProcessPeerMsg
(
int64_t
rid
,
void
*
buffer
);
static
tsem_t
tsArbSem
;
static
tsem_t
tsArbSem
;
static
void
*
tsArbTcpPool
;
static
void
*
tsArbTcpPool
;
...
@@ -147,10 +147,10 @@ static void arbProcessIncommingConnection(SOCKET connFd, uint32_t sourceIp) {
...
@@ -147,10 +147,10 @@ static void arbProcessIncommingConnection(SOCKET connFd, uint32_t sourceIp) {
return
;
return
;
}
}
static
void
arbProcessBrokenLink
(
int64_t
rid
)
{
static
void
arbProcessBrokenLink
(
int64_t
rid
,
int32_t
closedByApp
)
{
SNodeConn
*
pNode
=
(
SNodeConn
*
)
rid
;
SNodeConn
*
pNode
=
(
SNodeConn
*
)
rid
;
sDebug
(
"%s, TCP link is broken since %s, close
connection"
,
pNode
->
id
,
strerror
(
errno
)
);
sDebug
(
"%s, TCP link is broken since %s, close
dByApp:%d"
,
pNode
->
id
,
strerror
(
errno
),
closedByApp
);
tfree
(
pNode
);
tfree
(
pNode
);
}
}
...
...
src/sync/src/syncMain.c
浏览文件 @
27b7eecc
...
@@ -43,7 +43,7 @@ static void syncProcessSyncRequest(char *pMsg, SSyncPeer *pPeer);
...
@@ -43,7 +43,7 @@ static void syncProcessSyncRequest(char *pMsg, SSyncPeer *pPeer);
static
void
syncRecoverFromMaster
(
SSyncPeer
*
pPeer
);
static
void
syncRecoverFromMaster
(
SSyncPeer
*
pPeer
);
static
void
syncCheckPeerConnection
(
void
*
param
,
void
*
tmrId
);
static
void
syncCheckPeerConnection
(
void
*
param
,
void
*
tmrId
);
static
int32_t
syncSendPeersStatusMsgToPeer
(
SSyncPeer
*
pPeer
,
char
ack
,
int8_t
type
,
uint16_t
tranId
);
static
int32_t
syncSendPeersStatusMsgToPeer
(
SSyncPeer
*
pPeer
,
char
ack
,
int8_t
type
,
uint16_t
tranId
);
static
void
syncProcessBrokenLink
(
int64_t
rid
);
static
void
syncProcessBrokenLink
(
int64_t
rid
,
int32_t
closedByApp
);
static
int32_t
syncProcessPeerMsg
(
int64_t
rid
,
void
*
buffer
);
static
int32_t
syncProcessPeerMsg
(
int64_t
rid
,
void
*
buffer
);
static
void
syncProcessIncommingConnection
(
SOCKET
connFd
,
uint32_t
sourceIp
);
static
void
syncProcessIncommingConnection
(
SOCKET
connFd
,
uint32_t
sourceIp
);
static
void
syncRemovePeer
(
SSyncPeer
*
pPeer
);
static
void
syncRemovePeer
(
SSyncPeer
*
pPeer
);
...
@@ -1308,7 +1308,7 @@ static void syncProcessIncommingConnection(SOCKET connFd, uint32_t sourceIp) {
...
@@ -1308,7 +1308,7 @@ static void syncProcessIncommingConnection(SOCKET connFd, uint32_t sourceIp) {
pthread_mutex_unlock
(
&
pNode
->
mutex
);
pthread_mutex_unlock
(
&
pNode
->
mutex
);
}
}
static
void
syncProcessBrokenLink
(
int64_t
rid
)
{
static
void
syncProcessBrokenLink
(
int64_t
rid
,
int32_t
closedByApp
)
{
SSyncPeer
*
pPeer
=
syncAcquirePeer
(
rid
);
SSyncPeer
*
pPeer
=
syncAcquirePeer
(
rid
);
if
(
pPeer
==
NULL
)
return
;
if
(
pPeer
==
NULL
)
return
;
...
@@ -1316,9 +1316,10 @@ static void syncProcessBrokenLink(int64_t rid) {
...
@@ -1316,9 +1316,10 @@ static void syncProcessBrokenLink(int64_t rid) {
pthread_mutex_lock
(
&
pNode
->
mutex
);
pthread_mutex_lock
(
&
pNode
->
mutex
);
sDebug
(
"%s, TCP link is broken since %s, pfd:%d sfd:%d"
,
pPeer
->
id
,
strerror
(
errno
),
pPeer
->
peerFd
,
pPeer
->
syncFd
);
sDebug
(
"%s, TCP link is broken since %s, pfd:%d sfd:%d closedByApp:%d"
,
pPeer
->
id
,
strerror
(
errno
),
pPeer
->
peerFd
,
pPeer
->
syncFd
,
closedByApp
);
pPeer
->
peerFd
=
-
1
;
pPeer
->
peerFd
=
-
1
;
if
(
pPeer
->
isArb
)
{
if
(
!
closedByApp
&&
pPeer
->
isArb
)
{
tsArbOnline
=
0
;
tsArbOnline
=
0
;
}
}
...
...
src/sync/src/syncTcp.c
浏览文件 @
27b7eecc
...
@@ -177,7 +177,7 @@ static void taosProcessBrokenLink(SConnObj *pConn) {
...
@@ -177,7 +177,7 @@ static void taosProcessBrokenLink(SConnObj *pConn) {
SPoolInfo
*
pInfo
=
&
pPool
->
info
;
SPoolInfo
*
pInfo
=
&
pPool
->
info
;
if
(
pConn
->
closedByApp
==
0
)
shutdown
(
pConn
->
fd
,
SHUT_WR
);
if
(
pConn
->
closedByApp
==
0
)
shutdown
(
pConn
->
fd
,
SHUT_WR
);
(
*
pInfo
->
processBrokenLink
)(
pConn
->
handleId
);
(
*
pInfo
->
processBrokenLink
)(
pConn
->
handleId
,
pConn
->
closedByApp
);
pThread
->
numOfFds
--
;
pThread
->
numOfFds
--
;
epoll_ctl
(
pThread
->
pollFd
,
EPOLL_CTL_DEL
,
pConn
->
fd
,
NULL
);
epoll_ctl
(
pThread
->
pollFd
,
EPOLL_CTL_DEL
,
pConn
->
fd
,
NULL
);
...
...
src/vnode/src/vnodeMgmt.c
浏览文件 @
27b7eecc
...
@@ -110,7 +110,9 @@ void vnodeRelease(void *vparam) {
...
@@ -110,7 +110,9 @@ void vnodeRelease(void *vparam) {
if
(
vparam
==
NULL
)
return
;
if
(
vparam
==
NULL
)
return
;
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
vTrace
(
"vgId:%d, release vnode, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
refCount
,
pVnode
);
int32_t
vgId
=
pVnode
->
vgId
;
vTrace
(
"vgId:%d, release vnode, refCount:%d pVnode:%p"
,
vgId
,
refCount
,
pVnode
);
assert
(
refCount
>=
0
);
assert
(
refCount
>=
0
);
if
(
refCount
>
0
)
{
if
(
refCount
>
0
)
{
...
@@ -118,10 +120,10 @@ void vnodeRelease(void *vparam) {
...
@@ -118,10 +120,10 @@ void vnodeRelease(void *vparam) {
tsem_post
(
&
pVnode
->
sem
);
tsem_post
(
&
pVnode
->
sem
);
}
}
}
else
{
}
else
{
vDebug
(
"vgId:%d, vnode will be destroyed, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
refCount
,
pVnode
);
vDebug
(
"vgId:%d, vnode will be destroyed, refCount:%d pVnode:%p"
,
vgId
,
refCount
,
pVnode
);
vnodeDestroyInMWorker
(
pVnode
);
vnodeDestroyInMWorker
(
pVnode
);
int32_t
count
=
taosHashGetSize
(
tsVnodesHash
);
int32_t
count
=
taosHashGetSize
(
tsVnodesHash
);
vDebug
(
"vgId:%d, vnode is destroyed, vnodes:%d"
,
pVnode
->
vgId
,
count
);
vDebug
(
"vgId:%d, vnode is destroyed, vnodes:%d"
,
vgId
,
count
);
}
}
}
}
...
...
tests/pytest/fulltest.sh
浏览文件 @
27b7eecc
...
@@ -244,6 +244,7 @@ python3 ./test.py -f query/queryStddevWithGroupby.py
...
@@ -244,6 +244,7 @@ python3 ./test.py -f query/queryStddevWithGroupby.py
python3 ./test.py
-f
query/querySecondtscolumnTowherenow.py
python3 ./test.py
-f
query/querySecondtscolumnTowherenow.py
python3 ./test.py
-f
query/queryFilterTswithDateUnit.py
python3 ./test.py
-f
query/queryFilterTswithDateUnit.py
python3 ./test.py
-f
query/queryTscomputWithNow.py
python3 ./test.py
-f
query/queryTscomputWithNow.py
python3 ./test.py
-f
query/queryStableJoin.py
python3 ./test.py
-f
query/computeErrorinWhere.py
python3 ./test.py
-f
query/computeErrorinWhere.py
python3 ./test.py
-f
query/queryTsisNull.py
python3 ./test.py
-f
query/queryTsisNull.py
python3 ./test.py
-f
query/subqueryFilter.py
python3 ./test.py
-f
query/subqueryFilter.py
...
...
tests/pytest/insert/metadataUpdate.py
浏览文件 @
27b7eecc
...
@@ -16,7 +16,6 @@ from util.log import tdLog
...
@@ -16,7 +16,6 @@ from util.log import tdLog
from
util.cases
import
tdCases
from
util.cases
import
tdCases
from
util.sql
import
tdSql
from
util.sql
import
tdSql
from
util.dnodes
import
tdDnodes
from
util.dnodes
import
tdDnodes
from
multiprocessing
import
Process
import
subprocess
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -28,16 +27,6 @@ class TDTestCase:
...
@@ -28,16 +27,6 @@ class TDTestCase:
self
.
tables
=
10
self
.
tables
=
10
self
.
rows
=
1000
self
.
rows
=
1000
def
updateMetadata
(
self
):
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
password
=
"taosdata"
self
.
config
=
tdDnodes
.
getSimCfgPath
()
self
.
conn
=
taos
.
connect
(
host
=
self
.
host
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
self
.
config
)
self
.
cursor
=
self
.
conn
.
cursor
()
self
.
cursor
.
execute
(
"alter table db.tb add column col2 int"
)
print
(
"alter table done"
)
def
deleteTableAndRecreate
(
self
):
def
deleteTableAndRecreate
(
self
):
self
.
config
=
tdDnodes
.
getSimCfgPath
()
self
.
config
=
tdDnodes
.
getSimCfgPath
()
...
@@ -68,11 +57,15 @@ class TDTestCase:
...
@@ -68,11 +57,15 @@ class TDTestCase:
tdSql
.
query
(
"select * from tb"
)
tdSql
.
query
(
"select * from tb"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
p
=
Process
(
target
=
self
.
updateMetadata
,
args
=
())
self
.
config
=
tdDnodes
.
getSimCfgPath
()
p
.
start
()
command
=
[
"taos"
,
"-c"
,
self
.
config
,
"-s"
,
"alter table db.tb add column col2 int;"
]
p
.
join
()
print
(
"alter table db.tb add column col2 int;"
)
p
.
terminate
()
result
=
subprocess
.
run
(
command
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
encoding
=
"utf-8"
)
if
result
.
returncode
==
0
:
print
(
"success:"
,
result
)
else
:
print
(
"error:"
,
result
)
tdSql
.
execute
(
"insert into tb(ts, col1, col2) values(%d, 1, 2)"
%
(
self
.
ts
+
2
))
tdSql
.
execute
(
"insert into tb(ts, col1, col2) values(%d, 1, 2)"
%
(
self
.
ts
+
2
))
print
(
"==============step2"
)
print
(
"==============step2"
)
...
...
tests/pytest/query/queryInterval.py
浏览文件 @
27b7eecc
...
@@ -73,6 +73,52 @@ class TDTestCase:
...
@@ -73,6 +73,52 @@ class TDTestCase:
tdSql
.
checkData
(
6
,
0
,
"2020-09-16 00:00:00"
)
tdSql
.
checkData
(
6
,
0
,
"2020-09-16 00:00:00"
)
tdSql
.
checkData
(
6
,
1
,
222.0
)
tdSql
.
checkData
(
6
,
1
,
222.0
)
# test case for https://jira.taosdata.com:18080/browse/TD-5338
tdSql
.
query
(
"select loc,max(voltage) from st interval(1m);"
)
tdSql
.
checkRows
(
8
)
tdSql
.
checkData
(
0
,
0
,
"2020-07-01 04:24:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"beijing"
)
tdSql
.
checkData
(
0
,
2
,
220
)
tdSql
.
checkData
(
1
,
0
,
"2020-07-12 18:11:00.000"
)
tdSql
.
checkData
(
1
,
1
,
"beijing"
)
tdSql
.
checkData
(
1
,
2
,
221
)
tdSql
.
checkData
(
2
,
0
,
"2020-07-24 07:58:00.000"
)
tdSql
.
checkData
(
2
,
1
,
"beijing"
)
tdSql
.
checkData
(
2
,
2
,
225
)
tdSql
.
checkData
(
3
,
0
,
"2020-08-04 21:44:00.000"
)
tdSql
.
checkData
(
2
,
1
,
"beijing"
)
tdSql
.
checkData
(
3
,
2
,
228
)
tdSql
.
checkData
(
4
,
0
,
"2020-08-16 11:31:00.000"
)
tdSql
.
checkData
(
4
,
1
,
"shanghai"
)
tdSql
.
checkData
(
4
,
2
,
225
)
tdSql
.
checkData
(
5
,
0
,
"2020-08-28 01:18:00.000"
)
tdSql
.
checkData
(
5
,
1
,
"shanghai"
)
tdSql
.
checkData
(
5
,
2
,
228
)
tdSql
.
checkData
(
6
,
0
,
"2020-09-08 15:04:00.000"
)
tdSql
.
checkData
(
6
,
1
,
"beijing"
)
tdSql
.
checkData
(
6
,
2
,
222
)
tdSql
.
checkData
(
7
,
0
,
"2020-09-20 04:51:00.000"
)
tdSql
.
checkData
(
7
,
1
,
"shanghai"
)
tdSql
.
checkData
(
7
,
2
,
222
)
tdSql
.
query
(
"select loc,max(voltage) from t0 interval(1m);"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkData
(
0
,
0
,
"2020-07-01 04:24:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"beijing"
)
tdSql
.
checkData
(
0
,
2
,
220
)
tdSql
.
checkData
(
1
,
0
,
"2020-07-12 18:11:00.000"
)
tdSql
.
checkData
(
1
,
1
,
"beijing"
)
tdSql
.
checkData
(
1
,
2
,
221
)
tdSql
.
checkData
(
2
,
0
,
"2020-07-24 07:58:00.000"
)
tdSql
.
checkData
(
2
,
1
,
"beijing"
)
tdSql
.
checkData
(
2
,
2
,
225
)
tdSql
.
checkData
(
3
,
0
,
"2020-08-04 21:44:00.000"
)
tdSql
.
checkData
(
2
,
1
,
"beijing"
)
tdSql
.
checkData
(
3
,
2
,
228
)
tdSql
.
checkData
(
4
,
0
,
"2020-09-08 15:04:00.000"
)
tdSql
.
checkData
(
4
,
1
,
"beijing"
)
tdSql
.
checkData
(
4
,
2
,
222
)
# test case for https://jira.taosdata.com:18080/browse/TD-2298
# test case for https://jira.taosdata.com:18080/browse/TD-2298
tdSql
.
execute
(
"create database test keep 36500"
)
tdSql
.
execute
(
"create database test keep 36500"
)
tdSql
.
execute
(
"use test"
)
tdSql
.
execute
(
"use test"
)
...
...
tests/pytest/query/queryStableJoin.py
0 → 100644
浏览文件 @
27b7eecc
###################################################################
# 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
taos
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
import
random
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
ts
=
1600000000000
self
.
num
=
10
def
run
(
self
):
tdSql
.
prepare
()
# test case for https://jira.taosdata.com:18080/browse/TD-5206
tdSql
.
execute
(
'''create stable stable_1
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint,
q_bool bool , q_binary binary(20) , q_nchar nchar(20) ,q_float float , q_double double , q_ts timestamp)
tags(loc nchar(20) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint,
t_bool bool , t_binary binary(20) , t_nchar nchar(20) ,t_float float , t_double double );'''
)
tdSql
.
execute
(
'''create stable stable_2
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint,
q_bool bool , q_binary binary(20) , q_nchar nchar(20) ,q_float float , q_double double , q_ts timestamp)
tags(loc nchar(20) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint,
t_bool bool , t_binary binary(20) , t_nchar nchar(20) ,t_float float , t_double double );'''
)
tdSql
.
execute
(
'''create table table_0 using stable_1
tags('table_0' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' )'''
)
tdSql
.
execute
(
'''create table table_1 using stable_1
tags('table_1' , '2147483647' , '9223372036854775807' , '32767' , '127' , 1 ,
'binary1' , 'nchar1' , '1' , '11' )'''
)
tdSql
.
execute
(
'''create table table_2 using stable_1
tags('table_2' , '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false ,
'binary2' , 'nchar2nchar2' , '-2.2' , '-22.22')'''
)
tdSql
.
execute
(
'''create table table_3 using stable_1
tags('table_3' , '3' , '3' , '3' , '3' , true , 'binary3' , 'nchar3' , '33.33' , '3333.3333' )'''
)
tdSql
.
execute
(
'''create table table_4 using stable_1
tags('table_4' , '4' , '4' , '4' , '4' , false , 'binary4' , 'nchar4' , '-444.444' , '-444444.444444' )'''
)
tdSql
.
execute
(
'''create table table_5 using stable_1
tags('table_5' , '5' , '5' , '5' , '5' , true , 'binary5' , 'nchar5' , '5555.5555' , '55555555.55555555' )'''
)
tdSql
.
execute
(
'''create table table_21 using stable_2
tags('table_5' , '5' , '5' , '5' , '5' , true , 'binary5' , 'nchar5' , '5555.5555' , '55555555.55555555' )'''
)
for
i
in
range
(
self
.
num
):
tdSql
.
execute
(
'''insert into table_0 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)'''
%
(
self
.
ts
+
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
self
.
ts
+
i
))
tdSql
.
execute
(
'''insert into table_1 values(%d, %d, %d, %d, %d, 1, 'binary1.%s', 'nchar1.%s', %f, %f, %d)'''
%
(
self
.
ts
+
i
,
2147483647
-
i
,
9223372036854775807
-
i
,
32767
-
i
,
127
-
i
,
i
,
i
,
random
.
random
(),
random
.
random
(),
1262304000001
+
i
))
tdSql
.
execute
(
'''insert into table_2 values(%d, %d, %d, %d, %d, true, 'binary2.%s', 'nchar2nchar2.%s', %f, %f, %d)'''
%
(
self
.
ts
+
i
,
-
2147483647
+
i
,
-
9223372036854775807
+
i
,
-
32767
+
i
,
-
127
+
i
,
i
,
i
,
random
.
uniform
(
-
1
,
0
),
random
.
uniform
(
-
1
,
0
),
1577836800001
+
i
))
tdSql
.
execute
(
'''insert into table_3 values(%d, %d, %d, %d, %d, false, 'binary3.%s', 'nchar3.%s', %f, %f, %d)'''
%
(
self
.
ts
+
i
,
random
.
randint
(
-
2147483647
,
2147483647
),
random
.
randint
(
-
9223372036854775807
,
9223372036854775807
),
random
.
randint
(
-
32767
,
32767
),
random
.
randint
(
-
127
,
127
),
random
.
randint
(
-
100
,
100
),
random
.
randint
(
-
10000
,
10000
),
random
.
uniform
(
-
100000
,
100000
),
random
.
uniform
(
-
1000000000
,
1000000000
),
self
.
ts
+
i
))
tdSql
.
execute
(
'''insert into table_4 values(%d, %d, %d, %d, %d, true, 'binary4.%s', 'nchar4.%s', %f, %f, %d)'''
%
(
self
.
ts
+
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
self
.
ts
+
i
))
tdSql
.
execute
(
'''insert into table_5 values(%d, %d, %d, %d, %d, false, 'binary5.%s', 'nchar5.%s', %f, %f, %d)'''
%
(
self
.
ts
+
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
self
.
ts
+
i
))
tdSql
.
execute
(
'''insert into table_21 values(%d, %d, %d, %d, %d, false, 'binary5.%s', 'nchar5.%s', %f, %f, %d)'''
%
(
self
.
ts
+
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
i
,
self
.
ts
+
i
))
tdLog
.
info
(
"==========TEST1:test all table data=========="
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_tinyint = stable_2.t_tinyint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_binary = stable_2.t_binary and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_double = stable_2.t_double and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_smallint = stable_2.t_smallint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bigint = stable_2.t_bigint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_int = stable_2.t_int and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_float = stable_2.t_float and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bool = stable_2.t_bool and stable_1.ts = stable_2.ts;'''
tdSql
.
error
(
sql
)
tdLog
.
info
(
"==========TEST1:test drop table_0 data=========="
)
sql
=
'''drop table table_0;'''
tdSql
.
execute
(
sql
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_tinyint = stable_2.t_tinyint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_binary = stable_2.t_binary and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_double = stable_2.t_double and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_smallint = stable_2.t_smallint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bigint = stable_2.t_bigint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_int = stable_2.t_int and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_float = stable_2.t_float and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bool = stable_2.t_bool and stable_1.ts = stable_2.ts;'''
tdSql
.
error
(
sql
)
tdLog
.
info
(
"==========TEST1:test drop table_1 data=========="
)
sql
=
'''drop table table_1;'''
tdSql
.
execute
(
sql
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_tinyint = stable_2.t_tinyint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_binary = stable_2.t_binary and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_double = stable_2.t_double and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_smallint = stable_2.t_smallint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bigint = stable_2.t_bigint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_int = stable_2.t_int and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_float = stable_2.t_float and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bool = stable_2.t_bool and stable_1.ts = stable_2.ts;'''
tdSql
.
error
(
sql
)
tdLog
.
info
(
"==========TEST1:test drop table_2 data=========="
)
sql
=
'''drop table table_2;'''
tdSql
.
execute
(
sql
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_tinyint = stable_2.t_tinyint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_binary = stable_2.t_binary and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_double = stable_2.t_double and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_smallint = stable_2.t_smallint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bigint = stable_2.t_bigint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_int = stable_2.t_int and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_float = stable_2.t_float and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bool = stable_2.t_bool and stable_1.ts = stable_2.ts;'''
tdSql
.
error
(
sql
)
tdLog
.
info
(
"==========TEST1:test drop table_3 data=========="
)
sql
=
'''drop table table_3;'''
tdSql
.
execute
(
sql
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_tinyint = stable_2.t_tinyint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_binary = stable_2.t_binary and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_double = stable_2.t_double and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_smallint = stable_2.t_smallint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bigint = stable_2.t_bigint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_int = stable_2.t_int and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_float = stable_2.t_float and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bool = stable_2.t_bool and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
tdLog
.
info
(
"==========TEST1:test drop table_4 data=========="
)
sql
=
'''drop table table_4;'''
tdSql
.
execute
(
sql
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_tinyint = stable_2.t_tinyint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_binary = stable_2.t_binary and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_double = stable_2.t_double and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_smallint = stable_2.t_smallint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bigint = stable_2.t_bigint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_int = stable_2.t_int and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_float = stable_2.t_float and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bool = stable_2.t_bool and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
self
.
num
)
tdLog
.
info
(
"==========TEST1:test drop table_5 data=========="
)
sql
=
'''drop table table_5;'''
tdSql
.
execute
(
sql
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_tinyint = stable_2.t_tinyint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_binary = stable_2.t_binary and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_double = stable_2.t_double and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_smallint = stable_2.t_smallint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bigint = stable_2.t_bigint and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_int = stable_2.t_int and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_float = stable_2.t_float and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
sql
=
'''select * from stable_1,stable_2 where stable_1.t_bool = stable_2.t_bool and stable_1.ts = stable_2.ts;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
0
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
浏览文件 @
27b7eecc
...
@@ -176,12 +176,8 @@ class TDTestCase:
...
@@ -176,12 +176,8 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql"
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
浏览文件 @
27b7eecc
...
@@ -180,13 +180,14 @@ class TDTestCase:
...
@@ -180,13 +180,14 @@ class TDTestCase:
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables like 'stb0%' "
)
tdSql
.
query
(
"show stables like 'stb0%' "
)
tdSql
.
checkData
(
0
,
2
,
11
)
tdSql
.
checkData
(
0
,
2
,
11
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
...
@@ -196,7 +197,7 @@ class TDTestCase:
...
@@ -196,7 +197,7 @@ class TDTestCase:
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from db.stb1"
)
tdSql
.
query
(
"select count(*) from db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select * from db.stb4"
)
tdSql
.
error
(
"select * from db.stb4"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
error
(
"select * from db.stb2"
)
...
@@ -221,7 +222,7 @@ class TDTestCase:
...
@@ -221,7 +222,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
"2020-03-31 12:00:00.000"
)
tdSql
.
checkData
(
0
,
0
,
"2020-03-31 12:00:00.000"
)
tdSql
.
query
(
"select first(ts) from blf.p_0_topics_2"
)
tdSql
.
query
(
"select first(ts) from blf.p_0_topics_2"
)
tdSql
.
checkData
(
0
,
0
,
"2019-10-01 00:00:00"
)
tdSql
.
checkData
(
0
,
0
,
"2019-10-01 00:00:00"
)
tdSql
.
query
(
"select last(ts) from blf.p_0_topics_6 "
)
tdSql
.
query
(
"select last(ts) from blf.p_0_topics_6 "
)
tdSql
.
checkData
(
0
,
0
,
"2020-09-29 23:59:00"
)
tdSql
.
checkData
(
0
,
0
,
"2020-09-29 23:59:00"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
...
@@ -324,6 +325,7 @@ class TDTestCase:
...
@@ -324,6 +325,7 @@ class TDTestCase:
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoTestTblAlt.py
浏览文件 @
27b7eecc
...
@@ -98,8 +98,8 @@ class TDTestCase:
...
@@ -98,8 +98,8 @@ class TDTestCase:
break
break
time
.
sleep
(
1
)
time
.
sleep
(
1
)
print
(
"alter table test.meters add column c
ol
10 int"
)
print
(
"alter table test.meters add column c10 int"
)
tdSql
.
execute
(
"alter table test.meters add column c
ol
10 int"
)
tdSql
.
execute
(
"alter table test.meters add column c10 int"
)
print
(
"insert into test.t9 values (now, 1, 2, 3, 4, 0)"
)
print
(
"insert into test.t9 values (now, 1, 2, 3, 4, 0)"
)
tdSql
.
execute
(
"insert into test.t9 values (now, 1, 2, 3, 4, 0)"
)
tdSql
.
execute
(
"insert into test.t9 values (now, 1, 2, 3, 4, 0)"
)
...
...
tests/tsim/src/simExe.c
浏览文件 @
27b7eecc
...
@@ -808,6 +808,11 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
...
@@ -808,6 +808,11 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
break
;
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
if
(
length
[
i
]
<
0
||
length
[
i
]
>
1
<<
20
)
{
fprintf
(
stderr
,
"Invalid length(%d) of BINARY or NCHAR
\n
"
,
length
[
i
]);
exit
(
-
1
);
}
memset
(
value
,
0
,
MAX_QUERY_VALUE_LEN
);
memset
(
value
,
0
,
MAX_QUERY_VALUE_LEN
);
memcpy
(
value
,
row
[
i
],
length
[
i
]);
memcpy
(
value
,
row
[
i
],
length
[
i
]);
value
[
length
[
i
]]
=
0
;
value
[
length
[
i
]]
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录