Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9c610369
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看板
提交
9c610369
编写于
3月 05, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-13039] refactor.
上级
fa3fce9c
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
150 addition
and
202 deletion
+150
-202
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+0
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+26
-23
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+2
-17
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+114
-153
source/libs/executor/test/executorTests.cpp
source/libs/executor/test/executorTests.cpp
+6
-6
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+1
-1
未找到文件。
include/libs/executor/dataSinkMgt.h
浏览文件 @
9c610369
...
...
@@ -40,7 +40,6 @@ int32_t dsDataSinkMgtInit(SDataSinkMgtCfg *cfg);
typedef
struct
SInputData
{
const
struct
SSDataBlock
*
pData
;
SHashObj
*
pTableRetrieveTsMap
;
}
SInputData
;
typedef
struct
SOutputData
{
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
9c610369
...
...
@@ -253,6 +253,11 @@ typedef struct STaskIdInfo {
char
*
str
;
}
STaskIdInfo
;
typedef
struct
STaskBufInfo
{
int32_t
bufSize
;
// total available buffer size in bytes
int32_t
remainBuf
;
// remain buffer size
}
STaskBufInfo
;
typedef
struct
SExecTaskInfo
{
STaskIdInfo
id
;
char
*
content
;
...
...
@@ -265,7 +270,7 @@ typedef struct SExecTaskInfo {
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
char
*
sql
;
// query sql string
jmp_buf
env
;
// when error occurs, abort
int32_t
bufSize
;
// available buffer size for all operator
STaskBufInfo
bufInfo
;
// available buffer info this task
struct
SOperatorInfo
*
pRoot
;
}
SExecTaskInfo
;
...
...
@@ -308,9 +313,11 @@ typedef struct STaskRuntimeEnv {
}
STaskRuntimeEnv
;
enum
{
OP_IN_EXECUTING
=
1
,
OP_RES_TO_RETURN
=
2
,
OP_EXEC_DONE
=
3
,
OP_NOT_OPENED
=
0x0
,
OP_OPENED
=
0x1
,
OP_IN_EXECUTING
=
0x3
,
OP_RES_TO_RETURN
=
0x5
,
OP_EXEC_DONE
=
0x9
,
};
typedef
struct
SOperatorInfo
{
...
...
@@ -328,7 +335,7 @@ typedef struct SOperatorInfo {
struct
SOperatorInfo
**
pDownstream
;
// downstram pointer list
int32_t
numOfDownstream
;
// number of downstream. The value is always ONE expect for join operator
__optr_open_fn_t
openFn
;
__optr_fn_t
nextData
Fn
;
__optr_fn_t
getNext
Fn
;
__optr_close_fn_t
closeFn
;
}
SOperatorInfo
;
...
...
@@ -380,9 +387,9 @@ typedef struct STaskParam {
}
STaskParam
;
enum
{
DATA_NOT_READY
=
0x1
,
DATA_READY
=
0x2
,
DATA_EXHAUSTED
=
0x3
,
EX_SOURCE_
DATA_NOT_READY
=
0x1
,
EX_SOURCE_
DATA_READY
=
0x2
,
EX_SOURCE_
DATA_EXHAUSTED
=
0x3
,
};
typedef
struct
SSourceDataInfo
{
...
...
@@ -407,16 +414,16 @@ typedef struct SExchangeInfo {
}
SExchangeInfo
;
typedef
struct
STableScanInfo
{
void
*
pTsdbReadHandle
;
int32_t
numOfBlocks
;
// extract basic running information.
int32_t
numOfSkipped
;
int32_t
numOfBlockStatis
;
int64_t
numOfRows
;
void
*
pTsdbReadHandle
;
int32_t
numOfBlocks
;
// extract basic running information.
int32_t
numOfSkipped
;
int32_t
numOfBlockStatis
;
int64_t
numOfRows
;
int32_t
order
;
// scan order
int32_t
times
;
// repeat counts
int32_t
current
;
int32_t
reverseTimes
;
// 0 by default
int32_t
order
;
// scan order
int32_t
times
;
// repeat counts
int32_t
current
;
int32_t
reverseTimes
;
// 0 by default
SqlFunctionCtx
*
pCtx
;
// next operator query context
SResultRowInfo
*
pResultRowInfo
;
...
...
@@ -427,7 +434,7 @@ typedef struct STableScanInfo {
int64_t
elapsedTime
;
int32_t
prevGroupId
;
// previous table group id
int32_t
scanFlag
;
// table scan flag to denote if it is a repeat/reverse/main scan
int32_t
scanFlag
;
// table scan flag to denote if it is a repeat/reverse/main scan
}
STableScanInfo
;
typedef
struct
STagScanInfo
{
...
...
@@ -624,9 +631,9 @@ SOperatorInfo* createMultiTableAggOperatorInfo(SOperatorInfo* downstream, SArray
SOperatorInfo
*
createProjectOperatorInfo
(
SOperatorInfo
*
downstream
,
SArray
*
pExprInfo
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createOrderOperatorInfo
(
SOperatorInfo
*
downstream
,
SArray
*
pExprInfo
,
SArray
*
pOrderVal
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createSortedMergeOperatorInfo
(
SOperatorInfo
**
downstream
,
int32_t
numOfDownstream
,
SArray
*
pExprInfo
,
SArray
*
pOrderVal
,
SArray
*
pGroupInfo
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SArray
*
pExprInfo
,
SInterval
*
pInterval
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createLimitOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
downstream
);
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SArray
*
pExprInfo
,
SInterval
*
pInterval
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createAllTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
downstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
...
...
@@ -672,13 +679,9 @@ void* doDestroyFilterInfo(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFil
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
void
finalizeQueryResult
(
SOperatorInfo
*
pOperator
,
SqlFunctionCtx
*
pCtx
,
SResultRowInfo
*
pResultRowInfo
,
int32_t
*
rowCellInfoOffset
);
void
updateOutputBuf
(
SOptrBasicInfo
*
pBInfo
,
int32_t
*
bufCapacity
,
int32_t
numOfInputRows
);
void
clearOutputBuf
(
SOptrBasicInfo
*
pBInfo
,
int32_t
*
bufCapacity
);
void
copyTsColoum
(
SSDataBlock
*
pRes
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
int32_t
createQueryFunc
(
SQueriedTableInfo
*
pTableInfo
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
SSqlExpr
**
pExprMsg
,
SColumnInfo
*
pTagCols
,
int32_t
queryType
,
void
*
pMsg
,
struct
SUdfInfo
*
pUdfInfo
);
int32_t
createIndirectQueryFuncExprFromMsg
(
SQueryTableReq
*
pQueryMsg
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
SSqlExpr
**
pExpr
,
SExprInfo
*
prevExpr
,
struct
SUdfInfo
*
pUdfInfo
);
...
...
source/libs/executor/src/dataDispatcher.c
浏览文件 @
9c610369
...
...
@@ -21,8 +21,6 @@
#include "tqueue.h"
#include "executorimpl.h"
#define DATA_META_LENGTH(tables) (sizeof(int32_t) + sizeof(STableIdInfo) * taosHashGetSize(tables) + sizeof(SRetrieveTableRsp))
typedef
struct
SDataDispatchBuf
{
int32_t
useSize
;
int32_t
allocSize
;
...
...
@@ -88,19 +86,6 @@ static void copyData(const SInputData* pInput, const SDataBlockSchema* pSchema,
data
+=
pColRes
->
info
.
bytes
*
pInput
->
pData
->
info
.
rows
;
}
}
int32_t
numOfTables
=
(
int32_t
)
taosHashGetSize
(
pInput
->
pTableRetrieveTsMap
);
*
(
int32_t
*
)
data
=
htonl
(
numOfTables
);
data
+=
sizeof
(
int32_t
);
STableIdInfo
*
item
=
taosHashIterate
(
pInput
->
pTableRetrieveTsMap
,
NULL
);
while
(
item
)
{
STableIdInfo
*
pDst
=
(
STableIdInfo
*
)
data
;
pDst
->
uid
=
htobe64
(
item
->
uid
);
pDst
->
key
=
htobe64
(
item
->
key
);
data
+=
sizeof
(
STableIdInfo
);
item
=
taosHashIterate
(
pInput
->
pTableRetrieveTsMap
,
item
);
}
}
// data format with compress: SDataCacheEntry | cols_data_offset | col1_data col2_data ... | numOfTables | STableIdInfo STableIdInfo ...
...
...
@@ -111,7 +96,7 @@ static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputDat
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
dataLen
=
0
;
pBuf
->
useSize
=
DATA_META_LENGTH
(
pInput
->
pTableRetrieveTsMa
p
);
pBuf
->
useSize
=
sizeof
(
SRetrieveTableRs
p
);
copyData
(
pInput
,
&
pHandle
->
schema
,
pEntry
->
data
,
pEntry
->
compressed
,
&
pEntry
->
dataLen
);
if
(
0
==
pEntry
->
compressed
)
{
pEntry
->
dataLen
=
pHandle
->
schema
.
resultRowSize
*
pInput
->
pData
->
info
.
rows
;
...
...
@@ -128,7 +113,7 @@ static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput,
return
false
;
}
pBuf
->
allocSize
=
DATA_META_LENGTH
(
pInput
->
pTableRetrieveTsMa
p
)
+
pDispatcher
->
schema
.
resultRowSize
*
pInput
->
pData
->
info
.
rows
;
pBuf
->
allocSize
=
sizeof
(
SRetrieveTableRs
p
)
+
pDispatcher
->
schema
.
resultRowSize
*
pInput
->
pData
->
info
.
rows
;
pBuf
->
pData
=
malloc
(
pBuf
->
allocSize
);
if
(
pBuf
->
pData
==
NULL
)
{
qError
(
"SinkNode failed to malloc memory, size:%d, code:%d"
,
pBuf
->
allocSize
,
TAOS_SYSTEM_ERROR
(
errno
));
...
...
source/libs/executor/src/executorMain.c
浏览文件 @
9c610369
...
...
@@ -158,7 +158,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds) {
int64_t
st
=
0
;
st
=
taosGetTimestampUs
();
*
pRes
=
pTaskInfo
->
pRoot
->
nextData
Fn
(
pTaskInfo
->
pRoot
,
&
newgroup
);
*
pRes
=
pTaskInfo
->
pRoot
->
getNext
Fn
(
pTaskInfo
->
pRoot
,
&
newgroup
);
uint64_t
el
=
(
taosGetTimestampUs
()
-
st
);
pTaskInfo
->
cost
.
elapsedTime
+=
el
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
9c610369
此差异已折叠。
点击以展开。
source/libs/executor/test/executorTests.cpp
浏览文件 @
9c610369
...
...
@@ -201,9 +201,9 @@ SOperatorInfo* createDummyOperator(int32_t startVal, int32_t numOfBlocks, int32_
pOperator
->
name
=
"dummyInputOpertor4Test"
;
if
(
numOfCols
==
1
)
{
pOperator
->
nextData
Fn
=
getDummyBlock
;
pOperator
->
getNext
Fn
=
getDummyBlock
;
}
else
{
pOperator
->
nextData
Fn
=
get2ColsDummyBlock
;
pOperator
->
getNext
Fn
=
get2ColsDummyBlock
;
}
SDummyInputInfo
*
pInfo
=
(
SDummyInputInfo
*
)
calloc
(
1
,
sizeof
(
SDummyInputInfo
));
...
...
@@ -837,7 +837,7 @@ TEST(testCase, inMem_sort_Test) {
SOperatorInfo
*
pOperator
=
createOrderOperatorInfo
(
createDummyOperator
(
10000
,
5
,
1000
,
data_asc
,
1
),
pExprInfo
,
pOrderVal
,
NULL
);
bool
newgroup
=
false
;
SSDataBlock
*
pRes
=
pOperator
->
nextData
Fn
(
pOperator
,
&
newgroup
);
SSDataBlock
*
pRes
=
pOperator
->
getNext
Fn
(
pOperator
,
&
newgroup
);
SColumnInfoData
*
pCol1
=
static_cast
<
SColumnInfoData
*>
(
taosArrayGet
(
pRes
->
pDataBlock
,
0
));
SColumnInfoData
*
pCol2
=
static_cast
<
SColumnInfoData
*>
(
taosArrayGet
(
pRes
->
pDataBlock
,
1
));
...
...
@@ -912,7 +912,7 @@ TEST(testCase, external_sort_Test) {
while
(
1
)
{
int64_t
s
=
taosGetTimestampUs
();
pRes
=
pOperator
->
nextData
Fn
(
pOperator
,
&
newgroup
);
pRes
=
pOperator
->
getNext
Fn
(
pOperator
,
&
newgroup
);
int64_t
e
=
taosGetTimestampUs
();
if
(
t
++
==
1
)
{
...
...
@@ -984,7 +984,7 @@ TEST(testCase, sorted_merge_Test) {
while
(
1
)
{
int64_t
s
=
taosGetTimestampUs
();
pRes
=
pOperator
->
nextData
Fn
(
pOperator
,
&
newgroup
);
pRes
=
pOperator
->
getNext
Fn
(
pOperator
,
&
newgroup
);
int64_t
e
=
taosGetTimestampUs
();
if
(
t
++
==
1
)
{
...
...
@@ -1062,7 +1062,7 @@ TEST(testCase, time_interval_Operator_Test) {
while
(
1
)
{
int64_t
s
=
taosGetTimestampUs
();
pRes
=
pOperator
->
nextData
Fn
(
pOperator
,
&
newgroup
);
pRes
=
pOperator
->
getNext
Fn
(
pOperator
,
&
newgroup
);
int64_t
e
=
taosGetTimestampUs
();
if
(
t
++
==
1
)
{
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
9c610369
...
...
@@ -494,7 +494,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryEnd) {
ASSERT
(
pRes
->
info
.
rows
>
0
);
SInputData
inputData
=
{.
pData
=
pRes
,
.
pTableRetrieveTsMap
=
NULL
};
SInputData
inputData
=
{.
pData
=
pRes
};
code
=
dsPutDataBlock
(
sinkHandle
,
&
inputData
,
&
qcontinue
);
if
(
code
)
{
QW_TASK_ELOG
(
"dsPutDataBlock failed, code:%s"
,
tstrerror
(
code
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录