Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aaec70eb
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
aaec70eb
编写于
5月 30, 2022
作者:
wmmhello
提交者:
GitHub
5月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13217 from taosdata/feature/TD-14222-new
feat:add test for operator encode/decode
上级
313e3be0
6c38d716
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
18 deletion
+36
-18
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+2
-2
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+17
-12
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+14
-1
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+3
-3
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
aaec70eb
...
...
@@ -160,7 +160,7 @@ struct SOperatorInfo;
//struct SOptrBasicInfo;
typedef
int32_t
(
*
__optr_encode_fn_t
)(
struct
SOperatorInfo
*
pOperator
,
char
**
result
,
int32_t
*
length
);
typedef
int32_t
(
*
__optr_decode_fn_t
)(
struct
SOperatorInfo
*
pOperator
,
char
*
result
,
int32_t
length
);
typedef
int32_t
(
*
__optr_decode_fn_t
)(
struct
SOperatorInfo
*
pOperator
,
char
*
result
);
typedef
int32_t
(
*
__optr_open_fn_t
)(
struct
SOperatorInfo
*
pOptr
);
typedef
SSDataBlock
*
(
*
__optr_fn_t
)(
struct
SOperatorInfo
*
pOptr
);
...
...
@@ -821,7 +821,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
int32_t
getOperatorExplainExecInfo
(
SOperatorInfo
*
operatorInfo
,
SExplainExecInfo
**
pRes
,
int32_t
*
capacity
,
int32_t
*
resNum
);
int32_t
aggDecodeResultRow
(
SOperatorInfo
*
pOperator
,
char
*
result
,
int32_t
length
);
int32_t
aggDecodeResultRow
(
SOperatorInfo
*
pOperator
,
char
*
result
);
int32_t
aggEncodeResultRow
(
SOperatorInfo
*
pOperator
,
char
**
result
,
int32_t
*
length
);
STimeWindow
getActiveTimeWindow
(
SDiskbasedBuf
*
pBuf
,
SResultRowInfo
*
pResultRowInfo
,
int64_t
ts
,
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
aaec70eb
...
...
@@ -3448,14 +3448,14 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
}
#if 0 // test for encode/decode result info
if(pOperator->encodeResultRow){
if(pOperator->
fpSet.
encodeResultRow){
char *result = NULL;
int32_t length = 0;
SAggSupporter *pSup = &pAggInfo->aggSup
;
pOperator->encodeResultRow(pOperator, pSup, pInfo, &result, &length)
;
pOperator->fpSet.encodeResultRow(pOperator, &result, &length)
;
SAggSupporter* pSup = &pAggInfo->aggSup
;
taosHashClear(pSup->pResultRowHashTable);
pInfo->resultRowInfo.size = 0;
pOperator->
decodeResultRow(pOperator, pSup, pInfo, result, length
);
pOperator->
fpSet.decodeResultRow(pOperator, result
);
if(result){
taosMemoryFree(result);
}
...
...
@@ -3567,17 +3567,20 @@ int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* len
return
TDB_CODE_SUCCESS
;
}
int32_t
aggDecodeResultRow
(
SOperatorInfo
*
pOperator
,
char
*
result
,
int32_t
length
)
{
if
(
result
==
NULL
||
length
<=
0
){
int32_t
aggDecodeResultRow
(
SOperatorInfo
*
pOperator
,
char
*
result
)
{
if
(
result
==
NULL
){
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
SOptrBasicInfo
*
pInfo
=
(
SOptrBasicInfo
*
)(
pOperator
->
info
);
SAggSupporter
*
pSup
=
(
SAggSupporter
*
)
POINTER_SHIFT
(
pOperator
->
info
,
sizeof
(
SOptrBasicInfo
));
// int32_t size = taosHashGetSize(pSup->pResultRowHashTable);
int32_t
count
=
*
(
int32_t
*
)(
result
);
int32_t
length
=
*
(
int32_t
*
)(
result
);
int32_t
offset
=
sizeof
(
int32_t
);
int32_t
count
=
*
(
int32_t
*
)(
result
+
offset
);
offset
+=
sizeof
(
int32_t
);
while
(
count
--
>
0
&&
length
>
offset
)
{
int32_t
keyLen
=
*
(
int32_t
*
)(
result
+
offset
);
offset
+=
sizeof
(
int32_t
);
...
...
@@ -5048,17 +5051,19 @@ int32_t encodeOperator(SOperatorInfo* ops, char** result, int32_t *length){
int32_t
decodeOperator
(
SOperatorInfo
*
ops
,
char
*
result
,
int32_t
length
){
int32_t
code
=
TDB_CODE_SUCCESS
;
if
(
ops
->
fpSet
.
decodeResultRow
){
if
(
result
==
NULL
||
length
<=
0
){
if
(
result
==
NULL
){
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
char
*
data
=
result
+
2
*
sizeof
(
int32_
t
);
int32_t
dataLength
=
*
(
int32_t
*
)(
result
+
sizeof
(
int32_t
)
);
code
=
ops
->
fpSet
.
decodeResultRow
(
ops
,
data
,
dataLength
-
sizeof
(
int32_t
)
);
ASSERT
(
length
==
*
(
int32_t
*
)
resul
t
);
char
*
data
=
result
+
sizeof
(
int32_t
);
code
=
ops
->
fpSet
.
decodeResultRow
(
ops
,
data
);
if
(
code
!=
TDB_CODE_SUCCESS
){
return
code
;
}
int32_t
totalLength
=
*
(
int32_t
*
)
result
;
int32_t
dataLength
=
*
(
int32_t
*
)
data
;
if
(
totalLength
==
dataLength
+
sizeof
(
int32_t
))
{
// the last data
result
=
NULL
;
length
=
0
;
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
aaec70eb
...
...
@@ -318,7 +318,20 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
// updateNumOfRowsInResultRows(pInfo->binfo.pCtx, pOperator->numOfExprs, &pInfo->binfo.resultRowInfo,
// pInfo->binfo.rowCellInfoOffset);
// }
#if 0
if(pOperator->fpSet.encodeResultRow){
char *result = NULL;
int32_t length = 0;
pOperator->fpSet.encodeResultRow(pOperator, &result, &length);
SAggSupporter* pSup = &pInfo->aggSup;
taosHashClear(pSup->pResultRowHashTable);
pInfo->binfo.resultRowInfo.size = 0;
pOperator->fpSet.decodeResultRow(pOperator, result);
if(result){
taosMemoryFree(result);
}
}
#endif
blockDataEnsureCapacity
(
pRes
,
pOperator
->
resultInfo
.
capacity
);
initGroupedResultInfo
(
&
pInfo
->
groupResInfo
,
pInfo
->
aggSup
.
pResultRowHashTable
,
0
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
aaec70eb
...
...
@@ -880,14 +880,14 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) {
hashIntervalAgg
(
pOperator
,
&
pInfo
->
binfo
.
resultRowInfo
,
pBlock
,
pBlock
->
info
.
groupId
,
NULL
);
#if 0 // test for encode/decode result info
if(pOperator->encodeResultRow){
if(pOperator->
fpSet.
encodeResultRow){
char *result = NULL;
int32_t length = 0;
SAggSupporter *pSup = &pInfo->aggSup;
pOperator->
encodeResultRow(pOperator, pSup, &pInfo->binfo
, &result, &length);
pOperator->
fpSet.encodeResultRow(pOperator
, &result, &length);
taosHashClear(pSup->pResultRowHashTable);
pInfo->binfo.resultRowInfo.size = 0;
pOperator->
decodeResultRow(pOperator, pSup, &pInfo->binfo, result, length
);
pOperator->
fpSet.decodeResultRow(pOperator, result
);
if(result){
taosMemoryFree(result);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录