Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f24e06f3
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f24e06f3
编写于
3月 18, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tag filter
上级
4f15a328
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
7 deletion
+54
-7
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+40
-3
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+14
-4
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
f24e06f3
...
...
@@ -14,6 +14,8 @@
*/
#include "meta.h"
#include "osMemory.h"
#include "tencode.h"
void
metaReaderInit
(
SMetaReader
*
pReader
,
SMeta
*
pMeta
,
int32_t
flags
)
{
memset
(
pReader
,
0
,
sizeof
(
*
pReader
));
...
...
@@ -1235,9 +1237,14 @@ END:
return
0
;
}
int32_t
metaFilterTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
int32_t
ret
=
0
;
char
*
buf
=
NULL
;
SMetaEntry
oStbEntry
=
{
0
};
int32_t
ret
=
-
1
;
char
*
buf
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
SDecoder
dc
=
{
0
};
STbDbKey
tbDbKey
=
{
0
};
STagIdxKey
*
pKey
=
NULL
;
int32_t
nKey
=
0
;
...
...
@@ -1249,6 +1256,32 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
pCursor
->
type
=
param
->
type
;
metaRLock
(
pMeta
);
if
(
tdbTbGet
(
pMeta
->
pUidIdx
,
&
param
->
suid
,
sizeof
(
tb_uid_t
),
&
pData
,
&
nData
)
!=
0
)
{
goto
END
;
}
tbDbKey
.
uid
=
param
->
suid
;
tbDbKey
.
version
=
((
SUidIdxVal
*
)
pData
)[
0
].
version
;
tdbTbGet
(
pMeta
->
pTbDb
,
&
tbDbKey
,
sizeof
(
tbDbKey
),
&
pData
,
&
nData
);
tDecoderInit
(
&
dc
,
pData
,
nData
);
ret
=
metaDecodeEntry
(
&
dc
,
&
oStbEntry
);
if
(
oStbEntry
.
stbEntry
.
schemaTag
.
pSchema
==
NULL
||
oStbEntry
.
stbEntry
.
schemaTag
.
pSchema
==
NULL
)
{
ret
=
-
1
;
goto
END
;
}
for
(
int
i
=
0
;
i
<
oStbEntry
.
stbEntry
.
schemaTag
.
nCols
;
i
++
)
{
SSchema
*
schema
=
oStbEntry
.
stbEntry
.
schemaTag
.
pSchema
+
i
;
if
(
schema
->
colId
==
param
->
cid
&&
param
->
type
==
schema
->
type
&&
IS_IDX_ON
(
schema
))
{
ret
=
0
;
}
}
if
(
ret
!=
0
)
{
goto
END
;
}
ret
=
tdbTbcOpen
(
pMeta
->
pTagIdx
,
&
pCursor
->
pCur
,
NULL
);
if
(
ret
<
0
)
{
goto
END
;
...
...
@@ -1353,6 +1386,10 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
END:
if
(
pCursor
->
pMeta
)
metaULock
(
pCursor
->
pMeta
);
if
(
pCursor
->
pCur
)
tdbTbcClose
(
pCursor
->
pCur
);
if
(
oStbEntry
.
pBuf
)
taosMemoryFree
(
oStbEntry
.
pBuf
);
tDecoderClear
(
&
dc
);
tdbFree
(
pData
);
taosMemoryFree
(
buf
);
taosMemoryFree
(
pKey
);
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
f24e06f3
...
...
@@ -677,6 +677,11 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
_return:
for
(
int
i
=
0
;
i
<
nParam
;
i
++
)
sifFreeParam
(
&
params
[
i
]);
taosMemoryFree
(
params
);
if
(
code
!=
0
)
{
output
->
status
=
SFLT_NOT_INDEX
;
}
else
{
output
->
status
=
SFLT_COARSE_INDEX
;
}
return
code
;
}
...
...
@@ -717,7 +722,7 @@ _return:
static
EDealRes
sifWalkFunction
(
SNode
*
pNode
,
void
*
context
)
{
SFunctionNode
*
node
=
(
SFunctionNode
*
)
pNode
;
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))};
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))
,
.
status
=
SFLT_COARSE_INDEX
};
SIFCtx
*
ctx
=
context
;
ctx
->
code
=
sifExecFunction
(
node
,
ctx
,
&
output
);
...
...
@@ -735,7 +740,7 @@ static EDealRes sifWalkFunction(SNode *pNode, void *context) {
static
EDealRes
sifWalkLogic
(
SNode
*
pNode
,
void
*
context
)
{
SLogicConditionNode
*
node
=
(
SLogicConditionNode
*
)
pNode
;
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))};
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))
,
.
status
=
SFLT_COARSE_INDEX
};
SIFCtx
*
ctx
=
context
;
ctx
->
code
=
sifExecLogic
(
node
,
ctx
,
&
output
);
...
...
@@ -831,6 +836,7 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
if
(
res
->
result
!=
NULL
)
{
taosArrayAddAll
(
pDst
->
result
,
res
->
result
);
}
if
(
res
==
SFLT_NOT_INDEX
)
pDst
->
status
=
res
->
status
;
sifFreeParam
(
res
);
taosHashRemove
(
ctx
.
pRes
,
(
void
*
)
&
pNode
,
POINTER_BYTES
);
...
...
@@ -887,16 +893,20 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
SFilterInfo
*
filter
=
NULL
;
SArray
*
output
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
SIFParam
param
=
{.
arg
=
*
metaArg
,
.
result
=
output
};
SIFParam
param
=
{.
arg
=
*
metaArg
,
.
result
=
output
,
.
status
=
SFLT_NOT_INDEX
};
int32_t
code
=
sifCalculate
((
SNode
*
)
pFilterNode
,
&
param
);
if
(
code
!=
0
)
{
sifFreeParam
(
&
param
);
return
code
;
}
if
(
param
.
status
==
SFLT_NOT_INDEX
)
{
*
status
=
param
.
status
;
}
else
{
*
status
=
st
;
}
taosArrayAddAll
(
result
,
param
.
result
);
sifFreeParam
(
&
param
);
*
status
=
st
;
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录