Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c941a2c7
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看板
提交
c941a2c7
编写于
3月 29, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test for encode/decode ResultRow in group by and interval
上级
22674396
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
71 addition
and
8 deletion
+71
-8
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+2
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+69
-7
未找到文件。
include/libs/nodes/nodes.h
浏览文件 @
c941a2c7
...
...
@@ -141,7 +141,8 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_DISPATCH
,
QUERY_NODE_PHYSICAL_PLAN_INSERT
,
QUERY_NODE_PHYSICAL_SUBPLAN
,
QUERY_NODE_PHYSICAL_PLAN
QUERY_NODE_PHYSICAL_PLAN
,
QUERY_NODE_PHYSICAL_PLAN_GROUPBY
}
ENodeType
;
/**
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
c941a2c7
...
...
@@ -6346,7 +6346,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo *pOperator) {
taosHashClear
(
pSup
->
pResultRowHashTable
);
pOperator
->
decodeResultRow
(
pOperator
,
result
,
length
);
if
(
result
){
f
ree
(
result
);
taosMemoryF
ree
(
result
);
}
}
...
...
@@ -6377,8 +6377,27 @@ static SSDataBlock* getAggregateResult(SOperatorInfo *pOperator, bool* newgroup)
}
static
void
aggEncodeResultRow
(
SOperatorInfo
*
pOperator
,
char
**
result
,
int32_t
*
length
)
{
SAggOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
SAggSupporter
*
pSup
=
&
pAggInfo
->
aggSup
;
SAggSupporter
*
pSup
=
NULL
;
switch
(
pOperator
->
operatorType
){
case
QUERY_NODE_PHYSICAL_PLAN_AGG
:{
SAggOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
pSup
=
&
pAggInfo
->
aggSup
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_GROUPBY
:{
SGroupbyOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
pSup
=
&
pAggInfo
->
aggSup
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
:{
STableIntervalOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
pSup
=
&
pAggInfo
->
aggSup
;
break
;
}
default:
{
qDebug
(
"invalid operatorType: %d"
,
pOperator
->
operatorType
);
}
}
int32_t
size
=
taosHashGetSize
(
pSup
->
pResultRowHashTable
);
size_t
keyLen
=
POINTER_BYTES
;
// estimate the key length
...
...
@@ -6434,9 +6453,28 @@ static bool aggDecodeResultRow(SOperatorInfo* pOperator, char *result, int32_t l
return
false
;
}
SAggOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
SAggSupporter
*
pSup
=
&
pAggInfo
->
aggSup
;
SOptrBasicInfo
*
pInfo
=
&
pAggInfo
->
binfo
;
SAggSupporter
*
pSup
=
NULL
;
switch
(
pOperator
->
operatorType
){
case
QUERY_NODE_PHYSICAL_PLAN_AGG
:{
SAggOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
//SOptrBasicInfo *pInfo = &pAggInfo->binfo;
pSup
=
&
pAggInfo
->
aggSup
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_GROUPBY
:{
SGroupbyOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
pSup
=
&
pAggInfo
->
aggSup
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
:{
STableIntervalOperatorInfo
*
pAggInfo
=
pOperator
->
info
;
pSup
=
&
pAggInfo
->
aggSup
;
break
;
}
default:
{
qDebug
(
"invalid operatorType: %d"
,
pOperator
->
operatorType
);
}
}
// int32_t size = taosHashGetSize(pSup->pResultRowHashTable);
int32_t
count
=
*
(
int32_t
*
)(
result
);
...
...
@@ -6733,6 +6771,16 @@ static int32_t doOpenIntervalAgg(SOperatorInfo *pOperator) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock
(
pOperator
,
pInfo
->
binfo
.
pCtx
,
pBlock
,
order
);
hashIntervalAgg
(
pOperator
,
&
pInfo
->
binfo
.
resultRowInfo
,
pBlock
,
0
);
char
*
result
=
NULL
;
int32_t
length
=
0
;
pOperator
->
encodeResultRow
(
pOperator
,
&
result
,
&
length
);
SAggSupporter
*
pSup
=
&
pInfo
->
aggSup
;
taosHashClear
(
pSup
->
pResultRowHashTable
);
pOperator
->
decodeResultRow
(
pOperator
,
result
,
length
);
if
(
result
){
taosMemoryFree
(
result
);
}
}
closeAllResultRows
(
&
pInfo
->
binfo
.
resultRowInfo
);
...
...
@@ -7149,6 +7197,16 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo *pOperator, bool* newgrou
setInputDataBlock
(
pOperator
,
pInfo
->
binfo
.
pCtx
,
pBlock
,
order
);
// setTagValue(pOperator, pRuntimeEnv->current->pTable, pInfo->binfo.pCtx, pOperator->numOfOutput);
doHashGroupbyAgg
(
pOperator
,
pBlock
);
char
*
result
=
NULL
;
int32_t
length
=
0
;
pOperator
->
encodeResultRow
(
pOperator
,
&
result
,
&
length
);
SAggSupporter
*
pSup
=
&
pInfo
->
aggSup
;
taosHashClear
(
pSup
->
pResultRowHashTable
);
pOperator
->
decodeResultRow
(
pOperator
,
result
,
length
);
if
(
result
){
taosMemoryFree
(
result
);
}
}
pOperator
->
status
=
OP_RES_TO_RETURN
;
...
...
@@ -7693,6 +7751,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
pOperator
->
_openFn
=
doOpenIntervalAgg
;
pOperator
->
getNextFn
=
doBuildIntervalResult
;
pOperator
->
closeFn
=
destroyIntervalOperatorInfo
;
pOperator
->
encodeResultRow
=
aggEncodeResultRow
;
pOperator
->
decodeResultRow
=
aggDecodeResultRow
;
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -7903,13 +7963,15 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
pOperator
->
name
=
"GroupbyAggOperator"
;
pOperator
->
blockingOptr
=
true
;
pOperator
->
status
=
OP_NOT_OPENED
;
// pOperator->operatorType = OP_Groupby
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_GROUPBY
;
pOperator
->
pExpr
=
pExprInfo
;
pOperator
->
numOfOutput
=
numOfCols
;
pOperator
->
info
=
pInfo
;
pOperator
->
_openFn
=
operatorDummyOpenFn
;
pOperator
->
getNextFn
=
hashGroupbyAggregate
;
pOperator
->
closeFn
=
destroyGroupbyOperatorInfo
;
pOperator
->
encodeResultRow
=
aggEncodeResultRow
;
pOperator
->
decodeResultRow
=
aggDecodeResultRow
;
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
return
pOperator
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录