Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
58c75dde
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看板
提交
58c75dde
编写于
12月 01, 2022
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: add seperate group for normal table when group by db_name/stbable_name
上级
920eac30
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
36 addition
and
29 deletion
+36
-29
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+13
-13
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+4
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+19
-16
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
58c75dde
...
...
@@ -116,14 +116,14 @@ int32_t metaGetCachedTableUidList(SMeta *pMeta, tb_uid_t suid, const uint8_t
int32_t
metaUidFilterCachePut
(
SMeta
*
pMeta
,
uint64_t
suid
,
const
void
*
pKey
,
int32_t
keyLen
,
void
*
pPayload
,
int32_t
payloadLen
,
double
selectivityRatio
);
int32_t
metaUidCacheClear
(
SMeta
*
pMeta
,
uint64_t
suid
);
tb_uid_t
metaGetTableEntryUidByName
(
SMeta
*
pMeta
,
const
char
*
name
);
int64_t
metaGetTbNum
(
SMeta
*
pMeta
);
tb_uid_t
metaGetTableEntryUidByName
(
SMeta
*
pMeta
,
const
char
*
name
);
int64_t
metaGetTbNum
(
SMeta
*
pMeta
);
int64_t
metaGetNtbNum
(
SMeta
*
pMeta
);
typedef
struct
{
int64_t
uid
;
int64_t
ctbNum
;
}
SMetaStbStats
;
int32_t
metaGetStbStats
(
SMeta
*
pMeta
,
int64_t
uid
,
SMetaStbStats
*
pInfo
);
int32_t
metaGetStbStats
(
SMeta
*
pMeta
,
int64_t
uid
,
SMetaStbStats
*
pInfo
);
typedef
struct
SMetaFltParam
{
tb_uid_t
suid
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
58c75dde
...
...
@@ -756,6 +756,10 @@ int64_t metaGetTimeSeriesNum(SMeta *pMeta) {
return
pMeta
->
pVnode
->
config
.
vndStats
.
numOfTimeSeries
+
pMeta
->
pVnode
->
config
.
vndStats
.
numOfNTimeSeries
;
}
int64_t
metaGetNtbNum
(
SMeta
*
pMeta
)
{
return
pMeta
->
pVnode
->
config
.
vndStats
.
numOfNTables
;
}
typedef
struct
{
SMeta
*
pMeta
;
TBC
*
pCur
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
58c75dde
...
...
@@ -3050,7 +3050,7 @@ _error:
void
fillTableCountScanDataBlock
(
STableCountScanSupp
*
pSupp
,
char
*
dbName
,
char
*
stbName
,
int64_t
count
,
SSDataBlock
*
pRes
)
{
if
(
pSupp
->
dbNameSlotId
!=
-
1
)
{
ASSERT
(
strlen
(
dbName
));
ASSERT
(
strlen
(
pSupp
->
dbName
));
SColumnInfoData
*
colInfoData
=
taosArrayGet
(
pRes
->
pDataBlock
,
pSupp
->
dbNameSlotId
);
char
varDbName
[
TSDB_DB_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
strncpy
(
varDataVal
(
varDbName
),
dbName
,
strlen
(
dbName
));
...
...
@@ -3059,12 +3059,15 @@ void fillTableCountScanDataBlock(STableCountScanSupp* pSupp, char* dbName, char*
}
if
(
pSupp
->
stbNameSlotId
!=
-
1
)
{
ASSERT
(
strlen
(
stbName
));
SColumnInfoData
*
colInfoData
=
taosArrayGet
(
pRes
->
pDataBlock
,
pSupp
->
stbNameSlotId
);
if
(
strlen
(
stbName
)
!=
0
)
{
char
varStbName
[
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
strncpy
(
varDataVal
(
varStbName
),
stbName
,
strlen
(
stbName
));
varDataSetLen
(
varStbName
,
strlen
(
stbName
));
colDataAppend
(
colInfoData
,
0
,
varStbName
,
false
);
}
else
{
colDataAppendNULL
(
colInfoData
,
0
);
}
}
if
(
pSupp
->
tbCountSlotId
!=
-
1
)
{
...
...
@@ -3084,10 +3087,6 @@ static SSDataBlock* buildSysDbTableCount(SOperatorInfo* pOperator, STableCountSc
getPerfDbMeta
(
NULL
,
&
perfdbTableNum
);
if
(
pSupp
->
groupByDbName
)
{
if
(
pSupp
->
groupByStbName
)
{
setOperatorCompleted
(
pOperator
);
return
NULL
;
}
if
(
pInfo
->
currGrpIdx
==
0
)
{
uint64_t
groupId
=
calcGroupId
(
TSDB_INFORMATION_SCHEMA_DB
,
strlen
(
TSDB_INFORMATION_SCHEMA_DB
));
pRes
->
info
.
id
.
groupId
=
groupId
;
...
...
@@ -3121,10 +3120,7 @@ static SSDataBlock* doTableCountScan(SOperatorInfo* pOperator) {
STableCountScanSupp
*
pSupp
=
&
pInfo
->
supp
;
SSDataBlock
*
pRes
=
pInfo
->
pRes
;
blockDataCleanup
(
pRes
);
// compute group id must, but output is according to scancols. output group by group
// grouptags high priority(groupid<=>grouptag), then tablename(dbname,tableName).
// scanCols, (grouptags cols)
// mnode, query table count of information_schema and performance_schema
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
...
...
@@ -3145,7 +3141,6 @@ static SSDataBlock* doTableCountScan(SOperatorInfo* pOperator) {
}
if
(
pSupp
->
groupByDbName
)
{
if
(
pSupp
->
groupByStbName
)
{
// group by db_name and stable_name
if
(
pInfo
->
stbUidList
==
NULL
)
{
pInfo
->
stbUidList
=
taosArrayInit
(
16
,
sizeof
(
tb_uid_t
));
if
(
vnodeGetStbIdList
(
pInfo
->
readHandle
.
vnode
,
0
,
pInfo
->
stbUidList
)
<
0
)
{
...
...
@@ -3169,13 +3164,21 @@ static SSDataBlock* doTableCountScan(SOperatorInfo* pOperator) {
fillTableCountScanDataBlock
(
pSupp
,
dbName
,
stbName
,
ctbNum
,
pRes
);
pInfo
->
currGrpIdx
++
;
}
else
if
(
pInfo
->
currGrpIdx
==
taosArrayGetSize
(
pInfo
->
stbUidList
))
{
char
fullStbName
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
snprintf
(
fullStbName
,
TSDB_TABLE_FNAME_LEN
,
"%s.%s"
,
dbName
,
""
);
uint64_t
groupId
=
calcGroupId
(
fullStbName
,
strlen
(
fullStbName
));
pRes
->
info
.
id
.
groupId
=
groupId
;
int64_t
ntbNum
=
metaGetNtbNum
(
pInfo
->
readHandle
.
meta
);
fillTableCountScanDataBlock
(
pSupp
,
dbName
,
""
,
ntbNum
,
pRes
);
pInfo
->
currGrpIdx
++
;
}
else
{
setOperatorCompleted
(
pOperator
);
return
NULL
;
}
}
else
{
// group by only db_name
uint64_t
groupId
=
calcGroupId
(
dbName
,
strlen
(
dbName
));
pRes
->
info
.
id
.
groupId
=
groupId
;
int64_t
dbTableCount
=
metaGetTbNum
(
pInfo
->
readHandle
.
meta
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录