Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57d14060
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看板
提交
57d14060
编写于
10月 09, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tbname column into stream special block
上级
2b3ff125
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
46 addition
and
17 deletion
+46
-17
include/common/tcommon.h
include/common/tcommon.h
+1
-0
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+7
-2
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+10
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-1
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+2
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+8
-3
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+17
-8
未找到文件。
include/common/tcommon.h
浏览文件 @
57d14060
...
...
@@ -340,6 +340,7 @@ typedef struct SSortExecInfo {
#define GROUPID_COLUMN_INDEX 3
#define CALCULATE_START_TS_COLUMN_INDEX 4
#define CALCULATE_END_TS_COLUMN_INDEX 5
#define TABLE_NAME_COLUMN_INDEX 6
#ifdef __cplusplus
}
...
...
source/common/src/tdatablock.c
浏览文件 @
57d14060
...
...
@@ -1316,8 +1316,8 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) {
pBlock
->
info
.
groupId
=
0
;
pBlock
->
info
.
rows
=
0
;
pBlock
->
info
.
type
=
type
;
pBlock
->
info
.
rowSize
=
sizeof
(
TSKEY
)
+
sizeof
(
TSKEY
)
+
sizeof
(
uint64_t
)
+
sizeof
(
uint64_t
)
+
sizeof
(
TSKEY
)
+
sizeof
(
TSKEY
)
;
pBlock
->
info
.
rowSize
=
sizeof
(
TSKEY
)
+
sizeof
(
TSKEY
)
+
sizeof
(
uint64_t
)
+
sizeof
(
uint64_t
)
+
sizeof
(
TSKEY
)
+
sizeof
(
TSKEY
)
+
TSDB_TABLE_NAME_LEN
;
pBlock
->
info
.
watermark
=
INT64_MIN
;
pBlock
->
pDataBlock
=
taosArrayInit
(
6
,
sizeof
(
SColumnInfoData
));
...
...
@@ -1343,6 +1343,11 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) {
// calculate end ts
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
// table name
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
TSDB_TABLE_NAME_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
return
pBlock
;
}
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
57d14060
...
...
@@ -23,10 +23,19 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
int32_t
totRow
=
pDataBlock
->
info
.
rows
;
SColumnInfoData
*
pTsCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pGidCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pTbNameCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
for
(
int32_t
row
=
0
;
row
<
totRow
;
row
++
)
{
int64_t
ts
=
*
(
int64_t
*
)
colDataGetData
(
pTsCol
,
row
);
int64_t
groupId
=
*
(
int64_t
*
)
colDataGetData
(
pGidCol
,
row
);
char
*
name
=
buildCtbNameByGroupId
(
stbFullName
,
groupId
);
char
*
name
;
void
*
varTbName
=
colDataGetVarData
(
pTbNameCol
,
row
);
if
(
varTbName
!=
NULL
&&
varTbName
!=
(
void
*
)
-
1
)
{
name
=
taosMemoryCalloc
(
1
,
TSDB_TABLE_NAME_LEN
);
memcpy
(
name
,
varDataVal
(
varTbName
),
varDataLen
(
varTbName
));
}
else
{
name
=
buildCtbNameByGroupId
(
stbFullName
,
groupId
);
}
tqDebug
(
"stream delete msg: groupId :%ld, name: %s"
,
groupId
,
name
);
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pVnode
->
pMeta
,
0
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
57d14060
...
...
@@ -1067,7 +1067,7 @@ bool isOverdue(TSKEY ts, STimeWindowAggSupp* pSup);
bool
isCloseWindow
(
STimeWindow
*
pWin
,
STimeWindowAggSupp
*
pSup
);
bool
isDeletedWindow
(
STimeWindow
*
pWin
,
uint64_t
groupId
,
SAggSupporter
*
pSup
);
bool
isDeletedStreamWindow
(
STimeWindow
*
pWin
,
uint64_t
groupId
,
SStreamState
*
pState
,
STimeWindowAggSupp
*
pTwSup
);
void
appendOneRow
(
SSDataBlock
*
pBlock
,
TSKEY
*
pStartTs
,
TSKEY
*
pEndTs
,
uint64_t
*
pUid
,
uint64_t
*
pGp
);
void
appendOneRow
ToStreamSpecialBlock
(
SSDataBlock
*
pBlock
,
TSKEY
*
pStartTs
,
TSKEY
*
pEndTs
,
uint64_t
*
pUid
,
uint64_t
*
pGp
,
void
*
pTbName
);
void
printDataBlock
(
SSDataBlock
*
pBlock
,
const
char
*
flag
);
uint64_t
calGroupIdByData
(
SPartitionBySupporter
*
pParSup
,
SExprSupp
*
pExprSup
,
SSDataBlock
*
pBlock
,
int32_t
rowId
);
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
57d14060
...
...
@@ -885,8 +885,8 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
ASSERT
(
taosArrayGetSize
(
pResBlock
->
pDataBlock
)
==
1
);
SColumnInfoData
*
pCol
=
taosArrayGet
(
pResBlock
->
pDataBlock
,
0
);
ASSERT
(
pCol
->
info
.
type
==
TSDB_DATA_TYPE_VARCHAR
);
void
*
pData
=
colDataGetData
(
pCol
,
0
);
// TODO check tbname valid
ation
void
*
pData
=
colDataGet
Var
Data
(
pCol
,
0
);
// TODO check tbname valid
ity
if
(
pData
!=
(
void
*
)
-
1
)
{
memcpy
(
pDest
->
info
.
parTbName
,
varDataVal
(
pData
),
varDataLen
(
pData
));
}
else
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
57d14060
...
...
@@ -1300,19 +1300,22 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock,
return
code
;
}
void
appendOneRow
(
SSDataBlock
*
pBlock
,
TSKEY
*
pStartTs
,
TSKEY
*
pEndTs
,
uint64_t
*
pUid
,
uint64_t
*
pGp
)
{
void
appendOneRowToStreamSpecialBlock
(
SSDataBlock
*
pBlock
,
TSKEY
*
pStartTs
,
TSKEY
*
pEndTs
,
uint64_t
*
pUid
,
uint64_t
*
pGp
,
void
*
pTbName
)
{
SColumnInfoData
*
pStartTsCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndTsCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pUidCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
UID_COLUMN_INDEX
);
SColumnInfoData
*
pGpCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pCalStartCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalEndCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pTableCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
colDataAppend
(
pStartTsCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
pStartTs
,
false
);
colDataAppend
(
pEndTsCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
pEndTs
,
false
);
colDataAppend
(
pUidCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
pUid
,
false
);
colDataAppend
(
pGpCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
pGp
,
false
);
colDataAppend
(
pCalStartCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
pStartTs
,
false
);
colDataAppend
(
pCalEndCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
pEndTs
,
false
);
colDataAppend
(
pTableCol
,
pBlock
->
info
.
rows
,
(
const
char
*
)
pTbName
,
pTbName
==
NULL
);
pBlock
->
info
.
rows
++
;
}
...
...
@@ -1342,10 +1345,12 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
if
((
update
||
closedWin
)
&&
out
)
{
qDebug
(
"stream update check not pass, update %d, closedWin %d"
,
update
,
closedWin
);
uint64_t
gpId
=
0
;
appendOneRow
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
uid
,
&
gpId
);
appendOneRowToStreamSpecialBlock
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
uid
,
&
gpId
,
NULL
);
if
(
closedWin
&&
pInfo
->
partitionSup
.
needCalc
)
{
gpId
=
calGroupIdByData
(
&
pInfo
->
partitionSup
,
pInfo
->
pPartScalarSup
,
pBlock
,
rowId
);
appendOneRow
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
uid
,
&
gpId
);
appendOneRowToStreamSpecialBlock
(
pInfo
->
pUpdateDataRes
,
tsCol
+
rowId
,
tsCol
+
rowId
,
&
pBlock
->
info
.
uid
,
&
gpId
,
NULL
);
}
}
}
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
57d14060
...
...
@@ -1687,7 +1687,8 @@ static void freeAllPages(SArray* pageIds, SDiskbasedBuf* pDiskBuf) {
taosArrayClear
(
pageIds
);
}
static
void
doBuildDeleteResult
(
SArray
*
pWins
,
int32_t
*
index
,
SSDataBlock
*
pBlock
)
{
static
void
doBuildDeleteResult
(
SStreamIntervalOperatorInfo
*
pInfo
,
SArray
*
pWins
,
int32_t
*
index
,
SSDataBlock
*
pBlock
)
{
blockDataCleanup
(
pBlock
);
int32_t
size
=
taosArrayGetSize
(
pWins
);
if
(
*
index
==
size
)
{
...
...
@@ -1699,7 +1700,14 @@ static void doBuildDeleteResult(SArray* pWins, int32_t* index, SSDataBlock* pBlo
uint64_t
uid
=
0
;
for
(
int32_t
i
=
*
index
;
i
<
size
;
i
++
)
{
SWinKey
*
pWin
=
taosArrayGet
(
pWins
,
i
);
appendOneRow
(
pBlock
,
&
pWin
->
ts
,
&
pWin
->
ts
,
&
uid
,
&
pWin
->
groupId
);
char
*
tbname
=
taosHashGet
(
pInfo
->
pGroupIdTbNameMap
,
&
pWin
->
groupId
,
sizeof
(
int64_t
));
if
(
tbname
==
NULL
)
{
appendOneRowToStreamSpecialBlock
(
pBlock
,
&
pWin
->
ts
,
&
pWin
->
ts
,
&
uid
,
&
pWin
->
groupId
,
NULL
);
}
else
{
char
parTbName
[
VARSTR_HEADER_SIZE
+
TSDB_TABLE_NAME_LEN
];
STR_WITH_MAXSIZE_TO_VARSTR
(
parTbName
,
tbname
,
sizeof
(
parTbName
));
appendOneRowToStreamSpecialBlock
(
pBlock
,
&
pWin
->
ts
,
&
pWin
->
ts
,
&
uid
,
&
pWin
->
groupId
,
parTbName
);
}
(
*
index
)
++
;
}
}
...
...
@@ -3239,7 +3247,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
return
pInfo
->
pPullDataRes
;
}
doBuildDeleteResult
(
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
doBuildDeleteResult
(
pInfo
,
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
if
(
pInfo
->
pDelRes
->
info
.
rows
!=
0
)
{
// process the rest of the data
printDataBlock
(
pInfo
->
pDelRes
,
IS_FINAL_OP
(
pInfo
)
?
"interval final"
:
"interval semi"
);
...
...
@@ -3265,7 +3273,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
return
NULL
;
}
else
{
if
(
!
IS_FINAL_OP
(
pInfo
))
{
doBuildDeleteResult
(
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
doBuildDeleteResult
(
pInfo
,
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
if
(
pInfo
->
pDelRes
->
info
.
rows
!=
0
)
{
// process the rest of the data
printDataBlock
(
pInfo
->
pDelRes
,
IS_FINAL_OP
(
pInfo
)
?
"interval final"
:
"interval semi"
);
...
...
@@ -3392,7 +3400,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
return
pInfo
->
pPullDataRes
;
}
doBuildDeleteResult
(
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
doBuildDeleteResult
(
pInfo
,
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
if
(
pInfo
->
pDelRes
->
info
.
rows
!=
0
)
{
// process the rest of the data
printDataBlock
(
pInfo
->
pDelRes
,
IS_FINAL_OP
(
pInfo
)
?
"interval final"
:
"interval semi"
);
...
...
@@ -4849,7 +4857,8 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl
i
,
&
allEqual
,
pStDeleted
);
if
(
!
allEqual
)
{
uint64_t
uid
=
0
;
appendOneRow
(
pAggSup
->
pScanBlock
,
&
pCurWin
->
winInfo
.
win
.
skey
,
&
pCurWin
->
winInfo
.
win
.
ekey
,
&
uid
,
&
groupId
);
appendOneRowToStreamSpecialBlock
(
pAggSup
->
pScanBlock
,
&
pCurWin
->
winInfo
.
win
.
skey
,
&
pCurWin
->
winInfo
.
win
.
ekey
,
&
uid
,
&
groupId
,
NULL
);
taosHashRemove
(
pSeUpdated
,
&
pCurWin
->
winInfo
.
pos
,
sizeof
(
SResultRowPosition
));
deleteWindow
(
pAggSup
->
pCurWins
,
winIndex
,
destroyStateWinInfo
);
continue
;
...
...
@@ -5645,7 +5654,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
}
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
doBuildDeleteResult
(
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
doBuildDeleteResult
(
pInfo
,
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
"single interval delete"
);
return
pInfo
->
pDelRes
;
...
...
@@ -5729,7 +5738,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
taosHashCleanup
(
pUpdatedMap
);
doBuildDeleteResult
(
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
doBuildDeleteResult
(
pInfo
,
pInfo
->
pDelWins
,
&
pInfo
->
delIndex
,
pInfo
->
pDelRes
);
if
(
pInfo
->
pDelRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pInfo
->
pDelRes
,
"single interval delete"
);
return
pInfo
->
pDelRes
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录