Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2b3ff125
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2b3ff125
编写于
10月 09, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bad merge
上级
eafe8666
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
62 addition
and
2 deletion
+62
-2
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-0
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+4
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+37
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+18
-0
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
2b3ff125
...
...
@@ -478,6 +478,7 @@ typedef struct SStreamScanInfo {
uint64_t
tableUid
;
// queried super table uid
SExprInfo
*
pPseudoExpr
;
int32_t
numOfPseudoExpr
;
SExprSupp
tbnameCalSup
;
int32_t
primaryTsIndex
;
// primary time stamp slot id
SReadHandle
readHandle
;
SInterval
interval
;
// if the upstream is an interval operator, the interval info is also kept here.
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
2b3ff125
...
...
@@ -4249,6 +4249,8 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
char
*
tbname
=
taosHashGet
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
));
if
(
tbname
!=
NULL
)
{
memcpy
(
pBlock
->
info
.
parTbName
,
tbname
,
TSDB_TABLE_NAME_LEN
);
}
else
{
pBlock
->
info
.
parTbName
[
0
]
=
0
;
}
}
else
{
// current value belongs to different group, it can't be packed into one datablock
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
2b3ff125
...
...
@@ -873,7 +873,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
colDataAppend
(
pDestCol
,
pDest
->
info
.
rows
,
pSrcData
,
isNull
);
}
pDest
->
info
.
rows
++
;
if
(
i
==
0
)
{
if
(
pInfo
->
tbnameCalSup
.
numOfExprs
>
0
&&
i
==
0
)
{
SSDataBlock
*
pTmpBlock
=
blockCopyOneRow
(
pSrc
,
rowIndex
);
SSDataBlock
*
pResBlock
=
createDataBlock
();
pResBlock
->
info
.
rowSize
=
TSDB_TABLE_NAME_LEN
;
...
...
@@ -892,6 +892,9 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
}
else
{
pDest
->
info
.
parTbName
[
0
]
=
0
;
}
/*printf("\n\n set name %s\n\n", pDest->info.parTbName);*/
blockDataDestroy
(
pTmpBlock
);
blockDataDestroy
(
pResBlock
);
}
}
blockDataUpdateTsWindow
(
pDest
,
pInfo
->
tsColIndex
);
...
...
@@ -915,7 +918,6 @@ static void doStreamHashPartitionImpl(SStreamPartitionOperatorInfo* pInfo, SSDat
}
else
{
SPartitionDataInfo
newParData
=
{
0
};
newParData
.
groupId
=
calcGroupId
(
pInfo
->
partitionSup
.
keyBuf
,
keyLen
);
/*newParData.tbname = */
newParData
.
rowIds
=
taosArrayInit
(
64
,
sizeof
(
int32_t
));
taosArrayPush
(
newParData
.
rowIds
,
&
i
);
taosHashPut
(
pInfo
->
pPartitions
,
pInfo
->
partitionSup
.
keyBuf
,
keyLen
,
&
newParData
,
sizeof
(
SPartitionDataInfo
));
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
2b3ff125
...
...
@@ -1415,6 +1415,30 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
}
blockDataUpdateTsWindow
(
pInfo
->
pRes
,
pInfo
->
primaryTsIndex
);
blockDataFreeRes
((
SSDataBlock
*
)
pBlock
);
if
(
pInfo
->
tbnameCalSup
.
numOfExprs
>
0
&&
pInfo
->
pRes
->
info
.
rows
>
0
)
{
SSDataBlock
*
pTmpBlock
=
blockCopyOneRow
(
pInfo
->
pRes
,
0
);
SSDataBlock
*
pResBlock
=
createDataBlock
();
pResBlock
->
info
.
rowSize
=
TSDB_TABLE_NAME_LEN
;
SColumnInfoData
data
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
TSDB_TABLE_NAME_LEN
,
0
);
taosArrayPush
(
pResBlock
->
pDataBlock
,
&
data
);
blockDataEnsureCapacity
(
pResBlock
,
1
);
projectApplyFunctions
(
pInfo
->
tbnameCalSup
.
pExprInfo
,
pResBlock
,
pTmpBlock
,
pInfo
->
tbnameCalSup
.
pCtx
,
1
,
NULL
);
ASSERT
(
pResBlock
->
info
.
rows
==
1
);
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 validation
if
(
pData
!=
(
void
*
)
-
1
)
{
memcpy
(
pInfo
->
pRes
->
info
.
parTbName
,
varDataVal
(
pData
),
varDataLen
(
pData
));
}
else
{
pInfo
->
pRes
->
info
.
parTbName
[
0
]
=
0
;
}
blockDataDestroy
(
pTmpBlock
);
blockDataDestroy
(
pResBlock
);
}
return
0
;
}
...
...
@@ -2089,6 +2113,19 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
}
}
if
(
pTableScanNode
->
pSubtable
!=
NULL
)
{
SExprInfo
*
pSubTableExpr
=
taosMemoryCalloc
(
1
,
sizeof
(
SExprInfo
));
if
(
pSubTableExpr
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
}
pInfo
->
tbnameCalSup
.
pExprInfo
=
pSubTableExpr
;
createExprFromOneNode
(
pSubTableExpr
,
pTableScanNode
->
pSubtable
,
0
);
if
(
initExprSupp
(
&
pInfo
->
tbnameCalSup
,
pSubTableExpr
,
1
)
!=
0
)
{
goto
_error
;
}
}
pInfo
->
pBlockLists
=
taosArrayInit
(
4
,
POINTER_BYTES
);
if
(
pInfo
->
pBlockLists
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
2b3ff125
...
...
@@ -1761,6 +1761,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) {
nodesDestroyNode
((
SNode
*
)
pInfo
->
pPhyNode
);
colDataDestroy
(
&
pInfo
->
twAggSup
.
timeWindowData
);
cleanupGroupResInfo
(
&
pInfo
->
groupResInfo
);
taosHashCleanup
(
pInfo
->
pGroupIdTbNameMap
);
taosMemoryFreeClear
(
param
);
}
...
...
@@ -3291,6 +3292,11 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
}
printDataBlock
(
pBlock
,
IS_FINAL_OP
(
pInfo
)
?
"interval final recv"
:
"interval semi recv"
);
if
(
pBlock
->
info
.
parTbName
[
0
])
{
taosHashPut
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
),
&
pBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
}
ASSERT
(
pBlock
->
info
.
type
!=
STREAM_INVERT
);
if
(
pBlock
->
info
.
type
==
STREAM_NORMAL
||
pBlock
->
info
.
type
==
STREAM_PULL_DATA
)
{
pInfo
->
binfo
.
pRes
->
info
.
type
=
pBlock
->
info
.
type
;
...
...
@@ -3501,6 +3507,9 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
pInfo
->
delKey
.
ts
=
INT64_MAX
;
pInfo
->
delKey
.
groupId
=
0
;
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
pOperator
->
operatorType
=
pPhyNode
->
type
;
pOperator
->
blocking
=
true
;
pOperator
->
status
=
OP_NOT_OPENED
;
...
...
@@ -5666,6 +5675,12 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
}
printDataBlock
(
pBlock
,
"single interval recv"
);
if
(
pBlock
->
info
.
parTbName
[
0
])
{
taosHashPut
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
),
&
pBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
/*printf("\n\n put tbname %s\n\n", pBlock->info.parTbName);*/
}
if
(
pBlock
->
info
.
type
==
STREAM_DELETE_DATA
||
pBlock
->
info
.
type
==
STREAM_DELETE_RESULT
||
pBlock
->
info
.
type
==
STREAM_CLEAR
)
{
doDeleteWindows
(
pOperator
,
&
pInfo
->
interval
,
pBlock
,
pInfo
->
pDelWins
,
pUpdatedMap
);
...
...
@@ -5807,6 +5822,9 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo
->
delKey
.
ts
=
INT64_MAX
;
pInfo
->
delKey
.
groupId
=
0
;
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
pOperator
->
name
=
"StreamIntervalOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
;
pOperator
->
blocking
=
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录