Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7f6ff396
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看板
提交
7f6ff396
编写于
11月 18, 2022
作者:
S
shenglian zhou
提交者:
slzhou
11月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: table merge scan save work
上级
bc180e39
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
104 addition
and
6 deletion
+104
-6
include/libs/function/function.h
include/libs/function/function.h
+1
-0
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+6
-0
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+0
-6
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+11
-0
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+1
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+5
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+80
-0
未找到文件。
include/libs/function/function.h
浏览文件 @
7f6ff396
...
@@ -163,6 +163,7 @@ typedef struct tExprNode {
...
@@ -163,6 +163,7 @@ typedef struct tExprNode {
int32_t
functionId
;
int32_t
functionId
;
int32_t
num
;
int32_t
num
;
struct
SFunctionNode
*
pFunctNode
;
struct
SFunctionNode
*
pFunctNode
;
int32_t
functionType
;
}
_function
;
}
_function
;
struct
{
struct
{
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
7f6ff396
...
@@ -109,6 +109,12 @@ int metaGetTableUidByName(void *meta, char *tbName, int64_t *uid);
...
@@ -109,6 +109,12 @@ int metaGetTableUidByName(void *meta, char *tbName, int64_t *uid);
int
metaGetTableTypeByName
(
void
*
meta
,
char
*
tbName
,
ETableType
*
tbType
);
int
metaGetTableTypeByName
(
void
*
meta
,
char
*
tbName
,
ETableType
*
tbType
);
bool
metaIsTableExist
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
bool
metaIsTableExist
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
typedef
struct
{
int64_t
uid
;
int64_t
ctbNum
;
}
SMetaStbStats
;
int32_t
metaGetStbStats
(
SMeta
*
pMeta
,
int64_t
uid
,
SMetaStbStats
*
pInfo
);
typedef
struct
SMetaFltParam
{
typedef
struct
SMetaFltParam
{
tb_uid_t
suid
;
tb_uid_t
suid
;
int16_t
cid
;
int16_t
cid
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
7f6ff396
...
@@ -144,12 +144,6 @@ typedef struct SMetaInfo {
...
@@ -144,12 +144,6 @@ typedef struct SMetaInfo {
}
SMetaInfo
;
}
SMetaInfo
;
int32_t
metaGetInfo
(
SMeta
*
pMeta
,
int64_t
uid
,
SMetaInfo
*
pInfo
);
int32_t
metaGetInfo
(
SMeta
*
pMeta
,
int64_t
uid
,
SMetaInfo
*
pInfo
);
typedef
struct
{
int64_t
uid
;
int64_t
ctbNum
;
}
SMetaStbStats
;
int32_t
metaGetStbStats
(
SMeta
*
pMeta
,
int64_t
uid
,
SMetaStbStats
*
pInfo
);
// tsdb
// tsdb
int
tsdbOpen
(
SVnode
*
pVnode
,
STsdb
**
ppTsdb
,
const
char
*
dir
,
STsdbKeepCfg
*
pKeepCfg
,
int8_t
rollback
);
int
tsdbOpen
(
SVnode
*
pVnode
,
STsdb
**
ppTsdb
,
const
char
*
dir
,
STsdbKeepCfg
*
pKeepCfg
,
int8_t
rollback
);
int
tsdbClose
(
STsdb
**
pTsdb
);
int
tsdbClose
(
STsdb
**
pTsdb
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
7f6ff396
...
@@ -530,6 +530,17 @@ typedef struct SSysTableScanInfo {
...
@@ -530,6 +530,17 @@ typedef struct SSysTableScanInfo {
SLoadRemoteDataInfo
loadInfo
;
SLoadRemoteDataInfo
loadInfo
;
}
SSysTableScanInfo
;
}
SSysTableScanInfo
;
typedef
struct
STableCountScanInfo
{
SReadHandle
readHandle
;
SSDataBlock
*
pRes
;
SExprSupp
pseudoSup
;
SNode
*
pCondition
;
SName
name
;
uint64_t
suid
;
uint64_t
uid
;
int8_t
tableType
;
}
STableCountScanInfo
;
typedef
struct
SBlockDistInfo
{
typedef
struct
SBlockDistInfo
{
SSDataBlock
*
pResBlock
;
SSDataBlock
*
pResBlock
;
STsdbReader
*
pHandle
;
STsdbReader
*
pHandle
;
...
...
source/libs/executor/src/executil.c
浏览文件 @
7f6ff396
...
@@ -1283,6 +1283,7 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
...
@@ -1283,6 +1283,7 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
pExprNode
->
_function
.
functionId
=
pFuncNode
->
funcId
;
pExprNode
->
_function
.
functionId
=
pFuncNode
->
funcId
;
pExprNode
->
_function
.
pFunctNode
=
pFuncNode
;
pExprNode
->
_function
.
pFunctNode
=
pFuncNode
;
pExprNode
->
_function
.
functionType
=
pFuncNode
->
funcType
;
tstrncpy
(
pExprNode
->
_function
.
functionName
,
pFuncNode
->
functionName
,
tListLen
(
pExprNode
->
_function
.
functionName
));
tstrncpy
(
pExprNode
->
_function
.
functionName
,
pFuncNode
->
functionName
,
tListLen
(
pExprNode
->
_function
.
functionName
));
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
7f6ff396
...
@@ -2543,6 +2543,8 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT
...
@@ -2543,6 +2543,8 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT
SSchemaWrapper
*
extractQueriedColumnSchema
(
SScanPhysiNode
*
pScanNode
);
SSchemaWrapper
*
extractQueriedColumnSchema
(
SScanPhysiNode
*
pScanNode
);
SOperatorInfo
*
createTableCountScanOperatorInfo
(
SReadHandle
*
handle
,
STableCountScanPhysiNode
*
pNode
,
SExecTaskInfo
*
pTaskInfo
);
int32_t
extractTableSchemaInfo
(
SReadHandle
*
pHandle
,
SScanPhysiNode
*
pScanNode
,
SExecTaskInfo
*
pTaskInfo
)
{
int32_t
extractTableSchemaInfo
(
SReadHandle
*
pHandle
,
SScanPhysiNode
*
pScanNode
,
SExecTaskInfo
*
pTaskInfo
)
{
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
metaReaderInit
(
&
mr
,
pHandle
->
meta
,
0
);
...
@@ -2733,6 +2735,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -2733,6 +2735,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
==
type
)
{
SSystemTableScanPhysiNode
*
pSysScanPhyNode
=
(
SSystemTableScanPhysiNode
*
)
pPhyNode
;
SSystemTableScanPhysiNode
*
pSysScanPhyNode
=
(
SSystemTableScanPhysiNode
*
)
pPhyNode
;
pOperator
=
createSysTableScanOperatorInfo
(
pHandle
,
pSysScanPhyNode
,
pUser
,
pTaskInfo
);
pOperator
=
createSysTableScanOperatorInfo
(
pHandle
,
pSysScanPhyNode
,
pUser
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN
==
type
)
{
STableCountScanPhysiNode
*
pTblCountScanNode
=
(
STableCountScanPhysiNode
*
)
pPhyNode
;
pOperator
=
createTableCountScanOperatorInfo
(
pHandle
,
pTblCountScanNode
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
==
type
)
{
STagScanPhysiNode
*
pScanPhyNode
=
(
STagScanPhysiNode
*
)
pPhyNode
;
STagScanPhysiNode
*
pScanPhyNode
=
(
STagScanPhysiNode
*
)
pPhyNode
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
7f6ff396
...
@@ -4788,3 +4788,83 @@ _error:
...
@@ -4788,3 +4788,83 @@ _error:
taosMemoryFree
(
pOperator
);
taosMemoryFree
(
pOperator
);
return
NULL
;
return
NULL
;
}
}
// ====================================================================================================================
// TableCountScanOperator
static
SSDataBlock
*
doTableCountScan
(
SOperatorInfo
*
pOperator
);
static
void
destoryTableCountScanOperator
(
void
*
param
);
SOperatorInfo
*
createTableCountScanOperatorInfo
(
SReadHandle
*
readHandle
,
STableCountScanPhysiNode
*
pScanNode
,
SExecTaskInfo
*
pTaskInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
STableCountScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STableCountScanInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
!
pInfo
||
!
pOperator
)
{
goto
_error
;
}
pInfo
->
readHandle
=
*
readHandle
;
if
(
pScanNode
->
pScanPseudoCols
!=
NULL
)
{
SExprSupp
*
pSup
=
&
pInfo
->
pseudoSup
;
pSup
->
pExprInfo
=
createExprInfo
(
pScanNode
->
pScanPseudoCols
,
NULL
,
&
pSup
->
numOfExprs
);
pSup
->
pCtx
=
createSqlFunctionCtx
(
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
&
pSup
->
rowEntryInfoOffset
);
}
SDataBlockDescNode
*
pDescNode
=
pScanNode
->
node
.
pOutputDataBlockDesc
;
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
1
);
pInfo
->
pRes
=
createResDataBlock
(
pDescNode
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
tNameAssign
(
&
pInfo
->
name
,
&
pScanNode
->
tableName
);
pInfo
->
suid
=
pScanNode
->
suid
;
// 0 for super table, super table uid for child table
pInfo
->
uid
=
pScanNode
->
uid
;
// super table uid, or child table uid
pInfo
->
tableType
=
pScanNode
->
tableType
;
setOperatorInfo
(
pOperator
,
"TableCountScanOperator"
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doTableCountScan
,
NULL
,
destoryTableCountScanOperator
,
NULL
);
return
pOperator
;
_error:
if
(
pInfo
!=
NULL
)
{
destoryTableCountScanOperator
(
pInfo
);
}
taosMemoryFreeClear
(
pOperator
);
pTaskInfo
->
code
=
code
;
return
NULL
;
}
static
SSDataBlock
*
doTableCountScan
(
SOperatorInfo
*
pOperator
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
STableCountScanInfo
*
pInfo
=
pOperator
->
info
;
SExprSupp
*
pSup
=
&
pInfo
->
pseudoSup
;
if
(
pSup
->
numOfExprs
!=
1
||
pSup
->
pExprInfo
[
0
].
pExpr
->
nodeType
!=
QUERY_NODE_FUNCTION
||
pSup
->
pExprInfo
[
0
].
pExpr
->
_function
.
functionType
!=
FUNCTION_TYPE_TABLE_COUNT
)
{
qError
(
"%s table count scan operator invalid pseduo columns"
,
GET_TASKID
(
pTaskInfo
));
}
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
0
);
if
(
pInfo
->
uid
!=
0
)
{
SMetaStbStats
stats
=
{
0
};
metaGetStbStats
(
pInfo
->
readHandle
.
meta
,
pInfo
->
uid
,
&
stats
);
int64_t
ctbNum
=
stats
.
ctbNum
;
//TODO: wxy about the return type bigint or int?
colDataAppend
(
pColInfoData
,
0
,
(
char
*
)
&
ctbNum
,
false
);
pInfo
->
pRes
->
info
.
rows
=
1
;
}
else
{
//TODO: get table count in this vnode?
}
return
NULL
;
}
static
void
destoryTableCountScanOperator
(
void
*
param
)
{
STableCountScanInfo
*
pTableCountScanInfo
=
param
;
blockDataDestroy
(
pTableCountScanInfo
->
pRes
);
cleanupExprSupp
(
&
pTableCountScanInfo
->
pseudoSup
);
taosMemoryFreeClear
(
param
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录