Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e74881c1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
e74881c1
编写于
10月 18, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add systable filter
上级
0c6ada5e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
137 addition
and
39 deletion
+137
-39
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+137
-39
未找到文件。
source/libs/executor/src/scanoperator.c
浏览文件 @
e74881c1
...
...
@@ -42,32 +42,44 @@ static int32_t buildDbTableInfoBlock(bool sysInfo, const SSDataBlock* p, const S
static
char
*
SYSTABLE_IDX_COLUMN
[]
=
{
"table_name"
,
"db_name"
,
"create_time"
,
"columns"
,
"ttl"
,
"stable_name"
,
"vgroup_id', 'uid"
,
"type"
};
typedef
int32_t
(
*
__sys_filte
r
)(
void
*
pMeta
,
SNode
*
condition
,
SArray
*
result
);
typedef
int32_t
(
*
__sys_filte
)(
void
*
pMeta
,
SNode
*
condition
,
SArray
*
result
);
typedef
int32_t
(
*
__sys_check
)(
SNode
*
condtion
);
typedef
struct
{
const
char
*
name
;
__sys_filter
fltFunc
;
const
char
*
name
;
__sys_check
chkFunc
;
__sys_filte
fltFunc
;
}
SSTabFltFuncDef
;
static
int32_t
sysFilteDbName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteVgroupId
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteTableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteCreateTime
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteNcolumn
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteTtl
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteSTableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteUid
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilteType
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
const
SSTabFltFuncDef
filterDict
[]
=
{{.
name
=
"table_name"
,
.
fltFunc
=
sysFilteTableName
},
{.
name
=
"db_name"
,
.
fltFunc
=
sysFilteDbName
},
{.
name
=
"create_time"
,
.
fltFunc
=
sysFilteCreateTime
},
{.
name
=
"columns"
,
.
fltFunc
=
sysFilteNcolumn
},
{.
name
=
"ttl"
,
.
fltFunc
=
sysFilteTtl
},
{.
name
=
"stable_name"
,
.
fltFunc
=
sysFilteSTableName
},
{.
name
=
"vgroup_id"
,
.
fltFunc
=
sysFilteVgroupId
},
{.
name
=
"uid"
,
.
fltFunc
=
sysFilteUid
},
{.
name
=
"type"
,
.
fltFunc
=
sysFilteType
}};
static
int32_t
sysChkFilter__DBName
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__VgroupId
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__TableName
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__CreateTime
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__Ncolumn
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__Ttl
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__STableName
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__Uid
(
SNode
*
pNode
);
static
int32_t
sysChkFilter__Type
(
SNode
*
pNode
);
static
int32_t
sysFilte__DbName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__VgroupId
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__TableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__CreateTime
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__Ncolumn
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__Ttl
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__STableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__Uid
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
static
int32_t
sysFilte__Type
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
);
const
SSTabFltFuncDef
filterDict
[]
=
{
{.
name
=
"table_name"
,
.
chkFunc
=
sysChkFilter__TableName
,
.
fltFunc
=
sysFilte__TableName
},
{.
name
=
"db_name"
,
.
chkFunc
=
sysChkFilter__DBName
,
.
fltFunc
=
sysFilte__DbName
},
{.
name
=
"create_time"
,
.
chkFunc
=
sysChkFilter__CreateTime
,
.
fltFunc
=
sysFilte__CreateTime
},
{.
name
=
"columns"
,
.
chkFunc
=
sysChkFilter__Ncolumn
,
.
fltFunc
=
sysFilte__Ncolumn
},
{.
name
=
"ttl"
,
.
chkFunc
=
sysChkFilter__Ttl
,
.
fltFunc
=
sysFilte__Ttl
},
{.
name
=
"stable_name"
,
.
chkFunc
=
sysChkFilter__STableName
,
.
fltFunc
=
sysFilte__STableName
},
{.
name
=
"vgroup_id"
,
.
chkFunc
=
sysChkFilter__VgroupId
,
.
fltFunc
=
sysFilte__VgroupId
},
{.
name
=
"uid"
,
.
chkFunc
=
sysChkFilter__Uid
,
.
fltFunc
=
sysFilte__Uid
},
{.
name
=
"type"
,
.
chkFunc
=
sysChkFilter__Type
,
.
fltFunc
=
sysFilte__Type
}};
#define SYSTAB_FILTER_DICT_SIZE (sizeof(filterDict) / sizeof(filterDict[0]))
...
...
@@ -320,7 +332,6 @@ static bool doLoadBlockSMA(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
return
true
;
}
static
void
doSetTagColumnData
(
STableScanInfo
*
pTableScanInfo
,
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
)
{
if
(
pTableScanInfo
->
pseudoSup
.
numOfExprs
>
0
)
{
SExprSupp
*
pSup
=
&
pTableScanInfo
->
pseudoSup
;
...
...
@@ -1587,7 +1598,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
tsdbReaderClose
(
pTSInfo
->
dataReader
);
pTSInfo
->
dataReader
=
NULL
;
tqOffsetResetToLog
(
&
pTaskInfo
->
streamInfo
.
prepareStatus
,
pTaskInfo
->
streamInfo
.
snapshotVer
);
qDebug
(
"queue scan tsdb over, switch to wal ver %"
PRId64
,
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
);
qDebug
(
"queue scan tsdb over, switch to wal ver %"
PRId64
,
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
);
if
(
tqSeekVer
(
pInfo
->
tqReader
,
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
)
<
0
)
{
return
NULL
;
}
...
...
@@ -2804,7 +2815,7 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo,
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
sysFilteDbName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
DbName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
void
*
pVnode
=
pMeta
;
const
char
*
db
=
NULL
;
...
...
@@ -2819,7 +2830,7 @@ static int32_t sysFilteDbName(void* pMeta, SNode* pNode, SArray* result) {
return
-
1
;
}
static
int32_t
sysFilteVgroupId
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
VgroupId
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
void
*
pVnode
=
pMeta
;
int32_t
vgId
=
0
;
...
...
@@ -2828,57 +2839,143 @@ static int32_t sysFilteVgroupId(void* pMeta, SNode* pNode, SArray* result) {
return
-
1
;
}
static
int32_t
sysFilteTableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
TableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
}
static
int32_t
sysFilteCreateTime
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
CreateTime
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
}
static
int32_t
sysFilteNcolumn
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
Ncolumn
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
}
static
int32_t
sysFilteTtl
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
Ttl
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
}
static
int32_t
sysFilteSTableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
STableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
}
static
int32_t
sysFilteUid
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
Uid
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
}
static
int32_t
sysFilteType
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
static
int32_t
sysFilte
__
Type
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
}
static
int32_t
sysChkFilter__DBName
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_STR_DATA_TYPE
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__VgroupId
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_VALID_INT
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__TableName
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_STR_DATA_TYPE
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__CreateTime
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_VALID_BIGINT
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__Ncolumn
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_VALID_INT
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__Ttl
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_VALID_BIGINT
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__STableName
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_STR_DATA_TYPE
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__Uid
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_VALID_BIGINT
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
sysChkFilter__Type
(
SNode
*
pNode
)
{
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
if
(
!
IS_VALID_INT
(
pVal
->
typeData
))
{
return
-
1
;
}
return
0
;
}
static
int32_t
optSysTabFilteImpl
(
void
*
arg
,
SNode
*
cond
,
SArray
*
result
)
{
if
(
nodeType
(
cond
)
!=
QUERY_NODE_OPERATOR
||
optSysCheckOper
(
cond
)
!=
0
)
return
-
1
;
if
(
optSysCheckOper
(
cond
)
!=
0
)
return
-
1
;
SOperatorNode
*
pNode
=
(
SOperatorNode
*
)
cond
;
if
(
nodeType
(
pNode
->
pLeft
)
!=
QUERY_NODE_COLUMN
)
return
-
1
;
int8_t
i
=
-
1
;
for
(
i
=
0
;
i
<
SYSTAB_FILTER_DICT_SIZE
;
i
++
)
{
int8_t
i
=
0
;
for
(;
i
<
SYSTAB_FILTER_DICT_SIZE
;
i
++
)
{
if
(
strcmp
(
filterDict
[
i
].
name
,
((
SColumnNode
*
)(
pNode
->
pLeft
))
->
colName
)
==
0
)
{
break
;
}
}
if
(
i
>=
SYSTAB_FILTER_DICT_SIZE
)
return
-
1
;
if
(
filterDict
[
i
].
chkFunc
(
cond
)
!=
0
)
return
-
1
;
return
filterDict
[
i
].
fltFunc
(
arg
,
cond
,
result
);
}
static
int32_t
optSysCheckOper
(
SNode
*
pOpear
)
{
if
(
nodeType
(
pOpear
)
!=
QUERY_NODE_OPERATOR
)
return
-
1
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pOpear
;
return
-
1
;
if
(
pOper
->
opType
<
OP_TYPE_GREATER_THAN
||
pOper
->
opType
>
OP_TYPE_NOT_EQUAL
)
{
return
-
1
;
}
if
(
nodeType
(
pOper
->
pLeft
)
!=
QUERY_NODE_COLUMN
||
nodeType
(
pOper
->
pRight
)
!=
QUERY_NODE_VALUE
)
{
return
-
1
;
}
return
0
;
}
static
int32_t
optSysTabFilte
(
void
*
arg
,
SNode
*
cond
,
SArray
*
result
)
{
int
ret
=
-
1
;
...
...
@@ -2886,6 +2983,7 @@ static int32_t optSysTabFilte(void* arg, SNode* cond, SArray* result) {
ret
=
optSysTabFilteImpl
(
arg
,
cond
,
result
);
return
ret
;
}
if
(
nodeType
(
cond
)
!=
QUERY_NODE_LOGIC_CONDITION
||
((
SLogicConditionNode
*
)
cond
)
->
condType
!=
LOGIC_COND_TYPE_AND
)
{
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录