Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1acb4dd6
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
1acb4dd6
编写于
2月 18, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt filter
上级
96864b27
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
35 deletion
+38
-35
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+11
-11
source/libs/executor/src/sysscanoperator.c
source/libs/executor/src/sysscanoperator.c
+26
-19
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+1
-5
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
1acb4dd6
...
...
@@ -1110,7 +1110,7 @@ int32_t metaFilterCreateTime(SMeta *pMeta, SMetaFltParam *param, SArray *pUids)
int32_t
valid
=
0
;
int32_t
count
=
0
;
static
const
int8_t
TRY_ERROR_LIMIT
=
4
;
static
const
int8_t
TRY_ERROR_LIMIT
=
1
;
do
{
void
*
entryKey
=
NULL
;
int32_t
nEntryKey
=
-
1
;
...
...
@@ -1118,15 +1118,14 @@ int32_t metaFilterCreateTime(SMeta *pMeta, SMetaFltParam *param, SArray *pUids)
if
(
valid
<
0
)
break
;
SCtimeIdxKey
*
p
=
entryKey
;
if
(
count
>
TRY_ERROR_LIMIT
)
break
;
int32_t
cmp
=
(
*
param
->
filterFunc
)((
void
*
)
&
p
->
ctime
,
(
void
*
)
&
pCtimeKey
->
ctime
,
param
->
type
);
if
(
cmp
==
0
)
taosArrayPush
(
pUids
,
&
p
->
uid
);
else
{
if
(
param
->
equal
==
true
)
break
;
count
++
;
if
(
count
>=
TRY_ERROR_LIMIT
)
{
break
;
}
}
valid
=
param
->
reverse
?
tdbTbcMoveToPrev
(
pCursor
->
pCur
)
:
tdbTbcMoveToNext
(
pCursor
->
pCur
);
if
(
valid
<
0
)
break
;
...
...
@@ -1168,23 +1167,23 @@ int32_t metaFilterTableName(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
int32_t
valid
=
0
;
int32_t
count
=
0
;
int32_t
TRY_ERROR_LIMIT
=
4
;
int32_t
TRY_ERROR_LIMIT
=
1
;
do
{
void
*
pEntryKey
=
NULL
,
*
pEntryVal
=
NULL
;
int32_t
nEntryKey
=
-
1
,
nEntryVal
=
0
;
valid
=
tdbTbcGet
(
pCursor
->
pCur
,
(
const
void
**
)
pEntryKey
,
&
nEntryKey
,
(
const
void
**
)
&
pEntryVal
,
&
nEntryVal
);
if
(
valid
<
0
)
break
;
if
(
count
>
TRY_ERROR_LIMIT
)
break
;
char
*
pTableKey
=
(
char
*
)
pEntryKey
;
cmp
=
(
*
param
->
filterFunc
)(
pTableKey
,
pName
,
pCursor
->
type
);
if
(
cmp
==
0
)
{
tb_uid_t
tuid
=
*
(
tb_uid_t
*
)
pEntryVal
;
taosArrayPush
(
pUids
,
&
tuid
);
}
else
{
if
(
param
->
equal
==
true
)
break
;
count
++
;
if
(
count
>=
TRY_ERROR_LIMIT
)
{
break
;
}
}
valid
=
param
->
reverse
?
tdbTbcMoveToPrev
(
pCursor
->
pCur
)
:
tdbTbcMoveToNext
(
pCursor
->
pCur
);
if
(
valid
<
0
)
{
...
...
@@ -1293,7 +1292,7 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
int
count
=
0
;
int32_t
valid
=
0
;
static
const
int8_t
TRY_ERROR_LIMIT
=
4
;
static
const
int8_t
TRY_ERROR_LIMIT
=
1
;
do
{
void
*
entryKey
=
NULL
,
*
entryVal
=
NULL
;
int32_t
nEntryKey
,
nEntryVal
;
...
...
@@ -1302,7 +1301,7 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
if
(
valid
<
0
)
{
break
;
}
if
(
count
>
=
TRY_ERROR_LIMIT
)
{
if
(
count
>
TRY_ERROR_LIMIT
)
{
break
;
}
...
...
@@ -1330,7 +1329,8 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
}
taosArrayPush
(
pUids
,
&
tuid
);
}
else
{
// opt later
if
(
param
->
equal
==
true
)
break
;
count
++
;
}
valid
=
param
->
reverse
?
tdbTbcMoveToPrev
(
pCursor
->
pCur
)
:
tdbTbcMoveToNext
(
pCursor
->
pCur
);
if
(
valid
<
0
)
{
...
...
source/libs/executor/src/sysscanoperator.c
浏览文件 @
1acb4dd6
...
...
@@ -134,7 +134,7 @@ static SSDataBlock* buildInfoSchemaTableMetaBlock(char* tableName);
static
void
destroySysScanOperator
(
void
*
param
);
static
int32_t
loadSysTableCallback
(
void
*
param
,
SDataBuf
*
pMsg
,
int32_t
code
);
static
SSDataBlock
*
doFilterResult
(
SSDataBlock
*
pDataBlock
,
SFilterInfo
*
pFilterInfo
);
static
__optSysFilter
optSysGetFilterFunc
(
int32_t
ctype
,
bool
*
reverse
);
static
__optSysFilter
optSysGetFilterFunc
(
int32_t
ctype
,
bool
*
reverse
,
bool
*
equal
);
static
int32_t
sysTableUserTagsFillOneTableTags
(
const
SSysTableScanInfo
*
pInfo
,
SMetaReader
*
smrSuperTable
,
SMetaReader
*
smrChildTable
,
const
char
*
dbname
,
const
char
*
tableName
,
...
...
@@ -164,7 +164,8 @@ int32_t sysFilte__DbName(void* arg, SNode* pNode, SArray* result) {
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
int
ret
=
func
(
dbname
,
pVal
->
datum
.
p
,
TSDB_DATA_TYPE_VARCHAR
);
...
...
@@ -182,9 +183,9 @@ int32_t sysFilte__VgroupId(void* arg, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
reverse
=
false
;
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
int
ret
=
func
(
&
vgId
,
&
pVal
->
datum
.
i
,
TSDB_DATA_TYPE_BIGINT
);
...
...
@@ -199,8 +200,8 @@ int32_t sysFilte__TableName(void* arg, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
SMetaFltParam
param
=
{.
suid
=
0
,
...
...
@@ -208,6 +209,7 @@ int32_t sysFilte__TableName(void* arg, SNode* pNode, SArray* result) {
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
val
=
pVal
->
datum
.
p
,
.
reverse
=
reverse
,
.
equal
=
equal
,
.
filterFunc
=
func
};
return
-
1
;
}
...
...
@@ -219,7 +221,8 @@ int32_t sysFilte__CreateTime(void* arg, SNode* pNode, SArray* result) {
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
SMetaFltParam
param
=
{.
suid
=
0
,
...
...
@@ -227,6 +230,7 @@ int32_t sysFilte__CreateTime(void* arg, SNode* pNode, SArray* result) {
.
type
=
TSDB_DATA_TYPE_BIGINT
,
.
val
=
&
pVal
->
datum
.
i
,
.
reverse
=
reverse
,
.
equal
=
equal
,
.
filterFunc
=
func
};
int32_t
ret
=
metaFilterCreateTime
(
pMeta
,
&
param
,
result
);
...
...
@@ -239,8 +243,8 @@ int32_t sysFilte__Ncolumn(void* arg, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
return
-
1
;
}
...
...
@@ -251,8 +255,8 @@ int32_t sysFilte__Ttl(void* arg, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
return
-
1
;
}
...
...
@@ -263,8 +267,8 @@ int32_t sysFilte__STableName(void* arg, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
return
-
1
;
}
...
...
@@ -275,8 +279,8 @@ int32_t sysFilte__Uid(void* arg, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
return
-
1
;
}
...
...
@@ -287,8 +291,8 @@ int32_t sysFilte__Type(void* arg, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
bool
equal
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
,
&
equal
);
if
(
func
==
NULL
)
return
-
1
;
return
-
1
;
}
...
...
@@ -359,10 +363,13 @@ void extractTbnameSlotId(SSysTableScanInfo* pInfo, const SScanPhy
static
void
sysTableScanFillTbName
(
SOperatorInfo
*
pOperator
,
const
SSysTableScanInfo
*
pInfo
,
const
char
*
name
,
SSDataBlock
*
pBlock
);
__optSysFilter
optSysGetFilterFunc
(
int32_t
ctype
,
bool
*
reverse
)
{
__optSysFilter
optSysGetFilterFunc
(
int32_t
ctype
,
bool
*
reverse
,
bool
*
equal
)
{
if
(
ctype
==
OP_TYPE_LOWER_EQUAL
||
ctype
==
OP_TYPE_LOWER_THAN
)
{
*
reverse
=
true
;
}
if
(
ctype
==
OP_TYPE_EQUAL
)
{
*
equal
=
true
;
}
if
(
ctype
==
OP_TYPE_LOWER_THAN
)
return
optSysFilterFuncImpl__LowerThan
;
else
if
(
ctype
==
OP_TYPE_LOWER_EQUAL
)
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
1acb4dd6
...
...
@@ -390,11 +390,6 @@ static FORCE_INLINE FilterFunc sifGetFilterFunc(EIndexQueryType type, bool *reve
*
reverse
=
false
;
}
if
(
type
==
QUERY_LESS_EQUAL
||
type
==
QUERY_GREATER_EQUAL
)
{
*
equal
=
true
;
}
else
{
*
equal
=
false
;
}
if
(
type
==
QUERY_LESS_EQUAL
)
return
sifLessEqual
;
else
if
(
type
==
QUERY_LESS_THAN
)
...
...
@@ -404,6 +399,7 @@ static FORCE_INLINE FilterFunc sifGetFilterFunc(EIndexQueryType type, bool *reve
else
if
(
type
==
QUERY_GREATER_THAN
)
return
sifGreaterThan
;
else
if
(
type
==
QUERY_TERM
)
{
*
equal
=
true
;
return
sifEqual
;
}
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录