Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5bda367f
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看板
提交
5bda367f
编写于
6月 09, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into fix/dnode
上级
e65dc65e
7ed9da56
变更
65
显示空白变更内容
内联
并排
Showing
65 changed file
with
1078 addition
and
448 deletion
+1078
-448
include/common/tmsg.h
include/common/tmsg.h
+1
-0
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+3
-1
include/libs/function/function.h
include/libs/function/function.h
+1
-0
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+2
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+1
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+34
-19
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+54
-2
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+4
-7
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+19
-5
source/common/src/tmsg.c
source/common/src/tmsg.c
+9
-0
source/common/test/dataformatTest.cpp
source/common/test/dataformatTest.cpp
+41
-43
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+3
-5
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+7
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+3
-3
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+89
-12
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+3
-1
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+18
-0
source/libs/command/inc/commandInt.h
source/libs/command/inc/commandInt.h
+5
-1
source/libs/command/src/explain.c
source/libs/command/src/explain.c
+155
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+3
-3
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+20
-13
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+27
-5
source/libs/function/inc/builtinsimpl.h
source/libs/function/inc/builtinsimpl.h
+5
-0
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+50
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+118
-2
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+1
-0
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+1
-1
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+3
-1
source/os/src/osFile.c
source/os/src/osFile.c
+16
-19
source/os/src/osTime.c
source/os/src/osTime.c
+190
-243
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+3
-0
tests/script/tsim/stream/session0.sim
tests/script/tsim/stream/session0.sim
+104
-1
tests/system-test/0-others/taosdlog.py
tests/system-test/0-others/taosdlog.py
+1
-1
tests/system-test/0-others/udf_cluster.py
tests/system-test/0-others/udf_cluster.py
+1
-1
tests/system-test/0-others/udf_create.py
tests/system-test/0-others/udf_create.py
+13
-11
tests/system-test/0-others/user_control.py
tests/system-test/0-others/user_control.py
+2
-1
tests/system-test/1-insert/insertWithMoreVgroup.py
tests/system-test/1-insert/insertWithMoreVgroup.py
+1
-1
tests/system-test/1-insert/mutipythonnodebugtaosd.py
tests/system-test/1-insert/mutipythonnodebugtaosd.py
+1
-1
tests/system-test/1-insert/test_stmt_insert_query_ex.py
tests/system-test/1-insert/test_stmt_insert_query_ex.py
+1
-1
tests/system-test/1-insert/test_stmt_muti_insert_query.py
tests/system-test/1-insert/test_stmt_muti_insert_query.py
+1
-1
tests/system-test/1-insert/test_stmt_set_tbname_tag.py
tests/system-test/1-insert/test_stmt_set_tbname_tag.py
+1
-1
tests/system-test/2-query/histogram.py
tests/system-test/2-query/histogram.py
+1
-1
tests/system-test/2-query/timezone.py
tests/system-test/2-query/timezone.py
+16
-9
tests/system-test/7-tmq/basic5.py
tests/system-test/7-tmq/basic5.py
+19
-4
tests/system-test/7-tmq/db.py
tests/system-test/7-tmq/db.py
+1
-1
tests/system-test/7-tmq/schema.py
tests/system-test/7-tmq/schema.py
+1
-1
tests/system-test/7-tmq/subscribeDb.py
tests/system-test/7-tmq/subscribeDb.py
+1
-1
tests/system-test/7-tmq/subscribeDb0.py
tests/system-test/7-tmq/subscribeDb0.py
+1
-1
tests/system-test/7-tmq/subscribeDb1.py
tests/system-test/7-tmq/subscribeDb1.py
+1
-1
tests/system-test/7-tmq/subscribeStb.py
tests/system-test/7-tmq/subscribeStb.py
+1
-1
tests/system-test/7-tmq/subscribeStb0.py
tests/system-test/7-tmq/subscribeStb0.py
+1
-1
tests/system-test/7-tmq/subscribeStb1.py
tests/system-test/7-tmq/subscribeStb1.py
+1
-1
tests/system-test/7-tmq/subscribeStb2.py
tests/system-test/7-tmq/subscribeStb2.py
+1
-1
tests/system-test/7-tmq/subscribeStb3.py
tests/system-test/7-tmq/subscribeStb3.py
+1
-1
tests/system-test/7-tmq/subscribeStb4.py
tests/system-test/7-tmq/subscribeStb4.py
+1
-1
tests/system-test/7-tmq/tmqDnode.py
tests/system-test/7-tmq/tmqDnode.py
+1
-1
tests/system-test/7-tmq/tmqModule.py
tests/system-test/7-tmq/tmqModule.py
+1
-1
tests/system-test/99-TDcase/TD-15517.py
tests/system-test/99-TDcase/TD-15517.py
+1
-1
tests/system-test/99-TDcase/TD-15554.py
tests/system-test/99-TDcase/TD-15554.py
+1
-1
tests/system-test/99-TDcase/TD-15557.py
tests/system-test/99-TDcase/TD-15557.py
+1
-1
tests/system-test/99-TDcase/TD-15563.py
tests/system-test/99-TDcase/TD-15563.py
+1
-1
tests/system-test/99-TDcase/TD-16025.py
tests/system-test/99-TDcase/TD-16025.py
+1
-1
tests/system-test/fulltest.bat
tests/system-test/fulltest.bat
+2
-2
tests/system-test/test.py
tests/system-test/test.py
+6
-5
未找到文件。
include/common/tmsg.h
浏览文件 @
5bda367f
...
@@ -2510,6 +2510,7 @@ typedef struct {
...
@@ -2510,6 +2510,7 @@ typedef struct {
int32_t
tSerializeSTableIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
STableIndexRsp
*
pRsp
);
int32_t
tSerializeSTableIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
STableIndexRsp
*
pRsp
);
int32_t
tDeserializeSTableIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
STableIndexRsp
*
pRsp
);
int32_t
tDeserializeSTableIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
STableIndexRsp
*
pRsp
);
void
tFreeSTableIndexInfo
(
void
*
pInfo
);
typedef
struct
{
typedef
struct
{
...
...
include/libs/catalog/catalog.h
浏览文件 @
5bda367f
...
@@ -67,6 +67,7 @@ typedef struct SCatalogReq {
...
@@ -67,6 +67,7 @@ typedef struct SCatalogReq {
SArray
*
pUdf
;
// element is udf name
SArray
*
pUdf
;
// element is udf name
SArray
*
pIndex
;
// element is index name
SArray
*
pIndex
;
// element is index name
SArray
*
pUser
;
// element is SUserAuthInfo
SArray
*
pUser
;
// element is SUserAuthInfo
SArray
*
pTableIndex
;
// element is SNAME
bool
qNodeRequired
;
// valid qnode
bool
qNodeRequired
;
// valid qnode
bool
forceUpdate
;
bool
forceUpdate
;
}
SCatalogReq
;
}
SCatalogReq
;
...
@@ -82,6 +83,7 @@ typedef struct SMetaData {
...
@@ -82,6 +83,7 @@ typedef struct SMetaData {
SArray
*
pDbInfo
;
// pRes = SDbInfo*
SArray
*
pDbInfo
;
// pRes = SDbInfo*
SArray
*
pTableMeta
;
// pRes = STableMeta*
SArray
*
pTableMeta
;
// pRes = STableMeta*
SArray
*
pTableHash
;
// pRes = SVgroupInfo*
SArray
*
pTableHash
;
// pRes = SVgroupInfo*
SArray
*
pTableIndex
;
// pRes = SArray<STableIndexInfo>*
SArray
*
pUdfList
;
// pRes = SFuncInfo*
SArray
*
pUdfList
;
// pRes = SFuncInfo*
SArray
*
pIndex
;
// pRes = SIndexInfo*
SArray
*
pIndex
;
// pRes = SIndexInfo*
SArray
*
pUser
;
// pRes = bool*
SArray
*
pUser
;
// pRes = bool*
...
@@ -277,7 +279,7 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
...
@@ -277,7 +279,7 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
int32_t
catalogGetIndexMeta
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
pInfo
);
int32_t
catalogGetIndexMeta
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
pInfo
);
int32_t
catalogGetTableIndex
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
const
char
*
tbF
Name
,
SArray
**
pRes
);
int32_t
catalogGetTableIndex
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTable
Name
,
SArray
**
pRes
);
int32_t
catalogGetUdfInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
funcName
,
SFuncInfo
*
pInfo
);
int32_t
catalogGetUdfInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
funcName
,
SFuncInfo
*
pInfo
);
...
...
include/libs/function/function.h
浏览文件 @
5bda367f
...
@@ -146,6 +146,7 @@ typedef struct SqlFunctionCtx {
...
@@ -146,6 +146,7 @@ typedef struct SqlFunctionCtx {
struct
SDiskbasedBuf
*
pBuf
;
struct
SDiskbasedBuf
*
pBuf
;
struct
SSDataBlock
*
pSrcBlock
;
struct
SSDataBlock
*
pSrcBlock
;
int32_t
curBufPage
;
int32_t
curBufPage
;
bool
increase
;
char
udfName
[
TSDB_FUNC_NAME_LEN
];
char
udfName
[
TSDB_FUNC_NAME_LEN
];
}
SqlFunctionCtx
;
}
SqlFunctionCtx
;
...
...
include/libs/function/functionMgt.h
浏览文件 @
5bda367f
...
@@ -129,6 +129,8 @@ typedef enum EFunctionType {
...
@@ -129,6 +129,8 @@ typedef enum EFunctionType {
FUNCTION_TYPE_SPREAD_MERGE
,
FUNCTION_TYPE_SPREAD_MERGE
,
FUNCTION_TYPE_HISTOGRAM_PARTIAL
,
FUNCTION_TYPE_HISTOGRAM_PARTIAL
,
FUNCTION_TYPE_HISTOGRAM_MERGE
,
FUNCTION_TYPE_HISTOGRAM_MERGE
,
FUNCTION_TYPE_HYPERLOGLOG_PARTIAL
,
FUNCTION_TYPE_HYPERLOGLOG_MERGE
,
// user defined funcion
// user defined funcion
FUNCTION_TYPE_UDF
=
10000
FUNCTION_TYPE_UDF
=
10000
...
...
include/libs/nodes/plannodes.h
浏览文件 @
5bda367f
...
@@ -304,6 +304,7 @@ typedef struct SDownstreamSourceNode {
...
@@ -304,6 +304,7 @@ typedef struct SDownstreamSourceNode {
typedef
struct
SExchangePhysiNode
{
typedef
struct
SExchangePhysiNode
{
SPhysiNode
node
;
SPhysiNode
node
;
int32_t
srcGroupId
;
// group id of datasource suplans
int32_t
srcGroupId
;
// group id of datasource suplans
bool
singleChannel
;
SNodeList
*
pSrcEndPoints
;
// element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode
SNodeList
*
pSrcEndPoints
;
// element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode
}
SExchangePhysiNode
;
}
SExchangePhysiNode
;
...
...
source/client/src/clientSml.c
浏览文件 @
5bda367f
...
@@ -303,7 +303,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
...
@@ -303,7 +303,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
}
}
taos_free_result
(
res2
);
taos_free_result
(
res2
);
taosMsleep
(
50
0
);
taosMsleep
(
1
0
);
}
}
break
;
break
;
}
}
...
@@ -327,7 +327,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
...
@@ -327,7 +327,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
}
}
taos_free_result
(
res2
);
taos_free_result
(
res2
);
taosMsleep
(
50
0
);
taosMsleep
(
1
0
);
}
}
break
;
break
;
}
}
...
@@ -350,7 +350,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
...
@@ -350,7 +350,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
}
}
taos_free_result
(
res2
);
taos_free_result
(
res2
);
taosMsleep
(
50
0
);
taosMsleep
(
1
0
);
}
}
break
;
break
;
}
}
...
@@ -373,7 +373,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
...
@@ -373,7 +373,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
}
}
taos_free_result
(
res2
);
taos_free_result
(
res2
);
taosMsleep
(
50
0
);
taosMsleep
(
1
0
);
}
}
break
;
break
;
}
}
...
@@ -424,7 +424,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
...
@@ -424,7 +424,7 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) {
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. reset query cache. error: %s"
,
info
->
id
,
taos_errstr
(
res2
));
}
}
taos_free_result
(
res2
);
taos_free_result
(
res2
);
taosMsleep
(
50
0
);
taosMsleep
(
1
0
);
}
}
break
;
break
;
}
}
...
@@ -461,18 +461,18 @@ static int32_t smlProcessSchemaAction(SSmlHandle* info, SSchema* schemaField, SH
...
@@ -461,18 +461,18 @@ static int32_t smlProcessSchemaAction(SSmlHandle* info, SSchema* schemaField, SH
static
int32_t
smlModifyDBSchemas
(
SSmlHandle
*
info
)
{
static
int32_t
smlModifyDBSchemas
(
SSmlHandle
*
info
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
SEpSet
ep
=
getEpSet_s
(
&
info
->
taos
->
pAppInfo
->
mgmtEp
);
SName
pName
=
{
TSDB_TABLE_NAME_T
,
info
->
taos
->
acctId
,
{
0
},
{
0
}};
strcpy
(
pName
.
dbname
,
info
->
pRequest
->
pDb
);
SSmlSTableMeta
**
tableMetaSml
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
NULL
);
SSmlSTableMeta
**
tableMetaSml
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
NULL
);
while
(
tableMetaSml
)
{
while
(
tableMetaSml
)
{
SSmlSTableMeta
*
sTableData
=
*
tableMetaSml
;
SSmlSTableMeta
*
sTableData
=
*
tableMetaSml
;
STableMeta
*
pTableMeta
=
NULL
;
STableMeta
*
pTableMeta
=
NULL
;
SEpSet
ep
=
getEpSet_s
(
&
info
->
taos
->
pAppInfo
->
mgmtEp
);
size_t
superTableLen
=
0
;
size_t
superTableLen
=
0
;
void
*
superTable
=
taosHashGetKey
(
tableMetaSml
,
&
superTableLen
);
void
*
superTable
=
taosHashGetKey
(
tableMetaSml
,
&
superTableLen
);
SName
pName
=
{
TSDB_TABLE_NAME_T
,
info
->
taos
->
acctId
,
{
0
},
{
0
}};
memset
(
pName
.
tname
,
0
,
TSDB_TABLE_NAME_LEN
);
strcpy
(
pName
.
dbname
,
info
->
pRequest
->
pDb
);
memcpy
(
pName
.
tname
,
superTable
,
superTableLen
);
memcpy
(
pName
.
tname
,
superTable
,
superTableLen
);
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
&
pTableMeta
);
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
&
pTableMeta
);
...
@@ -487,7 +487,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
...
@@ -487,7 +487,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
code
=
smlApplySchemaAction
(
info
,
&
schemaAction
);
code
=
smlApplySchemaAction
(
info
,
&
schemaAction
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlApplySchemaAction failed. can not create %s"
,
info
->
id
,
schemaAction
.
createSTable
.
sTableName
);
uError
(
"SML:0x%"
PRIx64
" smlApplySchemaAction failed. can not create %s"
,
info
->
id
,
schemaAction
.
createSTable
.
sTableName
);
return
code
;
goto
end
;
}
}
info
->
cost
.
numOfCreateSTables
++
;
info
->
cost
.
numOfCreateSTables
++
;
}
else
if
(
code
==
TSDB_CODE_SUCCESS
)
{
}
else
if
(
code
==
TSDB_CODE_SUCCESS
)
{
...
@@ -502,7 +502,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
...
@@ -502,7 +502,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
code
=
smlProcessSchemaAction
(
info
,
pTableMeta
->
schema
,
hashTmp
,
sTableData
->
tags
,
&
schemaAction
,
true
);
code
=
smlProcessSchemaAction
(
info
,
pTableMeta
->
schema
,
hashTmp
,
sTableData
->
tags
,
&
schemaAction
,
true
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosHashCleanup
(
hashTmp
);
taosHashCleanup
(
hashTmp
);
return
code
;
goto
end
;
}
}
taosHashClear
(
hashTmp
);
taosHashClear
(
hashTmp
);
...
@@ -512,29 +512,33 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
...
@@ -512,29 +512,33 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
code
=
smlProcessSchemaAction
(
info
,
pTableMeta
->
schema
,
hashTmp
,
sTableData
->
cols
,
&
schemaAction
,
false
);
code
=
smlProcessSchemaAction
(
info
,
pTableMeta
->
schema
,
hashTmp
,
sTableData
->
cols
,
&
schemaAction
,
false
);
taosHashCleanup
(
hashTmp
);
taosHashCleanup
(
hashTmp
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
goto
end
;
}
}
code
=
catalogRefreshTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
-
1
);
code
=
catalogRefreshTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
goto
end
;
}
}
}
else
{
}
else
{
uError
(
"SML:0x%"
PRIx64
" load table meta error: %s"
,
info
->
id
,
tstrerror
(
code
));
uError
(
"SML:0x%"
PRIx64
" load table meta error: %s"
,
info
->
id
,
tstrerror
(
code
));
return
code
;
goto
end
;
}
}
if
(
pTableMeta
)
taosMemoryFree
(
pTableMeta
);
if
(
pTableMeta
)
taosMemoryFree
(
pTableMeta
);
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
&
pTableMeta
);
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
&
pTableMeta
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" catalogGetSTableMeta failed. super table name %s"
,
info
->
id
,
(
char
*
)
superTable
);
uError
(
"SML:0x%"
PRIx64
" catalogGetSTableMeta failed. super table name %s"
,
info
->
id
,
(
char
*
)
superTable
);
return
code
;
goto
end
;
}
}
sTableData
->
tableMeta
=
pTableMeta
;
sTableData
->
tableMeta
=
pTableMeta
;
tableMetaSml
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
tableMetaSml
);
tableMetaSml
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
tableMetaSml
);
}
}
return
0
;
return
0
;
end:
catalogRefreshTableMeta
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pName
,
1
);
return
code
;
}
}
//=========================================================================
//=========================================================================
...
@@ -1544,7 +1548,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
...
@@ -1544,7 +1548,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
}
}
size_t
typeLen
=
strlen
(
type
->
valuestring
);
size_t
typeLen
=
strlen
(
type
->
valuestring
);
if
(
typeLen
==
1
&&
type
->
valuestring
[
0
]
==
's'
)
{
if
(
typeLen
==
1
&&
(
type
->
valuestring
[
0
]
==
's'
||
type
->
valuestring
[
0
]
==
'S'
)
)
{
//seconds
//seconds
timeDouble
=
timeDouble
*
1e9
;
timeDouble
=
timeDouble
*
1e9
;
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
...
@@ -1552,9 +1556,10 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
...
@@ -1552,9 +1556,10 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
return
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
}
}
*
tsVal
=
timeDouble
;
*
tsVal
=
timeDouble
;
}
else
if
(
typeLen
==
2
&&
type
->
valuestring
[
1
]
==
's'
)
{
}
else
if
(
typeLen
==
2
&&
(
type
->
valuestring
[
1
]
==
's'
||
type
->
valuestring
[
1
]
==
'S'
)
)
{
switch
(
type
->
valuestring
[
0
])
{
switch
(
type
->
valuestring
[
0
])
{
case
'm'
:
case
'm'
:
case
'M'
:
//milliseconds
//milliseconds
timeDouble
=
timeDouble
*
1e6
;
timeDouble
=
timeDouble
*
1e6
;
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
...
@@ -1564,6 +1569,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
...
@@ -1564,6 +1569,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
*
tsVal
=
timeDouble
;
*
tsVal
=
timeDouble
;
break
;
break
;
case
'u'
:
case
'u'
:
case
'U'
:
//microseconds
//microseconds
timeDouble
=
timeDouble
*
1e3
;
timeDouble
=
timeDouble
*
1e3
;
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
if
(
smlDoubleToInt64OverFlow
(
timeDouble
)){
...
@@ -1573,6 +1579,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
...
@@ -1573,6 +1579,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
*
tsVal
=
timeDouble
;
*
tsVal
=
timeDouble
;
break
;
break
;
case
'n'
:
case
'n'
:
case
'N'
:
//nanoseconds
//nanoseconds
*
tsVal
=
timeDouble
;
*
tsVal
=
timeDouble
;
break
;
break
;
...
@@ -2285,6 +2292,8 @@ static int32_t smlParseLine(SSmlHandle *info, char* lines[], int numLines){
...
@@ -2285,6 +2292,8 @@ static int32_t smlParseLine(SSmlHandle *info, char* lines[], int numLines){
static
int
smlProcess
(
SSmlHandle
*
info
,
char
*
lines
[],
int
numLines
)
{
static
int
smlProcess
(
SSmlHandle
*
info
,
char
*
lines
[],
int
numLines
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
retryNum
=
0
;
info
->
cost
.
parseTime
=
taosGetTimestampUs
();
info
->
cost
.
parseTime
=
taosGetTimestampUs
();
code
=
smlParseLine
(
info
,
lines
,
numLines
);
code
=
smlParseLine
(
info
,
lines
,
numLines
);
...
@@ -2298,7 +2307,12 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) {
...
@@ -2298,7 +2307,12 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) {
info
->
cost
.
numOfCTables
=
taosHashGetSize
(
info
->
childTables
);
info
->
cost
.
numOfCTables
=
taosHashGetSize
(
info
->
childTables
);
info
->
cost
.
schemaTime
=
taosGetTimestampUs
();
info
->
cost
.
schemaTime
=
taosGetTimestampUs
();
do
{
code
=
smlModifyDBSchemas
(
info
);
code
=
smlModifyDBSchemas
(
info
);
if
(
code
==
0
)
break
;
}
while
(
retryNum
++
<
taosHashGetSize
(
info
->
superTables
));
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
uError
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas error : %s"
,
info
->
id
,
tstrerror
(
code
));
uError
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas error : %s"
,
info
->
id
,
tstrerror
(
code
));
goto
cleanup
;
goto
cleanup
;
...
@@ -2409,6 +2423,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
...
@@ -2409,6 +2423,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
info
->
pRequest
->
code
=
smlProcess
(
info
,
lines
,
numLines
);
info
->
pRequest
->
code
=
smlProcess
(
info
,
lines
,
numLines
);
end:
end:
info
->
taos
->
schemalessType
=
0
;
uDebug
(
"result:%s"
,
info
->
msgBuf
.
buf
);
uDebug
(
"result:%s"
,
info
->
msgBuf
.
buf
);
smlDestroyInfo
(
info
);
smlDestroyInfo
(
info
);
return
(
TAOS_RES
*
)
request
;
return
(
TAOS_RES
*
)
request
;
...
...
source/client/test/smlTest.cpp
浏览文件 @
5bda367f
...
@@ -1272,14 +1272,40 @@ TEST(testCase, sml_params_Test) {
...
@@ -1272,14 +1272,40 @@ TEST(testCase, sml_params_Test) {
};
};
TAOS_RES
*
res
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
1
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
TAOS_RES
*
res
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
1
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
ASSERT_EQ
(
taos_errno
(
res
),
TSDB_CODE_PAR_DB_NOT_SPECIFIED
);
ASSERT_EQ
(
taos_errno
(
res
),
TSDB_CODE_PAR_DB_NOT_SPECIFIED
);
taos_free_result
(
pR
es
);
taos_free_result
(
r
es
);
pRes
=
taos_query
(
taos
,
"use param"
);
pRes
=
taos_query
(
taos
,
"use param"
);
taos_free_result
(
pR
es
);
taos_free_result
(
r
es
);
res
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
1
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
res
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
1
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_SECONDS
);
ASSERT_EQ
(
taos_errno
(
res
),
TSDB_CODE_SML_INVALID_DB_CONF
);
ASSERT_EQ
(
taos_errno
(
res
),
TSDB_CODE_SML_INVALID_DB_CONF
);
taos_free_result
(
res
);
}
TEST
(
testCase
,
sml_16384_Test
)
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
taos
,
nullptr
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"create database if not exists d16384 schemaless 1"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=t,c1=127i8 1626006833639000000"
,
};
pRes
=
taos_query
(
taos
,
"use d16384"
);
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
TAOS_RES
*
res
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
1
,
TSDB_SML_LINE_PROTOCOL
,
0
);
ASSERT_EQ
(
taos_errno
(
res
),
0
);
taos_free_result
(
res
);
const
char
*
sql1
[]
=
{
"qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=f,c1=127i8,c11=L
\"
ncharColValue
\"
,c10=t 1626006833639000000"
,
};
TAOS_RES
*
res1
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql1
,
1
,
TSDB_SML_LINE_PROTOCOL
,
0
);
ASSERT_EQ
(
taos_errno
(
res1
),
0
);
taos_free_result
(
res1
);
}
}
TEST
(
testCase
,
sml_oom_Test
)
{
TEST
(
testCase
,
sml_oom_Test
)
{
...
@@ -1303,3 +1329,29 @@ TEST(testCase, sml_oom_Test) {
...
@@ -1303,3 +1329,29 @@ TEST(testCase, sml_oom_Test) {
ASSERT_EQ
(
taos_errno
(
res
),
0
);
ASSERT_EQ
(
taos_errno
(
res
),
0
);
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
}
}
TEST
(
testCase
,
sml_16368_Test
)
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
taos
,
nullptr
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"create database if not exists d16368 schemaless 1"
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"use d16368"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"[{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639000,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 1,
\"
tags
\"
: {
\"
t1
\"
: 3,
\"
t2
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t3
\"
,
\"
type
\"
:
\"
binary
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833739000,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 2,
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stb_name
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639100,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 3,
\"
tags
\"
: {
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
ste
\"
,
\"
type
\"
:
\"
nchar
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stf567890
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639200,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: 4,
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
bigint
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639300,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t2
\"
: 5.0,
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stb_name
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639400,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 6,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t2
\"
: 5.0,
\"
t3
\"
: {
\"
value
\"
:
\"
ste2
\"
,
\"
type
\"
:
\"
nchar
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
stb_name
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006834639400,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 7,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t2
\"
: {
\"
value
\"
: 5.0,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
ste2
\"
,
\"
type
\"
:
\"
nchar
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833839006,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 8,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t1
\"
: {
\"
value
\"
: 4,
\"
type
\"
:
\"
double
\"
},
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}},
\n
"
"{
\"
metric
\"
:
\"
st123456
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833939007,
\"
type
\"
:
\"
us
\"
},
\"
value
\"
: {
\"
value
\"
: 9,
\"
type
\"
:
\"
double
\"
},
\"
tags
\"
: {
\"
t1
\"
: 4,
\"
t3
\"
: {
\"
value
\"
:
\"
t4
\"
,
\"
type
\"
:
\"
binary
\"
},
\"
t2
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
},
\"
t4
\"
: {
\"
value
\"
: 5,
\"
type
\"
:
\"
double
\"
}}}]"
};
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_JSON_PROTOCOL
,
TSDB_SML_TIMESTAMP_MICRO_SECONDS
);
ASSERT_EQ
(
taos_errno
(
pRes
),
0
);
taos_free_result
(
pRes
);
}
source/common/src/tdatablock.c
浏览文件 @
5bda367f
...
@@ -1752,7 +1752,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -1752,7 +1752,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
taosArrayClear
(
tagArray
);
taosArrayClear
(
tagArray
);
taosArrayPush
(
tagArray
,
&
tagVal
);
taosArrayPush
(
tagArray
,
&
tagVal
);
tTagNew
(
tagArray
,
1
,
false
,
&
pTag
);
tTagNew
(
tagArray
,
1
,
false
,
&
pTag
);
if
(
!
pTag
)
{
if
(
pTag
==
NULL
)
{
tdDestroySVCreateTbReq
(
&
createTbReq
);
tdDestroySVCreateTbReq
(
&
createTbReq
);
taosArrayDestroy
(
tagArray
);
taosArrayDestroy
(
tagArray
);
return
NULL
;
return
NULL
;
...
@@ -1763,9 +1763,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -1763,9 +1763,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
tEncodeSize
(
tEncodeSVCreateTbReq
,
&
createTbReq
,
schemaLen
,
code
);
tEncodeSize
(
tEncodeSVCreateTbReq
,
&
createTbReq
,
schemaLen
,
code
);
tdDestroySVCreateTbReq
(
&
createTbReq
);
tdDestroySVCreateTbReq
(
&
createTbReq
);
if
(
code
<
0
)
{
if
(
code
<
0
)
{
tdDestroySVCreateTbReq
(
&
createTbReq
);
taosArrayDestroy
(
tagArray
);
taosArrayDestroy
(
tagArray
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1804,8 +1802,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -1804,8 +1802,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
int32_t
schemaLen
=
0
;
int32_t
schemaLen
=
0
;
if
(
createTb
)
{
if
(
createTb
)
{
SVCreateTbReq
createTbReq
=
{
0
};
SVCreateTbReq
createTbReq
=
{
0
};
char
*
cname
=
taosMemoryCalloc
(
1
,
TSDB_TABLE_FNAME_LEN
);
char
*
cname
=
buildCtbNameByGroupId
(
stbFullName
,
pDataBlock
->
info
.
groupId
);
snprintf
(
cname
,
TSDB_TABLE_FNAME_LEN
,
"%s:%ld"
,
stbFullName
,
pDataBlock
->
info
.
groupId
);
createTbReq
.
name
=
cname
;
createTbReq
.
name
=
cname
;
createTbReq
.
flags
=
0
;
createTbReq
.
flags
=
0
;
createTbReq
.
type
=
TSDB_CHILD_TABLE
;
createTbReq
.
type
=
TSDB_CHILD_TABLE
;
...
@@ -1819,7 +1816,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -1819,7 +1816,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
taosArrayPush
(
tagArray
,
&
tagVal
);
taosArrayPush
(
tagArray
,
&
tagVal
);
STag
*
pTag
=
NULL
;
STag
*
pTag
=
NULL
;
tTagNew
(
tagArray
,
1
,
false
,
&
pTag
);
tTagNew
(
tagArray
,
1
,
false
,
&
pTag
);
if
(
!
pTag
)
{
if
(
pTag
==
NULL
)
{
tdDestroySVCreateTbReq
(
&
createTbReq
);
tdDestroySVCreateTbReq
(
&
createTbReq
);
taosArrayDestroy
(
tagArray
);
taosArrayDestroy
(
tagArray
);
taosMemoryFreeClear
(
ret
);
taosMemoryFreeClear
(
ret
);
...
@@ -1945,7 +1942,6 @@ void blockCompressEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen
...
@@ -1945,7 +1942,6 @@ void blockCompressEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen
const
char
*
blockCompressDecode
(
SSDataBlock
*
pBlock
,
int32_t
numOfCols
,
int32_t
numOfRows
,
const
char
*
pData
)
{
const
char
*
blockCompressDecode
(
SSDataBlock
*
pBlock
,
int32_t
numOfCols
,
int32_t
numOfRows
,
const
char
*
pData
)
{
blockDataEnsureCapacity
(
pBlock
,
numOfRows
);
blockDataEnsureCapacity
(
pBlock
,
numOfRows
);
pBlock
->
info
.
rows
=
numOfRows
;
const
char
*
pStart
=
pData
;
const
char
*
pStart
=
pData
;
...
@@ -2019,6 +2015,7 @@ const char* blockCompressDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t
...
@@ -2019,6 +2015,7 @@ const char* blockCompressDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t
pStart
+=
colLen
[
i
];
pStart
+=
colLen
[
i
];
}
}
pBlock
->
info
.
rows
=
numOfRows
;
ASSERT
(
pStart
-
pData
==
dataLen
);
ASSERT
(
pStart
-
pData
==
dataLen
);
return
pStart
;
return
pStart
;
}
}
source/common/src/tdataformat.c
浏览文件 @
5bda367f
...
@@ -244,7 +244,7 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
...
@@ -244,7 +244,7 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
}
}
}
}
// ASSERT(flags); // only 1 column(ts)
ASSERT
(
flags
);
// decide
// decide
uint32_t
nData
=
0
;
uint32_t
nData
=
0
;
...
@@ -268,8 +268,8 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
...
@@ -268,8 +268,8 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
nDataT
=
BIT2_SIZE
(
pTSchema
->
numOfCols
-
1
)
+
pTSchema
->
flen
+
ntv
;
nDataT
=
BIT2_SIZE
(
pTSchema
->
numOfCols
-
1
)
+
pTSchema
->
flen
+
ntv
;
break
;
break
;
default:
default:
break
;
// only ts column
break
;
//
ASSERT(0);
ASSERT
(
0
);
}
}
uint8_t
tflags
=
0
;
uint8_t
tflags
=
0
;
...
@@ -374,7 +374,7 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
...
@@ -374,7 +374,7 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
ptv
=
pf
+
pTSchema
->
flen
;
ptv
=
pf
+
pTSchema
->
flen
;
break
;
break
;
default:
default:
//
ASSERT(0);
ASSERT
(
0
);
break
;
break
;
}
}
}
else
{
}
else
{
...
@@ -421,12 +421,26 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
...
@@ -421,12 +421,26 @@ int32_t tTSRowNew(STSRowBuilder *pBuilder, SArray *pArray, STSchema *pTSchema, S
_set_none:
_set_none:
if
((
flags
&
0xf0
)
==
0
)
{
if
((
flags
&
0xf0
)
==
0
)
{
setBitMap
(
pb
,
0
,
iColumn
-
1
,
flags
);
setBitMap
(
pb
,
0
,
iColumn
-
1
,
flags
);
if
(
flags
&
TSROW_HAS_VAL
)
{
// set 0
if
(
IS_VAR_DATA_TYPE
(
pTColumn
->
type
))
{
*
(
VarDataOffsetT
*
)(
pf
+
pTColumn
->
offset
)
=
0
;
}
else
{
tPutValue
(
pf
+
pTColumn
->
offset
,
&
((
SValue
){
0
}),
pTColumn
->
type
);
}
}
}
}
continue
;
continue
;
_set_null:
_set_null:
if
((
flags
&
0xf0
)
==
0
)
{
if
((
flags
&
0xf0
)
==
0
)
{
setBitMap
(
pb
,
1
,
iColumn
-
1
,
flags
);
setBitMap
(
pb
,
1
,
iColumn
-
1
,
flags
);
if
(
flags
&
TSROW_HAS_VAL
)
{
// set 0
if
(
IS_VAR_DATA_TYPE
(
pTColumn
->
type
))
{
*
(
VarDataOffsetT
*
)(
pf
+
pTColumn
->
offset
)
=
0
;
}
else
{
tPutValue
(
pf
+
pTColumn
->
offset
,
&
((
SValue
){
0
}),
pTColumn
->
type
);
}
}
}
else
{
}
else
{
SET_IDX
(
pidx
,
pTSKVRow
->
nCols
,
nkv
,
flags
);
SET_IDX
(
pidx
,
pTSKVRow
->
nCols
,
nkv
,
flags
);
pTSKVRow
->
nCols
++
;
pTSKVRow
->
nCols
++
;
...
@@ -497,7 +511,7 @@ void tTSRowGet(STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal
...
@@ -497,7 +511,7 @@ void tTSRowGet(STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal
SValue
value
;
SValue
value
;
ASSERT
(
iCol
<
pTSchema
->
numOfCols
);
ASSERT
(
iCol
<
pTSchema
->
numOfCols
);
// ASSERT(flags); // only 1 ts column
ASSERT
(
flags
);
ASSERT
(
pRow
->
sver
==
pTSchema
->
version
);
ASSERT
(
pRow
->
sver
==
pTSchema
->
version
);
if
(
iCol
==
0
)
{
if
(
iCol
==
0
)
{
...
...
source/common/src/tmsg.c
浏览文件 @
5bda367f
...
@@ -2491,6 +2491,15 @@ int32_t tDeserializeSTableIndexRsp(void *buf, int32_t bufLen, STableIndexRsp *pR
...
@@ -2491,6 +2491,15 @@ int32_t tDeserializeSTableIndexRsp(void *buf, int32_t bufLen, STableIndexRsp *pR
return
0
;
return
0
;
}
}
void
tFreeSTableIndexInfo
(
void
*
info
)
{
if
(
NULL
==
info
)
{
return
;
}
STableIndexInfo
*
pInfo
=
(
STableIndexInfo
*
)
info
;
taosMemoryFree
(
pInfo
->
expr
);
}
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
...
...
source/common/test/dataformatTest.cpp
浏览文件 @
5bda367f
...
@@ -52,61 +52,61 @@ STSchema *genSTSchema(int16_t nCols) {
...
@@ -52,61 +52,61 @@ STSchema *genSTSchema(int16_t nCols) {
switch
(
i
)
{
switch
(
i
)
{
case
0
:
{
case
0
:
{
pSchema
[
0
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
0
].
bytes
=
TYPE_BYTES
[
pSchema
[
0
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
1
:
{
case
1
:
{
pSchema
[
1
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
1
].
bytes
=
TYPE_BYTES
[
pSchema
[
1
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
;
;
}
break
;
}
break
;
case
2
:
{
case
2
:
{
pSchema
[
2
].
type
=
TSDB_DATA_TYPE_BIGINT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_BIGINT
;
pSchema
[
2
].
bytes
=
TYPE_BYTES
[
pSchema
[
2
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
3
:
{
case
3
:
{
pSchema
[
3
].
type
=
TSDB_DATA_TYPE_FLOAT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_FLOAT
;
pSchema
[
3
].
bytes
=
TYPE_BYTES
[
pSchema
[
3
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
4
:
{
case
4
:
{
pSchema
[
4
].
type
=
TSDB_DATA_TYPE_DOUBLE
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_DOUBLE
;
pSchema
[
4
].
bytes
=
TYPE_BYTES
[
pSchema
[
4
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
5
:
{
case
5
:
{
pSchema
[
5
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
5
].
bytes
=
12
;
pSchema
[
i
].
bytes
=
12
;
}
break
;
}
break
;
case
6
:
{
case
6
:
{
pSchema
[
6
].
type
=
TSDB_DATA_TYPE_NCHAR
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_NCHAR
;
pSchema
[
6
].
bytes
=
42
;
pSchema
[
i
].
bytes
=
42
;
}
break
;
}
break
;
case
7
:
{
case
7
:
{
pSchema
[
7
].
type
=
TSDB_DATA_TYPE_TINYINT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_TINYINT
;
pSchema
[
7
].
bytes
=
TYPE_BYTES
[
pSchema
[
7
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
8
:
{
case
8
:
{
pSchema
[
8
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
8
].
bytes
=
TYPE_BYTES
[
pSchema
[
8
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
9
:
{
case
9
:
{
pSchema
[
9
].
type
=
TSDB_DATA_TYPE_BOOL
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_BOOL
;
pSchema
[
9
].
bytes
=
TYPE_BYTES
[
pSchema
[
9
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
10
:
{
case
10
:
{
pSchema
[
10
].
type
=
TSDB_DATA_TYPE_UTINYINT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_UTINYINT
;
pSchema
[
10
].
bytes
=
TYPE_BYTES
[
pSchema
[
10
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
11
:
{
case
11
:
{
pSchema
[
11
].
type
=
TSDB_DATA_TYPE_USMALLINT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_USMALLINT
;
pSchema
[
11
].
bytes
=
TYPE_BYTES
[
pSchema
[
11
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
12
:
{
case
12
:
{
pSchema
[
12
].
type
=
TSDB_DATA_TYPE_UINT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_UINT
;
pSchema
[
12
].
bytes
=
TYPE_BYTES
[
pSchema
[
12
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
case
13
:
{
case
13
:
{
pSchema
[
13
].
type
=
TSDB_DATA_TYPE_UBIGINT
;
pSchema
[
i
].
type
=
TSDB_DATA_TYPE_UBIGINT
;
pSchema
[
13
].
bytes
=
TYPE_BYTES
[
pSchema
[
13
].
type
];
pSchema
[
i
].
bytes
=
TYPE_BYTES
[
pSchema
[
i
].
type
];
}
break
;
}
break
;
default:
default:
...
@@ -146,9 +146,9 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) {
...
@@ -146,9 +146,9 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) {
case
0
:
case
0
:
sscanf
(
data
[
i
],
"%"
PRIi64
,
&
colVal
.
value
.
ts
);
sscanf
(
data
[
i
],
"%"
PRIi64
,
&
colVal
.
value
.
ts
);
break
;
break
;
case
1
:
{
case
1
:
sscanf
(
data
[
i
],
"%"
PRIi32
,
&
colVal
.
value
.
i32
);
sscanf
(
data
[
i
],
"%"
PRIi32
,
&
colVal
.
value
.
i32
);
}
break
;
break
;
case
2
:
case
2
:
sscanf
(
data
[
i
],
"%"
PRIi64
,
&
colVal
.
value
.
i64
);
sscanf
(
data
[
i
],
"%"
PRIi64
,
&
colVal
.
value
.
i64
);
break
;
break
;
...
@@ -274,9 +274,6 @@ int32_t debugPrintSColVal(SColVal *cv, int8_t type) {
...
@@ -274,9 +274,6 @@ int32_t debugPrintSColVal(SColVal *cv, int8_t type) {
case
TSDB_DATA_TYPE_MEDIUMBLOB
:
case
TSDB_DATA_TYPE_MEDIUMBLOB
:
printf
(
"MedBLOB "
);
printf
(
"MedBLOB "
);
break
;
break
;
// case TSDB_DATA_TYPE_BINARY:
// printf("BINARY ");
// break;
case
TSDB_DATA_TYPE_MAX
:
case
TSDB_DATA_TYPE_MAX
:
printf
(
"UNDEF "
);
printf
(
"UNDEF "
);
break
;
break
;
...
@@ -404,7 +401,8 @@ static void checkTSRow(const char **data, STSRow2 *row, STSchema *pTSchema) {
...
@@ -404,7 +401,8 @@ static void checkTSRow(const char **data, STSRow2 *row, STSchema *pTSchema) {
}
}
TEST
(
testCase
,
AllNormTest
)
{
TEST
(
testCase
,
AllNormTest
)
{
int16_t
nCols
=
1
;
int16_t
nCols
=
14
;
STSRowBuilder
rb
=
{
0
};
STSRow2
*
row
=
nullptr
;
STSRow2
*
row
=
nullptr
;
SArray
*
pArray
=
taosArrayInit
(
nCols
,
sizeof
(
SColVal
));
SArray
*
pArray
=
taosArrayInit
(
nCols
,
sizeof
(
SColVal
));
EXPECT_NE
(
pArray
,
nullptr
);
EXPECT_NE
(
pArray
,
nullptr
);
...
@@ -414,15 +412,16 @@ TEST(testCase, AllNormTest) {
...
@@ -414,15 +412,16 @@ TEST(testCase, AllNormTest) {
// ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 binary(10), c6 nchar(10), c7 tinyint, c8 smallint,
// ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 binary(10), c6 nchar(10), c7 tinyint, c8 smallint,
// c9 bool
// c9 bool
char
*
data
[
1
0
]
=
{
"1653694220000"
,
"10"
,
"20"
,
"10.1"
,
"10.1"
,
"binary10"
,
"nchar10"
,
"10"
,
"10"
,
"1
"
};
char
*
data
[
1
4
]
=
{
"1653694220000"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no
"
};
genTestData
((
const
char
**
)
&
data
,
nCols
,
&
pArray
);
genTestData
((
const
char
**
)
&
data
,
nCols
,
&
pArray
);
tTSRowNew
(
NULL
,
pArray
,
pTSchema
,
&
row
);
tTSRowNew
(
&
rb
,
pArray
,
pTSchema
,
&
row
);
debugPrintTSRow
(
row
,
pTSchema
,
__func__
,
__LINE__
);
debugPrintTSRow
(
row
,
pTSchema
,
__func__
,
__LINE__
);
checkTSRow
((
const
char
**
)
&
data
,
row
,
pTSchema
);
checkTSRow
((
const
char
**
)
&
data
,
row
,
pTSchema
);
tsRowBuilderClear
(
&
rb
);
taosArrayDestroy
(
pArray
);
taosArrayDestroy
(
pArray
);
taosMemoryFree
(
pTSchema
);
taosMemoryFree
(
pTSchema
);
}
}
...
@@ -443,12 +442,12 @@ TEST(testCase, NoneTest) {
...
@@ -443,12 +442,12 @@ TEST(testCase, NoneTest) {
const
char
*
data
[
nRows
][
nCols
]
=
{
const
char
*
data
[
nRows
][
nCols
]
=
{
{
"1653694220000"
,
"no"
,
"20"
,
"10.1"
,
"10.1"
,
"binary10"
,
"no"
,
"10"
,
"10"
,
"nu"
,
"10"
,
"20"
,
"30"
,
"40"
},
{
"1653694220000"
,
"no"
,
"20"
,
"10.1"
,
"10.1"
,
"binary10"
,
"no"
,
"10"
,
"10"
,
"nu"
,
"10"
,
"20"
,
"30"
,
"40"
},
{
"1653694220001"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
},
{
"1653694220001"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
},
{
"1653694220002"
,
"
no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"nu"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"nu
"
},
{
"1653694220002"
,
"
10"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no
"
},
{
"1653694220003"
,
"
nu"
,
"no"
,
"no"
,
"no"
,
"no"
,
"nu
"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
},
{
"1653694220003"
,
"
10"
,
"10"
,
"no"
,
"no"
,
"no"
,
"no
"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
},
{
"1653694220004"
,
"no"
,
"20"
,
"no"
,
"no"
,
"no"
,
"nchar10"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
},
{
"1653694220004"
,
"no"
,
"20"
,
"no"
,
"no"
,
"no"
,
"nchar10"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
,
"no"
},
{
"1653694220005"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
},
{
"1653694220005"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
},
{
"1653694220006"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
},
{
"1653694220006"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
},
{
"1653694220007"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"n
u"
,
"nu"
,
"nu"
,
"nu
"
,
"no"
},
{
"1653694220007"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"n
o"
,
"no"
,
"no"
,
"no
"
,
"no"
},
{
"1653694220008"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"binary10"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"no"
},
{
"1653694220008"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"binary10"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"nu"
,
"no"
},
{
"1653694220009"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"binary10"
,
"nu"
,
"nu"
,
"10"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"100"
},
{
"1653694220009"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"binary10"
,
"nu"
,
"nu"
,
"10"
,
"no"
,
"nu"
,
"nu"
,
"nu"
,
"100"
},
{
"1653694220010"
,
"-1"
,
"-1"
,
"-1"
,
"-1"
,
"binary10"
,
"nu"
,
"-1"
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
},
{
"1653694220010"
,
"-1"
,
"-1"
,
"-1"
,
"-1"
,
"binary10"
,
"nu"
,
"-1"
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
},
...
@@ -465,13 +464,12 @@ TEST(testCase, NoneTest) {
...
@@ -465,13 +464,12 @@ TEST(testCase, NoneTest) {
{
"1653694220019"
,
"no"
,
"9223372036854775807"
,
"nu"
,
"nu"
,
"bin10"
,
"nu"
,
"nu"
,
"10"
,
"no"
,
"254"
,
"nu"
,
"nu"
,
{
"1653694220019"
,
"no"
,
"9223372036854775807"
,
"nu"
,
"nu"
,
"bin10"
,
"nu"
,
"nu"
,
"10"
,
"no"
,
"254"
,
"nu"
,
"nu"
,
"no"
}};
"no"
}};
for
(
int
r
=
0
;
r
<
nRows
;
++
r
)
{
for
(
int
r
=
0
;
r
<
nRows
;
++
r
)
{
genTestData
((
const
char
**
)
&
data
[
r
],
nCols
,
&
pArray
);
genTestData
((
const
char
**
)
&
data
[
r
],
nCols
,
&
pArray
);
tTSRowNew
(
NULL
,
pArray
,
pTSchema
,
&
row
);
tTSRowNew
(
NULL
,
pArray
,
pTSchema
,
&
row
);
debugPrintTSRow
(
row
,
pTSchema
,
__func__
,
__LINE__
);
// debug print
debugPrintTSRow
(
row
,
pTSchema
,
__func__
,
__LINE__
);
// debug print
checkTSRow
((
const
char
**
)
&
data
[
r
],
row
,
pTSchema
);
// check
checkTSRow
((
const
char
**
)
&
data
[
r
],
row
,
pTSchema
);
// check
t
aosMemoryFreeClear
(
row
);
t
TSRowFree
(
row
);
taosArrayClear
(
pArray
);
taosArrayClear
(
pArray
);
}
}
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
5bda367f
...
@@ -186,7 +186,7 @@ int32_t mndAddShuffledSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* p
...
@@ -186,7 +186,7 @@ int32_t mndAddShuffledSinkToStream(SMnode* pMnode, STrans* pTrans, SStreamObj* p
SVgObj
*
pVgroup
;
SVgObj
*
pVgroup
;
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
!=
pStream
->
dbUid
)
{
if
(
strcmp
(
pVgroup
->
dbName
,
pStream
->
targetDb
)
!=
0
)
{
sdbRelease
(
pSdb
,
pVgroup
);
sdbRelease
(
pSdb
,
pVgroup
);
continue
;
continue
;
}
}
...
@@ -286,7 +286,8 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -286,7 +286,8 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
pStream
->
tasks
=
taosArrayInit
(
totLevel
,
sizeof
(
void
*
));
pStream
->
tasks
=
taosArrayInit
(
totLevel
,
sizeof
(
void
*
));
bool
hasExtraSink
=
false
;
bool
hasExtraSink
=
false
;
if
(
totLevel
==
2
||
strcmp
(
pStream
->
sourceDb
,
pStream
->
targetDb
)
!=
0
)
{
bool
externalTargetDB
=
strcmp
(
pStream
->
sourceDb
,
pStream
->
targetDb
)
!=
0
;
if
(
totLevel
==
2
||
externalTargetDB
)
{
SArray
*
taskOneLevel
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
SArray
*
taskOneLevel
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
taosArrayPush
(
pStream
->
tasks
,
&
taskOneLevel
);
taosArrayPush
(
pStream
->
tasks
,
&
taskOneLevel
);
// add extra sink
// add extra sink
...
@@ -405,7 +406,6 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -405,7 +406,6 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
if
(
pStream
->
fixedSinkVgId
==
0
)
{
if
(
pStream
->
fixedSinkVgId
==
0
)
{
pTask
->
dispatchType
=
TASK_DISPATCH__SHUFFLE
;
pTask
->
dispatchType
=
TASK_DISPATCH__SHUFFLE
;
/*pTask->dispatchMsgType = TDMT_VND_TASK_WRITE_EXEC;*/
pTask
->
dispatchMsgType
=
TDMT_STREAM_TASK_DISPATCH
;
pTask
->
dispatchMsgType
=
TDMT_STREAM_TASK_DISPATCH
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pStream
->
targetDb
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pStream
->
targetDb
);
ASSERT
(
pDb
);
ASSERT
(
pDb
);
...
@@ -426,10 +426,8 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -426,10 +426,8 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
SVgroupInfo
*
pVgInfo
=
taosArrayGet
(
pVgs
,
i
);
SVgroupInfo
*
pVgInfo
=
taosArrayGet
(
pVgs
,
i
);
for
(
int32_t
j
=
0
;
j
<
sinkLvSize
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
sinkLvSize
;
j
++
)
{
SStreamTask
*
pLastLevelTask
=
taosArrayGetP
(
sinkLv
,
j
);
SStreamTask
*
pLastLevelTask
=
taosArrayGetP
(
sinkLv
,
j
);
/*printf("vgid %d node id %d\n", pVgInfo->vgId, pTask->nodeId);*/
if
(
pLastLevelTask
->
nodeId
==
pVgInfo
->
vgId
)
{
if
(
pLastLevelTask
->
nodeId
==
pVgInfo
->
vgId
)
{
pVgInfo
->
taskId
=
pLastLevelTask
->
taskId
;
pVgInfo
->
taskId
=
pLastLevelTask
->
taskId
;
/*printf("taskid %d set to %d\n", pVgInfo->taskId, pTask->taskId);*/
break
;
break
;
}
}
}
}
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
5bda367f
...
@@ -67,6 +67,7 @@ typedef enum {
...
@@ -67,6 +67,7 @@ typedef enum {
CTG_TASK_GET_DB_INFO
,
CTG_TASK_GET_DB_INFO
,
CTG_TASK_GET_TB_META
,
CTG_TASK_GET_TB_META
,
CTG_TASK_GET_TB_HASH
,
CTG_TASK_GET_TB_HASH
,
CTG_TASK_GET_TB_INDEX
,
CTG_TASK_GET_INDEX
,
CTG_TASK_GET_INDEX
,
CTG_TASK_GET_UDF
,
CTG_TASK_GET_UDF
,
CTG_TASK_GET_USER
,
CTG_TASK_GET_USER
,
...
@@ -93,6 +94,10 @@ typedef struct SCtgTbMetaCtx {
...
@@ -93,6 +94,10 @@ typedef struct SCtgTbMetaCtx {
int32_t
flag
;
int32_t
flag
;
}
SCtgTbMetaCtx
;
}
SCtgTbMetaCtx
;
typedef
struct
SCtgTbIndexCtx
{
SName
*
pName
;
}
SCtgTbIndexCtx
;
typedef
struct
SCtgDbVgCtx
{
typedef
struct
SCtgDbVgCtx
{
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
}
SCtgDbVgCtx
;
}
SCtgDbVgCtx
;
...
@@ -189,6 +194,7 @@ typedef struct SCtgJob {
...
@@ -189,6 +194,7 @@ typedef struct SCtgJob {
int32_t
indexNum
;
int32_t
indexNum
;
int32_t
userNum
;
int32_t
userNum
;
int32_t
dbInfoNum
;
int32_t
dbInfoNum
;
int32_t
tbIndexNum
;
}
SCtgJob
;
}
SCtgJob
;
typedef
struct
SCtgMsgCtx
{
typedef
struct
SCtgMsgCtx
{
...
@@ -490,7 +496,7 @@ int32_t ctgGetDBVgInfoFromMnode(CTG_PARAMS, SBuildUseDBInput *input, SUseDbOutpu
...
@@ -490,7 +496,7 @@ int32_t ctgGetDBVgInfoFromMnode(CTG_PARAMS, SBuildUseDBInput *input, SUseDbOutpu
int32_t
ctgGetQnodeListFromMnode
(
CTG_PARAMS
,
SArray
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetQnodeListFromMnode
(
CTG_PARAMS
,
SArray
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDBCfgFromMnode
(
CTG_PARAMS
,
const
char
*
dbFName
,
SDbCfgInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDBCfgFromMnode
(
CTG_PARAMS
,
const
char
*
dbFName
,
SDbCfgInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetIndexInfoFromMnode
(
CTG_PARAMS
,
const
char
*
indexName
,
SIndexInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetIndexInfoFromMnode
(
CTG_PARAMS
,
const
char
*
indexName
,
SIndexInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbIndexFromMnode
(
CTG_PARAMS
,
const
char
*
tbFN
ame
,
SArray
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbIndexFromMnode
(
CTG_PARAMS
,
SName
*
n
ame
,
SArray
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetUdfInfoFromMnode
(
CTG_PARAMS
,
const
char
*
funcName
,
SFuncInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetUdfInfoFromMnode
(
CTG_PARAMS
,
const
char
*
funcName
,
SFuncInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetUserDbAuthFromMnode
(
CTG_PARAMS
,
const
char
*
user
,
SGetUserAuthRsp
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetUserDbAuthFromMnode
(
CTG_PARAMS
,
const
char
*
user
,
SGetUserAuthRsp
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbMetaFromMnodeImpl
(
CTG_PARAMS
,
char
*
dbFName
,
char
*
tbName
,
STableMetaOutput
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbMetaFromMnodeImpl
(
CTG_PARAMS
,
char
*
dbFName
,
char
*
tbName
,
STableMetaOutput
*
out
,
SCtgTask
*
pTask
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
5bda367f
...
@@ -1136,14 +1136,14 @@ int32_t catalogGetIndexMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps
...
@@ -1136,14 +1136,14 @@ int32_t catalogGetIndexMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps
CTG_API_LEAVE
(
ctgGetIndexInfoFromMnode
(
CTG_PARAMS_LIST
(),
indexName
,
pInfo
,
NULL
));
CTG_API_LEAVE
(
ctgGetIndexInfoFromMnode
(
CTG_PARAMS_LIST
(),
indexName
,
pInfo
,
NULL
));
}
}
int32_t
catalogGetTableIndex
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
const
char
*
tbF
Name
,
SArray
**
pRes
)
{
int32_t
catalogGetTableIndex
(
SCatalog
*
pCtg
,
void
*
pTrans
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTable
Name
,
SArray
**
pRes
)
{
CTG_API_ENTER
();
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pTrans
||
NULL
==
pMgmtEps
||
NULL
==
tbF
Name
||
NULL
==
pRes
)
{
if
(
NULL
==
pCtg
||
NULL
==
pTrans
||
NULL
==
pMgmtEps
||
NULL
==
pTable
Name
||
NULL
==
pRes
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
}
CTG_API_LEAVE
(
ctgGetTbIndexFromMnode
(
CTG_PARAMS_LIST
(),
tbF
Name
,
pRes
,
NULL
));
CTG_API_LEAVE
(
ctgGetTbIndexFromMnode
(
CTG_PARAMS_LIST
(),
(
SName
*
)
pTable
Name
,
pRes
,
NULL
));
}
}
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
5bda367f
...
@@ -44,7 +44,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob *pJob, int32_t taskIdx, SName *name) {
...
@@ -44,7 +44,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob *pJob, int32_t taskIdx, SName *name) {
taosArrayPush
(
pJob
->
pTasks
,
&
task
);
taosArrayPush
(
pJob
->
pTasks
,
&
task
);
qDebug
(
"QID:0x%"
PRIx64
" the %d task type %s initialized, t
able
Name:%s"
,
pJob
->
queryId
,
taskIdx
,
ctgTaskTypeStr
(
task
.
type
),
name
->
tname
);
qDebug
(
"QID:0x%"
PRIx64
" the %d task type %s initialized, t
b
Name:%s"
,
pJob
->
queryId
,
taskIdx
,
ctgTaskTypeStr
(
task
.
type
),
name
->
tname
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -232,6 +232,35 @@ int32_t ctgInitGetUserTask(SCtgJob *pJob, int32_t taskIdx, SUserAuthInfo *user)
...
@@ -232,6 +232,35 @@ int32_t ctgInitGetUserTask(SCtgJob *pJob, int32_t taskIdx, SUserAuthInfo *user)
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgInitGetTbIndexTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
SName
*
name
)
{
SCtgTask
task
=
{
0
};
task
.
type
=
CTG_TASK_GET_TB_INDEX
;
task
.
taskId
=
taskIdx
;
task
.
pJob
=
pJob
;
task
.
taskCtx
=
taosMemoryCalloc
(
1
,
sizeof
(
SCtgTbIndexCtx
));
if
(
NULL
==
task
.
taskCtx
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
SCtgTbIndexCtx
*
ctx
=
task
.
taskCtx
;
ctx
->
pName
=
taosMemoryMalloc
(
sizeof
(
*
name
));
if
(
NULL
==
ctx
->
pName
)
{
taosMemoryFree
(
task
.
taskCtx
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
memcpy
(
ctx
->
pName
,
name
,
sizeof
(
*
name
));
taosArrayPush
(
pJob
->
pTasks
,
&
task
);
qDebug
(
"QID:%"
PRIx64
" the %d task type %s initialized, tbName:%s"
,
pJob
->
queryId
,
taskIdx
,
ctgTaskTypeStr
(
task
.
type
),
name
->
tname
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgHandleForceUpdate
(
SCatalog
*
pCtg
,
SCtgJob
*
pJob
,
const
SCatalogReq
*
pReq
)
{
int32_t
ctgHandleForceUpdate
(
SCatalog
*
pCtg
,
SCtgJob
*
pJob
,
const
SCatalogReq
*
pReq
)
{
int32_t
dbNum
=
pJob
->
dbCfgNum
+
pJob
->
dbVgNum
+
pJob
->
dbInfoNum
;
int32_t
dbNum
=
pJob
->
dbCfgNum
+
pJob
->
dbVgNum
+
pJob
->
dbInfoNum
;
if
(
dbNum
>
0
)
{
if
(
dbNum
>
0
)
{
...
@@ -329,8 +358,9 @@ int32_t ctgInitJob(CTG_PARAMS, SCtgJob** job, uint64_t reqId, const SCatalogReq*
...
@@ -329,8 +358,9 @@ int32_t ctgInitJob(CTG_PARAMS, SCtgJob** job, uint64_t reqId, const SCatalogReq*
int32_t
indexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pIndex
);
int32_t
indexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pIndex
);
int32_t
userNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUser
);
int32_t
userNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUser
);
int32_t
dbInfoNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbInfo
);
int32_t
dbInfoNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbInfo
);
int32_t
tbIndexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableIndex
);
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
dbCfgNum
+
indexNum
+
userNum
+
dbInfoNum
;
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
dbCfgNum
+
indexNum
+
userNum
+
dbInfoNum
+
tbIndexNum
;
if
(
*
taskNum
<=
0
)
{
if
(
*
taskNum
<=
0
)
{
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
reqId
);
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
reqId
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -360,6 +390,7 @@ int32_t ctgInitJob(CTG_PARAMS, SCtgJob** job, uint64_t reqId, const SCatalogReq*
...
@@ -360,6 +390,7 @@ int32_t ctgInitJob(CTG_PARAMS, SCtgJob** job, uint64_t reqId, const SCatalogReq*
pJob
->
indexNum
=
indexNum
;
pJob
->
indexNum
=
indexNum
;
pJob
->
userNum
=
userNum
;
pJob
->
userNum
=
userNum
;
pJob
->
dbInfoNum
=
dbInfoNum
;
pJob
->
dbInfoNum
=
dbInfoNum
;
pJob
->
tbIndexNum
=
tbIndexNum
;
pJob
->
pTasks
=
taosArrayInit
(
*
taskNum
,
sizeof
(
SCtgTask
));
pJob
->
pTasks
=
taosArrayInit
(
*
taskNum
,
sizeof
(
SCtgTask
));
...
@@ -398,6 +429,11 @@ int32_t ctgInitJob(CTG_PARAMS, SCtgJob** job, uint64_t reqId, const SCatalogReq*
...
@@ -398,6 +429,11 @@ int32_t ctgInitJob(CTG_PARAMS, SCtgJob** job, uint64_t reqId, const SCatalogReq*
CTG_ERR_JRET
(
ctgInitGetTbHashTask
(
pJob
,
taskIdx
++
,
name
));
CTG_ERR_JRET
(
ctgInitGetTbHashTask
(
pJob
,
taskIdx
++
,
name
));
}
}
for
(
int32_t
i
=
0
;
i
<
tbIndexNum
;
++
i
)
{
SName
*
name
=
taosArrayGet
(
pReq
->
pTableIndex
,
i
);
CTG_ERR_JRET
(
ctgInitGetTbIndexTask
(
pJob
,
taskIdx
++
,
name
));
}
for
(
int32_t
i
=
0
;
i
<
indexNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
indexNum
;
++
i
)
{
char
*
indexName
=
taosArrayGet
(
pReq
->
pIndex
,
i
);
char
*
indexName
=
taosArrayGet
(
pReq
->
pIndex
,
i
);
CTG_ERR_JRET
(
ctgInitGetIndexTask
(
pJob
,
taskIdx
++
,
indexName
));
CTG_ERR_JRET
(
ctgInitGetIndexTask
(
pJob
,
taskIdx
++
,
indexName
));
...
@@ -479,6 +515,21 @@ int32_t ctgDumpTbHashRes(SCtgTask* pTask) {
...
@@ -479,6 +515,21 @@ int32_t ctgDumpTbHashRes(SCtgTask* pTask) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgDumpTbIndexRes
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pTableIndex
)
{
pJob
->
jobRes
.
pTableIndex
=
taosArrayInit
(
pJob
->
tbIndexNum
,
sizeof
(
SMetaRes
));
if
(
NULL
==
pJob
->
jobRes
.
pTableIndex
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
SMetaRes
res
=
{.
code
=
pTask
->
code
,
.
pRes
=
pTask
->
res
};
taosArrayPush
(
pJob
->
jobRes
.
pTableHash
,
&
res
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgDumpIndexRes
(
SCtgTask
*
pTask
)
{
int32_t
ctgDumpIndexRes
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pIndex
)
{
if
(
NULL
==
pJob
->
jobRes
.
pIndex
)
{
...
@@ -817,6 +868,20 @@ _return:
...
@@ -817,6 +868,20 @@ _return:
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
int32_t
ctgHandleGetTbIndexRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
TSWAP
(
pTask
->
res
,
pTask
->
msgCtx
.
out
);
_return:
ctgHandleTaskEnd
(
pTask
,
code
);
CTG_RET
(
code
);
}
int32_t
ctgHandleGetDbCfgRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
ctgHandleGetDbCfgRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
...
@@ -1056,13 +1121,24 @@ _return:
...
@@ -1056,13 +1121,24 @@ _return:
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
int32_t
ctgLaunchGetTbIndexTask
(
SCtgTask
*
pTask
)
{
int32_t
code
=
0
;
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
void
*
pTrans
=
pTask
->
pJob
->
pTrans
;
const
SEpSet
*
pMgmtEps
=
&
pTask
->
pJob
->
pMgmtEps
;
SCtgTbIndexCtx
*
pCtx
=
(
SCtgTbIndexCtx
*
)
pTask
->
taskCtx
;
CTG_ERR_RET
(
ctgGetTbIndexFromMnode
(
CTG_PARAMS_LIST
(),
pCtx
->
pName
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgLaunchGetQnodeTask
(
SCtgTask
*
pTask
)
{
int32_t
ctgLaunchGetQnodeTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
void
*
pTrans
=
pTask
->
pJob
->
pTrans
;
void
*
pTrans
=
pTask
->
pJob
->
pTrans
;
const
SEpSet
*
pMgmtEps
=
&
pTask
->
pJob
->
pMgmtEps
;
const
SEpSet
*
pMgmtEps
=
&
pTask
->
pJob
->
pMgmtEps
;
CTG_ERR_RET
(
ctgGetQnodeListFromMnode
(
CTG_PARAMS_LIST
(),
NULL
,
pTask
));
CTG_ERR_RET
(
ctgGetQnodeListFromMnode
(
CTG_PARAMS_LIST
(),
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1174,6 +1250,7 @@ SCtgAsyncFps gCtgAsyncFps[] = {
...
@@ -1174,6 +1250,7 @@ SCtgAsyncFps gCtgAsyncFps[] = {
{
ctgLaunchGetDbInfoTask
,
ctgHandleGetDbInfoRsp
,
ctgDumpDbInfoRes
},
{
ctgLaunchGetDbInfoTask
,
ctgHandleGetDbInfoRsp
,
ctgDumpDbInfoRes
},
{
ctgLaunchGetTbMetaTask
,
ctgHandleGetTbMetaRsp
,
ctgDumpTbMetaRes
},
{
ctgLaunchGetTbMetaTask
,
ctgHandleGetTbMetaRsp
,
ctgDumpTbMetaRes
},
{
ctgLaunchGetTbHashTask
,
ctgHandleGetTbHashRsp
,
ctgDumpTbHashRes
},
{
ctgLaunchGetTbHashTask
,
ctgHandleGetTbHashRsp
,
ctgDumpTbHashRes
},
{
ctgLaunchGetTbIndexTask
,
ctgHandleGetTbIndexRsp
,
ctgDumpTbIndexRes
},
{
ctgLaunchGetIndexTask
,
ctgHandleGetIndexRsp
,
ctgDumpIndexRes
},
{
ctgLaunchGetIndexTask
,
ctgHandleGetIndexRsp
,
ctgDumpIndexRes
},
{
ctgLaunchGetUdfTask
,
ctgHandleGetUdfRsp
,
ctgDumpUdfRes
},
{
ctgLaunchGetUdfTask
,
ctgHandleGetUdfRsp
,
ctgDumpUdfRes
},
{
ctgLaunchGetUserTask
,
ctgHandleGetUserRsp
,
ctgDumpUserRes
},
{
ctgLaunchGetUserTask
,
ctgHandleGetUserRsp
,
ctgDumpUserRes
},
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
5bda367f
...
@@ -427,11 +427,13 @@ int32_t ctgGetIndexInfoFromMnode(CTG_PARAMS, const char *indexName, SIndexInfo *
...
@@ -427,11 +427,13 @@ int32_t ctgGetIndexInfoFromMnode(CTG_PARAMS, const char *indexName, SIndexInfo *
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgGetTbIndexFromMnode
(
CTG_PARAMS
,
const
char
*
tbFN
ame
,
SArray
**
out
,
SCtgTask
*
pTask
)
{
int32_t
ctgGetTbIndexFromMnode
(
CTG_PARAMS
,
SName
*
n
ame
,
SArray
**
out
,
SCtgTask
*
pTask
)
{
char
*
msg
=
NULL
;
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
msgLen
=
0
;
int32_t
reqType
=
TDMT_MND_GET_TABLE_INDEX
;
int32_t
reqType
=
TDMT_MND_GET_TABLE_INDEX
;
void
*
(
*
mallocFp
)(
int32_t
)
=
pTask
?
taosMemoryMalloc
:
rpcMallocCont
;
void
*
(
*
mallocFp
)(
int32_t
)
=
pTask
?
taosMemoryMalloc
:
rpcMallocCont
;
char
tbFName
[
TSDB_TABLE_FNAME_LEN
];
tNameExtractFullName
(
name
,
tbFName
);
ctgDebug
(
"try to get tb index from mnode, tbFName:%s"
,
tbFName
);
ctgDebug
(
"try to get tb index from mnode, tbFName:%s"
,
tbFName
);
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
5bda367f
...
@@ -60,6 +60,9 @@ void ctgFreeSMetaData(SMetaData* pData) {
...
@@ -60,6 +60,9 @@ void ctgFreeSMetaData(SMetaData* pData) {
taosArrayDestroy
(
pData
->
pTableHash
);
taosArrayDestroy
(
pData
->
pTableHash
);
pData
->
pTableHash
=
NULL
;
pData
->
pTableHash
=
NULL
;
taosArrayDestroy
(
pData
->
pTableIndex
);
pData
->
pTableIndex
=
NULL
;
taosArrayDestroy
(
pData
->
pUdfList
);
taosArrayDestroy
(
pData
->
pUdfList
);
pData
->
pUdfList
=
NULL
;
pData
->
pUdfList
=
NULL
;
...
@@ -248,6 +251,14 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) {
...
@@ -248,6 +251,14 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) {
taosMemoryFreeClear
(
pCtx
->
out
);
taosMemoryFreeClear
(
pCtx
->
out
);
break
;
break
;
}
}
case
TDMT_MND_GET_TABLE_INDEX
:
{
SArray
**
pOut
=
(
SArray
**
)
pCtx
->
out
;
if
(
pOut
)
{
taosArrayDestroyEx
(
*
pOut
,
tFreeSTableIndexInfo
);
taosMemoryFreeClear
(
pCtx
->
out
);
}
break
;
}
case
TDMT_MND_RETRIEVE_FUNC
:
{
case
TDMT_MND_RETRIEVE_FUNC
:
{
SFuncInfo
*
pOut
=
(
SFuncInfo
*
)
pCtx
->
out
;
SFuncInfo
*
pOut
=
(
SFuncInfo
*
)
pCtx
->
out
;
taosMemoryFree
(
pOut
->
pCode
);
taosMemoryFree
(
pOut
->
pCode
);
...
@@ -344,6 +355,13 @@ void ctgFreeTask(SCtgTask* pTask) {
...
@@ -344,6 +355,13 @@ void ctgFreeTask(SCtgTask* pTask) {
taosMemoryFreeClear
(
pTask
->
res
);
taosMemoryFreeClear
(
pTask
->
res
);
break
;
break
;
}
}
case
CTG_TASK_GET_TB_INDEX
:
{
SCtgTbIndexCtx
*
taskCtx
=
(
SCtgTbIndexCtx
*
)
pTask
->
taskCtx
;
taosMemoryFreeClear
(
taskCtx
->
pName
);
taosMemoryFreeClear
(
pTask
->
taskCtx
);
taosArrayDestroyEx
(
pTask
->
res
,
tFreeSTableIndexInfo
);
break
;
}
case
CTG_TASK_GET_INDEX
:
{
case
CTG_TASK_GET_INDEX
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
taosMemoryFreeClear
(
pTask
->
taskCtx
);
taosMemoryFreeClear
(
pTask
->
res
);
taosMemoryFreeClear
(
pTask
->
res
);
...
...
source/libs/command/inc/commandInt.h
浏览文件 @
5bda367f
...
@@ -32,15 +32,17 @@ extern "C" {
...
@@ -32,15 +32,17 @@ extern "C" {
#define EXPLAIN_PROJECTION_FORMAT "Projection"
#define EXPLAIN_PROJECTION_FORMAT "Projection"
#define EXPLAIN_JOIN_FORMAT "%s"
#define EXPLAIN_JOIN_FORMAT "%s"
#define EXPLAIN_AGG_FORMAT "Aggragate"
#define EXPLAIN_AGG_FORMAT "Aggragate"
#define EXPLAIN_INDEF_ROWS_FORMAT "Indefinite Rows Function"
#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1"
#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1"
#define EXPLAIN_SORT_FORMAT "Sort"
#define EXPLAIN_SORT_FORMAT "Sort"
#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s"
#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s"
#define EXPLAIN_FILL_FORMAT "Fill"
#define EXPLAIN_SESSION_FORMAT "Session"
#define EXPLAIN_SESSION_FORMAT "Session"
#define EXPLAIN_STATE_WINDOW_FORMAT "StateWindow on Column %s"
#define EXPLAIN_STATE_WINDOW_FORMAT "StateWindow on Column %s"
#define EXPLAIN_PARITION_FORMAT "Partition on Column %s"
#define EXPLAIN_PARITION_FORMAT "Partition on Column %s"
#define EXPLAIN_ORDER_FORMAT "Order: %s"
#define EXPLAIN_ORDER_FORMAT "Order: %s"
#define EXPLAIN_FILTER_FORMAT "Filter: "
#define EXPLAIN_FILTER_FORMAT "Filter: "
#define EXPLAIN_FILL_
FORMAT "Fill: %s
"
#define EXPLAIN_FILL_
VALUE_FORMAT "Fill Values:
"
#define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: "
#define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: "
#define EXPLAIN_TIMERANGE_FORMAT "Time Range: [%" PRId64 ", %" PRId64 "]"
#define EXPLAIN_TIMERANGE_FORMAT "Time Range: [%" PRId64 ", %" PRId64 "]"
#define EXPLAIN_OUTPUT_FORMAT "Output: "
#define EXPLAIN_OUTPUT_FORMAT "Output: "
...
@@ -66,6 +68,8 @@ extern "C" {
...
@@ -66,6 +68,8 @@ extern "C" {
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_FUNCTIONS_FORMAT "functions=%d"
#define EXPLAIN_FUNCTIONS_FORMAT "functions=%d"
#define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64
#define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64
#define EXPLAIN_MODE_FORMAT "mode=%s"
#define EXPLAIN_STRING_TYPE_FORMAT "%s"
typedef
struct
SExplainGroup
{
typedef
struct
SExplainGroup
{
int32_t
nodeNum
;
int32_t
nodeNum
;
...
...
source/libs/command/src/explain.c
浏览文件 @
5bda367f
...
@@ -179,6 +179,21 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo
...
@@ -179,6 +179,21 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo
pPhysiChildren
=
mergePhysiNode
->
node
.
pChildren
;
pPhysiChildren
=
mergePhysiNode
->
node
.
pChildren
;
break
;
break
;
}
}
case
QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC
:
{
SIndefRowsFuncPhysiNode
*
indefPhysiNode
=
(
SIndefRowsFuncPhysiNode
*
)
pNode
;
pPhysiChildren
=
indefPhysiNode
->
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
:
{
SMergeIntervalPhysiNode
*
intPhysiNode
=
(
SMergeIntervalPhysiNode
*
)
pNode
;
pPhysiChildren
=
intPhysiNode
->
window
.
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
{
SFillPhysiNode
*
fillPhysiNode
=
(
SFillPhysiNode
*
)
pNode
;
pPhysiChildren
=
fillPhysiNode
->
node
.
pChildren
;
break
;
}
default:
default:
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
...
@@ -212,12 +227,15 @@ int32_t qExplainGenerateResNodeExecInfo(SArray **pExecInfo, SExplainGroup *group
...
@@ -212,12 +227,15 @@ int32_t qExplainGenerateResNodeExecInfo(SArray **pExecInfo, SExplainGroup *group
SExplainRsp
*
rsp
=
NULL
;
SExplainRsp
*
rsp
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
group
->
nodeNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
group
->
nodeNum
;
++
i
)
{
rsp
=
taosArrayGet
(
group
->
nodeExecInfo
,
i
);
rsp
=
taosArrayGet
(
group
->
nodeExecInfo
,
i
);
/*
if (group->physiPlanExecIdx >= rsp->numOfPlans) {
if (group->physiPlanExecIdx >= rsp->numOfPlans) {
qError("physiPlanIdx %d exceed plan num %d", group->physiPlanExecIdx, rsp->numOfPlans);
qError("physiPlanIdx %d exceed plan num %d", group->physiPlanExecIdx, rsp->numOfPlans);
return TSDB_CODE_QRY_APP_ERROR;
return TSDB_CODE_QRY_APP_ERROR;
}
}
taosArrayPush(*pExecInfo, rsp->subplanInfo + group->physiPlanExecIdx);
taosArrayPush(*pExecInfo, rsp->subplanInfo + group->physiPlanExecIdx);
*/
taosArrayPush
(
*
pExecInfo
,
rsp
->
subplanInfo
);
}
}
++
group
->
physiPlanExecIdx
;
++
group
->
physiPlanExecIdx
;
...
@@ -599,6 +617,42 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
...
@@ -599,6 +617,42 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
}
break
;
break
;
}
}
case
QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC
:
{
SIndefRowsFuncPhysiNode
*
pIndefNode
=
(
SIndefRowsFuncPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_INDEF_ROWS_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
if
(
pIndefNode
->
pVectorFuncs
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_FUNCTIONS_FORMAT
,
pIndefNode
->
pVectorFuncs
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pIndefNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pIndefNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pIndefNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pIndefNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pIndefNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
:
{
case
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
:
{
SExchangePhysiNode
*
pExchNode
=
(
SExchangePhysiNode
*
)
pNode
;
SExchangePhysiNode
*
pExchNode
=
(
SExchangePhysiNode
*
)
pNode
;
SExplainGroup
*
group
=
taosHashGet
(
ctx
->
groupHash
,
&
pExchNode
->
srcGroupId
,
sizeof
(
pExchNode
->
srcGroupId
));
SExplainGroup
*
group
=
taosHashGet
(
ctx
->
groupHash
,
&
pExchNode
->
srcGroupId
,
sizeof
(
pExchNode
->
srcGroupId
));
...
@@ -607,7 +661,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
...
@@ -607,7 +661,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
}
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_EXCHANGE_FORMAT
,
group
->
nodeNum
);
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_EXCHANGE_FORMAT
,
pExchNode
->
singleChannel
?
1
:
group
->
nodeNum
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
...
@@ -750,6 +804,106 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
...
@@ -750,6 +804,106 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
}
break
;
break
;
}
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
:
{
SMergeIntervalPhysiNode
*
pIntNode
=
(
SMergeIntervalPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_INTERVAL_FORMAT
,
nodesGetNameFromColumnNode
(
pIntNode
->
window
.
pTspk
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_FUNCTIONS_FORMAT
,
pIntNode
->
window
.
pFuncs
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pIntNode
->
window
.
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pIntNode
->
window
.
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pIntNode
->
window
.
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
uint8_t
precision
=
getIntervalPrecision
(
pIntNode
);
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_TIME_WINDOWS_FORMAT
,
INVERAL_TIME_FROM_PRECISION_TO_UNIT
(
pIntNode
->
interval
,
pIntNode
->
intervalUnit
,
precision
),
pIntNode
->
intervalUnit
,
pIntNode
->
offset
,
getPrecisionUnit
(
precision
),
INVERAL_TIME_FROM_PRECISION_TO_UNIT
(
pIntNode
->
sliding
,
pIntNode
->
slidingUnit
,
precision
),
pIntNode
->
slidingUnit
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pIntNode
->
window
.
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pIntNode
->
window
.
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_FILL
:
{
SFillPhysiNode
*
pFillNode
=
(
SFillPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_FILL_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_MODE_FORMAT
,
nodesGetFillModeString
(
pFillNode
->
mode
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pFillNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pFillNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pFillNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pFillNode
->
pValues
)
{
SNodeListNode
*
pValues
=
(
SNodeListNode
*
)
pFillNode
->
pValues
;
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILL_VALUE_FORMAT
);
SNode
*
tNode
=
NULL
;
int32_t
i
=
0
;
FOREACH
(
tNode
,
pValues
->
pNodeList
)
{
if
(
i
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
SValueNode
*
tValue
=
(
SValueNode
*
)
tNode
;
char
*
value
=
nodesGetStrValueFromNode
(
tValue
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_STRING_TYPE_FORMAT
,
value
);
taosMemoryFree
(
value
);
++
i
;
}
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_TIMERANGE_FORMAT
,
pFillNode
->
timeRange
.
skey
,
pFillNode
->
timeRange
.
ekey
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pFillNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pFillNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION
:
{
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION
:
{
SSessionWinodwPhysiNode
*
pSessNode
=
(
SSessionWinodwPhysiNode
*
)
pNode
;
SSessionWinodwPhysiNode
*
pSessNode
=
(
SSessionWinodwPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_SESSION_FORMAT
);
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_SESSION_FORMAT
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
5bda367f
...
@@ -804,7 +804,7 @@ SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t
...
@@ -804,7 +804,7 @@ SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
);
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
,
bool
isStream
);
SOperatorInfo
*
createStreamFinalIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SOperatorInfo
*
createStreamFinalIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
int32_t
numOfChild
);
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
,
int32_t
numOfChild
);
SOperatorInfo
*
createStreamIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createStreamIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
...
@@ -892,8 +892,8 @@ STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowI
...
@@ -892,8 +892,8 @@ STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowI
int32_t
getNumOfRowsInTimeWindow
(
SDataBlockInfo
*
pDataBlockInfo
,
TSKEY
*
pPrimaryColumn
,
int32_t
startPos
,
TSKEY
ekey
,
int32_t
getNumOfRowsInTimeWindow
(
SDataBlockInfo
*
pDataBlockInfo
,
TSKEY
*
pPrimaryColumn
,
int32_t
startPos
,
TSKEY
ekey
,
__block_search_fn_t
searchFn
,
STableQueryInfo
*
item
,
int32_t
order
);
__block_search_fn_t
searchFn
,
STableQueryInfo
*
item
,
int32_t
order
);
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
int32_t
initS
essionAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
);
int32_t
initS
treamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
int32_t
initStateAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
);
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
size_t
size
);
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
);
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
);
SResultWindowInfo
*
getSessionTimeWindow
(
SArray
*
pWinInfos
,
TSKEY
ts
,
int64_t
gap
,
int32_t
*
pIndex
);
SResultWindowInfo
*
getSessionTimeWindow
(
SArray
*
pWinInfos
,
TSKEY
ts
,
int64_t
gap
,
int32_t
*
pIndex
);
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pTs
,
int32_t
rows
,
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pTs
,
int32_t
rows
,
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
5bda367f
...
@@ -1130,6 +1130,7 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
...
@@ -1130,6 +1130,7 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
pCtx
->
start
.
key
=
INT64_MIN
;
pCtx
->
start
.
key
=
INT64_MIN
;
pCtx
->
end
.
key
=
INT64_MIN
;
pCtx
->
end
.
key
=
INT64_MIN
;
pCtx
->
numOfParams
=
pExpr
->
base
.
numOfParams
;
pCtx
->
numOfParams
=
pExpr
->
base
.
numOfParams
;
pCtx
->
increase
=
false
;
pCtx
->
param
=
pFunct
->
pParam
;
pCtx
->
param
=
pFunct
->
pParam
;
// for (int32_t j = 0; j < pCtx->numOfParams; ++j) {
// for (int32_t j = 0; j < pCtx->numOfParams; ++j) {
...
@@ -2008,11 +2009,19 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI
...
@@ -2008,11 +2009,19 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI
// the _wstartts needs to copy to 20 following rows, since the results of top-k expands to 20 different rows.
// the _wstartts needs to copy to 20 following rows, since the results of top-k expands to 20 different rows.
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
char
*
in
=
GET_ROWCELL_INTERBUF
(
pCtx
[
j
].
resultInfo
);
char
*
in
=
GET_ROWCELL_INTERBUF
(
pCtx
[
j
].
resultInfo
);
if
(
pCtx
[
j
].
increase
)
{
int64_t
ts
=
*
(
int64_t
*
)
in
;
for
(
int32_t
k
=
0
;
k
<
pRow
->
numOfRows
;
++
k
)
{
colDataAppend
(
pColInfoData
,
pBlock
->
info
.
rows
+
k
,
(
const
char
*
)
&
ts
,
pCtx
[
j
].
resultInfo
->
isNullRes
);
ts
++
;
}
}
else
{
for
(
int32_t
k
=
0
;
k
<
pRow
->
numOfRows
;
++
k
)
{
for
(
int32_t
k
=
0
;
k
<
pRow
->
numOfRows
;
++
k
)
{
colDataAppend
(
pColInfoData
,
pBlock
->
info
.
rows
+
k
,
in
,
pCtx
[
j
].
resultInfo
->
isNullRes
);
colDataAppend
(
pColInfoData
,
pBlock
->
info
.
rows
+
k
,
in
,
pCtx
[
j
].
resultInfo
->
isNullRes
);
}
}
}
}
}
}
}
releaseBufPage
(
pBuf
,
page
);
releaseBufPage
(
pBuf
,
page
);
pBlock
->
info
.
rows
+=
pRow
->
numOfRows
;
pBlock
->
info
.
rows
+=
pRow
->
numOfRows
;
...
@@ -4676,7 +4685,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4676,7 +4685,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
}
}
int32_t
tsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
int32_t
tsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
pOptr
=
createIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
tsSlotId
,
&
as
,
pTaskInfo
);
bool
isStream
=
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
==
type
);
pOptr
=
createIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
tsSlotId
,
&
as
,
pTaskInfo
,
isStream
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
==
type
)
{
int32_t
children
=
8
;
int32_t
children
=
8
;
...
@@ -5339,7 +5349,8 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
...
@@ -5339,7 +5349,8 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
size_t
size
)
{
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
size_t
size
)
{
pSup
->
resultRowSize
=
getResultRowSize
(
pCtx
,
numOfOutput
);
pSup
->
keySize
=
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
);
pSup
->
keySize
=
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
);
pSup
->
pKeyBuf
=
taosMemoryCalloc
(
1
,
pSup
->
keySize
);
pSup
->
pKeyBuf
=
taosMemoryCalloc
(
1
,
pSup
->
keySize
);
pSup
->
pResultRows
=
taosArrayInit
(
1024
,
size
);
pSup
->
pResultRows
=
taosArrayInit
(
1024
,
size
);
...
@@ -5358,15 +5369,11 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, const char* pKey, size
...
@@ -5358,15 +5369,11 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, const char* pKey, size
if
(
bufSize
<=
pageSize
)
{
if
(
bufSize
<=
pageSize
)
{
bufSize
=
pageSize
*
4
;
bufSize
=
pageSize
*
4
;
}
}
return
createDiskbasedBuf
(
&
pSup
->
pResultBuf
,
pageSize
,
bufSize
,
pKey
,
TD_TMP_DIR_PATH
);
int32_t
code
=
createDiskbasedBuf
(
&
pSup
->
pResultBuf
,
pageSize
,
bufSize
,
pKey
,
TD_TMP_DIR_PATH
);
}
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
pCtx
[
i
].
pBuf
=
pSup
->
pResultBuf
;
int32_t
initSessionAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
)
{
}
return
initStreamAggSupporter
(
pSup
,
pKey
,
sizeof
(
SResultWindowInfo
));
return
code
;
}
int32_t
initStateAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
)
{
return
initStreamAggSupporter
(
pSup
,
pKey
,
sizeof
(
SStateWindowInfo
));
}
}
int64_t
getSmaWaterMark
(
int64_t
interval
,
double
filesFactor
)
{
int64_t
getSmaWaterMark
(
int64_t
interval
,
double
filesFactor
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
5bda367f
...
@@ -1756,6 +1756,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
...
@@ -1756,6 +1756,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
;
;
pInfo
->
readHandle
=
*
pReadHandle
;
pInfo
->
readHandle
=
*
pReadHandle
;
pInfo
->
curPos
=
0
;
pInfo
->
curPos
=
0
;
pInfo
->
pFilterNode
=
pPhyNode
->
node
.
pConditions
;
pOperator
->
name
=
"TagScanOperator"
;
pOperator
->
name
=
"TagScanOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
;
pOperator
->
blocking
=
false
;
pOperator
->
blocking
=
false
;
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
5bda367f
...
@@ -1438,9 +1438,15 @@ static bool timeWindowinterpNeeded(SqlFunctionCtx* pCtx, int32_t numOfCols, SInt
...
@@ -1438,9 +1438,15 @@ static bool timeWindowinterpNeeded(SqlFunctionCtx* pCtx, int32_t numOfCols, SInt
return
needed
;
return
needed
;
}
}
void
increaseTs
(
SqlFunctionCtx
*
pCtx
)
{
if
(
pCtx
[
0
].
pExpr
->
pExpr
->
_function
.
pFunctNode
->
funcType
==
FUNCTION_TYPE_WSTARTTS
)
{
pCtx
[
0
].
increase
=
true
;
}
}
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
)
{
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
,
bool
isStream
)
{
SIntervalAggOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SIntervalAggOperatorInfo
));
SIntervalAggOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SIntervalAggOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
@@ -1461,6 +1467,11 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
...
@@ -1461,6 +1467,11 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
int32_t
code
=
int32_t
code
=
initAggInfo
(
&
pInfo
->
binfo
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
pResBlock
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
initAggInfo
(
&
pInfo
->
binfo
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
pResBlock
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
if
(
isStream
)
{
ASSERT
(
numOfCols
>
0
);
increaseTs
(
pInfo
->
binfo
.
pCtx
);
}
initExecTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
pInfo
->
win
);
initExecTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
pInfo
->
win
);
pInfo
->
invertible
=
allInvertible
(
pInfo
->
binfo
.
pCtx
,
numOfCols
);
pInfo
->
invertible
=
allInvertible
(
pInfo
->
binfo
.
pCtx
,
numOfCols
);
...
@@ -2128,6 +2139,8 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
...
@@ -2128,6 +2139,8 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyNode
->
pOutputDataBlockDesc
);
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyNode
->
pOutputDataBlockDesc
);
int32_t
code
=
initAggInfo
(
&
pInfo
->
binfo
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
int32_t
code
=
initAggInfo
(
&
pInfo
->
binfo
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
pResBlock
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
pResBlock
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
ASSERT
(
numOfCols
>
0
);
increaseTs
(
pInfo
->
binfo
.
pCtx
);
initExecTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
pTaskInfo
->
window
);
initExecTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
pTaskInfo
->
window
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
...
@@ -2212,6 +2225,8 @@ int32_t initBiasicInfo(SOptrBasicInfo* pBasicInfo, SExprInfo* pExprInfo,
...
@@ -2212,6 +2225,8 @@ int32_t initBiasicInfo(SOptrBasicInfo* pBasicInfo, SExprInfo* pExprInfo,
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
pBasicInfo
->
pCtx
[
i
].
pBuf
=
NULL
;
pBasicInfo
->
pCtx
[
i
].
pBuf
=
NULL
;
}
}
ASSERT
(
numOfCols
>
0
);
increaseTs
(
pBasicInfo
->
pCtx
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -2228,6 +2243,10 @@ void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, int
...
@@ -2228,6 +2243,10 @@ void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, int
pScanInfo
->
pUpdateInfo
=
updateInfoInit
(
60000
,
TSDB_TIME_PRECISION_MILLI
,
waterMark
);
pScanInfo
->
pUpdateInfo
=
updateInfoInit
(
60000
,
TSDB_TIME_PRECISION_MILLI
,
waterMark
);
}
}
int32_t
initSessionAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
return
initStreamAggSupporter
(
pSup
,
pKey
,
pCtx
,
numOfOutput
,
sizeof
(
SResultWindowInfo
));
}
SOperatorInfo
*
createStreamSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createStreamSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
int64_t
gap
,
int32_t
tsSlotId
,
SSDataBlock
*
pResBlock
,
int64_t
gap
,
int32_t
tsSlotId
,
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
)
{
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
)
{
...
@@ -2244,8 +2263,8 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SEx
...
@@ -2244,8 +2263,8 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SEx
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
pInfo
->
streamAggSup
.
resultRowSize
=
getResultRowSize
(
pInfo
->
binfo
.
pCtx
,
numOfCols
);
code
=
initSessionAggSupporter
(
&
pInfo
->
streamAggSup
,
"StreamSessionAggOperatorInfo"
);
code
=
initSessionAggSupporter
(
&
pInfo
->
streamAggSup
,
"StreamSessionAggOperatorInfo"
,
pInfo
->
binfo
.
pCtx
,
numOfCols
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
@@ -3097,6 +3116,10 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
...
@@ -3097,6 +3116,10 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
return
pBInfo
->
pRes
->
info
.
rows
==
0
?
NULL
:
pBInfo
->
pRes
;
return
pBInfo
->
pRes
->
info
.
rows
==
0
?
NULL
:
pBInfo
->
pRes
;
}
}
int32_t
initStateAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
return
initStreamAggSupporter
(
pSup
,
pKey
,
pCtx
,
numOfOutput
,
sizeof
(
SStateWindowInfo
));
}
SOperatorInfo
*
createStreamStateAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SOperatorInfo
*
createStreamStateAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
)
{
SExecTaskInfo
*
pTaskInfo
)
{
SStreamStateWinodwPhysiNode
*
pStateNode
=
(
SStreamStateWinodwPhysiNode
*
)
pPhyNode
;
SStreamStateWinodwPhysiNode
*
pStateNode
=
(
SStreamStateWinodwPhysiNode
*
)
pPhyNode
;
...
@@ -3130,8 +3153,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
...
@@ -3130,8 +3153,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
goto
_error
;
goto
_error
;
}
}
pInfo
->
streamAggSup
.
resultRowSize
=
getResultRowSize
(
pInfo
->
binfo
.
pCtx
,
numOfCols
);
code
=
initStateAggSupporter
(
&
pInfo
->
streamAggSup
,
"StreamStateAggOperatorInfo"
,
pInfo
->
binfo
.
pCtx
,
numOfCols
);
code
=
initStateAggSupporter
(
&
pInfo
->
streamAggSup
,
"StreamStateAggOperatorInfo"
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
...
source/libs/function/inc/builtinsimpl.h
浏览文件 @
5bda367f
...
@@ -102,6 +102,8 @@ bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
...
@@ -102,6 +102,8 @@ bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
int32_t
topFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
topFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
bottomFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
bottomFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
topBotFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
topBotFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
topCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
);
int32_t
bottomCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
);
bool
getSpreadFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
getSpreadFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
spreadFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
);
bool
spreadFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
);
...
@@ -126,7 +128,10 @@ int32_t getHistogramInfoSize();
...
@@ -126,7 +128,10 @@ int32_t getHistogramInfoSize();
bool
getHLLFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
getHLLFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
int32_t
hllFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
hllFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
hllFunctionMerge
(
SqlFunctionCtx
*
pCtx
);
int32_t
hllFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
hllFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
hllPartialFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
getHLLInfoSize
();
bool
getStateFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
getStateFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
stateFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
);
bool
stateFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
);
...
...
source/libs/function/src/builtins.c
浏览文件 @
5bda367f
...
@@ -313,6 +313,7 @@ static int32_t translateApercentileImpl(SFunctionNode* pFunc, char* pErrBuf, int
...
@@ -313,6 +313,7 @@ static int32_t translateApercentileImpl(SFunctionNode* pFunc, char* pErrBuf, int
static
int32_t
translateApercentilePartial
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateApercentilePartial
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateApercentileImpl
(
pFunc
,
pErrBuf
,
len
,
true
);
return
translateApercentileImpl
(
pFunc
,
pErrBuf
,
len
,
true
);
}
}
static
int32_t
translateApercentileMerge
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateApercentileMerge
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateApercentileImpl
(
pFunc
,
pErrBuf
,
len
,
false
);
return
translateApercentileImpl
(
pFunc
,
pErrBuf
,
len
,
false
);
}
}
...
@@ -401,6 +402,7 @@ static int32_t translateSpreadImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -401,6 +402,7 @@ static int32_t translateSpreadImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t
static
int32_t
translateSpreadPartial
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateSpreadPartial
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateSpreadImpl
(
pFunc
,
pErrBuf
,
len
,
true
);
return
translateSpreadImpl
(
pFunc
,
pErrBuf
,
len
,
true
);
}
}
static
int32_t
translateSpreadMerge
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateSpreadMerge
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateSpreadImpl
(
pFunc
,
pErrBuf
,
len
,
false
);
return
translateSpreadImpl
(
pFunc
,
pErrBuf
,
len
,
false
);
}
}
...
@@ -551,6 +553,7 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32
...
@@ -551,6 +553,7 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32
static
int32_t
translateHistogramPartial
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateHistogramPartial
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateHistogramImpl
(
pFunc
,
pErrBuf
,
len
,
true
);
return
translateHistogramImpl
(
pFunc
,
pErrBuf
,
len
,
true
);
}
}
static
int32_t
translateHistogramMerge
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateHistogramMerge
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateHistogramImpl
(
pFunc
,
pErrBuf
,
len
,
false
);
return
translateHistogramImpl
(
pFunc
,
pErrBuf
,
len
,
false
);
}
}
...
@@ -564,6 +567,28 @@ static int32_t translateHLL(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
...
@@ -564,6 +567,28 @@ static int32_t translateHLL(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
translateHLLImpl
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
,
bool
isPartial
)
{
if
(
1
!=
LIST_LENGTH
(
pFunc
->
pParameterList
))
{
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
if
(
isPartial
)
{
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
getHistogramInfoSize
()
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
};
}
else
{
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BIGINT
].
bytes
,
.
type
=
TSDB_DATA_TYPE_BIGINT
};
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateHLLPartial
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateHLLImpl
(
pFunc
,
pErrBuf
,
len
,
true
);
}
static
int32_t
translateHLLMerge
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
return
translateHLLImpl
(
pFunc
,
pErrBuf
,
len
,
false
);
}
static
bool
validateStateOper
(
const
SValueNode
*
pVal
)
{
static
bool
validateStateOper
(
const
SValueNode
*
pVal
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
return
false
;
return
false
;
...
@@ -1339,6 +1364,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1339,6 +1364,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
initFunc
=
functionSetup
,
.
initFunc
=
functionSetup
,
.
processFunc
=
topFunction
,
.
processFunc
=
topFunction
,
.
finalizeFunc
=
topBotFinalize
,
.
finalizeFunc
=
topBotFinalize
,
.
combineFunc
=
topCombine
,
},
},
{
{
.
name
=
"bottom"
,
.
name
=
"bottom"
,
...
@@ -1348,7 +1374,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1348,7 +1374,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
getEnvFunc
=
getTopBotFuncEnv
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
initFunc
=
functionSetup
,
.
initFunc
=
functionSetup
,
.
processFunc
=
bottomFunction
,
.
processFunc
=
bottomFunction
,
.
finalizeFunc
=
topBotFinalize
.
finalizeFunc
=
topBotFinalize
,
.
combineFunc
=
bottomCombine
,
},
},
{
{
.
name
=
"spread"
,
.
name
=
"spread"
,
...
@@ -1478,6 +1505,28 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1478,6 +1505,28 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
getEnvFunc
=
getHLLFuncEnv
,
.
getEnvFunc
=
getHLLFuncEnv
,
.
initFunc
=
functionSetup
,
.
initFunc
=
functionSetup
,
.
processFunc
=
hllFunction
,
.
processFunc
=
hllFunction
,
.
finalizeFunc
=
hllFinalize
,
.
pPartialFunc
=
"_hyperloglog_partial"
,
.
pMergeFunc
=
"_hyperloglog_merge"
},
{
.
name
=
"_hyperloglog_partial"
,
.
type
=
FUNCTION_TYPE_HYPERLOGLOG_PARTIAL
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateHLLPartial
,
.
getEnvFunc
=
getHLLFuncEnv
,
.
initFunc
=
functionSetup
,
.
processFunc
=
hllFunction
,
.
finalizeFunc
=
hllPartialFinalize
},
{
.
name
=
"_hyperloglog_merge"
,
.
type
=
FUNCTION_TYPE_HYPERLOGLOG_MERGE
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateHLLMerge
,
.
getEnvFunc
=
getHLLFuncEnv
,
.
initFunc
=
functionSetup
,
.
processFunc
=
hllFunctionMerge
,
.
finalizeFunc
=
hllFinalize
.
finalizeFunc
=
hllFinalize
},
},
{
{
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
5bda367f
...
@@ -1389,6 +1389,18 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple
...
@@ -1389,6 +1389,18 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple
}
}
}
}
void
releaseSource
(
STuplePos
*
pPos
)
{
if
(
pPos
->
pageId
==
-
1
)
{
return
;
}
// Todo(liuyao) relase row
}
void
replaceTupleData
(
STuplePos
*
pDestPos
,
STuplePos
*
pSourcePos
)
{
releaseSource
(
pDestPos
);
*
pDestPos
=
*
pSourcePos
;
}
int32_t
minMaxCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
,
int32_t
isMinFunc
)
{
int32_t
minMaxCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
,
int32_t
isMinFunc
)
{
SResultRowEntryInfo
*
pDResInfo
=
GET_RES_INFO
(
pDestCtx
);
SResultRowEntryInfo
*
pDResInfo
=
GET_RES_INFO
(
pDestCtx
);
SMinmaxResInfo
*
pDBuf
=
GET_ROWCELL_INTERBUF
(
pDResInfo
);
SMinmaxResInfo
*
pDBuf
=
GET_ROWCELL_INTERBUF
(
pDResInfo
);
...
@@ -1400,10 +1412,12 @@ int32_t minMaxCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx, int3
...
@@ -1400,10 +1412,12 @@ int32_t minMaxCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx, int3
if
(
pSBuf
->
assign
&&
if
(
pSBuf
->
assign
&&
(
(((
*
(
double
*
)
&
pDBuf
->
v
)
<
(
*
(
double
*
)
&
pSBuf
->
v
))
^
isMinFunc
)
||
!
pDBuf
->
assign
)
)
{
(
(((
*
(
double
*
)
&
pDBuf
->
v
)
<
(
*
(
double
*
)
&
pSBuf
->
v
))
^
isMinFunc
)
||
!
pDBuf
->
assign
)
)
{
*
(
double
*
)
&
pDBuf
->
v
=
*
(
double
*
)
&
pSBuf
->
v
;
*
(
double
*
)
&
pDBuf
->
v
=
*
(
double
*
)
&
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
}
}
}
else
{
}
else
{
if
(
pSBuf
->
assign
&&
(
((
pDBuf
->
v
<
pSBuf
->
v
)
^
isMinFunc
)
||
!
pDBuf
->
assign
)
)
{
if
(
pSBuf
->
assign
&&
(
((
pDBuf
->
v
<
pSBuf
->
v
)
^
isMinFunc
)
||
!
pDBuf
->
assign
)
)
{
pDBuf
->
v
=
pSBuf
->
v
;
pDBuf
->
v
=
pSBuf
->
v
;
replaceTupleData
(
&
pDBuf
->
tuplePos
,
&
pSBuf
->
tuplePos
);
}
}
}
}
pDResInfo
->
numOfRes
=
TMAX
(
pDResInfo
->
numOfRes
,
pSResInfo
->
numOfRes
);
pDResInfo
->
numOfRes
=
TMAX
(
pDResInfo
->
numOfRes
,
pSResInfo
->
numOfRes
);
...
@@ -2856,7 +2870,6 @@ void copyTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pS
...
@@ -2856,7 +2870,6 @@ void copyTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pS
int32_t
topBotFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
int32_t
topBotFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SResultRowEntryInfo
*
pEntryInfo
=
GET_RES_INFO
(
pCtx
);
SResultRowEntryInfo
*
pEntryInfo
=
GET_RES_INFO
(
pCtx
);
STopBotRes
*
pRes
=
GET_ROWCELL_INTERBUF
(
pEntryInfo
);
STopBotRes
*
pRes
=
GET_ROWCELL_INTERBUF
(
pEntryInfo
);
pEntryInfo
->
complete
=
true
;
int32_t
type
=
pCtx
->
input
.
pData
[
0
]
->
info
.
type
;
int32_t
type
=
pCtx
->
input
.
pData
[
0
]
->
info
.
type
;
int32_t
slotId
=
pCtx
->
pExpr
->
base
.
resSchema
.
slotId
;
int32_t
slotId
=
pCtx
->
pExpr
->
base
.
resSchema
.
slotId
;
...
@@ -2881,6 +2894,67 @@ int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -2881,6 +2894,67 @@ int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return
pEntryInfo
->
numOfRes
;
return
pEntryInfo
->
numOfRes
;
}
}
void
addResult
(
SqlFunctionCtx
*
pCtx
,
STopBotResItem
*
pSourceItem
,
int16_t
type
,
bool
isTopQuery
)
{
SResultRowEntryInfo
*
pEntryInfo
=
GET_RES_INFO
(
pCtx
);
STopBotRes
*
pRes
=
getTopBotOutputInfo
(
pCtx
);
int32_t
maxSize
=
pCtx
->
param
[
1
].
param
.
i
;
STopBotResItem
*
pItems
=
pRes
->
pItems
;
assert
(
pItems
!=
NULL
);
// not full yet
if
(
pEntryInfo
->
numOfRes
<
maxSize
)
{
STopBotResItem
*
pItem
=
&
pItems
[
pEntryInfo
->
numOfRes
];
pItem
->
v
=
pSourceItem
->
v
;
pItem
->
uid
=
pSourceItem
->
uid
;
pItem
->
tuplePos
.
pageId
=
-
1
;
replaceTupleData
(
&
pItem
->
tuplePos
,
&
pSourceItem
->
tuplePos
);
pEntryInfo
->
numOfRes
++
;
taosheapsort
((
void
*
)
pItems
,
sizeof
(
STopBotResItem
),
pEntryInfo
->
numOfRes
,
(
const
void
*
)
&
type
,
topBotResComparFn
,
!
isTopQuery
);
}
else
{
// replace the minimum value in the result
if
((
isTopQuery
&&
(
(
IS_SIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
i
>
pItems
[
0
].
v
.
i
)
||
(
IS_UNSIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
u
>
pItems
[
0
].
v
.
u
)
||
(
IS_FLOAT_TYPE
(
type
)
&&
pSourceItem
->
v
.
d
>
pItems
[
0
].
v
.
d
)))
||
(
!
isTopQuery
&&
(
(
IS_SIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
i
<
pItems
[
0
].
v
.
i
)
||
(
IS_UNSIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
u
<
pItems
[
0
].
v
.
u
)
||
(
IS_FLOAT_TYPE
(
type
)
&&
pSourceItem
->
v
.
d
<
pItems
[
0
].
v
.
d
))
))
{
// replace the old data and the coresponding tuple data
STopBotResItem
*
pItem
=
&
pItems
[
0
];
pItem
->
v
=
pSourceItem
->
v
;
pItem
->
uid
=
pSourceItem
->
uid
;
// save the data of this tuple by over writing the old data
replaceTupleData
(
&
pItem
->
tuplePos
,
&
pSourceItem
->
tuplePos
);
taosheapadjust
((
void
*
)
pItems
,
sizeof
(
STopBotResItem
),
0
,
pEntryInfo
->
numOfRes
-
1
,
(
const
void
*
)
&
type
,
topBotResComparFn
,
NULL
,
!
isTopQuery
);
}
}
}
int32_t
topCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
)
{
int32_t
type
=
pDestCtx
->
input
.
pData
[
0
]
->
info
.
type
;
SResultRowEntryInfo
*
pSResInfo
=
GET_RES_INFO
(
pSourceCtx
);
STopBotRes
*
pSBuf
=
getTopBotOutputInfo
(
pSourceCtx
);
for
(
int32_t
i
=
0
;
i
<
pSResInfo
->
numOfRes
;
i
++
)
{
addResult
(
pDestCtx
,
pSBuf
->
pItems
+
i
,
type
,
true
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
bottomCombine
(
SqlFunctionCtx
*
pDestCtx
,
SqlFunctionCtx
*
pSourceCtx
)
{
int32_t
type
=
pDestCtx
->
input
.
pData
[
0
]
->
info
.
type
;
SResultRowEntryInfo
*
pSResInfo
=
GET_RES_INFO
(
pSourceCtx
);
STopBotRes
*
pSBuf
=
getTopBotOutputInfo
(
pSourceCtx
);
for
(
int32_t
i
=
0
;
i
<
pSResInfo
->
numOfRes
;
i
++
)
{
addResult
(
pDestCtx
,
pSBuf
->
pItems
+
i
,
type
,
false
);
}
return
TSDB_CODE_SUCCESS
;
}
bool
getSpreadFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
bool
getSpreadFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
pEnv
->
calcMemSize
=
sizeof
(
SSpreadInfo
);
pEnv
->
calcMemSize
=
sizeof
(
SSpreadInfo
);
return
true
;
return
true
;
...
@@ -3411,7 +3485,6 @@ int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -3411,7 +3485,6 @@ int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
}
int32_t
histogramPartialFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
int32_t
histogramPartialFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SHistoFuncInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
SHistoFuncInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
int32_t
resultBytes
=
getHistogramInfoSize
();
int32_t
resultBytes
=
getHistogramInfoSize
();
char
*
res
=
taosMemoryCalloc
(
resultBytes
+
VARSTR_HEADER_SIZE
,
sizeof
(
char
));
char
*
res
=
taosMemoryCalloc
(
resultBytes
+
VARSTR_HEADER_SIZE
,
sizeof
(
char
));
...
@@ -3428,6 +3501,10 @@ int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -3428,6 +3501,10 @@ int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return
1
;
return
1
;
}
}
int32_t
getHLLInfoSize
()
{
return
(
int32_t
)
sizeof
(
SHLLInfo
);
}
bool
getHLLFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
bool
getHLLFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
pEnv
->
calcMemSize
=
sizeof
(
SHLLInfo
);
pEnv
->
calcMemSize
=
sizeof
(
SHLLInfo
);
return
true
;
return
true
;
...
@@ -3553,6 +3630,27 @@ int32_t hllFunction(SqlFunctionCtx *pCtx) {
...
@@ -3553,6 +3630,27 @@ int32_t hllFunction(SqlFunctionCtx *pCtx) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
hllFunctionMerge
(
SqlFunctionCtx
*
pCtx
)
{
SInputColumnInfoData
*
pInput
=
&
pCtx
->
input
;
SColumnInfoData
*
pCol
=
pInput
->
pData
[
0
];
ASSERT
(
pCol
->
info
.
type
==
TSDB_DATA_TYPE_BINARY
);
SHLLInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
int32_t
start
=
pInput
->
startRowIndex
;
char
*
data
=
colDataGetData
(
pCol
,
start
);
SHLLInfo
*
pInputInfo
=
(
SHLLInfo
*
)
varDataVal
(
data
);
for
(
int32_t
k
=
0
;
k
<
HLL_BUCKETS
;
++
k
)
{
if
(
pInfo
->
buckets
[
k
]
<
pInputInfo
->
buckets
[
k
])
{
pInfo
->
buckets
[
k
]
=
pInputInfo
->
buckets
[
k
];
}
}
SET_VAL
(
GET_RES_INFO
(
pCtx
),
1
,
1
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
hllFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
int32_t
hllFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SResultRowEntryInfo
*
pInfo
=
GET_RES_INFO
(
pCtx
);
SResultRowEntryInfo
*
pInfo
=
GET_RES_INFO
(
pCtx
);
...
@@ -3565,6 +3663,24 @@ int32_t hllFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -3565,6 +3663,24 @@ int32_t hllFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return
functionFinalize
(
pCtx
,
pBlock
);
return
functionFinalize
(
pCtx
,
pBlock
);
}
}
int32_t
hllPartialFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SHLLInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
int32_t
resultBytes
=
getHLLInfoSize
();
char
*
res
=
taosMemoryCalloc
(
resultBytes
+
VARSTR_HEADER_SIZE
,
sizeof
(
char
));
memcpy
(
varDataVal
(
res
),
pInfo
,
resultBytes
);
varDataSetLen
(
res
,
resultBytes
);
int32_t
slotId
=
pCtx
->
pExpr
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
colDataAppend
(
pCol
,
pBlock
->
info
.
rows
,
res
,
false
);
taosMemoryFree
(
res
);
return
pResInfo
->
numOfRes
;
}
bool
getStateFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
bool
getStateFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
pEnv
->
calcMemSize
=
sizeof
(
SStateInfo
);
pEnv
->
calcMemSize
=
sizeof
(
SStateInfo
);
return
true
;
return
true
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
5bda367f
...
@@ -1186,6 +1186,7 @@ static int32_t createExchangePhysiNodeByMerge(SMergePhysiNode* pMerge) {
...
@@ -1186,6 +1186,7 @@ static int32_t createExchangePhysiNodeByMerge(SMergePhysiNode* pMerge) {
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pExchange
->
srcGroupId
=
pMerge
->
srcGroupId
;
pExchange
->
srcGroupId
=
pMerge
->
srcGroupId
;
pExchange
->
singleChannel
=
true
;
pExchange
->
node
.
pParent
=
(
SPhysiNode
*
)
pMerge
;
pExchange
->
node
.
pParent
=
(
SPhysiNode
*
)
pMerge
;
pExchange
->
node
.
pOutputDataBlockDesc
=
nodesCloneNode
(
pMerge
->
node
.
pOutputDataBlockDesc
);
pExchange
->
node
.
pOutputDataBlockDesc
=
nodesCloneNode
(
pMerge
->
node
.
pOutputDataBlockDesc
);
if
(
NULL
==
pExchange
->
node
.
pOutputDataBlockDesc
)
{
if
(
NULL
==
pExchange
->
node
.
pOutputDataBlockDesc
)
{
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
5bda367f
...
@@ -348,7 +348,7 @@ static FORCE_INLINE void varToNchar(char* buf, SScalarParam* pOut, int32_t rowIn
...
@@ -348,7 +348,7 @@ static FORCE_INLINE void varToNchar(char* buf, SScalarParam* pOut, int32_t rowIn
int32_t
outputMaxLen
=
(
inputLen
+
1
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
int32_t
outputMaxLen
=
(
inputLen
+
1
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
char
*
t
=
taosMemoryCalloc
(
1
,
outputMaxLen
);
char
*
t
=
taosMemoryCalloc
(
1
,
outputMaxLen
);
/*int32_t resLen = */
taosMbsToUcs4
(
varDataVal
(
buf
),
inputLen
,
(
TdUcs4
*
)
varDataVal
(
t
),
outputMaxLen
,
&
len
);
/*int32_t resLen = */
taosMbsToUcs4
(
varDataVal
(
buf
),
inputLen
,
(
TdUcs4
*
)
varDataVal
(
t
),
outputMaxLen
-
VARSTR_HEADER_SIZE
,
&
len
);
varDataSetLen
(
t
,
len
);
varDataSetLen
(
t
,
len
);
colDataAppend
(
pOut
->
columnData
,
rowIndex
,
t
,
false
);
colDataAppend
(
pOut
->
columnData
,
rowIndex
,
t
,
false
);
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
5bda367f
...
@@ -253,6 +253,8 @@ int walRoll(SWal *pWal) {
...
@@ -253,6 +253,8 @@ int walRoll(SWal *pWal) {
static
int
walWriteIndex
(
SWal
*
pWal
,
int64_t
ver
,
int64_t
offset
)
{
static
int
walWriteIndex
(
SWal
*
pWal
,
int64_t
ver
,
int64_t
offset
)
{
SWalIdxEntry
entry
=
{.
ver
=
ver
,
.
offset
=
offset
};
SWalIdxEntry
entry
=
{.
ver
=
ver
,
.
offset
=
offset
};
/*int64_t idxOffset = taosLSeekFile(pWal->pWriteIdxTFile, 0, SEEK_CUR);*/
/*wDebug("write index: ver: %ld, offset: %ld, at %ld", ver, offset, idxOffset);*/
int
size
=
taosWriteFile
(
pWal
->
pWriteIdxTFile
,
&
entry
,
sizeof
(
SWalIdxEntry
));
int
size
=
taosWriteFile
(
pWal
->
pWriteIdxTFile
,
&
entry
,
sizeof
(
SWalIdxEntry
));
if
(
size
!=
sizeof
(
SWalIdxEntry
))
{
if
(
size
!=
sizeof
(
SWalIdxEntry
))
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
...
source/os/src/osFile.c
浏览文件 @
5bda367f
...
@@ -316,12 +316,12 @@ int64_t taosCloseFile(TdFilePtr *ppFile) {
...
@@ -316,12 +316,12 @@ int64_t taosCloseFile(TdFilePtr *ppFile) {
(
*
ppFile
)
->
fp
=
NULL
;
(
*
ppFile
)
->
fp
=
NULL
;
}
}
if
((
*
ppFile
)
->
fd
>=
0
)
{
if
((
*
ppFile
)
->
fd
>=
0
)
{
#ifdef WINDOWS
#ifdef WINDOWS
HANDLE
h
=
(
HANDLE
)
_get_osfhandle
((
*
ppFile
)
->
fd
);
HANDLE
h
=
(
HANDLE
)
_get_osfhandle
((
*
ppFile
)
->
fd
);
!
FlushFileBuffers
(
h
);
!
FlushFileBuffers
(
h
);
#else
#else
fsync
((
*
ppFile
)
->
fd
);
fsync
((
*
ppFile
)
->
fd
);
#endif
#endif
close
((
*
ppFile
)
->
fd
);
close
((
*
ppFile
)
->
fd
);
(
*
ppFile
)
->
fd
=
-
1
;
(
*
ppFile
)
->
fd
=
-
1
;
}
}
...
@@ -345,11 +345,11 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
...
@@ -345,11 +345,11 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
char
*
tbuf
=
(
char
*
)
buf
;
char
*
tbuf
=
(
char
*
)
buf
;
while
(
leftbytes
>
0
)
{
while
(
leftbytes
>
0
)
{
#ifdef WINDOWS
#ifdef WINDOWS
readbytes
=
_read
(
pFile
->
fd
,
(
void
*
)
tbuf
,
(
uint32_t
)
leftbytes
);
readbytes
=
_read
(
pFile
->
fd
,
(
void
*
)
tbuf
,
(
uint32_t
)
leftbytes
);
#else
#else
readbytes
=
read
(
pFile
->
fd
,
(
void
*
)
tbuf
,
(
uint32_t
)
leftbytes
);
readbytes
=
read
(
pFile
->
fd
,
(
void
*
)
tbuf
,
(
uint32_t
)
leftbytes
);
#endif
#endif
if
(
readbytes
<
0
)
{
if
(
readbytes
<
0
)
{
if
(
errno
==
EINTR
)
{
if
(
errno
==
EINTR
)
{
continue
;
continue
;
...
@@ -433,9 +433,6 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
...
@@ -433,9 +433,6 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
}
}
int64_t
taosLSeekFile
(
TdFilePtr
pFile
,
int64_t
offset
,
int32_t
whence
)
{
int64_t
taosLSeekFile
(
TdFilePtr
pFile
,
int64_t
offset
,
int32_t
whence
)
{
if
(
pFile
==
NULL
)
{
return
0
;
}
#if FILE_WITH_LOCK
#if FILE_WITH_LOCK
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
#endif
#endif
...
@@ -565,12 +562,12 @@ int32_t taosFsyncFile(TdFilePtr pFile) {
...
@@ -565,12 +562,12 @@ int32_t taosFsyncFile(TdFilePtr pFile) {
if
(
pFile
->
fp
!=
NULL
)
return
fflush
(
pFile
->
fp
);
if
(
pFile
->
fp
!=
NULL
)
return
fflush
(
pFile
->
fp
);
if
(
pFile
->
fd
>=
0
)
{
if
(
pFile
->
fd
>=
0
)
{
#ifdef WINDOWS
#ifdef WINDOWS
HANDLE
h
=
(
HANDLE
)
_get_osfhandle
(
pFile
->
fd
);
HANDLE
h
=
(
HANDLE
)
_get_osfhandle
(
pFile
->
fd
);
return
!
FlushFileBuffers
(
h
);
return
!
FlushFileBuffers
(
h
);
#else
#else
return
fsync
(
pFile
->
fd
);
return
fsync
(
pFile
->
fd
);
#endif
#endif
}
}
return
0
;
return
0
;
}
}
...
...
source/os/src/osTime.c
浏览文件 @
5bda367f
...
@@ -28,29 +28,29 @@
...
@@ -28,29 +28,29 @@
#ifdef WINDOWS
#ifdef WINDOWS
#include <time.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <time.h>
//#define TM_YEAR_BASE 1970 //origin
//#define TM_YEAR_BASE 1970 //origin
#define TM_YEAR_BASE 1900
//
slguan
#define TM_YEAR_BASE 1900
//
slguan
/*
/*
* We do not implement alternate representations. However, we always
* We do not implement alternate representations. However, we always
* check whether a given modifier is allowed for a certain conversion.
* check whether a given modifier is allowed for a certain conversion.
*/
*/
#define ALT_E 0x01
#define ALT_E 0x01
#define ALT_O 0x02
#define ALT_O 0x02
#define LEGAL_ALT(x) { if (alt_format & ~(x)) return (0); }
#define LEGAL_ALT(x) \
{ \
if (alt_format & ~(x)) return (0); \
}
static
int
conv_num
(
const
char
**
buf
,
int
*
dest
,
int
llim
,
int
ulim
)
static
int
conv_num
(
const
char
**
buf
,
int
*
dest
,
int
llim
,
int
ulim
)
{
{
int
result
=
0
;
int
result
=
0
;
/* The limit also determines the number of valid digits. */
/* The limit also determines the number of valid digits. */
int
rulim
=
ulim
;
int
rulim
=
ulim
;
if
(
**
buf
<
'0'
||
**
buf
>
'9'
)
if
(
**
buf
<
'0'
||
**
buf
>
'9'
)
return
(
0
);
return
(
0
);
do
{
do
{
result
*=
10
;
result
*=
10
;
...
@@ -58,62 +58,18 @@ static int conv_num(const char **buf, int *dest, int llim, int ulim)
...
@@ -58,62 +58,18 @@ static int conv_num(const char **buf, int *dest, int llim, int ulim)
rulim
/=
10
;
rulim
/=
10
;
}
while
((
result
*
10
<=
ulim
)
&&
rulim
&&
**
buf
>=
'0'
&&
**
buf
<=
'9'
);
}
while
((
result
*
10
<=
ulim
)
&&
rulim
&&
**
buf
>=
'0'
&&
**
buf
<=
'9'
);
if
(
result
<
llim
||
result
>
ulim
)
if
(
result
<
llim
||
result
>
ulim
)
return
(
0
);
return
(
0
);
*
dest
=
result
;
*
dest
=
result
;
return
(
1
);
return
(
1
);
}
}
static
const
char
*
day
[
7
]
=
{
static
const
char
*
day
[
7
]
=
{
"Sunday"
,
"Monday"
,
"Tuesday"
,
"Wednesday"
,
"Thursday"
,
"Friday"
,
"Saturday"
};
"Sunday"
,
"Monday"
,
"Tuesday"
,
"Wednesday"
,
"Thursday"
,
static
const
char
*
abday
[
7
]
=
{
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
};
"Friday"
,
"Saturday"
static
const
char
*
mon
[
12
]
=
{
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
};
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
};
static
const
char
*
abday
[
7
]
=
{
static
const
char
*
abmon
[
12
]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
static
const
char
*
am_pm
[
2
]
=
{
"AM"
,
"PM"
};
};
static
const
char
*
mon
[
12
]
=
{
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
};
static
const
char
*
abmon
[
12
]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
static
const
char
*
am_pm
[
2
]
=
{
"AM"
,
"PM"
};
#define BILLION (1E9)
static
BOOL
g_first_time
=
1
;
static
LARGE_INTEGER
g_counts_per_sec
;
int
clock_gettime
(
int
dummy
,
struct
timespec
*
ct
)
{
LARGE_INTEGER
count
;
if
(
g_first_time
)
{
g_first_time
=
0
;
if
(
0
==
QueryPerformanceFrequency
(
&
g_counts_per_sec
))
{
g_counts_per_sec
.
QuadPart
=
0
;
}
}
if
((
NULL
==
ct
)
||
(
g_counts_per_sec
.
QuadPart
<=
0
)
||
(
0
==
QueryPerformanceCounter
(
&
count
)))
{
return
-
1
;
}
ct
->
tv_sec
=
count
.
QuadPart
/
g_counts_per_sec
.
QuadPart
;
ct
->
tv_nsec
=
((
count
.
QuadPart
%
g_counts_per_sec
.
QuadPart
)
*
BILLION
)
/
g_counts_per_sec
.
QuadPart
;
return
0
;
}
#else
#else
#include <sys/time.h>
#include <sys/time.h>
...
@@ -134,22 +90,19 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -134,22 +90,19 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
/* Eat up white-space. */
/* Eat up white-space. */
if
(
isspace
(
c
))
{
if
(
isspace
(
c
))
{
while
(
isspace
(
*
bp
))
while
(
isspace
(
*
bp
))
bp
++
;
bp
++
;
fmt
++
;
fmt
++
;
continue
;
continue
;
}
}
if
((
c
=
*
fmt
++
)
!=
'%'
)
if
((
c
=
*
fmt
++
)
!=
'%'
)
goto
literal
;
goto
literal
;
again:
switch
(
c
=
*
fmt
++
)
{
again:
switch
(
c
=
*
fmt
++
)
{
case
'%'
:
/* "%%" is converted to "%". */
case
'%'
:
/* "%%" is converted to "%". */
literal
:
literal:
if
(
c
!=
*
bp
++
)
if
(
c
!=
*
bp
++
)
return
(
0
);
return
(
0
);
break
;
break
;
/*
/*
...
@@ -171,44 +124,37 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -171,44 +124,37 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
*/
*/
case
'c'
:
/* Date and time, using the locale's format. */
case
'c'
:
/* Date and time, using the locale's format. */
LEGAL_ALT
(
ALT_E
);
LEGAL_ALT
(
ALT_E
);
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%x %X"
,
tm
)))
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%x %X"
,
tm
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'D'
:
/* The date as "%m/%d/%y". */
case
'D'
:
/* The date as "%m/%d/%y". */
LEGAL_ALT
(
0
);
LEGAL_ALT
(
0
);
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%m/%d/%y"
,
tm
)))
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%m/%d/%y"
,
tm
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'R'
:
/* The time as "%H:%M". */
case
'R'
:
/* The time as "%H:%M". */
LEGAL_ALT
(
0
);
LEGAL_ALT
(
0
);
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%H:%M"
,
tm
)))
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%H:%M"
,
tm
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'r'
:
/* The time in 12-hour clock representation. */
case
'r'
:
/* The time in 12-hour clock representation. */
LEGAL_ALT
(
0
);
LEGAL_ALT
(
0
);
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%I:%M:%S %p"
,
tm
)))
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%I:%M:%S %p"
,
tm
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'T'
:
/* The time as "%H:%M:%S". */
case
'T'
:
/* The time as "%H:%M:%S". */
LEGAL_ALT
(
0
);
LEGAL_ALT
(
0
);
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%H:%M:%S"
,
tm
)))
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%H:%M:%S"
,
tm
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'X'
:
/* The time, using the locale's format. */
case
'X'
:
/* The time, using the locale's format. */
LEGAL_ALT
(
ALT_E
);
LEGAL_ALT
(
ALT_E
);
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%H:%M:%S"
,
tm
)))
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%H:%M:%S"
,
tm
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'x'
:
/* The date, using the locale's format. */
case
'x'
:
/* The date, using the locale's format. */
LEGAL_ALT
(
ALT_E
);
LEGAL_ALT
(
ALT_E
);
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%m/%d/%y"
,
tm
)))
if
(
!
(
bp
=
taosStrpTime
(
bp
,
"%m/%d/%y"
,
tm
)))
return
(
0
);
return
(
0
);
break
;
break
;
/*
/*
...
@@ -220,18 +166,15 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -220,18 +166,15 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
for
(
i
=
0
;
i
<
7
;
i
++
)
{
for
(
i
=
0
;
i
<
7
;
i
++
)
{
/* Full name. */
/* Full name. */
len
=
strlen
(
day
[
i
]);
len
=
strlen
(
day
[
i
]);
if
(
strncmp
(
day
[
i
],
bp
,
len
)
==
0
)
if
(
strncmp
(
day
[
i
],
bp
,
len
)
==
0
)
break
;
break
;
/* Abbreviated name. */
/* Abbreviated name. */
len
=
strlen
(
abday
[
i
]);
len
=
strlen
(
abday
[
i
]);
if
(
strncmp
(
abday
[
i
],
bp
,
len
)
==
0
)
if
(
strncmp
(
abday
[
i
],
bp
,
len
)
==
0
)
break
;
break
;
}
}
/* Nothing matched. */
/* Nothing matched. */
if
(
i
==
7
)
if
(
i
==
7
)
return
(
0
);
return
(
0
);
tm
->
tm_wday
=
i
;
tm
->
tm_wday
=
i
;
bp
+=
len
;
bp
+=
len
;
...
@@ -244,18 +187,15 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -244,18 +187,15 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
for
(
i
=
0
;
i
<
12
;
i
++
)
{
for
(
i
=
0
;
i
<
12
;
i
++
)
{
/* Full name. */
/* Full name. */
len
=
strlen
(
mon
[
i
]);
len
=
strlen
(
mon
[
i
]);
if
(
strncmp
(
mon
[
i
],
bp
,
len
)
==
0
)
if
(
strncmp
(
mon
[
i
],
bp
,
len
)
==
0
)
break
;
break
;
/* Abbreviated name. */
/* Abbreviated name. */
len
=
strlen
(
abmon
[
i
]);
len
=
strlen
(
abmon
[
i
]);
if
(
strncmp
(
abmon
[
i
],
bp
,
len
)
==
0
)
if
(
strncmp
(
abmon
[
i
],
bp
,
len
)
==
0
)
break
;
break
;
}
}
/* Nothing matched. */
/* Nothing matched. */
if
(
i
==
12
)
if
(
i
==
12
)
return
(
0
);
return
(
0
);
tm
->
tm_mon
=
i
;
tm
->
tm_mon
=
i
;
bp
+=
len
;
bp
+=
len
;
...
@@ -263,13 +203,11 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -263,13 +203,11 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
case
'C'
:
/* The century number. */
case
'C'
:
/* The century number. */
LEGAL_ALT
(
ALT_E
);
LEGAL_ALT
(
ALT_E
);
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
99
)))
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
99
)))
return
(
0
);
return
(
0
);
if
(
split_year
)
{
if
(
split_year
)
{
tm
->
tm_year
=
(
tm
->
tm_year
%
100
)
+
(
i
*
100
);
tm
->
tm_year
=
(
tm
->
tm_year
%
100
)
+
(
i
*
100
);
}
}
else
{
else
{
tm
->
tm_year
=
i
*
100
;
tm
->
tm_year
=
i
*
100
;
split_year
=
1
;
split_year
=
1
;
}
}
...
@@ -278,8 +216,7 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -278,8 +216,7 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
case
'd'
:
/* The day of month. */
case
'd'
:
/* The day of month. */
case
'e'
:
case
'e'
:
LEGAL_ALT
(
ALT_O
);
LEGAL_ALT
(
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_mday
,
1
,
31
)))
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_mday
,
1
,
31
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'k'
:
/* The hour (24-hour clock representation). */
case
'k'
:
/* The hour (24-hour clock representation). */
...
@@ -287,8 +224,7 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -287,8 +224,7 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
/* FALLTHROUGH */
/* FALLTHROUGH */
case
'H'
:
case
'H'
:
LEGAL_ALT
(
ALT_O
);
LEGAL_ALT
(
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_hour
,
0
,
23
)))
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_hour
,
0
,
23
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'l'
:
/* The hour (12-hour clock representation). */
case
'l'
:
/* The hour (12-hour clock representation). */
...
@@ -296,29 +232,24 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -296,29 +232,24 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
/* FALLTHROUGH */
/* FALLTHROUGH */
case
'I'
:
case
'I'
:
LEGAL_ALT
(
ALT_O
);
LEGAL_ALT
(
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_hour
,
1
,
12
)))
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_hour
,
1
,
12
)))
return
(
0
);
return
(
0
);
if
(
tm
->
tm_hour
==
12
)
tm
->
tm_hour
=
0
;
if
(
tm
->
tm_hour
==
12
)
tm
->
tm_hour
=
0
;
break
;
break
;
case
'j'
:
/* The day of year. */
case
'j'
:
/* The day of year. */
LEGAL_ALT
(
0
);
LEGAL_ALT
(
0
);
if
(
!
(
conv_num
(
&
bp
,
&
i
,
1
,
366
)))
if
(
!
(
conv_num
(
&
bp
,
&
i
,
1
,
366
)))
return
(
0
);
return
(
0
);
tm
->
tm_yday
=
i
-
1
;
tm
->
tm_yday
=
i
-
1
;
break
;
break
;
case
'M'
:
/* The minute. */
case
'M'
:
/* The minute. */
LEGAL_ALT
(
ALT_O
);
LEGAL_ALT
(
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_min
,
0
,
59
)))
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_min
,
0
,
59
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'm'
:
/* The month. */
case
'm'
:
/* The month. */
LEGAL_ALT
(
ALT_O
);
LEGAL_ALT
(
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
i
,
1
,
12
)))
if
(
!
(
conv_num
(
&
bp
,
&
i
,
1
,
12
)))
return
(
0
);
return
(
0
);
tm
->
tm_mon
=
i
-
1
;
tm
->
tm_mon
=
i
-
1
;
break
;
break
;
...
@@ -326,16 +257,14 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -326,16 +257,14 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
LEGAL_ALT
(
0
);
LEGAL_ALT
(
0
);
/* AM? */
/* AM? */
if
(
strcmp
(
am_pm
[
0
],
bp
)
==
0
)
{
if
(
strcmp
(
am_pm
[
0
],
bp
)
==
0
)
{
if
(
tm
->
tm_hour
>
11
)
if
(
tm
->
tm_hour
>
11
)
return
(
0
);
return
(
0
);
bp
+=
strlen
(
am_pm
[
0
]);
bp
+=
strlen
(
am_pm
[
0
]);
break
;
break
;
}
}
/* PM? */
/* PM? */
else
if
(
strcmp
(
am_pm
[
1
],
bp
)
==
0
)
{
else
if
(
strcmp
(
am_pm
[
1
],
bp
)
==
0
)
{
if
(
tm
->
tm_hour
>
11
)
if
(
tm
->
tm_hour
>
11
)
return
(
0
);
return
(
0
);
tm
->
tm_hour
+=
12
;
tm
->
tm_hour
+=
12
;
bp
+=
strlen
(
am_pm
[
1
]);
bp
+=
strlen
(
am_pm
[
1
]);
...
@@ -347,8 +276,7 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -347,8 +276,7 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
case
'S'
:
/* The seconds. */
case
'S'
:
/* The seconds. */
LEGAL_ALT
(
ALT_O
);
LEGAL_ALT
(
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_sec
,
0
,
61
)))
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_sec
,
0
,
61
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'U'
:
/* The week of year, beginning on sunday. */
case
'U'
:
/* The week of year, beginning on sunday. */
...
@@ -360,28 +288,24 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -360,28 +288,24 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
* point to calculate a real value, so just check the
* point to calculate a real value, so just check the
* range for now.
* range for now.
*/
*/
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
53
)))
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
53
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'w'
:
/* The day of week, beginning on sunday. */
case
'w'
:
/* The day of week, beginning on sunday. */
LEGAL_ALT
(
ALT_O
);
LEGAL_ALT
(
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_wday
,
0
,
6
)))
if
(
!
(
conv_num
(
&
bp
,
&
tm
->
tm_wday
,
0
,
6
)))
return
(
0
);
return
(
0
);
break
;
break
;
case
'Y'
:
/* The year. */
case
'Y'
:
/* The year. */
LEGAL_ALT
(
ALT_E
);
LEGAL_ALT
(
ALT_E
);
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
9999
)))
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
9999
)))
return
(
0
);
return
(
0
);
tm
->
tm_year
=
i
-
TM_YEAR_BASE
;
tm
->
tm_year
=
i
-
TM_YEAR_BASE
;
break
;
break
;
case
'y'
:
/* The year within 100 years of the epoch. */
case
'y'
:
/* The year within 100 years of the epoch. */
LEGAL_ALT
(
ALT_E
|
ALT_O
);
LEGAL_ALT
(
ALT_E
|
ALT_O
);
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
99
)))
if
(
!
(
conv_num
(
&
bp
,
&
i
,
0
,
99
)))
return
(
0
);
return
(
0
);
if
(
split_year
)
{
if
(
split_year
)
{
tm
->
tm_year
=
((
tm
->
tm_year
/
100
)
*
100
)
+
i
;
tm
->
tm_year
=
((
tm
->
tm_year
/
100
)
*
100
)
+
i
;
...
@@ -400,16 +324,12 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
...
@@ -400,16 +324,12 @@ char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm) {
case
'n'
:
/* Any kind of white-space. */
case
'n'
:
/* Any kind of white-space. */
case
't'
:
case
't'
:
LEGAL_ALT
(
0
);
LEGAL_ALT
(
0
);
while
(
isspace
(
*
bp
))
while
(
isspace
(
*
bp
))
bp
++
;
bp
++
;
break
;
break
;
default:
/* Unknown/unsupported conversion. */
default:
/* Unknown/unsupported conversion. */
return
(
0
);
return
(
0
);
}
}
}
}
/* LINTED functional specification */
/* LINTED functional specification */
...
@@ -435,13 +355,9 @@ FORCE_INLINE int32_t taosGetTimeOfDay(struct timeval *tv) {
...
@@ -435,13 +355,9 @@ FORCE_INLINE int32_t taosGetTimeOfDay(struct timeval *tv) {
#endif
#endif
}
}
time_t
taosTime
(
time_t
*
t
)
{
time_t
taosTime
(
time_t
*
t
)
{
return
time
(
t
);
}
return
time
(
t
);
}
time_t
taosMktime
(
struct
tm
*
timep
)
{
time_t
taosMktime
(
struct
tm
*
timep
)
{
return
mktime
(
timep
);
}
return
mktime
(
timep
);
}
struct
tm
*
taosLocalTime
(
const
time_t
*
timep
,
struct
tm
*
result
)
{
struct
tm
*
taosLocalTime
(
const
time_t
*
timep
,
struct
tm
*
result
)
{
if
(
result
==
NULL
)
{
if
(
result
==
NULL
)
{
...
@@ -456,5 +372,36 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) {
...
@@ -456,5 +372,36 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) {
}
}
int32_t
taosGetTimestampSec
()
{
return
(
int32_t
)
time
(
NULL
);
}
int32_t
taosGetTimestampSec
()
{
return
(
int32_t
)
time
(
NULL
);
}
int32_t
taosClockGetTime
(
int
clock_id
,
struct
timespec
*
pTS
)
{
int32_t
taosClockGetTime
(
int
clock_id
,
struct
timespec
*
pTS
)
{
return
clock_gettime
(
clock_id
,
pTS
);
}
#ifdef WINDOWS
\ No newline at end of file
LARGE_INTEGER
t
;
FILETIME
f
;
static
FILETIME
ff
;
static
SYSTEMTIME
ss
;
static
LARGE_INTEGER
offset
;
ss
.
wYear
=
1970
;
ss
.
wMonth
=
1
;
ss
.
wDay
=
1
;
ss
.
wHour
=
0
;
ss
.
wMinute
=
0
;
ss
.
wSecond
=
0
;
ss
.
wMilliseconds
=
0
;
SystemTimeToFileTime
(
&
ss
,
&
ff
);
offset
.
QuadPart
=
ff
.
dwHighDateTime
;
offset
.
QuadPart
<<=
32
;
offset
.
QuadPart
|=
ff
.
dwLowDateTime
;
GetSystemTimeAsFileTime
(
&
f
);
t
.
QuadPart
=
f
.
dwHighDateTime
;
t
.
QuadPart
<<=
32
;
t
.
QuadPart
|=
f
.
dwLowDateTime
;
t
.
QuadPart
-=
offset
.
QuadPart
;
pTS
->
tv_sec
=
t
.
QuadPart
/
10000000
;
pTS
->
tv_nsec
=
(
t
.
QuadPart
%
10000000
)
*
100
;
return
(
0
);
#else
return
clock_gettime
(
clock_id
,
pTS
);
#endif
}
\ No newline at end of file
tests/pytest/util/dnodes.py
浏览文件 @
5bda367f
...
@@ -574,6 +574,9 @@ class TDDnodes:
...
@@ -574,6 +574,9 @@ class TDDnodes:
def
stopAll
(
self
):
def
stopAll
(
self
):
tdLog
.
info
(
"stop all dnodes"
)
tdLog
.
info
(
"stop all dnodes"
)
if
(
not
self
.
dnodes
[
0
].
remoteIP
==
""
):
self
.
dnodes
[
0
].
remoteExec
(
self
.
dnodes
[
0
].
cfgDict
,
"for i in range(len(tdDnodes.dnodes)):
\n
tdDnodes.dnodes[i].running=1
\n
tdDnodes.stopAll()"
)
return
for
i
in
range
(
len
(
self
.
dnodes
)):
for
i
in
range
(
len
(
self
.
dnodes
)):
self
.
dnodes
[
i
].
stop
()
self
.
dnodes
[
i
].
stop
()
...
...
tests/script/tsim/stream/session0.sim
浏览文件 @
5bda367f
...
@@ -17,7 +17,7 @@ sql use test
...
@@ -17,7 +17,7 @@ sql use test
sql create table t1(ts timestamp, a int, b int , c int, d double,id int);
sql create table t1(ts timestamp, a int, b int , c int, d double,id int);
sql create stream streams
2
trigger at_once into streamt as select _wstartts, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s);
sql create stream streams
1
trigger at_once into streamt as select _wstartts, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s);
sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL,1);
sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL,1);
sql insert into t1 values(1648791223001,10,2,3,1.1,2);
sql insert into t1 values(1648791223001,10,2,3,1.1,2);
sql insert into t1 values(1648791233002,3,2,3,2.1,3);
sql insert into t1 values(1648791233002,3,2,3,2.1,3);
...
@@ -176,4 +176,107 @@ if $data08 != 13 then
...
@@ -176,4 +176,107 @@ if $data08 != 13 then
return -1
return -1
endi
endi
sql create database test2 vgroups 1;
sql use test2;
sql create table t2(ts timestamp, a int, b int , c int, d double, id int);
sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstartts,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s);
sql insert into t2 values(1648791213001,1,1,3,1.0,1);
sql insert into t2 values(1648791213002,2,2,6,3.4,2);
sql insert into t2 values(1648791213003,4,9,3,4.8,3);
sql insert into t2 values(1648791233003,3,4,3,2.1,4);
sql insert into t2 values(1648791233004,3,5,3,3.4,5);
sql insert into t2 values(1648791233005,3,6,3,7.6,6);
#
sql insert into t2 values(1648791223003,20,7,3,10.1,7);
$loop_count = 0
loop2:
sleep 300
sql select * from streamt2 where c4=7;
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
if $rows != 1 then
print ======$rows
goto loop2
endi
# row 0
if $data01 != 2.091607978 then
print =====data01=$data01
goto loop2
endi
if $data02 != 3.274823935 then
print =====data02=$data02
goto loop2
endi
if $data03 != 1.800000000 then
print ======$data03
return -1
endi
if $data04 != 3.350000000 then
print ======$data04
return -1
endi
sql create database test3 vgroups 1;
sql use test3;
sql create table t1(ts timestamp, a int, b int , c int, d double);
sql create stream streams3 trigger at_once watermark 1d into streamt3 as select _wstartts, min(b), a,c from t1 session(ts,10s);
sql create stream streams4 trigger at_once watermark 1d into streamt4 as select _wstartts, max(b), a,c from t1 session(ts,10s);
sql create stream streams5 trigger at_once watermark 1d into streamt5 as select _wstartts, max(b), a,c from t1 session(ts,10s);
sql create stream streams6 trigger at_once watermark 1d into streamt6 as select _wstartts, max(b), a,c from t1 session(ts,10s);
sql insert into t1 values(1648791213001,1,1,1,1.0);
sql insert into t1 values(1648791213002,2,3,2,3.4);
sql insert into t1 values(1648791213003,4,9,3,4.8);
sql insert into t1 values(1648791213004,4,5,4,4.8);
sql insert into t1 values(1648791233004,3,4,0,2.1);
sql insert into t1 values(1648791233005,3,0,6,3.4);
sql insert into t1 values(1648791233006,3,6,7,7.6);
sql insert into t1 values(1648791233007,3,13,8,7.6);
sql insert into t1 values(1648791223004,20,7,9,10.1);
$loop_count = 0
loop3:
sleep 300
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt3;
if $rows == 0 then
print ======$rows
goto loop3
endi
sql select * from streamt4;
if $rows == 0 then
print ======$rows
goto loop3
endi
sql select * from streamt5;
if $rows == 0 then
print ======$rows
goto loop3
endi
sql select * from streamt6;
if $rows == 0 then
print ======$rows
goto loop3
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/system-test/0-others/taosdlog.py
浏览文件 @
5bda367f
...
@@ -23,7 +23,7 @@ class TDTestCase:
...
@@ -23,7 +23,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/0-others/udf_cluster.py
浏览文件 @
5bda367f
...
@@ -37,7 +37,7 @@ class TDTestCase:
...
@@ -37,7 +37,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/0-others/udf_create.py
浏览文件 @
5bda367f
...
@@ -9,8 +9,9 @@ from util.sql import *
...
@@ -9,8 +9,9 @@ from util.sql import *
from
util.cases
import
*
from
util.cases
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
import
subprocess
# import win32gui
if
(
platform
.
system
().
lower
()
==
'windows'
):
# import threading
import
win32gui
import
threading
class
TDTestCase
:
class
TDTestCase
:
...
@@ -535,17 +536,18 @@ class TDTestCase:
...
@@ -535,17 +536,18 @@ class TDTestCase:
return
udf1_sqls
,
udf2_sqls
return
udf1_sqls
,
udf2_sqls
# def checkRunTimeError(self):
def
checkRunTimeError
(
self
):
# while 1:
if
(
platform
.
system
().
lower
()
==
'windows'
and
tdDnodes
.
dnodes
[
0
].
remoteIP
==
""
):
# time.sleep(1)
while
1
:
# hwnd = win32gui.FindWindow(None, "Microsoft Visual C++ Runtime Library")
time
.
sleep
(
1
)
# if hwnd:
hwnd
=
win32gui
.
FindWindow
(
None
,
"Microsoft Visual C++ Runtime Library"
)
# os.system("TASKKILL /F /IM udfd.exe")
if
hwnd
:
os
.
system
(
"TASKKILL /F /IM udfd.exe"
)
def
unexpected_create
(
self
):
def
unexpected_create
(
self
):
#
if (platform.system().lower() == 'windows' and tdDnodes.dnodes[0].remoteIP == ""):
if
(
platform
.
system
().
lower
()
==
'windows'
and
tdDnodes
.
dnodes
[
0
].
remoteIP
==
""
):
#
checkErrorThread = threading.Thread(target=self.checkRunTimeError,daemon=True)
checkErrorThread
=
threading
.
Thread
(
target
=
self
.
checkRunTimeError
,
daemon
=
True
)
#
checkErrorThread.start()
checkErrorThread
.
start
()
tdLog
.
info
(
" create function with out bufsize "
)
tdLog
.
info
(
" create function with out bufsize "
)
tdSql
.
query
(
"drop function udf1 "
)
tdSql
.
query
(
"drop function udf1 "
)
...
...
tests/system-test/0-others/user_control.py
浏览文件 @
5bda367f
...
@@ -3,6 +3,7 @@ import taos
...
@@ -3,6 +3,7 @@ import taos
import
time
import
time
import
inspect
import
inspect
import
traceback
import
traceback
import
socket
from
dataclasses
import
dataclass
from
dataclasses
import
dataclass
from
util.log
import
*
from
util.log
import
*
...
@@ -102,7 +103,7 @@ class TDconnect:
...
@@ -102,7 +103,7 @@ class TDconnect:
def
taos_connect
(
def
taos_connect
(
host
=
"127.0.0.1"
,
host
=
socket
.
gethostname
()
,
port
=
6030
,
port
=
6030
,
user
=
"root"
,
user
=
"root"
,
passwd
=
"taosdata"
,
passwd
=
"taosdata"
,
...
...
tests/system-test/1-insert/insertWithMoreVgroup.py
浏览文件 @
5bda367f
...
@@ -54,7 +54,7 @@ class TDTestCase:
...
@@ -54,7 +54,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/1-insert/mutipythonnodebugtaosd.py
浏览文件 @
5bda367f
...
@@ -52,7 +52,7 @@ class TDTestCase:
...
@@ -52,7 +52,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/1-insert/test_stmt_insert_query_ex.py
浏览文件 @
5bda367f
...
@@ -49,7 +49,7 @@ class TDTestCase:
...
@@ -49,7 +49,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/1-insert/test_stmt_muti_insert_query.py
浏览文件 @
5bda367f
...
@@ -49,7 +49,7 @@ class TDTestCase:
...
@@ -49,7 +49,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/1-insert/test_stmt_set_tbname_tag.py
浏览文件 @
5bda367f
...
@@ -49,7 +49,7 @@ class TDTestCase:
...
@@ -49,7 +49,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/2-query/histogram.py
浏览文件 @
5bda367f
...
@@ -400,7 +400,7 @@ class TDTestCase:
...
@@ -400,7 +400,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/2-query/timezone.py
浏览文件 @
5bda367f
...
@@ -3,7 +3,10 @@ from util.log import *
...
@@ -3,7 +3,10 @@ from util.log import *
from
util.sql
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.cases
import
*
import
platform
import
os
import
os
if
platform
.
system
().
lower
()
==
'windows'
:
import
tzlocal
class
TDTestCase
:
class
TDTestCase
:
...
@@ -15,8 +18,12 @@ class TDTestCase:
...
@@ -15,8 +18,12 @@ class TDTestCase:
def
run
(
self
):
# sourcery skip: extract-duplicate-method
def
run
(
self
):
# sourcery skip: extract-duplicate-method
tdSql
.
prepare
()
tdSql
.
prepare
()
# get system timezone
# get system timezone
time_zone_arr
=
os
.
popen
(
'timedatectl | grep zone'
).
read
(
if
platform
.
system
().
lower
()
==
'windows'
:
).
strip
().
split
(
':'
)
time_zone_1
=
tzlocal
.
get_localzone_name
()
time_zone_2
=
time
.
strftime
(
'(UTC, %z)'
)
time_zone
=
time_zone_1
+
" "
+
time_zone_2
else
:
time_zone_arr
=
os
.
popen
(
'timedatectl | grep zone'
).
read
().
strip
().
split
(
':'
)
if
len
(
time_zone_arr
)
>
1
:
if
len
(
time_zone_arr
)
>
1
:
time_zone
=
time_zone_arr
[
1
].
lstrip
()
time_zone
=
time_zone_arr
[
1
].
lstrip
()
else
:
else
:
...
...
tests/system-test/7-tmq/basic5.py
浏览文件 @
5bda367f
...
@@ -13,6 +13,12 @@ from util.dnodes import *
...
@@ -13,6 +13,12 @@ from util.dnodes import *
class
TDTestCase
:
class
TDTestCase
:
hostname
=
socket
.
gethostname
()
hostname
=
socket
.
gethostname
()
if
(
platform
.
system
().
lower
()
==
'windows'
and
not
tdDnodes
.
dnodes
[
0
].
remoteIP
==
""
):
try
:
config
=
eval
(
tdDnodes
.
dnodes
[
0
].
remoteIP
)
hostname
=
config
[
"host"
]
except
Exception
:
hostname
=
tdDnodes
.
dnodes
[
0
].
remoteIP
#rpcDebugFlagVal = '143'
#rpcDebugFlagVal = '143'
#clientCfgDict = {'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''}
#clientCfgDict = {'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''}
#clientCfgDict["rpcDebugFlag"] = rpcDebugFlagVal
#clientCfgDict["rpcDebugFlag"] = rpcDebugFlagVal
...
@@ -34,7 +40,7 @@ class TDTestCase:
...
@@ -34,7 +40,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
@@ -192,6 +198,9 @@ class TDTestCase:
...
@@ -192,6 +198,9 @@ class TDTestCase:
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
parameterDict
[
"dbName"
],
showMsg
,
showRow
,
cdbName
)
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
parameterDict
[
"dbName"
],
showMsg
,
showRow
,
cdbName
)
if
(
platform
.
system
().
lower
()
==
'windows'
):
shellCmd
+=
"> nul 2>&1 &"
else
:
shellCmd
+=
"> /dev/null 2>&1 &"
shellCmd
+=
"> /dev/null 2>&1 &"
tdLog
.
info
(
shellCmd
)
tdLog
.
info
(
shellCmd
)
os
.
system
(
shellCmd
)
os
.
system
(
shellCmd
)
...
@@ -306,6 +315,9 @@ class TDTestCase:
...
@@ -306,6 +315,9 @@ class TDTestCase:
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
parameterDict
[
"dbName"
],
showMsg
,
showRow
,
cdbName
)
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
parameterDict
[
"dbName"
],
showMsg
,
showRow
,
cdbName
)
if
(
platform
.
system
().
lower
()
==
'windows'
):
shellCmd
+=
"> nul 2>&1 &"
else
:
shellCmd
+=
"> /dev/null 2>&1 &"
shellCmd
+=
"> /dev/null 2>&1 &"
tdLog
.
info
(
shellCmd
)
tdLog
.
info
(
shellCmd
)
os
.
system
(
shellCmd
)
os
.
system
(
shellCmd
)
...
@@ -438,6 +450,9 @@ class TDTestCase:
...
@@ -438,6 +450,9 @@ class TDTestCase:
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
parameterDict
[
"dbName"
],
showMsg
,
showRow
,
cdbName
)
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
parameterDict
[
"dbName"
],
showMsg
,
showRow
,
cdbName
)
if
(
platform
.
system
().
lower
()
==
'windows'
):
shellCmd
+=
"> nul 2>&1 &"
else
:
shellCmd
+=
"> /dev/null 2>&1 &"
shellCmd
+=
"> /dev/null 2>&1 &"
tdLog
.
info
(
shellCmd
)
tdLog
.
info
(
shellCmd
)
os
.
system
(
shellCmd
)
os
.
system
(
shellCmd
)
...
...
tests/system-test/7-tmq/db.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/schema.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeDb.py
浏览文件 @
5bda367f
...
@@ -34,7 +34,7 @@ class TDTestCase:
...
@@ -34,7 +34,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeDb0.py
浏览文件 @
5bda367f
...
@@ -34,7 +34,7 @@ class TDTestCase:
...
@@ -34,7 +34,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeDb1.py
浏览文件 @
5bda367f
...
@@ -34,7 +34,7 @@ class TDTestCase:
...
@@ -34,7 +34,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeStb.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeStb0.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeStb1.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeStb2.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeStb3.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/subscribeStb4.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/tmqDnode.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/7-tmq/tmqModule.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/99-TDcase/TD-15517.py
浏览文件 @
5bda367f
...
@@ -34,7 +34,7 @@ class TDTestCase:
...
@@ -34,7 +34,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/99-TDcase/TD-15554.py
浏览文件 @
5bda367f
...
@@ -33,7 +33,7 @@ class TDTestCase:
...
@@ -33,7 +33,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/99-TDcase/TD-15557.py
浏览文件 @
5bda367f
...
@@ -34,7 +34,7 @@ class TDTestCase:
...
@@ -34,7 +34,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/99-TDcase/TD-15563.py
浏览文件 @
5bda367f
...
@@ -34,7 +34,7 @@ class TDTestCase:
...
@@ -34,7 +34,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/99-TDcase/TD-16025.py
浏览文件 @
5bda367f
...
@@ -41,7 +41,7 @@ class TDTestCase:
...
@@ -41,7 +41,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/fulltest.bat
浏览文件 @
5bda367f
...
@@ -3,7 +3,7 @@ python3 .\test.py -f 0-others\taosShell.py
...
@@ -3,7 +3,7 @@ python3 .\test.py -f 0-others\taosShell.py
python3
.\test.py
-f
0
-others
\taosShellError.py
python3
.\test.py
-f
0
-others
\taosShellError.py
python3
.\test.py
-f
0
-others
\taosShellNetChk.py
python3
.\test.py
-f
0
-others
\taosShellNetChk.py
python3
.\test.py
-f
0
-others
\telemetry.py
python3
.\test.py
-f
0
-others
\telemetry.py
python3
.\test.py
-f
0
-others
\taosdMonitor.py
@REM
python3 .\test.py -f 0-others\taosdMonitor.py
python3
.\test.py
-f
0
-others
\udfTest.py
python3
.\test.py
-f
0
-others
\udfTest.py
python3
.\test.py
-f
0
-others
\udf_create.py
python3
.\test.py
-f
0
-others
\udf_create.py
python3
.\test.py
-f
0
-others
\udf_restart_taosd.py
python3
.\test.py
-f
0
-others
\udf_restart_taosd.py
...
...
tests/system-test/test.py
浏览文件 @
5bda367f
...
@@ -20,6 +20,7 @@ import time
...
@@ -20,6 +20,7 @@ import time
import
base64
import
base64
import
json
import
json
import
platform
import
platform
import
socket
from
distutils.log
import
warn
as
printf
from
distutils.log
import
warn
as
printf
from
fabric2
import
Connection
from
fabric2
import
Connection
sys
.
path
.
append
(
"../pytest"
)
sys
.
path
.
append
(
"../pytest"
)
...
@@ -149,7 +150,7 @@ if __name__ == "__main__":
...
@@ -149,7 +150,7 @@ if __name__ == "__main__":
tdLog
.
info
(
'stop All dnodes'
)
tdLog
.
info
(
'stop All dnodes'
)
if
masterIp
==
""
:
if
masterIp
==
""
:
host
=
'127.0.0.1'
host
=
socket
.
gethostname
()
else
:
else
:
try
:
try
:
config
=
eval
(
masterIp
)
config
=
eval
(
masterIp
)
...
@@ -170,8 +171,8 @@ if __name__ == "__main__":
...
@@ -170,8 +171,8 @@ if __name__ == "__main__":
try
:
try
:
if
key_word
in
open
(
fileName
,
encoding
=
'UTF-8'
).
read
():
if
key_word
in
open
(
fileName
,
encoding
=
'UTF-8'
).
read
():
is_test_framework
=
1
is_test_framework
=
1
except
:
except
Exception
as
r
:
p
ass
p
rint
(
r
)
updateCfgDictStr
=
''
updateCfgDictStr
=
''
if
is_test_framework
:
if
is_test_framework
:
moduleName
=
fileName
.
replace
(
".py"
,
""
).
replace
(
os
.
sep
,
"."
)
moduleName
=
fileName
.
replace
(
".py"
,
""
).
replace
(
os
.
sep
,
"."
)
...
@@ -181,8 +182,8 @@ if __name__ == "__main__":
...
@@ -181,8 +182,8 @@ if __name__ == "__main__":
if
((
json
.
dumps
(
updateCfgDict
)
==
'{}'
)
and
(
ucase
.
updatecfgDict
is
not
None
)):
if
((
json
.
dumps
(
updateCfgDict
)
==
'{}'
)
and
(
ucase
.
updatecfgDict
is
not
None
)):
updateCfgDict
=
ucase
.
updatecfgDict
updateCfgDict
=
ucase
.
updatecfgDict
updateCfgDictStr
=
"-d %s"
%
base64
.
b64encode
(
json
.
dumps
(
updateCfgDict
).
encode
()).
decode
()
updateCfgDictStr
=
"-d %s"
%
base64
.
b64encode
(
json
.
dumps
(
updateCfgDict
).
encode
()).
decode
()
except
:
except
Exception
as
r
:
p
ass
p
rint
(
r
)
else
:
else
:
pass
pass
tdDnodes
.
deploy
(
1
,
updateCfgDict
)
tdDnodes
.
deploy
(
1
,
updateCfgDict
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录