Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
afd1ce63
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
afd1ce63
编写于
1月 28, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] Refactor API.
上级
699b37cc
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
297 addition
and
339 deletion
+297
-339
include/libs/executor/executor.h
include/libs/executor/executor.h
+12
-2
include/libs/function/function.h
include/libs/function/function.h
+15
-15
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+4
-4
include/libs/planner/plannerOp.h
include/libs/planner/plannerOp.h
+2
-1
source/dnode/vnode/inc/tsdb.h
source/dnode/vnode/inc/tsdb.h
+11
-11
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+23
-23
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+5
-3
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+10
-10
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+2
-2
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+1
-19
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+99
-133
source/libs/function/inc/taggfunction.h
source/libs/function/inc/taggfunction.h
+1
-1
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+109
-109
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+1
-1
source/libs/planner/src/physicalPlan.c
source/libs/planner/src/physicalPlan.c
+1
-1
source/libs/planner/src/physicalPlanJson.c
source/libs/planner/src/physicalPlanJson.c
+0
-3
未找到文件。
include/libs/executor/executor.h
浏览文件 @
afd1ce63
...
...
@@ -27,6 +27,10 @@ typedef void* DataSinkHandle;
struct
SRpcMsg
;
struct
SSubplan
;
typedef
struct
SReadHandle
{
void
*
reader
;
void
*
meta
;
}
SReadHandle
;
/**
* Create the exec task for streaming mode
* @param pMsg
...
...
@@ -35,7 +39,13 @@ struct SSubplan;
*/
qTaskInfo_t
qCreateStreamExecTaskInfo
(
void
*
msg
,
void
*
streamReadHandle
);
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
void
*
input
);
/**
*
* @param tinfo
* @param input
* @return
*/
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
input
);
/**
* Create the exec task object according to task json
...
...
@@ -46,7 +56,7 @@ int32_t qSetStreamInput(qTaskInfo_t tinfo, void* input);
* @param qId
* @return
*/
int32_t
qCreateExecTask
(
void
*
readHandle
,
int32_t
vgId
,
uint64_t
taskId
,
struct
SSubplan
*
pPlan
,
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
);
int32_t
qCreateExecTask
(
SReadHandle
*
readHandle
,
int32_t
vgId
,
uint64_t
taskId
,
struct
SSubplan
*
pPlan
,
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
);
/**
* The main task execution function, including query on both table and multiple tables,
...
...
include/libs/function/function.h
浏览文件 @
afd1ce63
...
...
@@ -107,14 +107,14 @@ typedef struct SPoint1 {
union
{
double
val
;
char
*
ptr
;};
}
SPoint1
;
struct
S
QL
FunctionCtx
;
struct
S
ql
FunctionCtx
;
struct
SResultRowEntryInfo
;
//for selectivity query, the corresponding tag value is assigned if the data is qualified
typedef
struct
SExtTagsInfo
{
int16_t
tagsLen
;
// keep the tags data for top/bottom query result
int16_t
numOfTagCols
;
struct
S
QL
FunctionCtx
**
pTagCtxList
;
struct
S
ql
FunctionCtx
**
pTagCtxList
;
}
SExtTagsInfo
;
typedef
struct
SResultDataInfo
{
...
...
@@ -126,18 +126,18 @@ typedef struct SResultDataInfo {
#define GET_RES_INFO(ctx) ((ctx)->resultInfo)
typedef
struct
SFunctionFpSet
{
bool
(
*
init
)(
struct
S
QL
FunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
// setup the execute environment
void
(
*
addInput
)(
struct
S
QL
FunctionCtx
*
pCtx
);
bool
(
*
init
)(
struct
S
ql
FunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
// setup the execute environment
void
(
*
addInput
)(
struct
S
ql
FunctionCtx
*
pCtx
);
// finalizer must be called after all exec has been executed to generated final result.
void
(
*
finalize
)(
struct
S
QL
FunctionCtx
*
pCtx
);
void
(
*
combine
)(
struct
S
QL
FunctionCtx
*
pCtx
);
void
(
*
finalize
)(
struct
S
ql
FunctionCtx
*
pCtx
);
void
(
*
combine
)(
struct
S
ql
FunctionCtx
*
pCtx
);
}
SFunctionFpSet
;
extern
SFunctionFpSet
fpSet
[
1
];
// sql function runtime context
typedef
struct
S
QL
FunctionCtx
{
typedef
struct
S
ql
FunctionCtx
{
int32_t
size
;
// number of rows
void
*
pInput
;
// input data buffer
uint32_t
order
;
// asc|desc
...
...
@@ -167,7 +167,7 @@ typedef struct SQLFunctionCtx {
int32_t
columnIndex
;
SFunctionFpSet
*
fpSet
;
}
S
QL
FunctionCtx
;
}
S
ql
FunctionCtx
;
enum
{
TEXPR_NODE_DUMMY
=
0x0
,
...
...
@@ -216,14 +216,14 @@ typedef struct SAggFunctionInfo {
int8_t
sFunctionId
;
// Transfer function for super table query
uint16_t
status
;
bool
(
*
init
)(
S
QL
FunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
// setup the execute environment
void
(
*
addInput
)(
S
QL
FunctionCtx
*
pCtx
);
bool
(
*
init
)(
S
ql
FunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
// setup the execute environment
void
(
*
addInput
)(
S
ql
FunctionCtx
*
pCtx
);
// finalizer must be called after all exec has been executed to generated final result.
void
(
*
finalize
)(
S
QL
FunctionCtx
*
pCtx
);
void
(
*
combine
)(
S
QL
FunctionCtx
*
pCtx
);
void
(
*
finalize
)(
S
ql
FunctionCtx
*
pCtx
);
void
(
*
combine
)(
S
ql
FunctionCtx
*
pCtx
);
int32_t
(
*
dataReqFunc
)(
S
QL
FunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
);
int32_t
(
*
dataReqFunc
)(
S
ql
FunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
);
}
SAggFunctionInfo
;
struct
SScalarFuncParam
;
...
...
@@ -279,9 +279,9 @@ void extractFunctionDesc(SArray* pFunctionIdList, SMultiFunctionsDesc* pDesc);
tExprNode
*
exprdup
(
tExprNode
*
pTree
);
void
resetResultRowEntryResult
(
S
QL
FunctionCtx
*
pCtx
,
int32_t
num
);
void
resetResultRowEntryResult
(
S
ql
FunctionCtx
*
pCtx
,
int32_t
num
);
void
cleanupResultRowEntry
(
struct
SResultRowEntryInfo
*
pCell
);
int32_t
getNumOfResult
(
S
QL
FunctionCtx
*
pCtx
,
int32_t
num
);
int32_t
getNumOfResult
(
S
ql
FunctionCtx
*
pCtx
,
int32_t
num
);
bool
isRowEntryCompleted
(
struct
SResultRowEntryInfo
*
pEntry
);
bool
isRowEntryInitialized
(
struct
SResultRowEntryInfo
*
pEntry
);
...
...
include/libs/function/functionMgt.h
浏览文件 @
afd1ce63
...
...
@@ -22,7 +22,7 @@ extern "C" {
#include "nodes.h"
struct
S
QL
FunctionCtx
;
struct
S
ql
FunctionCtx
;
struct
SResultRowEntryInfo
;
struct
STimeWindow
;
...
...
@@ -32,9 +32,9 @@ typedef struct SFuncExecEnv {
typedef
void
*
FuncMgtHandle
;
typedef
bool
(
*
FExecGetEnv
)(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
typedef
bool
(
*
FExecInit
)(
struct
S
QL
FunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
typedef
void
(
*
FExecProcess
)(
struct
S
QL
FunctionCtx
*
pCtx
);
typedef
void
(
*
FExecFinalize
)(
struct
S
QL
FunctionCtx
*
pCtx
);
typedef
bool
(
*
FExecInit
)(
struct
S
ql
FunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
typedef
void
(
*
FExecProcess
)(
struct
S
ql
FunctionCtx
*
pCtx
);
typedef
void
(
*
FExecFinalize
)(
struct
S
ql
FunctionCtx
*
pCtx
);
typedef
struct
SFuncExecFuncs
{
FExecGetEnv
getEnv
;
...
...
include/libs/planner/plannerOp.h
浏览文件 @
afd1ce63
...
...
@@ -24,7 +24,6 @@
#endif
OP_ENUM_MACRO
(
StreamScan
)
OP_ENUM_MACRO
(
TableScan
)
OP_ENUM_MACRO
(
DataBlocksOptScan
)
OP_ENUM_MACRO
(
TableSeqScan
)
OP_ENUM_MACRO
(
TagScan
)
...
...
@@ -48,3 +47,5 @@ OP_ENUM_MACRO(AllTimeWindow)
OP_ENUM_MACRO
(
AllMultiTableTimeInterval
)
OP_ENUM_MACRO
(
Order
)
OP_ENUM_MACRO
(
Exchange
)
//OP_ENUM_MACRO(TableScan)
source/dnode/vnode/inc/tsdb.h
浏览文件 @
afd1ce63
...
...
@@ -91,7 +91,7 @@ int tsdbCommit(STsdb *pTsdb);
int
tsdbOptionsInit
(
STsdbCfg
*
);
void
tsdbOptionsClear
(
STsdbCfg
*
);
typedef
void
*
tsdbRead
Handle
T
;
typedef
void
*
tsdbRead
er
T
;
/**
* Get the data block iterator, starting from position according to the query condition
...
...
@@ -103,7 +103,7 @@ typedef void* tsdbReadHandleT;
* @param qinfo query info handle from query processor
* @return
*/
tsdbRead
Handle
T
*
tsdbQueryTables
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
tableInfoGroup
,
uint64_t
qId
,
uint64_t
taskId
);
tsdbRead
er
T
*
tsdbQueryTables
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
tableInfoGroup
,
uint64_t
qId
,
uint64_t
taskId
);
/**
* Get the last row of the given query time window for all the tables in STableGroupInfo object.
...
...
@@ -115,13 +115,13 @@ tsdbReadHandleT *tsdbQueryTables(STsdb *tsdb, STsdbQueryCond *pCond, STableGroup
* @param tableInfo table list.
* @return
*/
//tsdbRead
Handle
T tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfo, uint64_t qId,
//tsdbRead
er
T tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfo, uint64_t qId,
// SMemRef *pRef);
tsdbRead
Handle
T
tsdbQueryCacheLast
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
void
*
pMemRef
);
tsdbRead
er
T
tsdbQueryCacheLast
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
void
*
pMemRef
);
bool
isTsdbCacheLastRow
(
tsdbRead
Handle
T
*
pTsdbReadHandle
);
bool
isTsdbCacheLastRow
(
tsdbRead
er
T
*
pTsdbReadHandle
);
/**
*
...
...
@@ -148,7 +148,7 @@ int32_t tsdbQuerySTableByTagCond(void* pMeta, uint64_t uid, TSKEY skey, const ch
* @return row size
*/
int64_t
tsdbGetNumOfRowsInMemTable
(
tsdbRead
Handle
T
*
pHandle
);
int64_t
tsdbGetNumOfRowsInMemTable
(
tsdbRead
er
T
*
pHandle
);
/**
* move to next block if exists
...
...
@@ -156,7 +156,7 @@ int64_t tsdbGetNumOfRowsInMemTable(tsdbReadHandleT* pHandle);
* @param pTsdbReadHandle
* @return
*/
bool
tsdbNextDataBlock
(
tsdbRead
Handle
T
pTsdbReadHandle
);
bool
tsdbNextDataBlock
(
tsdbRead
er
T
pTsdbReadHandle
);
/**
* Get current data block information
...
...
@@ -165,7 +165,7 @@ bool tsdbNextDataBlock(tsdbReadHandleT pTsdbReadHandle);
* @param pBlockInfo
* @return
*/
void
tsdbRetrieveDataBlockInfo
(
tsdbRead
Handle
T
*
pTsdbReadHandle
,
SDataBlockInfo
*
pBlockInfo
);
void
tsdbRetrieveDataBlockInfo
(
tsdbRead
er
T
*
pTsdbReadHandle
,
SDataBlockInfo
*
pBlockInfo
);
/**
*
...
...
@@ -177,7 +177,7 @@ void tsdbRetrieveDataBlockInfo(tsdbReadHandleT *pTsdbReadHandle, SDataBlockInfo
* @pBlockStatis the pre-calculated value for current data blocks. if the block is a cache block, always return 0
* @return
*/
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdbRead
Handle
T
*
pTsdbReadHandle
,
SDataStatis
**
pBlockStatis
);
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdbRead
er
T
*
pTsdbReadHandle
,
SDataStatis
**
pBlockStatis
);
/**
*
...
...
@@ -189,7 +189,7 @@ int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReadHandleT *pTsdbReadHandle, SDataS
* @param pColumnIdList required data columns id list
* @return
*/
SArray
*
tsdbRetrieveDataBlock
(
tsdbRead
Handle
T
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
SArray
*
tsdbRetrieveDataBlock
(
tsdbRead
er
T
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
/**
* destroy the created table group list, which is generated by tag query
...
...
@@ -220,7 +220,7 @@ int32_t tsdbGetTableGroupFromIdList(STsdb *tsdb, SArray *pTableIdList, STableGro
* clean up the query handle
* @param queryHandle
*/
void
tsdbCleanupReadHandle
(
tsdbRead
Handle
T
queryHandle
);
void
tsdbCleanupReadHandle
(
tsdbRead
er
T
queryHandle
);
#ifdef __cplusplus
}
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
afd1ce63
...
...
@@ -71,7 +71,7 @@ typedef struct {
typedef
struct
STqReadHandle
{
int64_t
ver
;
uint64_t
tbUid
;
SSubmitMsg
*
pMsg
;
const
SSubmitMsg
*
pMsg
;
SSubmitBlk
*
pBlock
;
SSubmitMsgIter
msgIter
;
SSubmitBlkIter
blkIter
;
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
afd1ce63
...
...
@@ -159,7 +159,7 @@ static int32_t checkForCachedLastRow(STsdbReadHandle* pTsdbReadHandle, STableGro
static
int32_t
checkForCachedLast
(
STsdbReadHandle
*
pTsdbReadHandle
);
//static int32_t tsdbGetCachedLastRow(STable* pTable, SMemRow* pRes, TSKEY* lastKey);
static
void
changeQueryHandleForInterpQuery
(
tsdbRead
Handle
T
pHandle
);
static
void
changeQueryHandleForInterpQuery
(
tsdbRead
er
T
pHandle
);
static
void
doMergeTwoLevelData
(
STsdbReadHandle
*
pTsdbReadHandle
,
STableCheckInfo
*
pCheckInfo
,
SBlock
*
pBlock
);
static
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
static
int32_t
tsdbReadRowsFromCache
(
STableCheckInfo
*
pCheckInfo
,
TSKEY
maxKey
,
int
maxRowsToRead
,
STimeWindow
*
win
,
STsdbReadHandle
*
pTsdbReadHandle
);
...
...
@@ -167,7 +167,7 @@ static int32_t tsdbCheckInfoCompar(const void* key1, const void* key2);
//static int32_t doGetExternalRow(STsdbReadHandle* pTsdbReadHandle, int16_t type, void* pMemRef);
//static void* doFreeColumnInfoData(SArray* pColumnInfoData);
//static void* destroyTableCheckInfo(SArray* pTableCheckInfo);
static
bool
tsdbGetExternalRow
(
tsdbRead
Handle
T
pHandle
);
static
bool
tsdbGetExternalRow
(
tsdbRead
er
T
pHandle
);
static
void
tsdbInitDataBlockLoadInfo
(
SDataBlockLoadInfo
*
pBlockLoadInfo
)
{
pBlockLoadInfo
->
slot
=
-
1
;
...
...
@@ -208,7 +208,7 @@ static SArray* getDefaultLoadColumns(STsdbReadHandle* pTsdbReadHandle, bool load
return
pLocalIdList
;
}
//int64_t tsdbGetNumOfRowsInMemTable(tsdbRead
Handle
T* pHandle) {
//int64_t tsdbGetNumOfRowsInMemTable(tsdbRead
er
T* pHandle) {
// STsdbReadHandle* pTsdbReadHandle = (STsdbReadHandle*) pHandle;
//
// int64_t rows = 0;
...
...
@@ -424,7 +424,7 @@ static STsdbReadHandle* tsdbQueryTablesImpl(STsdb* tsdb, STsdbQueryCond* pCond,
tsdbInitDataBlockLoadInfo
(
&
pReadHandle
->
dataBlockLoadInfo
);
tsdbInitCompBlockLoadInfo
(
&
pReadHandle
->
compBlockLoadInfo
);
return
(
tsdbRead
Handle
T
)
pReadHandle
;
return
(
tsdbRead
er
T
)
pReadHandle
;
_end:
tsdbCleanupReadHandle
(
pReadHandle
);
...
...
@@ -432,14 +432,14 @@ static STsdbReadHandle* tsdbQueryTablesImpl(STsdb* tsdb, STsdbQueryCond* pCond,
return
NULL
;
}
tsdbRead
Handle
T
*
tsdbQueryTables
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
)
{
tsdbRead
er
T
*
tsdbQueryTables
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
tsdbQueryTablesImpl
(
tsdb
,
pCond
,
qId
,
taskId
);
if
(
pTsdbReadHandle
==
NULL
)
{
return
NULL
;
}
if
(
emptyQueryTimewindow
(
pTsdbReadHandle
))
{
return
(
tsdbRead
Handle
T
*
)
pTsdbReadHandle
;
return
(
tsdbRead
er
T
*
)
pTsdbReadHandle
;
}
// todo apply the lastkey of table check to avoid to load header file
...
...
@@ -453,10 +453,10 @@ tsdbReadHandleT* tsdbQueryTables(STsdb* tsdb, STsdbQueryCond* pCond, STableGroup
tsdbDebug
(
"%p total numOfTable:%"
PRIzu
" in this query, group %"
PRIzu
" %s"
,
pTsdbReadHandle
,
taosArrayGetSize
(
pTsdbReadHandle
->
pTableCheckInfo
),
taosArrayGetSize
(
groupList
->
pGroupList
),
pTsdbReadHandle
->
idStr
);
return
(
tsdbRead
Handle
T
)
pTsdbReadHandle
;
return
(
tsdbRead
er
T
)
pTsdbReadHandle
;
}
void
tsdbResetQueryHandle
(
tsdbRead
Handle
T
queryHandle
,
STsdbQueryCond
*
pCond
)
{
void
tsdbResetQueryHandle
(
tsdbRead
er
T
queryHandle
,
STsdbQueryCond
*
pCond
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
queryHandle
;
if
(
emptyQueryTimewindow
(
pTsdbReadHandle
))
{
...
...
@@ -493,7 +493,7 @@ void tsdbResetQueryHandle(tsdbReadHandleT queryHandle, STsdbQueryCond *pCond) {
resetCheckInfo
(
pTsdbReadHandle
);
}
void
tsdbResetQueryHandleForNewTable
(
tsdbRead
Handle
T
queryHandle
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
)
{
void
tsdbResetQueryHandleForNewTable
(
tsdbRead
er
T
queryHandle
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
queryHandle
;
pTsdbReadHandle
->
order
=
pCond
->
order
;
...
...
@@ -533,7 +533,7 @@ void tsdbResetQueryHandleForNewTable(tsdbReadHandleT queryHandle, STsdbQueryCond
// pTsdbReadHandle->next = doFreeColumnInfoData(pTsdbReadHandle->next);
}
tsdbRead
Handle
T
tsdbQueryLastRow
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
)
{
tsdbRead
er
T
tsdbQueryLastRow
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
)
{
pCond
->
twindow
=
updateLastrowForEachGroup
(
groupList
);
// no qualified table
...
...
@@ -561,7 +561,7 @@ tsdbReadHandleT tsdbQueryLastRow(STsdb *tsdb, STsdbQueryCond *pCond, STableGroup
}
#if 0
tsdbRead
Handle
T tsdbQueryCacheLast(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, uint64_t qId, STsdbMemTable* pMemRef) {
tsdbRead
er
T tsdbQueryCacheLast(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, uint64_t qId, STsdbMemTable* pMemRef) {
STsdbReadHandle *pTsdbReadHandle = (STsdbReadHandle*) tsdbQueryTables(tsdb, pCond, groupList, qId, pMemRef);
if (pTsdbReadHandle == NULL) {
return NULL;
...
...
@@ -581,7 +581,7 @@ tsdbReadHandleT tsdbQueryCacheLast(STsdb *tsdb, STsdbQueryCond *pCond, STableGro
}
#endif
SArray
*
tsdbGetQueriedTableList
(
tsdbRead
Handle
T
*
pHandle
)
{
SArray
*
tsdbGetQueriedTableList
(
tsdbRead
er
T
*
pHandle
)
{
assert
(
pHandle
!=
NULL
);
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
pHandle
;
...
...
@@ -624,7 +624,7 @@ static STableGroupInfo* trimTableGroup(STimeWindow* window, STableGroupInfo* pGr
return
pNew
;
}
tsdbRead
Handle
T
tsdbQueryRowsInExternalWindow
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
)
{
tsdbRead
er
T
tsdbQueryRowsInExternalWindow
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
)
{
STableGroupInfo
*
pNew
=
trimTableGroup
(
&
pCond
->
twindow
,
groupList
);
if
(
pNew
->
numOfTables
==
0
)
{
...
...
@@ -2338,7 +2338,7 @@ static void moveToNextDataBlockInCurrentFile(STsdbReadHandle* pTsdbReadHandle) {
cur
->
blockCompleted
=
false
;
}
#if 0
int32_t tsdbGetFileBlocksDistInfo(tsdbRead
Handle
T* queryHandle, STableBlockDist* pTableBlockInfo) {
int32_t tsdbGetFileBlocksDistInfo(tsdbRead
er
T* queryHandle, STableBlockDist* pTableBlockInfo) {
STsdbReadHandle* pTsdbReadHandle = (STsdbReadHandle*) queryHandle;
pTableBlockInfo->totalSize = 0;
...
...
@@ -2494,7 +2494,7 @@ static bool doHasDataInBuffer(STsdbReadHandle* pTsdbReadHandle) {
}
//todo not unref yet, since it is not support multi-group interpolation query
static
UNUSED_FUNC
void
changeQueryHandleForInterpQuery
(
tsdbRead
Handle
T
pHandle
)
{
static
UNUSED_FUNC
void
changeQueryHandleForInterpQuery
(
tsdbRead
er
T
pHandle
)
{
// filter the queried time stamp in the first place
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
pHandle
;
...
...
@@ -2635,7 +2635,7 @@ static bool loadBlockOfActiveTable(STsdbReadHandle* pTsdbReadHandle) {
}
if
(
exists
)
{
tsdbRetrieveDataBlock
((
tsdbRead
Handle
T
*
)
pTsdbReadHandle
,
NULL
);
tsdbRetrieveDataBlock
((
tsdbRead
er
T
*
)
pTsdbReadHandle
,
NULL
);
if
(
pTsdbReadHandle
->
currentLoadExternalRows
&&
pTsdbReadHandle
->
window
.
skey
==
pTsdbReadHandle
->
window
.
ekey
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
pColumns
,
0
);
assert
(
*
(
int64_t
*
)
pColInfo
->
pData
==
pTsdbReadHandle
->
window
.
skey
);
...
...
@@ -2891,7 +2891,7 @@ static bool loadDataBlockFromTableSeq(STsdbReadHandle* pTsdbReadHandle) {
}
// handle data in cache situation
bool
tsdbNextDataBlock
(
tsdbRead
Handle
T
pHandle
)
{
bool
tsdbNextDataBlock
(
tsdbRead
er
T
pHandle
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
pHandle
;
if
(
emptyQueryTimewindow
(
pTsdbReadHandle
))
{
...
...
@@ -3055,7 +3055,7 @@ bool tsdbNextDataBlock(tsdbReadHandleT pHandle) {
// return terrno;
//}
bool
tsdbGetExternalRow
(
tsdbRead
Handle
T
pHandle
)
{
bool
tsdbGetExternalRow
(
tsdbRead
er
T
pHandle
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
pHandle
;
SQueryFilePos
*
cur
=
&
pTsdbReadHandle
->
cur
;
...
...
@@ -3112,7 +3112,7 @@ bool tsdbGetExternalRow(tsdbReadHandleT pHandle) {
// return code;
//}
bool
isTsdbCacheLastRow
(
tsdbRead
Handle
T
*
pTsdbReadHandle
)
{
bool
isTsdbCacheLastRow
(
tsdbRead
er
T
*
pTsdbReadHandle
)
{
return
((
STsdbReadHandle
*
)
pTsdbReadHandle
)
->
cachelastrow
>
TSDB_CACHED_TYPE_NONE
;
}
...
...
@@ -3230,7 +3230,7 @@ STimeWindow updateLastrowForEachGroup(STableGroupInfo *groupList) {
return
window
;
}
void
tsdbRetrieveDataBlockInfo
(
tsdbRead
Handle
T
*
pTsdbReadHandle
,
SDataBlockInfo
*
pDataBlockInfo
)
{
void
tsdbRetrieveDataBlockInfo
(
tsdbRead
er
T
*
pTsdbReadHandle
,
SDataBlockInfo
*
pDataBlockInfo
)
{
STsdbReadHandle
*
pHandle
=
(
STsdbReadHandle
*
)
pTsdbReadHandle
;
SQueryFilePos
*
cur
=
&
pHandle
->
cur
;
...
...
@@ -3254,7 +3254,7 @@ void tsdbRetrieveDataBlockInfo(tsdbReadHandleT* pTsdbReadHandle, SDataBlockInfo*
/*
* return null for mixed data block, if not a complete file data block, the statistics value will always return NULL
*/
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdbRead
Handle
T
*
pTsdbReadHandle
,
SDataStatis
**
pBlockStatis
)
{
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdbRead
er
T
*
pTsdbReadHandle
,
SDataStatis
**
pBlockStatis
)
{
STsdbReadHandle
*
pHandle
=
(
STsdbReadHandle
*
)
pTsdbReadHandle
;
SQueryFilePos
*
c
=
&
pHandle
->
cur
;
...
...
@@ -3309,7 +3309,7 @@ int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReadHandleT* pTsdbReadHandle, SDataS
return
TSDB_CODE_SUCCESS
;
}
SArray
*
tsdbRetrieveDataBlock
(
tsdbRead
Handle
T
*
pTsdbReadHandle
,
SArray
*
pIdList
)
{
SArray
*
tsdbRetrieveDataBlock
(
tsdbRead
er
T
*
pTsdbReadHandle
,
SArray
*
pIdList
)
{
/**
* In the following two cases, the data has been loaded to SColumnInfoData.
* 1. data is from cache, 2. data block is not completed qualified to query time range
...
...
@@ -3820,7 +3820,7 @@ static void* destroyTableCheckInfo(SArray* pTableCheckInfo) {
}
void
tsdbCleanupReadHandle
(
tsdbRead
Handle
T
queryHandle
)
{
void
tsdbCleanupReadHandle
(
tsdbRead
er
T
queryHandle
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
queryHandle
;
if
(
pTsdbReadHandle
==
NULL
)
{
return
;
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
afd1ce63
...
...
@@ -26,12 +26,14 @@ int vnodeQueryOpen(SVnode *pVnode) {
int
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vTrace
(
"message in query queue is processing"
);
SReadHandle
handle
=
{.
reader
=
pVnode
->
pTsdb
,
.
meta
=
pVnode
->
pMeta
};
switch
(
pMsg
->
msgType
)
{
case
TDMT_VND_QUERY
:
return
qWorkerProcessQueryMsg
(
pVnode
->
pTsdb
,
pVnode
->
pQuery
,
pMsg
);
case
TDMT_VND_QUERY
:{
return
qWorkerProcessQueryMsg
(
&
handle
,
pVnode
->
pQuery
,
pMsg
);
}
case
TDMT_VND_QUERY_CONTINUE
:
return
qWorkerProcessCQueryMsg
(
pVnode
->
pTsdb
,
pVnode
->
pQuery
,
pMsg
);
return
qWorkerProcessCQueryMsg
(
&
handle
,
pVnode
->
pQuery
,
pMsg
);
default:
vError
(
"unknown msg type:%d in query queue"
,
pMsg
->
msgType
);
return
TSDB_CODE_VND_APP_ERROR
;
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
afd1ce63
...
...
@@ -224,12 +224,12 @@ typedef struct STaskAttr {
// SFilterInfo *pFilters;
void
*
tsdb
;
// SMemRef memRef;
STableGroupInfo
tableGroupInfo
;
// table <tid, last_key> list SArray<STableKeyInfo>
int32_t
vgId
;
SArray
*
pUdfInfo
;
// no need to free
}
STaskAttr
;
typedef
int32_t
(
*
__optr_prepare_fn_t
)(
void
*
param
);
typedef
SSDataBlock
*
(
*
__operator_fn_t
)(
void
*
param
,
bool
*
newgroup
);
typedef
void
(
*
__optr_cleanup_fn_t
)(
void
*
param
,
int32_t
num
);
...
...
@@ -313,8 +313,9 @@ 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_prepare_fn_t
prepareFn
;
__operator_fn_t
exec
;
__optr_cleanup_fn_t
cleanup
;
__optr_cleanup_fn_t
cleanup
Fn
;
}
SOperatorInfo
;
enum
{
...
...
@@ -395,7 +396,7 @@ typedef struct STableScanInfo {
int32_t
current
;
int32_t
reverseTimes
;
// 0 by default
S
QL
FunctionCtx
*
pCtx
;
// next operator query context
S
ql
FunctionCtx
*
pCtx
;
// next operator query context
SResultRowInfo
*
pResultRowInfo
;
int32_t
*
rowCellInfoOffset
;
SExprInfo
*
pExpr
;
...
...
@@ -425,7 +426,7 @@ typedef struct SStreamBlockScanInfo {
typedef
struct
SOptrBasicInfo
{
SResultRowInfo
resultRowInfo
;
int32_t
*
rowCellInfoOffset
;
// offset value for each row result cell info
S
QL
FunctionCtx
*
pCtx
;
S
ql
FunctionCtx
*
pCtx
;
SSDataBlock
*
pRes
;
}
SOptrBasicInfo
;
...
...
@@ -564,7 +565,6 @@ typedef struct SOrderOperatorInfo {
SOperatorInfo
*
createExchangeOperatorInfo
(
const
SArray
*
pSources
,
const
SArray
*
pSchema
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createDataBlocksOptScanInfo
(
void
*
pTsdbReadHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
int32_t
reverseTime
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableScanOperatorInfo
(
void
*
pTsdbReadHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableSeqScanOperator
(
void
*
pTsdbReadHandle
,
STaskRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createSubmitBlockScanOperatorInfo
(
void
*
pSubmitBlockReadHandle
,
int32_t
numOfOutput
,
SExecTaskInfo
*
pTaskInfo
);
...
...
@@ -607,11 +607,11 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
S
QL
FunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
void
finalizeQueryResult
(
SOperatorInfo
*
pOperator
,
S
QL
FunctionCtx
*
pCtx
,
SResultRowInfo
*
pResultRowInfo
,
int32_t
*
rowCellInfoOffset
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
S
ql
FunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
void
finalizeQueryResult
(
SOperatorInfo
*
pOperator
,
S
ql
FunctionCtx
*
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
,
S
QL
FunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
copyTsColoum
(
SSDataBlock
*
pRes
,
S
ql
FunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
freeParam
(
STaskParam
*
param
);
int32_t
createQueryFunc
(
SQueriedTableInfo
*
pTableInfo
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
...
...
@@ -659,8 +659,8 @@ void freeQueryAttr(STaskAttr *pQuery);
int32_t
getMaximumIdleDurationSec
();
void
doInvokeUdf
(
struct
SUdfInfo
*
pUdfInfo
,
S
QL
FunctionCtx
*
pCtx
,
int32_t
idx
,
int32_t
type
);
void
doInvokeUdf
(
struct
SUdfInfo
*
pUdfInfo
,
S
ql
FunctionCtx
*
pCtx
,
int32_t
idx
,
int32_t
type
);
void
setTaskStatus
(
SExecTaskInfo
*
pTaskInfo
,
int8_t
status
);
int32_t
createExecTaskInfoImpl
(
SSubplan
*
pPlan
,
SExecTaskInfo
**
pTaskInfo
,
void
*
reader
Handle
,
uint64_t
taskId
);
int32_t
createExecTaskInfoImpl
(
SSubplan
*
pPlan
,
SExecTaskInfo
**
pTaskInfo
,
SReadHandle
*
p
Handle
,
uint64_t
taskId
);
#endif // TDENGINE_EXECUTORIMPL_H
source/libs/executor/src/executor.c
浏览文件 @
afd1ce63
...
...
@@ -39,7 +39,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, char* id)
}
}
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
void
*
input
)
{
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
input
)
{
if
(
tinfo
==
NULL
)
{
return
TSDB_CODE_QRY_APP_ERROR
;
}
...
...
@@ -50,7 +50,7 @@ int32_t qSetStreamInput(qTaskInfo_t tinfo, void* input) {
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
int32_t
code
=
doSetStreamBlock
(
pTaskInfo
->
pRoot
,
input
,
GET_TASKID
(
pTaskInfo
));
int32_t
code
=
doSetStreamBlock
(
pTaskInfo
->
pRoot
,
(
void
*
)
input
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"%s failed to set the stream block data"
,
GET_TASKID
(
pTaskInfo
));
}
else
{
...
...
source/libs/executor/src/executorMain.c
浏览文件 @
afd1ce63
...
...
@@ -51,25 +51,7 @@ static void freeqinfoFn(void *qhandle) {
qDestroyTask
(
*
handle
);
}
void
freeParam
(
STaskParam
*
param
)
{
tfree
(
param
->
sql
);
tfree
(
param
->
tagCond
);
tfree
(
param
->
tbnameCond
);
tfree
(
param
->
pTableIdList
);
taosArrayDestroy
(
param
->
pOperator
);
tfree
(
param
->
pExprs
);
tfree
(
param
->
pSecExprs
);
tfree
(
param
->
pExpr
);
tfree
(
param
->
pSecExpr
);
tfree
(
param
->
pGroupColIndex
);
tfree
(
param
->
pTagColumnInfo
);
tfree
(
param
->
pGroupbyExpr
);
tfree
(
param
->
prevResult
);
}
int32_t
qCreateExecTask
(
void
*
readHandle
,
int32_t
vgId
,
uint64_t
taskId
,
SSubplan
*
pSubplan
,
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
)
{
int32_t
qCreateExecTask
(
SReadHandle
*
readHandle
,
int32_t
vgId
,
uint64_t
taskId
,
SSubplan
*
pSubplan
,
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
)
{
assert
(
readHandle
!=
NULL
&&
pSubplan
!=
NULL
);
SExecTaskInfo
**
pTask
=
(
SExecTaskInfo
**
)
pTaskInfo
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
afd1ce63
此差异已折叠。
点击以展开。
source/libs/function/inc/taggfunction.h
浏览文件 @
afd1ce63
...
...
@@ -73,7 +73,7 @@ typedef struct STwaInfo {
extern
int32_t
functionCompatList
[];
// compatible check array list
bool
topbot_datablock_filter
(
S
QL
FunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
);
bool
topbot_datablock_filter
(
S
ql
FunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
);
/**
* the numOfRes should be kept, since it may be used later
...
...
source/libs/function/src/taggfunction.c
浏览文件 @
afd1ce63
此差异已折叠。
点击以展开。
source/libs/function/src/tudf.c
浏览文件 @
afd1ce63
...
...
@@ -121,7 +121,7 @@ void destroyUdfInfo(SUdfInfo* pUdfInfo) {
tfree(pUdfInfo);
}
void doInvokeUdf(struct SUdfInfo* pUdfInfo, S
QL
FunctionCtx *pCtx, int32_t idx, int32_t type) {
void doInvokeUdf(struct SUdfInfo* pUdfInfo, S
ql
FunctionCtx *pCtx, int32_t idx, int32_t type) {
int32_t output = 0;
if (pUdfInfo == NULL || pUdfInfo->funcs[type] == NULL) {
...
...
source/libs/planner/src/physicalPlan.c
浏览文件 @
afd1ce63
...
...
@@ -287,7 +287,7 @@ static bool needMultiNodeScan(SQueryTableInfo* pTable) {
static
SPhyNode
*
createSingleTableScanNode
(
SQueryPlanNode
*
pPlanNode
,
SQueryTableInfo
*
pTableInfo
,
SSubplan
*
subplan
)
{
SVgroupsInfo
*
pVgroupsInfo
=
pTableInfo
->
pMeta
->
vgroupList
;
vgroupInfoToNodeAddr
(
&
(
pVgroupsInfo
->
vgroups
[
0
]),
&
subplan
->
execNode
);
int32_t
type
=
(
pPlanNode
->
info
.
type
==
QNODE_TABLESCAN
)
?
OP_
Table
Scan
:
OP_StreamScan
;
int32_t
type
=
(
pPlanNode
->
info
.
type
==
QNODE_TABLESCAN
)
?
OP_
DataBlocksOpt
Scan
:
OP_StreamScan
;
return
createUserTableScanNode
(
pPlanNode
,
pTableInfo
,
type
);
}
...
...
source/libs/planner/src/physicalPlanJson.c
浏览文件 @
afd1ce63
...
...
@@ -88,7 +88,6 @@ static const char* jkPnodeType = "Type";
static
int32_t
getPnodeTypeSize
(
cJSON
*
json
)
{
switch
(
getNumber
(
json
,
jkPnodeType
))
{
case
OP_StreamScan
:
case
OP_TableScan
:
case
OP_DataBlocksOptScan
:
case
OP_TableSeqScan
:
return
sizeof
(
STableScanPhyNode
);
...
...
@@ -831,7 +830,6 @@ static bool specificPhyNodeToJson(const void* obj, cJSON* json) {
const
SPhyNode
*
phyNode
=
(
const
SPhyNode
*
)
obj
;
switch
(
phyNode
->
info
.
type
)
{
case
OP_StreamScan
:
case
OP_TableScan
:
case
OP_DataBlocksOptScan
:
case
OP_TableSeqScan
:
return
tableScanNodeToJson
(
obj
,
json
);
...
...
@@ -869,7 +867,6 @@ static bool specificPhyNodeToJson(const void* obj, cJSON* json) {
static
bool
specificPhyNodeFromJson
(
const
cJSON
*
json
,
void
*
obj
)
{
SPhyNode
*
phyNode
=
(
SPhyNode
*
)
obj
;
switch
(
phyNode
->
info
.
type
)
{
case
OP_TableScan
:
case
OP_StreamScan
:
case
OP_DataBlocksOptScan
:
case
OP_TableSeqScan
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录