Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c57e9bae
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c57e9bae
编写于
10月 26, 2022
作者:
J
jiajingbin
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into test/td-19847
上级
e2ce0726
9415ecb4
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
411 addition
and
132 deletion
+411
-132
cmake/cmake.define
cmake/cmake.define
+2
-0
examples/c/tmq.c
examples/c/tmq.c
+2
-2
packaging/tools/make_install.bat
packaging/tools/make_install.bat
+12
-0
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+1
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+9
-2
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+3
-10
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+9
-6
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+1
-1
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+2
-28
source/libs/wal/src/walRef.c
source/libs/wal/src/walRef.c
+4
-0
source/libs/wal/src/walSeek.c
source/libs/wal/src/walSeek.c
+4
-0
tests/system-test/0-others/show.py
tests/system-test/0-others/show.py
+71
-5
tests/system-test/1-insert/tb_100w_data_order.py
tests/system-test/1-insert/tb_100w_data_order.py
+77
-0
tests/system-test/2-query/Timediff.py
tests/system-test/2-query/Timediff.py
+55
-28
tests/system-test/2-query/avg.py
tests/system-test/2-query/avg.py
+49
-4
tests/system-test/2-query/stddev.py
tests/system-test/2-query/stddev.py
+79
-0
tests/system-test/2-query/timetruncate.py
tests/system-test/2-query/timetruncate.py
+2
-1
tests/system-test/7-tmq/tmqConsFromTsdb1.py
tests/system-test/7-tmq/tmqConsFromTsdb1.py
+2
-2
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-0
tools/CMakeLists.txt
tools/CMakeLists.txt
+21
-41
tools/shell/CMakeLists.txt
tools/shell/CMakeLists.txt
+4
-0
未找到文件。
cmake/cmake.define
浏览文件 @
c57e9bae
...
@@ -100,6 +100,8 @@ IF (TD_WINDOWS)
...
@@ -100,6 +100,8 @@ IF (TD_WINDOWS)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
SET(JEMALLOC_ENABLED OFF)
ELSE ()
ELSE ()
IF (${TD_DARWIN})
IF (${TD_DARWIN})
set(CMAKE_MACOSX_RPATH 0)
set(CMAKE_MACOSX_RPATH 0)
...
...
examples/c/tmq.c
浏览文件 @
c57e9bae
...
@@ -47,7 +47,7 @@ static int32_t msg_process(TAOS_RES* msg) {
...
@@ -47,7 +47,7 @@ static int32_t msg_process(TAOS_RES* msg) {
int32_t
precision
=
taos_result_precision
(
msg
);
int32_t
precision
=
taos_result_precision
(
msg
);
rows
++
;
rows
++
;
taos_print_row
(
buf
,
row
,
fields
,
numOfFields
);
taos_print_row
(
buf
,
row
,
fields
,
numOfFields
);
printf
(
"
row content: %s
\n
"
,
buf
);
printf
(
"
precision: %d, row content: %s
\n
"
,
precision
,
buf
);
}
}
return
rows
;
return
rows
;
...
@@ -70,7 +70,7 @@ static int32_t init_env() {
...
@@ -70,7 +70,7 @@ static int32_t init_env() {
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
// create database
// create database
pRes
=
taos_query
(
pConn
,
"create database tmqdb"
);
pRes
=
taos_query
(
pConn
,
"create database tmqdb
precision 'ns'
"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in create tmqdb, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"error in create tmqdb, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
...
...
packaging/tools/make_install.bat
浏览文件 @
c57e9bae
...
@@ -47,6 +47,15 @@ copy %binary_dir%\\build\\bin\\udfd.exe %tagert_dir% > nul
...
@@ -47,6 +47,15 @@ copy %binary_dir%\\build\\bin\\udfd.exe %tagert_dir% > nul
if
exist
%binary_dir%
\\build\\bin\\taosBenchmark.exe
(
if
exist
%binary_dir%
\\build\\bin\\taosBenchmark.exe
(
copy
%binary_dir%
\\build\\bin\\taosBenchmark.exe
%tagert_dir%
>
nul
copy
%binary_dir%
\\build\\bin\\taosBenchmark.exe
%tagert_dir%
>
nul
)
)
if
exist
%binary_dir%
\\build\\lib\\taosws.dll.lib
(
copy
%binary_dir%
\\build\\lib\\taosws.dll.lib
%tagert_dir%
\\driver
>
nul
)
if
exist
%binary_dir%
\\build\\lib\\taosws.dll
(
copy
%binary_dir%
\\build\\lib\\taosws.dll
%tagert_dir%
\\driver
>
nul
)
if
exist
%binary_dir%
\\build\\bin\\taosdump.exe
(
copy
%binary_dir%
\\build\\bin\\taosdump.exe
%tagert_dir%
>
nul
)
if
exist
%binary_dir%
\\build\\bin\\taosadapter.exe
(
if
exist
%binary_dir%
\\build\\bin\\taosadapter.exe
(
copy
%binary_dir%
\\build\\bin\\taosadapter.exe
%tagert_dir%
>
nul
copy
%binary_dir%
\\build\\bin\\taosadapter.exe
%tagert_dir%
>
nul
)
)
...
@@ -54,4 +63,7 @@ if exist %binary_dir%\\build\\bin\\taosadapter.exe (
...
@@ -54,4 +63,7 @@ if exist %binary_dir%\\build\\bin\\taosadapter.exe (
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&&
echo
To
start
/stop
TDengine
with
administrator
privileges
:
sc
start
/stop
taosd
&
goto
:eof
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&&
echo
To
start
/stop
TDengine
with
administrator
privileges
:
sc
start
/stop
taosd
&
goto
:eof
:hasAdmin
:hasAdmin
copy
/y
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
>
nul
copy
/y
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
>
nul
if
exist
C
:\\TDengine\\driver\\taosws.dll
(
copy
/y
C
:\\TDengine\\driver\\taosws.dll
C
:\\Windows\\System32
>
nul
)
sc
query
"taosd"
>
nul
||
sc
create
"taosd"
binPath
=
"C:\\TDengine\\taosd.exe --win_service"
start
=
DEMAND
sc
query
"taosd"
>
nul
||
sc
create
"taosd"
binPath
=
"C:\\TDengine\\taosd.exe --win_service"
start
=
DEMAND
source/client/src/clientTmq.c
浏览文件 @
c57e9bae
...
@@ -1619,7 +1619,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
...
@@ -1619,7 +1619,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspWrapper
);
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspWrapper
);
if
(
rspWrapper
==
NULL
)
{
if
(
rspWrapper
==
NULL
)
{
tscDebug
(
"consumer %"
PRId64
" mqueue empty"
,
tmq
->
consumerId
);
/*tscDebug("consumer %" PRId64 " mqueue empty", tmq->consumerId);*/
return
NULL
;
return
NULL
;
}
}
}
}
...
...
source/common/src/tmsg.c
浏览文件 @
c57e9bae
...
@@ -5988,7 +5988,11 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) {
...
@@ -5988,7 +5988,11 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) {
if
(
pRsp
->
withSchema
)
{
if
(
pRsp
->
withSchema
)
{
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SSchemaWrapper
));
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SSchemaWrapper
));
if
(
pSW
==
NULL
)
return
-
1
;
if
(
pSW
==
NULL
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pDecoder
,
pSW
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pDecoder
,
pSW
)
<
0
)
{
taosMemoryFree
(
pSW
);
return
-
1
;
}
taosArrayPush
(
pRsp
->
blockSchema
,
&
pSW
);
taosArrayPush
(
pRsp
->
blockSchema
,
&
pSW
);
}
}
...
@@ -6069,7 +6073,10 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, STaosxRsp *pRsp) {
...
@@ -6069,7 +6073,10 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, STaosxRsp *pRsp) {
if
(
pRsp
->
withSchema
)
{
if
(
pRsp
->
withSchema
)
{
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SSchemaWrapper
));
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SSchemaWrapper
));
if
(
pSW
==
NULL
)
return
-
1
;
if
(
pSW
==
NULL
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pDecoder
,
pSW
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pDecoder
,
pSW
)
<
0
)
{
taosMemoryFree
(
pSW
);
return
-
1
;
}
taosArrayPush
(
pRsp
->
blockSchema
,
&
pSW
);
taosArrayPush
(
pRsp
->
blockSchema
,
&
pSW
);
}
}
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
c57e9bae
...
@@ -155,7 +155,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
...
@@ -155,7 +155,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
// tqExec
// tqExec
int32_t
tqTaosxScanLog
(
STQ
*
pTq
,
STqHandle
*
pHandle
,
SSubmitReq
*
pReq
,
STaosxRsp
*
pRsp
);
int32_t
tqTaosxScanLog
(
STQ
*
pTq
,
STqHandle
*
pHandle
,
SSubmitReq
*
pReq
,
STaosxRsp
*
pRsp
);
int32_t
tqAddBlockDataToRsp
(
const
SSDataBlock
*
pBlock
,
SMqDataRsp
*
pRsp
,
int32_t
numOfCols
);
int32_t
tqAddBlockDataToRsp
(
const
SSDataBlock
*
pBlock
,
SMqDataRsp
*
pRsp
,
int32_t
numOfCols
,
int8_t
precision
);
int32_t
tqSendDataRsp
(
STQ
*
pTq
,
const
SRpcMsg
*
pMsg
,
const
SMqPollReq
*
pReq
,
const
SMqDataRsp
*
pRsp
);
int32_t
tqSendDataRsp
(
STQ
*
pTq
,
const
SRpcMsg
*
pMsg
,
const
SMqPollReq
*
pReq
,
const
SMqDataRsp
*
pRsp
);
int32_t
tqPushDataRsp
(
STQ
*
pTq
,
STqPushEntry
*
pPushEntry
);
int32_t
tqPushDataRsp
(
STQ
*
pTq
,
STqPushEntry
*
pPushEntry
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
c57e9bae
...
@@ -433,16 +433,9 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su
...
@@ -433,16 +433,9 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su
}
}
#endif
#endif
if
(
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
ASSERT
(
subType
==
TOPIC_SUB_TYPE__COLUMN
);
pRsp
->
withSchema
=
false
;
pRsp
->
withSchema
=
false
;
}
else
{
pRsp
->
withSchema
=
true
;
pRsp
->
blockSchema
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
if
(
pRsp
->
blockSchema
==
NULL
)
{
// TODO free
return
-
1
;
}
}
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
c57e9bae
...
@@ -15,14 +15,14 @@
...
@@ -15,14 +15,14 @@
#include "tq.h"
#include "tq.h"
int32_t
tqAddBlockDataToRsp
(
const
SSDataBlock
*
pBlock
,
SMqDataRsp
*
pRsp
,
int32_t
numOfCols
)
{
int32_t
tqAddBlockDataToRsp
(
const
SSDataBlock
*
pBlock
,
SMqDataRsp
*
pRsp
,
int32_t
numOfCols
,
int8_t
precision
)
{
int32_t
dataStrLen
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
int32_t
dataStrLen
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
void
*
buf
=
taosMemoryCalloc
(
1
,
dataStrLen
);
void
*
buf
=
taosMemoryCalloc
(
1
,
dataStrLen
);
if
(
buf
==
NULL
)
return
-
1
;
if
(
buf
==
NULL
)
return
-
1
;
SRetrieveTableRsp
*
pRetrieve
=
(
SRetrieveTableRsp
*
)
buf
;
SRetrieveTableRsp
*
pRetrieve
=
(
SRetrieveTableRsp
*
)
buf
;
pRetrieve
->
useconds
=
0
;
pRetrieve
->
useconds
=
0
;
pRetrieve
->
precision
=
TSDB_DEFAULT_PRECISION
;
pRetrieve
->
precision
=
precision
;
pRetrieve
->
compressed
=
0
;
pRetrieve
->
compressed
=
0
;
pRetrieve
->
completed
=
1
;
pRetrieve
->
completed
=
1
;
pRetrieve
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
pRetrieve
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
...
@@ -95,7 +95,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
...
@@ -95,7 +95,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
break
;
break
;
}
}
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
);
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
,
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
pRsp
->
blockNum
++
;
pRsp
->
blockNum
++
;
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
...
@@ -174,7 +174,8 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
...
@@ -174,7 +174,8 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
}
}
}
}
tqAddBlockDataToRsp
(
pDataBlock
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
pDataBlock
->
pDataBlock
));
tqAddBlockDataToRsp
(
pDataBlock
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
pDataBlock
->
pDataBlock
),
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
pRsp
->
blockNum
++
;
pRsp
->
blockNum
++
;
if
(
pOffset
->
type
==
TMQ_OFFSET__LOG
)
{
if
(
pOffset
->
type
==
TMQ_OFFSET__LOG
)
{
continue
;
continue
;
...
@@ -256,7 +257,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp
...
@@ -256,7 +257,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp
pRsp
->
createTableNum
++
;
pRsp
->
createTableNum
++
;
}
}
}
}
tqAddBlockDataToRsp
(
&
block
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
block
.
pDataBlock
));
tqAddBlockDataToRsp
(
&
block
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
block
.
pDataBlock
),
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
blockDataFreeRes
(
&
block
);
blockDataFreeRes
(
&
block
);
tqAddBlockSchemaToRsp
(
pExec
,
(
SMqDataRsp
*
)
pRsp
);
tqAddBlockSchemaToRsp
(
pExec
,
(
SMqDataRsp
*
)
pRsp
);
pRsp
->
blockNum
++
;
pRsp
->
blockNum
++
;
...
@@ -291,7 +293,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp
...
@@ -291,7 +293,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp
pRsp
->
createTableNum
++
;
pRsp
->
createTableNum
++
;
}
}
}
}
tqAddBlockDataToRsp
(
&
block
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
block
.
pDataBlock
));
tqAddBlockDataToRsp
(
&
block
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
block
.
pDataBlock
),
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
blockDataFreeRes
(
&
block
);
blockDataFreeRes
(
&
block
);
tqAddBlockSchemaToRsp
(
pExec
,
(
SMqDataRsp
*
)
pRsp
);
tqAddBlockSchemaToRsp
(
pExec
,
(
SMqDataRsp
*
)
pRsp
);
pRsp
->
blockNum
++
;
pRsp
->
blockNum
++
;
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
c57e9bae
...
@@ -270,7 +270,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
...
@@ -270,7 +270,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
break
;
break
;
}
}
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
);
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
,
pTq
->
pVnode
->
config
.
tsdbCfg
.
precision
);
pRsp
->
blockNum
++
;
pRsp
->
blockNum
++
;
}
}
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
c57e9bae
...
@@ -2325,9 +2325,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2325,9 +2325,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
pSliceInfo
->
current
=
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
}
}
...
@@ -2337,6 +2334,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2337,6 +2334,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
}
}
if
(
ts
==
pSliceInfo
->
current
)
{
if
(
ts
==
pSliceInfo
->
current
)
{
blockDataEnsureCapacity
(
pResBlock
,
pResBlock
->
info
.
rows
+
1
);
for
(
int32_t
j
=
0
;
j
<
pOperator
->
exprSupp
.
numOfExprs
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pOperator
->
exprSupp
.
numOfExprs
;
++
j
)
{
SExprInfo
*
pExprInfo
=
&
pOperator
->
exprSupp
.
pExprInfo
[
j
];
SExprInfo
*
pExprInfo
=
&
pOperator
->
exprSupp
.
pExprInfo
[
j
];
...
@@ -2377,9 +2375,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2377,9 +2375,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
...
@@ -2398,10 +2393,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2398,10 +2393,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
break
;
break
;
}
}
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
}
else
if
(
ts
<
pSliceInfo
->
current
)
{
}
else
if
(
ts
<
pSliceInfo
->
current
)
{
// in case of interpolation window starts and ends between two datapoints, fill(prev) need to interpolate
// in case of interpolation window starts and ends between two datapoints, fill(prev) need to interpolate
...
@@ -2419,9 +2410,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2419,9 +2410,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
...
@@ -2443,9 +2431,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2443,9 +2431,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
...
@@ -2467,13 +2452,11 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2467,13 +2452,11 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
pSliceInfo
->
current
=
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
// add current row if timestamp match
// add current row if timestamp match
if
(
ts
==
pSliceInfo
->
current
&&
pSliceInfo
->
current
<=
pSliceInfo
->
win
.
ekey
)
{
if
(
ts
==
pSliceInfo
->
current
&&
pSliceInfo
->
current
<=
pSliceInfo
->
win
.
ekey
)
{
blockDataEnsureCapacity
(
pResBlock
,
pResBlock
->
info
.
rows
+
1
);
for
(
int32_t
j
=
0
;
j
<
pOperator
->
exprSupp
.
numOfExprs
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pOperator
->
exprSupp
.
numOfExprs
;
++
j
)
{
SExprInfo
*
pExprInfo
=
&
pOperator
->
exprSupp
.
pExprInfo
[
j
];
SExprInfo
*
pExprInfo
=
&
pOperator
->
exprSupp
.
pExprInfo
[
j
];
...
@@ -2510,9 +2493,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2510,9 +2493,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
...
@@ -2528,9 +2508,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2528,9 +2508,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
pSliceInfo
->
current
=
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
}
}
...
@@ -2549,9 +2526,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
...
@@ -2549,9 +2526,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pResBlock
);
pSliceInfo
->
current
=
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
}
// restore the value
// restore the value
...
...
source/libs/wal/src/walRef.c
浏览文件 @
c57e9bae
...
@@ -32,6 +32,7 @@ SWalRef *walOpenRef(SWal *pWal) {
...
@@ -32,6 +32,7 @@ SWalRef *walOpenRef(SWal *pWal) {
return
pRef
;
return
pRef
;
}
}
#if 0
void walCloseRef(SWal *pWal, int64_t refId) {
void walCloseRef(SWal *pWal, int64_t refId) {
SWalRef **ppRef = taosHashGet(pWal->pRefHash, &refId, sizeof(int64_t));
SWalRef **ppRef = taosHashGet(pWal->pRefHash, &refId, sizeof(int64_t));
if (ppRef == NULL) return;
if (ppRef == NULL) return;
...
@@ -39,6 +40,7 @@ void walCloseRef(SWal *pWal, int64_t refId) {
...
@@ -39,6 +40,7 @@ void walCloseRef(SWal *pWal, int64_t refId) {
taosHashRemove(pWal->pRefHash, &refId, sizeof(int64_t));
taosHashRemove(pWal->pRefHash, &refId, sizeof(int64_t));
taosMemoryFree(pRef);
taosMemoryFree(pRef);
}
}
#endif
int32_t
walRefVer
(
SWalRef
*
pRef
,
int64_t
ver
)
{
int32_t
walRefVer
(
SWalRef
*
pRef
,
int64_t
ver
)
{
SWal
*
pWal
=
pRef
->
pWal
;
SWal
*
pWal
=
pRef
->
pWal
;
...
@@ -65,10 +67,12 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) {
...
@@ -65,10 +67,12 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) {
return
0
;
return
0
;
}
}
#if 0
void walUnrefVer(SWalRef *pRef) {
void walUnrefVer(SWalRef *pRef) {
pRef->refId = -1;
pRef->refId = -1;
pRef->refFile = -1;
pRef->refFile = -1;
}
}
#endif
SWalRef
*
walRefCommittedVer
(
SWal
*
pWal
)
{
SWalRef
*
walRefCommittedVer
(
SWal
*
pWal
)
{
SWalRef
*
pRef
=
walOpenRef
(
pWal
);
SWalRef
*
pRef
=
walOpenRef
(
pWal
);
...
...
source/libs/wal/src/walSeek.c
浏览文件 @
c57e9bae
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "tref.h"
#include "tref.h"
#include "walInt.h"
#include "walInt.h"
#if 0
static int64_t walSeekWritePos(SWal* pWal, int64_t ver) {
static int64_t walSeekWritePos(SWal* pWal, int64_t ver) {
int64_t code = 0;
int64_t code = 0;
...
@@ -47,6 +48,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) {
...
@@ -47,6 +48,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) {
}
}
return 0;
return 0;
}
}
#endif
int
walInitWriteFile
(
SWal
*
pWal
)
{
int
walInitWriteFile
(
SWal
*
pWal
)
{
TdFilePtr
pIdxTFile
,
pLogTFile
;
TdFilePtr
pIdxTFile
,
pLogTFile
;
...
@@ -134,6 +136,7 @@ int64_t walChangeWrite(SWal* pWal, int64_t ver) {
...
@@ -134,6 +136,7 @@ int64_t walChangeWrite(SWal* pWal, int64_t ver) {
return
fileFirstVer
;
return
fileFirstVer
;
}
}
#if 0
int walSeekWriteVer(SWal* pWal, int64_t ver) {
int walSeekWriteVer(SWal* pWal, int64_t ver) {
int64_t code;
int64_t code;
if (ver == pWal->vers.lastVer) {
if (ver == pWal->vers.lastVer) {
...
@@ -158,3 +161,4 @@ int walSeekWriteVer(SWal* pWal, int64_t ver) {
...
@@ -158,3 +161,4 @@ int walSeekWriteVer(SWal* pWal, int64_t ver) {
return 0;
return 0;
}
}
#endif
tests/system-test/0-others/show.py
浏览文件 @
c57e9bae
...
@@ -15,28 +15,30 @@
...
@@ -15,28 +15,30 @@
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
import
subprocess
from
util.common
import
*
from
util.common
import
*
from
util.sqlset
import
*
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
dbname
=
'db'
self
.
setsql
=
TDSetSql
()
self
.
ins_param_list
=
[
'dnodes'
,
'mnodes'
,
'qnodes'
,
'cluster'
,
'functions'
,
'users'
,
'grants'
,
'topics'
,
'subscriptions'
,
'streams'
]
self
.
ins_param_list
=
[
'dnodes'
,
'mnodes'
,
'qnodes'
,
'cluster'
,
'functions'
,
'users'
,
'grants'
,
'topics'
,
'subscriptions'
,
'streams'
]
self
.
perf_param
=
[
'apps'
,
'connections'
,
'consumers'
,
'queries'
,
'transactions'
]
self
.
perf_param
=
[
'apps'
,
'connections'
,
'consumers'
,
'queries'
,
'transactions'
]
self
.
perf_param_list
=
[
'apps'
,
'connections'
,
'consumers'
,
'queries'
,
'trans'
]
self
.
perf_param_list
=
[
'apps'
,
'connections'
,
'consumers'
,
'queries'
,
'trans'
]
def
ins_check
(
self
):
def
ins_check
(
self
):
tdSql
.
prepare
()
for
param
in
self
.
ins_param_list
:
for
param
in
self
.
ins_param_list
:
tdSql
.
query
(
f
'show
{
param
}
'
)
tdSql
.
query
(
f
'show
{
param
}
'
)
show_result
=
tdSql
.
queryResult
show_result
=
tdSql
.
queryResult
tdSql
.
query
(
f
'select * from information_schema.ins_
{
param
}
'
)
tdSql
.
query
(
f
'select * from information_schema.ins_
{
param
}
'
)
select_result
=
tdSql
.
queryResult
select_result
=
tdSql
.
queryResult
tdSql
.
checkEqual
(
show_result
,
select_result
)
tdSql
.
checkEqual
(
show_result
,
select_result
)
tdSql
.
execute
(
'drop database db'
)
def
perf_check
(
self
):
def
perf_check
(
self
):
tdSql
.
prepare
()
for
param
in
range
(
len
(
self
.
perf_param_list
)):
for
param
in
range
(
len
(
self
.
perf_param_list
)):
tdSql
.
query
(
f
'show
{
self
.
perf_param
[
param
]
}
'
)
tdSql
.
query
(
f
'show
{
self
.
perf_param
[
param
]
}
'
)
if
len
(
tdSql
.
queryResult
)
!=
0
:
if
len
(
tdSql
.
queryResult
)
!=
0
:
...
@@ -46,11 +48,74 @@ class TDTestCase:
...
@@ -46,11 +48,74 @@ class TDTestCase:
tdSql
.
checkEqual
(
show_result
,
select_result
)
tdSql
.
checkEqual
(
show_result
,
select_result
)
else
:
else
:
continue
continue
def
run
(
self
):
tdSql
.
execute
(
'drop database db'
)
def
set_stb_sql
(
self
,
stbname
,
column_dict
,
tag_dict
):
column_sql
=
''
tag_sql
=
''
for
k
,
v
in
column_dict
.
items
():
column_sql
+=
f
"
{
k
}
{
v
}
, "
for
k
,
v
in
tag_dict
.
items
():
tag_sql
+=
f
"
{
k
}
{
v
}
, "
create_stb_sql
=
f
'create stable
{
stbname
}
(
{
column_sql
[:
-
2
]
}
) tags (
{
tag_sql
[:
-
2
]
}
)'
return
create_stb_sql
def
show_sql
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
'use db'
)
stbname
=
f
'`
{
tdCom
.
getLongName
(
5
)
}
`'
tbname
=
f
'`
{
tdCom
.
getLongName
(
3
)
}
`'
column_dict
=
{
'`ts`'
:
'timestamp'
,
'`col1`'
:
'tinyint'
,
'`col2`'
:
'smallint'
,
'`col3`'
:
'int'
,
'`col4`'
:
'bigint'
,
'`col5`'
:
'tinyint unsigned'
,
'`col6`'
:
'smallint unsigned'
,
'`col7`'
:
'int unsigned'
,
'`col8`'
:
'bigint unsigned'
,
'`col9`'
:
'float'
,
'`col10`'
:
'double'
,
'`col11`'
:
'bool'
,
'`col12`'
:
'varchar(20)'
,
'`col13`'
:
'nchar(20)'
}
tag_dict
=
{
'`t1`'
:
'tinyint'
,
'`t2`'
:
'smallint'
,
'`t3`'
:
'int'
,
'`t4`'
:
'bigint'
,
'`t5`'
:
'tinyint unsigned'
,
'`t6`'
:
'smallint unsigned'
,
'`t7`'
:
'int unsigned'
,
'`t8`'
:
'bigint unsigned'
,
'`t9`'
:
'float'
,
'`t10`'
:
'double'
,
'`t11`'
:
'bool'
,
'`t12`'
:
'varchar(20)'
,
'`t13`'
:
'nchar(20)'
,
'`t14`'
:
'timestamp'
}
create_table_sql
=
self
.
set_stb_sql
(
stbname
,
column_dict
,
tag_dict
)
tdSql
.
execute
(
create_table_sql
)
tdSql
.
query
(
f
'show create table
{
stbname
}
'
)
query_result
=
tdSql
.
queryResult
tdSql
.
checkEqual
(
query_result
[
0
][
1
].
lower
(),
create_table_sql
)
tdSql
.
execute
(
f
'create table
{
tbname
}
using
{
stbname
}
tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)'
)
tag_sql
=
'('
for
tag_keys
in
tag_dict
.
keys
():
tag_sql
+=
f
'
{
tag_keys
}
, '
tags
=
f
'
{
tag_sql
[:
-
2
]
}
)'
sql
=
f
'create table
{
tbname
}
using
{
stbname
}
{
tags
}
tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)'
tdSql
.
query
(
f
'show create table
{
tbname
}
'
)
query_result
=
tdSql
.
queryResult
tdSql
.
checkEqual
(
query_result
[
0
][
1
].
lower
(),
sql
)
tdSql
.
execute
(
'drop database db'
)
def
run
(
self
):
self
.
ins_check
()
self
.
ins_check
()
self
.
perf_check
()
self
.
perf_check
()
self
.
show_sql
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
@@ -58,3 +123,4 @@ class TDTestCase:
...
@@ -58,3 +123,4 @@ class TDTestCase:
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/1-insert/tb_100w_data_order.py
0 → 100644
浏览文件 @
c57e9bae
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
ts
=
1537146000000
self
.
binary_str
=
'taosdata'
self
.
nchar_str
=
'涛思数据'
def
set_create_normaltable_sql
(
self
,
ntbname
,
column_dict
):
column_sql
=
''
for
k
,
v
in
column_dict
.
items
():
column_sql
+=
f
"
{
k
}
{
v
}
,"
create_ntb_sql
=
f
'create table
{
ntbname
}
(ts timestamp,
{
column_sql
[:
-
1
]
}
)'
return
create_ntb_sql
def
set_create_stable_sql
(
self
,
stbname
,
column_dict
,
tag_dict
):
column_sql
=
''
tag_sql
=
''
for
k
,
v
in
column_dict
.
items
():
column_sql
+=
f
"
{
k
}
{
v
}
,"
for
k
,
v
in
tag_dict
.
items
():
tag_sql
+=
f
"
{
k
}
{
v
}
,"
create_stb_sql
=
f
'create table
{
stbname
}
(ts timestamp,
{
column_sql
[:
-
1
]
}
) tags(
{
tag_sql
[:
-
1
]
}
)'
return
create_stb_sql
def
gen_batch_sql
(
self
,
ntbname
,
batch
=
10
):
values_str
=
""
for
i
in
range
(
batch
):
values_str
+=
f
'(
{
self
.
ts
}
, 1, 1, 1,
{
i
+
1
}
, 1, 1, 1,
{
i
+
1
}
,
{
i
+
0.1
}
,
{
i
+
0.1
}
,
{
i
%
2
}
,
{
i
+
1
}
,
{
i
+
1
}
),'
self
.
ts
+=
1
return
f
'insert into
{
ntbname
}
values
{
values_str
[:
-
1
]
}
;'
def
query_ntb_order_by_col
(
self
,
batch_num
,
rows_count
):
tdSql
.
prepare
()
ntbname
=
f
'db.
{
tdCom
.
getLongName
(
5
,
"letters"
)
}
'
column_dict
=
{
'col1'
:
'tinyint'
,
'col2'
:
'smallint'
,
'col3'
:
'int'
,
'col4'
:
'bigint'
,
'col5'
:
'tinyint unsigned'
,
'col6'
:
'smallint unsigned'
,
'col7'
:
'int unsigned'
,
'col8'
:
'bigint unsigned'
,
'col9'
:
'float'
,
'col10'
:
'double'
,
'col11'
:
'bool'
,
'col12'
:
'binary(20)'
,
'col13'
:
'nchar(20)'
}
range_times
=
int
(
rows_count
/
batch_num
)
create_ntb_sql
=
self
.
set_create_normaltable_sql
(
ntbname
,
column_dict
)
tdSql
.
execute
(
create_ntb_sql
)
for
i
in
range
(
range_times
):
tdSql
.
execute
(
self
.
gen_batch_sql
(
ntbname
,
batch_num
))
tdSql
.
query
(
f
'select count(*) from
{
ntbname
}
'
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
rows_count
)
tdSql
.
query
(
f
'select * from
{
ntbname
}
order by col1'
)
tdSql
.
execute
(
f
'flush database db'
)
def
run
(
self
):
self
.
query_ntb_order_by_col
(
batch_num
=
1000
,
rows_count
=
1000000
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/2-query/Timediff.py
浏览文件 @
c57e9bae
...
@@ -16,6 +16,7 @@ class TDTestCase:
...
@@ -16,6 +16,7 @@ class TDTestCase:
'2020-5-1 00:00:00.001002001'
'2020-5-1 00:00:00.001002001'
]
]
self
.
rest_tag
=
str
(
conn
).
lower
().
split
(
'.'
)[
0
].
replace
(
"<taos"
,
""
)
self
.
db_param_precision
=
[
'ms'
,
'us'
,
'ns'
]
self
.
db_param_precision
=
[
'ms'
,
'us'
,
'ns'
]
self
.
time_unit
=
[
'1w'
,
'1d'
,
'1h'
,
'1m'
,
'1s'
,
'1a'
,
'1u'
,
'1b'
]
self
.
time_unit
=
[
'1w'
,
'1d'
,
'1h'
,
'1m'
,
'1s'
,
'1a'
,
'1u'
,
'1b'
]
self
.
error_unit
=
[
'2w'
,
'2d'
,
'2h'
,
'2m'
,
'2s'
,
'2a'
,
'2u'
,
'1c'
,
'#1'
]
self
.
error_unit
=
[
'2w'
,
'2d'
,
'2h'
,
'2m'
,
'2s'
,
'2a'
,
'2u'
,
'1c'
,
'#1'
]
...
@@ -101,33 +102,34 @@ class TDTestCase:
...
@@ -101,33 +102,34 @@ class TDTestCase:
for
i
in
range
(
len
(
self
.
ts_str
)):
for
i
in
range
(
len
(
self
.
ts_str
)):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
])
-
self
.
subtractor
*
1000000
)))
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
])
-
self
.
subtractor
*
1000000
)))
elif
precision
.
lower
()
==
'ns'
:
elif
precision
.
lower
()
==
'ns'
:
self
.
check_tb_type
(
unit
,
tb_type
)
if
self
.
rest_tag
!=
'rest'
:
tdSql
.
checkRows
(
len
(
self
.
ts_str
))
self
.
check_tb_type
(
unit
,
tb_type
)
if
unit
.
lower
()
==
'1w'
:
tdSql
.
checkRows
(
len
(
self
.
ts_str
))
for
i
in
range
(
len
(
self
.
ts_str
)):
if
unit
.
lower
()
==
'1w'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
/
60
/
24
/
7
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1d'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
/
60
/
24
/
7
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1d'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
/
60
/
24
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1h'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
/
60
/
24
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1h'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
/
60
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1m'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
/
60
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1m'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1s'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)
/
60
))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1s'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1a'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000000
)
-
self
.
subtractor
)))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1a'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000
)
-
self
.
subtractor
*
1000
)))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1u'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000000
)
-
self
.
subtractor
*
1000
)))
for
i
in
range
(
len
(
self
.
ts_str
)):
elif
unit
.
lower
()
==
'1u'
:
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000
)
-
self
.
subtractor
*
1000000
)))
for
i
in
range
(
len
(
self
.
ts_str
)):
self
.
check_tbtype
(
tb_type
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
]
/
1000
)
-
self
.
subtractor
*
1000000
)))
tdSql
.
checkRows
(
len
(
self
.
ts_str
))
self
.
check_tbtype
(
tb_type
)
for
i
in
range
(
len
(
self
.
ts_str
)):
tdSql
.
checkRows
(
len
(
self
.
ts_str
))
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
])
-
self
.
subtractor
*
1000000000
)))
for
i
in
range
(
len
(
self
.
ts_str
)):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
])
-
self
.
subtractor
*
1000000000
)))
for
unit
in
self
.
error_unit
:
for
unit
in
self
.
error_unit
:
if
tb_type
.
lower
()
==
'ntb'
:
if
tb_type
.
lower
()
==
'ntb'
:
tdSql
.
error
(
f
'select timediff(ts,
{
self
.
subtractor
}
,
{
unit
}
) from
{
self
.
ntbname
}
'
)
tdSql
.
error
(
f
'select timediff(ts,
{
self
.
subtractor
}
,
{
unit
}
) from
{
self
.
ntbname
}
'
)
...
@@ -162,10 +164,35 @@ class TDTestCase:
...
@@ -162,10 +164,35 @@ class TDTestCase:
date_time
=
self
.
get_time
.
time_transform
(
self
.
ts_str
,
precision
)
date_time
=
self
.
get_time
.
time_transform
(
self
.
ts_str
,
precision
)
self
.
data_check
(
date_time
,
precision
,
'ctb'
)
self
.
data_check
(
date_time
,
precision
,
'ctb'
)
self
.
data_check
(
date_time
,
precision
,
'stb'
)
self
.
data_check
(
date_time
,
precision
,
'stb'
)
def
run
(
self
):
# sourcery skip: extract-duplicate-method
def
function_without_param
(
self
):
for
precision
in
self
.
db_param_precision
:
tdSql
.
execute
(
f
'drop database if exists
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'create database
{
self
.
dbname
}
precision "
{
precision
}
"'
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'create table
{
self
.
stbname
}
(ts timestamp,c0 int) tags(t0 int)'
)
tdSql
.
execute
(
f
'create table
{
self
.
ctbname
}
using
{
self
.
stbname
}
tags(1)'
)
for
ts
in
self
.
ts_str
:
tdSql
.
execute
(
f
'insert into
{
self
.
ctbname
}
values("
{
ts
}
",1)'
)
date_time
=
self
.
get_time
.
time_transform
(
self
.
ts_str
,
precision
)
tdSql
.
query
(
f
'select timediff(ts,
{
self
.
subtractor
}
) from
{
self
.
ctbname
}
'
)
if
precision
.
lower
()
==
'ms'
:
for
i
in
range
(
len
(
self
.
ts_str
)):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
])
-
self
.
subtractor
*
1000
)))
elif
precision
.
lower
()
==
'us'
:
for
i
in
range
(
len
(
self
.
ts_str
)):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
])
-
self
.
subtractor
*
1000000
)))
elif
precision
.
lower
()
==
'ns'
:
for
i
in
range
(
len
(
self
.
ts_str
)):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
int
(((
date_time
[
i
])
-
self
.
subtractor
*
1000000000
)))
def
run
(
self
):
# sourcery skip: extract-duplicate-method
self
.
function_check_ntb
()
self
.
function_check_ntb
()
self
.
function_check_stb
()
self
.
function_check_stb
()
self
.
function_without_param
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/avg.py
浏览文件 @
c57e9bae
import
taos
import
taos
import
sys
import
sys
import
datetime
import
numpy
as
np
import
inspect
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sqlset
import
TDSetSql
from
util.common
import
*
class
TDTestCase
:
class
TDTestCase
:
# updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
# updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
# "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
# "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
...
@@ -14,6 +13,51 @@ class TDTestCase:
...
@@ -14,6 +13,51 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
(),
False
)
tdSql
.
init
(
conn
.
cursor
(),
False
)
self
.
setsql
=
TDSetSql
()
self
.
column_dict
=
{
'ts'
:
'timestamp'
,
'col1'
:
'tinyint'
,
'col2'
:
'smallint'
,
'col3'
:
'int'
,
'col4'
:
'bigint'
,
'col5'
:
'tinyint unsigned'
,
'col6'
:
'smallint unsigned'
,
'col7'
:
'int unsigned'
,
'col8'
:
'bigint unsigned'
,
}
self
.
dbname
=
tdCom
.
getLongName
(
3
,
"letters"
)
self
.
row_num
=
10
self
.
ts
=
1537146000000
def
insert_data
(
self
,
column_dict
,
tbname
,
row_num
):
insert_sql
=
self
.
setsql
.
set_insertsql
(
column_dict
,
tbname
)
for
i
in
range
(
row_num
):
insert_list
=
[]
self
.
setsql
.
insert_values
(
column_dict
,
i
,
insert_sql
,
insert_list
,
self
.
ts
)
def
avg_check_unsigned
(
self
):
stbname
=
f
'
{
self
.
dbname
}
.
{
tdCom
.
getLongName
(
5
,
"letters"
)
}
'
tag_dict
=
{
't0'
:
'int'
}
tag_values
=
[
f
'1'
]
tdSql
.
execute
(
f
"create database if not exists
{
self
.
dbname
}
"
)
tdSql
.
execute
(
self
.
setsql
.
set_create_stable_sql
(
stbname
,
self
.
column_dict
,
tag_dict
))
tdSql
.
execute
(
f
"create table
{
stbname
}
_1 using
{
stbname
}
tags(
{
tag_values
[
0
]
}
)"
)
self
.
insert_data
(
self
.
column_dict
,
f
'
{
stbname
}
_1'
,
self
.
row_num
)
for
col
in
self
.
column_dict
.
keys
():
col_val_list
=
[]
if
col
.
lower
()
!=
'ts'
:
tdSql
.
query
(
f
'select
{
col
}
from
{
stbname
}
_1'
)
sum_val
=
0
for
col_val
in
tdSql
.
queryResult
:
col_val_list
.
append
(
col_val
[
0
])
col_avg
=
np
.
mean
(
col_val_list
)
tdSql
.
query
(
f
'select avg(
{
col
}
) from
{
stbname
}
_1'
)
tdSql
.
checkEqual
(
col_avg
,
tdSql
.
queryResult
[
0
][
0
])
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
prepare_datas
(
self
,
dbname
=
"db"
):
def
prepare_datas
(
self
,
dbname
=
"db"
):
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -412,6 +456,7 @@ class TDTestCase:
...
@@ -412,6 +456,7 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step6: avg filter query ============"
)
tdLog
.
printNoPrefix
(
"==========step6: avg filter query ============"
)
self
.
avg_func_filter
()
self
.
avg_func_filter
()
self
.
avg_check_unsigned
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/stddev.py
0 → 100644
浏览文件 @
c57e9bae
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
random
import
string
import
numpy
as
np
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
from
util.sqlset
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
dbname
=
'db_test'
self
.
setsql
=
TDSetSql
()
self
.
ntbname
=
f
'
{
self
.
dbname
}
.ntb'
self
.
row_num
=
10
self
.
ts
=
1537146000000
self
.
column_dict
=
{
'ts'
:
'timestamp'
,
'col1'
:
'tinyint'
,
'col2'
:
'smallint'
,
'col3'
:
'int'
,
'col4'
:
'bigint'
,
'col5'
:
'tinyint unsigned'
,
'col6'
:
'smallint unsigned'
,
'col7'
:
'int unsigned'
,
'col8'
:
'bigint unsigned'
,
}
def
insert_data
(
self
,
column_dict
,
tbname
,
row_num
):
insert_sql
=
self
.
setsql
.
set_insertsql
(
column_dict
,
tbname
)
for
i
in
range
(
row_num
):
insert_list
=
[]
self
.
setsql
.
insert_values
(
column_dict
,
i
,
insert_sql
,
insert_list
,
self
.
ts
)
def
stddev_check
(
self
):
stbname
=
f
'
{
self
.
dbname
}
.
{
tdCom
.
getLongName
(
5
,
"letters"
)
}
'
tag_dict
=
{
't0'
:
'int'
}
tag_values
=
[
f
'1'
]
tdSql
.
execute
(
f
"create database if not exists
{
self
.
dbname
}
"
)
tdSql
.
execute
(
self
.
setsql
.
set_create_stable_sql
(
stbname
,
self
.
column_dict
,
tag_dict
))
tdSql
.
execute
(
f
"create table
{
stbname
}
_1 using
{
stbname
}
tags(
{
tag_values
[
0
]
}
)"
)
self
.
insert_data
(
self
.
column_dict
,
f
'
{
stbname
}
_1'
,
self
.
row_num
)
for
col
in
self
.
column_dict
.
keys
():
col_val_list
=
[]
if
col
.
lower
()
!=
'ts'
:
tdSql
.
query
(
f
'select
{
col
}
from
{
stbname
}
_1'
)
for
col_val
in
tdSql
.
queryResult
:
col_val_list
.
append
(
col_val
[
0
])
col_std
=
np
.
std
(
col_val_list
)
tdSql
.
query
(
f
'select stddev(
{
col
}
) from
{
stbname
}
_1'
)
tdSql
.
checkEqual
(
col_std
,
tdSql
.
queryResult
[
0
][
0
])
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
run
(
self
):
self
.
stddev_check
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tests/system-test/2-query/timetruncate.py
浏览文件 @
c57e9bae
...
@@ -180,7 +180,8 @@ class TDTestCase:
...
@@ -180,7 +180,8 @@ class TDTestCase:
date_time
=
self
.
get_time
.
time_transform
(
self
.
ts_str
,
precision
)
date_time
=
self
.
get_time
.
time_transform
(
self
.
ts_str
,
precision
)
self
.
data_check
(
date_time
,
precision
,
'ctb'
)
self
.
data_check
(
date_time
,
precision
,
'ctb'
)
self
.
data_check
(
date_time
,
precision
,
'stb'
)
self
.
data_check
(
date_time
,
precision
,
'stb'
)
def
run
(
self
):
def
run
(
self
):
self
.
function_check_ntb
()
self
.
function_check_ntb
()
self
.
function_check_stb
()
self
.
function_check_stb
()
...
...
tests/system-test/7-tmq/tmqConsFromTsdb1.py
浏览文件 @
c57e9bae
...
@@ -86,7 +86,7 @@ class TDTestCase:
...
@@ -86,7 +86,7 @@ class TDTestCase:
'rowsPerTbl'
:
10000
,
'rowsPerTbl'
:
10000
,
'batchNum'
:
10
,
'batchNum'
:
10
,
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'pollDelay'
:
1
5
,
'pollDelay'
:
2
5
,
'showMsg'
:
1
,
'showMsg'
:
1
,
'showRow'
:
1
,
'showRow'
:
1
,
'snapshot'
:
1
}
'snapshot'
:
1
}
...
@@ -157,7 +157,7 @@ class TDTestCase:
...
@@ -157,7 +157,7 @@ class TDTestCase:
'rowsPerTbl'
:
10000
,
'rowsPerTbl'
:
10000
,
'batchNum'
:
10
,
'batchNum'
:
10
,
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'pollDelay'
:
10
,
'pollDelay'
:
25
,
'showMsg'
:
1
,
'showMsg'
:
1
,
'showRow'
:
1
,
'showRow'
:
1
,
'snapshot'
:
1
}
'snapshot'
:
1
}
...
...
tests/system-test/fulltest.sh
浏览文件 @
c57e9bae
...
@@ -207,6 +207,7 @@ python3 ./test.py -f 2-query/varchar.py -R
...
@@ -207,6 +207,7 @@ python3 ./test.py -f 2-query/varchar.py -R
python3 ./test.py
-f
1-insert/update_data.py
python3 ./test.py
-f
1-insert/update_data.py
python3 ./test.py
-f
1-insert/tb_100w_data_order.py
python3 ./test.py
-f
1-insert/delete_data.py
python3 ./test.py
-f
1-insert/delete_data.py
python3 ./test.py
-f
1-insert/keep_expired.py
python3 ./test.py
-f
1-insert/keep_expired.py
...
...
tools/CMakeLists.txt
浏览文件 @
c57e9bae
...
@@ -3,49 +3,29 @@ IF (TD_WEBSOCKET)
...
@@ -3,49 +3,29 @@ IF (TD_WEBSOCKET)
SET
(
websocket_lib_file
"libtaosws.so"
)
SET
(
websocket_lib_file
"libtaosws.so"
)
ELSEIF
(
TD_DARWIN
)
ELSEIF
(
TD_DARWIN
)
SET
(
websocket_lib_file
"libtaosws.dylib"
)
SET
(
websocket_lib_file
"libtaosws.dylib"
)
ELSEIF
(
TD_WINDOWS
)
SET
(
websocket_lib_file
"{taosws.dll,taosws.dll.lib}"
)
ENDIF
()
ENDIF
()
MESSAGE
(
"
${
Green
}
use libtaos-ws
${
ColourReset
}
"
)
MESSAGE
(
"
${
Green
}
use libtaos-ws
${
ColourReset
}
"
)
IF
(
EXISTS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/taosws-rs/target/release/
${
websocket_lib_file
}
"
OR
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/taosws-rs/target/release/
${
websocket_lib_file
}
"
IS_NEWER_THAN
"
${
CMAKE_SOURCE_DIR
}
/.git/modules/tools/taosws-rs/FETCH_HEAD"
)
include
(
ExternalProject
)
include
(
ExternalProject
)
ExternalProject_Add
(
taosws-rs
ExternalProject_Add
(
taosws-rs
PREFIX
"taosws-rs"
PREFIX
"taosws-rs"
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/taosws-rs
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/taosws-rs
BUILD_ALWAYS off
BUILD_ALWAYS on
DEPENDS taos
DEPENDS taos
BUILD_IN_SOURCE 1
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND cmake -E echo
"taosws-rs no need cmake to config"
CONFIGURE_COMMAND cmake -E echo
"taosws-rs no need cmake to config"
PATCH_COMMAND
PATCH_COMMAND
COMMAND git clean -f -d
COMMAND git clean -f -d
BUILD_COMMAND
BUILD_COMMAND
COMMAND cargo update
COMMAND cargo update
COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored
COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored
COMMAND ./taos-ws-sys/ci/package.sh
INSTALL_COMMAND
INSTALL_COMMAND
COMMAND cp target/release/
${
websocket_lib_file
}
${
CMAKE_BINARY_DIR
}
/build/lib
COMMAND cmake -E copy target/libtaosws/
${
websocket_lib_file
}
${
CMAKE_BINARY_DIR
}
/build/lib
COMMAND cmake -E make_directory
${
CMAKE_BINARY_DIR
}
/build/include
COMMAND cmake -E make_directory
${
CMAKE_BINARY_DIR
}
/build/include
COMMAND cmake -E copy target/release/taosws.h
${
CMAKE_BINARY_DIR
}
/build/include
COMMAND cmake -E copy target/libtaosws/taosws.h
${
CMAKE_BINARY_DIR
}
/build/include
)
)
ELSE
()
include
(
ExternalProject
)
ExternalProject_Add
(
taosws-rs
PREFIX
"taosws-rs"
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/taosws-rs
BUILD_ALWAYS on
DEPENDS taos
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND cmake -E echo
"taosws-rs no need cmake to config"
PATCH_COMMAND
COMMAND git clean -f -d
BUILD_COMMAND
COMMAND cargo update
COMMAND cargo build --release -p taos-ws-sys --features native-tls-vendored
COMMAND ./taos-ws-sys/ci/package.sh
INSTALL_COMMAND
COMMAND cmake -E copy target/libtaosws/
${
websocket_lib_file
}
${
CMAKE_BINARY_DIR
}
/build/lib
COMMAND cmake -E make_directory
${
CMAKE_BINARY_DIR
}
/build/include
COMMAND cmake -E copy target/libtaosws/taosws.h
${
CMAKE_BINARY_DIR
}
/build/include
)
ENDIF
()
ENDIF
()
ENDIF
()
IF
(
TD_TAOS_TOOLS
)
IF
(
TD_TAOS_TOOLS
)
...
...
tools/shell/CMakeLists.txt
浏览文件 @
c57e9bae
...
@@ -10,6 +10,10 @@ ELSEIF (TD_DARWIN AND TD_WEBSOCKET)
...
@@ -10,6 +10,10 @@ ELSEIF (TD_DARWIN AND TD_WEBSOCKET)
ADD_DEFINITIONS
(
-DWEBSOCKET -I
${
CMAKE_BINARY_DIR
}
/build/include
)
ADD_DEFINITIONS
(
-DWEBSOCKET -I
${
CMAKE_BINARY_DIR
}
/build/include
)
SET
(
LINK_WEBSOCKET
"
${
CMAKE_BINARY_DIR
}
/build/lib/libtaosws.dylib"
)
SET
(
LINK_WEBSOCKET
"
${
CMAKE_BINARY_DIR
}
/build/lib/libtaosws.dylib"
)
ADD_DEPENDENCIES
(
shell taosws-rs
)
ADD_DEPENDENCIES
(
shell taosws-rs
)
ELSEIF
(
TD_WINDOWS AND TD_WEBSOCKET
)
ADD_DEFINITIONS
(
-DWEBSOCKET -I
${
CMAKE_BINARY_DIR
}
/build/include
)
SET
(
LINK_WEBSOCKET
"
${
CMAKE_BINARY_DIR
}
/build/lib/taosws.dll.lib"
)
ADD_DEPENDENCIES
(
shell taosws-rs
)
ELSE
()
ELSE
()
SET
(
LINK_WEBSOCKET
""
)
SET
(
LINK_WEBSOCKET
""
)
ENDIF
()
ENDIF
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录