Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
78f05459
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
78f05459
编写于
4月 22, 2022
作者:
D
dapan1121
提交者:
GitHub
4月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11769 from taosdata/feature/qnode
feat: fix qnode list type issue
上级
126801c8
11cb0afa
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
126 addition
and
47 deletion
+126
-47
include/common/tmsg.h
include/common/tmsg.h
+7
-1
include/libs/qcom/query.h
include/libs/qcom/query.h
+0
-6
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+2
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+20
-7
source/dnode/mgmt/implement/src/dmHandle.c
source/dnode/mgmt/implement/src/dmHandle.c
+3
-3
source/dnode/mnode/impl/inc/mndVgroup.h
source/dnode/mnode/impl/inc/mndVgroup.h
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+2
-6
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+8
-6
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+2
-2
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+8
-0
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+4
-0
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+54
-12
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+15
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
78f05459
...
@@ -639,13 +639,19 @@ int32_t tSerializeSQnodeListReq(void* buf, int32_t bufLen, SQnodeListReq* pReq);
...
@@ -639,13 +639,19 @@ int32_t tSerializeSQnodeListReq(void* buf, int32_t bufLen, SQnodeListReq* pReq);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
typedef
struct
{
typedef
struct
{
SArray
*
epSetList
;
// SArray<SEpSet
>
SArray
*
addrsList
;
// SArray<SQueryNodeAddr
>
}
SQnodeListRsp
;
}
SQnodeListRsp
;
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
);
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
);
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
}
SQueryNodeAddr
;
typedef
struct
{
typedef
struct
{
SArray
*
pArray
;
// Array of SUseDbRsp
SArray
*
pArray
;
// Array of SUseDbRsp
}
SUseDbBatchRsp
;
}
SUseDbBatchRsp
;
...
...
include/libs/qcom/query.h
浏览文件 @
78f05459
...
@@ -133,12 +133,6 @@ typedef struct SMsgSendInfo {
...
@@ -133,12 +133,6 @@ typedef struct SMsgSendInfo {
SDataBuf
msgInfo
;
SDataBuf
msgInfo
;
}
SMsgSendInfo
;
}
SMsgSendInfo
;
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
}
SQueryNodeAddr
;
typedef
struct
SQueryNodeStat
{
typedef
struct
SQueryNodeStat
{
int32_t
tableNum
;
// vg table number, unit is TSDB_TABLE_NUM_UNIT
int32_t
tableNum
;
// vg table number, unit is TSDB_TABLE_NUM_UNIT
}
SQueryNodeStat
;
}
SQueryNodeStat
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
78f05459
...
@@ -151,13 +151,14 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -151,13 +151,14 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
taosMemoryFreeClear
(
output
.
dbVgroup
);
taosMemoryFreeClear
(
output
.
dbVgroup
);
tscError
(
"failed to build use db output since %s"
,
terrstr
());
tscError
(
"failed to build use db output since %s"
,
terrstr
());
}
else
{
}
else
if
(
output
.
dbVgroup
)
{
struct
SCatalog
*
pCatalog
=
NULL
;
struct
SCatalog
*
pCatalog
=
NULL
;
int32_t
code1
=
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
int32_t
code1
=
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
if
(
code1
!=
TSDB_CODE_SUCCESS
)
{
if
(
code1
!=
TSDB_CODE_SUCCESS
)
{
tscWarn
(
"catalogGetHandle failed, clusterId:%"
PRIx64
", error:%s"
,
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
tscWarn
(
"catalogGetHandle failed, clusterId:%"
PRIx64
", error:%s"
,
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
tstrerror
(
code1
));
tstrerror
(
code1
));
taosMemoryFreeClear
(
output
.
dbVgroup
);
}
else
{
}
else
{
catalogUpdateDBVgInfo
(
pCatalog
,
output
.
db
,
output
.
dbId
,
output
.
dbVgroup
);
catalogUpdateDBVgInfo
(
pCatalog
,
output
.
db
,
output
.
dbId
,
output
.
dbVgroup
);
}
}
...
...
source/common/src/tmsg.c
浏览文件 @
78f05459
...
@@ -114,6 +114,19 @@ int32_t tDecodeSEpSet(SCoder *pDecoder, SEpSet *pEp) {
...
@@ -114,6 +114,19 @@ int32_t tDecodeSEpSet(SCoder *pDecoder, SEpSet *pEp) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSQueryNodeAddr
(
SCoder
*
pEncoder
,
SQueryNodeAddr
*
pAddr
)
{
if
(
tEncodeI32
(
pEncoder
,
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tDecodeSQueryNodeAddr
(
SCoder
*
pDecoder
,
SQueryNodeAddr
*
pAddr
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
)
{
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
)
{
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pEp
->
inUse
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pEp
->
inUse
);
...
@@ -2058,11 +2071,11 @@ int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp)
...
@@ -2058,11 +2071,11 @@ int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp)
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
epSet
List
);
int32_t
num
=
taosArrayGetSize
(
pRsp
->
addrs
List
);
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
S
EpSet
*
epSet
=
taosArrayGet
(
pRsp
->
epSet
List
,
i
);
S
QueryNodeAddr
*
addr
=
taosArrayGet
(
pRsp
->
addrs
List
,
i
);
if
(
tEncodeS
EpSet
(
&
encoder
,
epSet
)
<
0
)
return
-
1
;
if
(
tEncodeS
QueryNodeAddr
(
&
encoder
,
addr
)
<
0
)
return
-
1
;
}
}
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
...
@@ -2078,10 +2091,10 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
...
@@ -2078,10 +2091,10 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
int32_t
num
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
pRsp
->
epSetList
=
taosArrayInit
(
num
,
sizeof
(
SEpSet
));
pRsp
->
addrsList
=
taosArrayInit
(
num
,
sizeof
(
SQueryNodeAddr
));
if
(
NULL
==
pRsp
->
epSet
List
)
return
-
1
;
if
(
NULL
==
pRsp
->
addrs
List
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
if
(
tDecodeS
EpSet
(
&
decoder
,
TARRAY_GET_ELEM
(
pRsp
->
epSet
List
,
i
))
<
0
)
return
-
1
;
if
(
tDecodeS
QueryNodeAddr
(
&
decoder
,
TARRAY_GET_ELEM
(
pRsp
->
addrs
List
,
i
))
<
0
)
return
-
1
;
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
...
@@ -2089,7 +2102,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
...
@@ -2089,7 +2102,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
return
0
;
return
0
;
}
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
epSet
List
);
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
addrs
List
);
}
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
SCoder
encoder
=
{
0
};
...
...
source/dnode/mgmt/implement/src/dmHandle.c
浏览文件 @
78f05459
...
@@ -370,9 +370,9 @@ static int32_t dmInitMgmt(SMgmtWrapper *pWrapper) {
...
@@ -370,9 +370,9 @@ static int32_t dmInitMgmt(SMgmtWrapper *pWrapper) {
}
}
dmReportStartup
(
pDnode
,
"dnode-transport"
,
"initialized"
);
dmReportStartup
(
pDnode
,
"dnode-transport"
,
"initialized"
);
if
(
dmStartUdfd
(
pDnode
)
!=
0
)
{
//
if (dmStartUdfd(pDnode) != 0) {
dError
(
"failed to start udfd"
);
//
dError("failed to start udfd");
}
//
}
dInfo
(
"dnode-mgmt is initialized"
);
dInfo
(
"dnode-mgmt is initialized"
);
return
0
;
return
0
;
...
...
source/dnode/mnode/impl/inc/mndVgroup.h
浏览文件 @
78f05459
...
@@ -30,6 +30,7 @@ SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup);
...
@@ -30,6 +30,7 @@ SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup);
int32_t
mndAllocVgroup
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SVgObj
**
ppVgroups
);
int32_t
mndAllocVgroup
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SVgObj
**
ppVgroups
);
SEpSet
mndGetVgroupEpset
(
SMnode
*
pMnode
,
const
SVgObj
*
pVgroup
);
SEpSet
mndGetVgroupEpset
(
SMnode
*
pMnode
,
const
SVgObj
*
pVgroup
);
int32_t
mndGetVnodesNum
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
int32_t
mndGetVnodesNum
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
int32_t
mndGetGlobalVgroupVersion
(
int32_t
*
vgId
);
void
*
mndBuildCreateVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
void
*
mndBuildCreateVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
void
*
mndBuildDropVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
void
*
mndBuildDropVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
78f05459
...
@@ -1191,6 +1191,7 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
...
@@ -1191,6 +1191,7 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
char
*
p
=
strchr
(
usedbReq
.
db
,
'.'
);
char
*
p
=
strchr
(
usedbReq
.
db
,
'.'
);
if
(
p
&&
0
==
strcmp
(
p
+
1
,
TSDB_INFORMATION_SCHEMA_DB
))
{
if
(
p
&&
0
==
strcmp
(
p
+
1
,
TSDB_INFORMATION_SCHEMA_DB
))
{
memcpy
(
usedbRsp
.
db
,
usedbReq
.
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
usedbRsp
.
db
,
usedbReq
.
db
,
TSDB_DB_FNAME_LEN
);
//mndGetGlobalVgroupVersion(); TODO
static
int32_t
vgVersion
=
1
;
static
int32_t
vgVersion
=
1
;
if
(
usedbReq
.
vgVersion
<
vgVersion
)
{
if
(
usedbReq
.
vgVersion
<
vgVersion
)
{
usedbRsp
.
pVgroupInfos
=
taosArrayInit
(
10
,
sizeof
(
SVgroupInfo
));
usedbRsp
.
pVgroupInfos
=
taosArrayInit
(
10
,
sizeof
(
SVgroupInfo
));
...
@@ -1202,16 +1203,11 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
...
@@ -1202,16 +1203,11 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
mndBuildDBVgroupInfo
(
NULL
,
pMnode
,
usedbRsp
.
pVgroupInfos
);
mndBuildDBVgroupInfo
(
NULL
,
pMnode
,
usedbRsp
.
pVgroupInfos
);
usedbRsp
.
vgVersion
=
vgVersion
++
;
usedbRsp
.
vgVersion
=
vgVersion
++
;
if
(
taosArrayGetSize
(
usedbRsp
.
pVgroupInfos
)
<=
0
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
}
else
{
code
=
0
;
}
}
else
{
}
else
{
usedbRsp
.
vgVersion
=
usedbReq
.
vgVersion
;
usedbRsp
.
vgVersion
=
usedbReq
.
vgVersion
;
code
=
0
;
}
}
usedbRsp
.
vgNum
=
taosArrayGetSize
(
usedbRsp
.
pVgroupInfos
);
usedbRsp
.
vgNum
=
taosArrayGetSize
(
usedbRsp
.
pVgroupInfos
);
code
=
0
;
// no jump, need to construct rsp
// no jump, need to construct rsp
}
else
{
}
else
{
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
78f05459
...
@@ -444,8 +444,8 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
...
@@ -444,8 +444,8 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
qlistRsp
.
epSetList
=
taosArrayInit
(
5
,
sizeof
(
SEpSet
));
qlistRsp
.
addrsList
=
taosArrayInit
(
5
,
sizeof
(
SQueryNodeAddr
));
if
(
NULL
==
qlistRsp
.
epSet
List
)
{
if
(
NULL
==
qlistRsp
.
addrs
List
)
{
mError
(
"failed to alloc epSet while process qnode list req"
);
mError
(
"failed to alloc epSet while process qnode list req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
goto
_OVER
;
...
@@ -455,11 +455,13 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
...
@@ -455,11 +455,13 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
void
*
pIter
=
sdbFetch
(
pSdb
,
SDB_QNODE
,
NULL
,
(
void
**
)
&
pObj
);
void
*
pIter
=
sdbFetch
(
pSdb
,
SDB_QNODE
,
NULL
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SEpSet
epSet
=
{.
numOfEps
=
1
};
SQueryNodeAddr
nodeAddr
=
{
0
};
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
nodeAddr
.
nodeId
=
QNODE_HANDLE
;
epSet
.
eps
[
0
].
port
=
pObj
->
pDnode
->
port
;
nodeAddr
.
epSet
.
numOfEps
=
1
;
tstrncpy
(
nodeAddr
.
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
nodeAddr
.
epSet
.
eps
[
0
].
port
=
pObj
->
pDnode
->
port
;
(
void
)
taosArrayPush
(
qlistRsp
.
epSetList
,
&
epSet
);
(
void
)
taosArrayPush
(
qlistRsp
.
addrsList
,
&
nodeAddr
);
numOfRows
++
;
numOfRows
++
;
sdbRelease
(
pSdb
,
pObj
);
sdbRelease
(
pSdb
,
pObj
);
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
78f05459
...
@@ -359,10 +359,10 @@ PROCESS_QLIST_OVER:
...
@@ -359,10 +359,10 @@ PROCESS_QLIST_OVER:
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tFreeSQnodeListRsp
(
&
out
);
tFreeSQnodeListRsp
(
&
out
);
out
.
epSet
List
=
NULL
;
out
.
addrs
List
=
NULL
;
}
}
*
(
SArray
**
)
output
=
out
.
epSet
List
;
*
(
SArray
**
)
output
=
out
.
addrs
List
;
return
code
;
return
code
;
}
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
78f05459
...
@@ -1388,6 +1388,14 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) {
...
@@ -1388,6 +1388,14 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) {
void
*
pIter
=
taosHashIterate
(
mgmt
->
schHash
,
NULL
);
void
*
pIter
=
taosHashIterate
(
mgmt
->
schHash
,
NULL
);
while
(
pIter
)
{
while
(
pIter
)
{
SQWSchStatus
*
sch
=
(
SQWSchStatus
*
)
pIter
;
if
(
NULL
==
sch
->
hbConnInfo
.
handle
)
{
uint64_t
*
sId
=
taosHashGetKey
(
pIter
,
NULL
);
QW_DLOG
(
"cancel send hb to sch %"
PRIx64
" cause of no connection handle"
,
*
sId
);
pIter
=
taosHashIterate
(
mgmt
->
schHash
,
pIter
);
continue
;
}
code
=
qwGenerateSchHbRsp
(
mgmt
,
(
SQWSchStatus
*
)
pIter
,
&
rspList
[
i
]);
code
=
qwGenerateSchHbRsp
(
mgmt
,
(
SQWSchStatus
*
)
pIter
,
&
rspList
[
i
]);
if
(
code
)
{
if
(
code
)
{
taosHashCancelIterate
(
mgmt
->
schHash
,
pIter
);
taosHashCancelIterate
(
mgmt
->
schHash
,
pIter
);
...
...
source/libs/scalar/inc/filterInt.h
浏览文件 @
78f05459
...
@@ -186,6 +186,7 @@ typedef struct SFilterColCtx {
...
@@ -186,6 +186,7 @@ typedef struct SFilterColCtx {
typedef
struct
SFilterCompare
{
typedef
struct
SFilterCompare
{
uint8_t
type
;
uint8_t
type
;
int8_t
precision
;
uint8_t
optr
;
uint8_t
optr
;
uint8_t
optr2
;
uint8_t
optr2
;
}
SFilterCompare
;
}
SFilterCompare
;
...
@@ -218,6 +219,7 @@ typedef struct SFltTreeStat {
...
@@ -218,6 +219,7 @@ typedef struct SFltTreeStat {
int32_t
code
;
int32_t
code
;
int8_t
precision
;
int8_t
precision
;
bool
scalarMode
;
bool
scalarMode
;
SArray
*
nodeList
;
SFilterInfo
*
info
;
SFilterInfo
*
info
;
}
SFltTreeStat
;
}
SFltTreeStat
;
...
@@ -303,6 +305,7 @@ struct SFilterInfo {
...
@@ -303,6 +305,7 @@ struct SFilterInfo {
#define FILTER_GET_FIELD(i, id) (&((i)->fields[(id).type].fields[(id).idx]))
#define FILTER_GET_FIELD(i, id) (&((i)->fields[(id).type].fields[(id).idx]))
#define FILTER_GET_COL_FIELD(i, idx) (&((i)->fields[FLD_TYPE_COLUMN].fields[idx]))
#define FILTER_GET_COL_FIELD(i, idx) (&((i)->fields[FLD_TYPE_COLUMN].fields[idx]))
#define FILTER_GET_COL_FIELD_TYPE(fi) (((SColumnNode *)((fi)->desc))->node.resType.type)
#define FILTER_GET_COL_FIELD_TYPE(fi) (((SColumnNode *)((fi)->desc))->node.resType.type)
#define FILTER_GET_COL_FIELD_PRECISION(fi) (((SColumnNode *)((fi)->desc))->node.resType.precision)
#define FILTER_GET_COL_FIELD_SIZE(fi) (((SColumnNode *)((fi)->desc))->node.resType.bytes)
#define FILTER_GET_COL_FIELD_SIZE(fi) (((SColumnNode *)((fi)->desc))->node.resType.bytes)
#define FILTER_GET_COL_FIELD_ID(fi) (((SColumnNode *)((fi)->desc))->colId)
#define FILTER_GET_COL_FIELD_ID(fi) (((SColumnNode *)((fi)->desc))->colId)
#define FILTER_GET_COL_FIELD_SLOT_ID(fi) (((SColumnNode *)((fi)->desc))->slotId)
#define FILTER_GET_COL_FIELD_SLOT_ID(fi) (((SColumnNode *)((fi)->desc))->slotId)
...
@@ -317,6 +320,7 @@ struct SFilterInfo {
...
@@ -317,6 +320,7 @@ struct SFilterInfo {
#define FILTER_UNIT_RIGHT_FIELD(i, u) FILTER_GET_FIELD(i, (u)->right)
#define FILTER_UNIT_RIGHT_FIELD(i, u) FILTER_GET_FIELD(i, (u)->right)
#define FILTER_UNIT_RIGHT2_FIELD(i, u) FILTER_GET_FIELD(i, (u)->right2)
#define FILTER_UNIT_RIGHT2_FIELD(i, u) FILTER_GET_FIELD(i, (u)->right2)
#define FILTER_UNIT_DATA_TYPE(u) ((u)->compare.type)
#define FILTER_UNIT_DATA_TYPE(u) ((u)->compare.type)
#define FILTER_UNIT_DATA_PRECISION(u) ((u)->compare.precision)
#define FILTER_UNIT_COL_DESC(i, u) FILTER_GET_COL_FIELD_DESC(FILTER_UNIT_LEFT_FIELD(i, u))
#define FILTER_UNIT_COL_DESC(i, u) FILTER_GET_COL_FIELD_DESC(FILTER_UNIT_LEFT_FIELD(i, u))
#define FILTER_UNIT_COL_DATA(i, u, ri) FILTER_GET_COL_FIELD_DATA(FILTER_UNIT_LEFT_FIELD(i, u), ri)
#define FILTER_UNIT_COL_DATA(i, u, ri) FILTER_GET_COL_FIELD_DATA(FILTER_UNIT_LEFT_FIELD(i, u), ri)
#define FILTER_UNIT_COL_SIZE(i, u) FILTER_GET_COL_FIELD_SIZE(FILTER_UNIT_LEFT_FIELD(i, u))
#define FILTER_UNIT_COL_SIZE(i, u) FILTER_GET_COL_FIELD_SIZE(FILTER_UNIT_LEFT_FIELD(i, u))
...
...
source/libs/scalar/src/filter.c
浏览文件 @
78f05459
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "sclInt.h"
#include "sclInt.h"
#include "tcompare.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "ttime.h"
OptrStr
gOptrStr
[]
=
{
OptrStr
gOptrStr
[]
=
{
{
0
,
"invalid"
},
{
0
,
"invalid"
},
...
@@ -986,6 +987,7 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi
...
@@ -986,6 +987,7 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi
assert
(
FILTER_GET_FLAG
(
col
->
flag
,
FLD_TYPE_COLUMN
));
assert
(
FILTER_GET_FLAG
(
col
->
flag
,
FLD_TYPE_COLUMN
));
info
->
units
[
info
->
unitNum
].
compare
.
type
=
FILTER_GET_COL_FIELD_TYPE
(
col
);
info
->
units
[
info
->
unitNum
].
compare
.
type
=
FILTER_GET_COL_FIELD_TYPE
(
col
);
info
->
units
[
info
->
unitNum
].
compare
.
precision
=
FILTER_GET_COL_FIELD_PRECISION
(
col
);
*
uidx
=
info
->
unitNum
;
*
uidx
=
info
->
unitNum
;
...
@@ -1748,6 +1750,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
...
@@ -1748,6 +1750,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
assert
(
FILTER_GET_FLAG
(
right
->
flag
,
FLD_TYPE_VALUE
));
assert
(
FILTER_GET_FLAG
(
right
->
flag
,
FLD_TYPE_VALUE
));
uint32_t
type
=
FILTER_UNIT_DATA_TYPE
(
unit
);
uint32_t
type
=
FILTER_UNIT_DATA_TYPE
(
unit
);
int8_t
precision
=
FILTER_UNIT_DATA_PRECISION
(
unit
);
SFilterField
*
fi
=
right
;
SFilterField
*
fi
=
right
;
SValueNode
*
var
=
(
SValueNode
*
)
fi
->
desc
;
SValueNode
*
var
=
(
SValueNode
*
)
fi
->
desc
;
...
@@ -1801,6 +1804,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
...
@@ -1801,6 +1804,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
}
else
{
}
else
{
SScalarParam
out
=
{.
columnData
=
taosMemoryCalloc
(
1
,
sizeof
(
SColumnInfoData
))};
SScalarParam
out
=
{.
columnData
=
taosMemoryCalloc
(
1
,
sizeof
(
SColumnInfoData
))};
out
.
columnData
->
info
.
type
=
type
;
out
.
columnData
->
info
.
type
=
type
;
out
.
columnData
->
info
.
precision
=
precision
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
IS_VAR_DATA_TYPE
(
type
))
{
out
.
columnData
->
info
.
bytes
=
bytes
;
out
.
columnData
->
info
.
bytes
=
bytes
;
}
else
{
}
else
{
...
@@ -3475,6 +3479,33 @@ int32_t filterFreeNcharColumns(SFilterInfo* info) {
...
@@ -3475,6 +3479,33 @@ int32_t filterFreeNcharColumns(SFilterInfo* info) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
fltAddValueNodeToConverList
(
SFltTreeStat
*
stat
,
SValueNode
*
pNode
)
{
if
(
NULL
==
stat
->
nodeList
)
{
stat
->
nodeList
=
taosArrayInit
(
10
,
POINTER_BYTES
);
if
(
NULL
==
stat
->
nodeList
)
{
FLT_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
}
if
(
NULL
==
taosArrayPush
(
stat
->
nodeList
,
&
pNode
))
{
FLT_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
return
TSDB_CODE_SUCCESS
;
}
void
fltConvertToTsValueNode
(
SFltTreeStat
*
stat
,
SValueNode
*
valueNode
)
{
char
*
timeStr
=
valueNode
->
datum
.
p
;
if
(
convertStringToTimestamp
(
valueNode
->
node
.
resType
.
type
,
valueNode
->
datum
.
p
,
stat
->
precision
,
&
valueNode
->
datum
.
i
)
!=
TSDB_CODE_SUCCESS
)
{
valueNode
->
datum
.
i
=
0
;
}
taosMemoryFree
(
timeStr
);
valueNode
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
valueNode
->
node
.
resType
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_TIMESTAMP
].
bytes
;
}
EDealRes
fltReviseRewriter
(
SNode
**
pNode
,
void
*
pContext
)
{
EDealRes
fltReviseRewriter
(
SNode
**
pNode
,
void
*
pContext
)
{
SFltTreeStat
*
stat
=
(
SFltTreeStat
*
)
pContext
;
SFltTreeStat
*
stat
=
(
SFltTreeStat
*
)
pContext
;
...
@@ -3504,25 +3535,23 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) {
...
@@ -3504,25 +3535,23 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) {
}
}
SValueNode
*
valueNode
=
(
SValueNode
*
)
*
pNode
;
SValueNode
*
valueNode
=
(
SValueNode
*
)
*
pNode
;
if
(
TSDB_DATA_TYPE_BINARY
!=
valueNode
->
node
.
resType
.
type
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
valueNode
->
node
.
resType
.
type
&&
TSDB_DATA_TYPE_NCHAR
!=
valueNode
->
node
.
resType
.
type
)
{
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
}
}
#if 0
if
(
stat
->
precision
<
0
)
{
if
(
stat
->
precision
<
0
)
{
//TODO
int32_t
code
=
fltAddValueNodeToConverList
(
stat
,
valueNode
);
if
(
code
)
{
stat
->
code
=
code
;
return
DEAL_RES_ERROR
;
}
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
}
}
char *timeStr = valueNode->datum.p;
fltConvertToTsValueNode
(
stat
,
valueNode
);
if (taosParseTime(valueNode->datum.p, &valueNode->datum.i, valueNode->node.resType.bytes, stat->precision, tsDaylight) !=
TSDB_CODE_SUCCESS) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
}
TODO
#else
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
#endif
}
}
if
(
QUERY_NODE_COLUMN
==
nodeType
(
*
pNode
))
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
*
pNode
))
{
...
@@ -3619,9 +3648,22 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) {
...
@@ -3619,9 +3648,22 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) {
}
}
int32_t
fltReviseNodes
(
SFilterInfo
*
pInfo
,
SNode
**
pNode
,
SFltTreeStat
*
pStat
)
{
int32_t
fltReviseNodes
(
SFilterInfo
*
pInfo
,
SNode
**
pNode
,
SFltTreeStat
*
pStat
)
{
int32_t
code
=
0
;
nodesRewriteExprPostOrder
(
pNode
,
fltReviseRewriter
,
(
void
*
)
pStat
);
nodesRewriteExprPostOrder
(
pNode
,
fltReviseRewriter
,
(
void
*
)
pStat
);
FLT_RET
(
pStat
->
code
);
FLT_ERR_JRET
(
pStat
->
code
);
int32_t
nodeNum
=
taosArrayGetSize
(
pStat
->
nodeList
);
for
(
int32_t
i
=
0
;
i
<
nodeNum
;
++
i
)
{
SValueNode
*
valueNode
=
*
(
SValueNode
**
)
taosArrayGet
(
pStat
->
nodeList
,
i
);
fltConvertToTsValueNode
(
pStat
,
valueNode
);
}
_return:
taosArrayDestroy
(
pStat
->
nodeList
);
FLT_RET
(
code
);
}
}
int32_t
fltOptimizeNodes
(
SFilterInfo
*
pInfo
,
SNode
**
pNode
,
SFltTreeStat
*
pStat
)
{
int32_t
fltOptimizeNodes
(
SFilterInfo
*
pInfo
,
SNode
**
pNode
,
SFltTreeStat
*
pStat
)
{
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
78f05459
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "tcompare.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "ttypes.h"
#include "ttypes.h"
#include "ttime.h"
#define LEFT_COL ((pLeftCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pLeftCol : pLeftCol->pData))
#define LEFT_COL ((pLeftCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pLeftCol : pLeftCol->pData))
#define RIGHT_COL ((pRightCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pRightCol : pRightCol->pData))
#define RIGHT_COL ((pRightCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pRightCol : pRightCol->pData))
...
@@ -252,6 +253,15 @@ _getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) {
...
@@ -252,6 +253,15 @@ _getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) {
return
p
;
return
p
;
}
}
static
FORCE_INLINE
void
varToTimestamp
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
int64_t
value
=
0
;
if
(
taosParseTime
(
buf
,
&
value
,
strlen
(
buf
),
pOut
->
columnData
->
info
.
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
value
=
0
;
}
colDataAppendInt64
(
pOut
->
columnData
,
rowIndex
,
&
value
);
}
static
FORCE_INLINE
void
varToSigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
varToSigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
int64_t
value
=
strtoll
(
buf
,
NULL
,
10
);
int64_t
value
=
strtoll
(
buf
,
NULL
,
10
);
colDataAppendInt64
(
pOut
->
columnData
,
rowIndex
,
&
value
);
colDataAppendInt64
(
pOut
->
columnData
,
rowIndex
,
&
value
);
...
@@ -295,7 +305,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
...
@@ -295,7 +305,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
_bufConverteFunc
func
=
NULL
;
_bufConverteFunc
func
=
NULL
;
if
(
TSDB_DATA_TYPE_BOOL
==
outType
)
{
if
(
TSDB_DATA_TYPE_BOOL
==
outType
)
{
func
=
varToBool
;
func
=
varToBool
;
}
else
if
(
IS_SIGNED_NUMERIC_TYPE
(
outType
)
||
TSDB_DATA_TYPE_TIMESTAMP
==
outType
)
{
}
else
if
(
IS_SIGNED_NUMERIC_TYPE
(
outType
))
{
func
=
varToSigned
;
func
=
varToSigned
;
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
outType
))
{
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
outType
))
{
func
=
varToUnsigned
;
func
=
varToUnsigned
;
...
@@ -305,6 +315,8 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
...
@@ -305,6 +315,8 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
ASSERT
(
inType
==
TSDB_DATA_TYPE_VARCHAR
);
ASSERT
(
inType
==
TSDB_DATA_TYPE_VARCHAR
);
func
=
varToNchar
;
func
=
varToNchar
;
vton
=
true
;
vton
=
true
;
}
else
if
(
TSDB_DATA_TYPE_TIMESTAMP
==
outType
)
{
func
=
varToTimestamp
;
}
else
{
}
else
{
sclError
(
"invalid convert outType:%d"
,
outType
);
sclError
(
"invalid convert outType:%d"
,
outType
);
return
TSDB_CODE_QRY_APP_ERROR
;
return
TSDB_CODE_QRY_APP_ERROR
;
...
@@ -594,8 +606,8 @@ int8_t gConvertTypes[TSDB_DATA_TYPE_BLOB+1][TSDB_DATA_TYPE_BLOB+1] = {
...
@@ -594,8 +606,8 @@ int8_t gConvertTypes[TSDB_DATA_TYPE_BLOB+1][TSDB_DATA_TYPE_BLOB+1] = {
/*BIGI*/
0
,
0
,
0
,
0
,
0
,
0
,
6
,
7
,
7
,
0
,
7
,
5
,
5
,
5
,
7
,
0
,
7
,
0
,
0
,
/*BIGI*/
0
,
0
,
0
,
0
,
0
,
0
,
6
,
7
,
7
,
0
,
7
,
5
,
5
,
5
,
7
,
0
,
7
,
0
,
0
,
/*FLOA*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
6
,
7
,
6
,
6
,
6
,
6
,
0
,
7
,
0
,
0
,
/*FLOA*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
6
,
7
,
6
,
6
,
6
,
6
,
0
,
7
,
0
,
0
,
/*DOUB*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
0
,
7
,
0
,
0
,
/*DOUB*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
0
,
7
,
0
,
0
,
/*VARC*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
0
,
7
,
7
,
7
,
7
,
0
,
0
,
0
,
0
,
/*VARC*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
9
,
0
,
7
,
7
,
7
,
7
,
0
,
0
,
0
,
0
,
/*TIME*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
9
,
9
,
9
,
7
,
0
,
7
,
0
,
0
,
/*TIME*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
9
,
9
,
9
,
9
,
7
,
0
,
7
,
0
,
0
,
/*NCHA*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
7
,
7
,
0
,
0
,
0
,
0
,
/*NCHA*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
7
,
7
,
0
,
0
,
0
,
0
,
/*UTIN*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
12
,
13
,
14
,
0
,
7
,
0
,
0
,
/*UTIN*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
12
,
13
,
14
,
0
,
7
,
0
,
0
,
/*USMA*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
13
,
14
,
0
,
7
,
0
,
0
,
/*USMA*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
13
,
14
,
0
,
7
,
0
,
0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录