Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
09662138
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看板
提交
09662138
编写于
5月 25, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(arch): set the correct module api dependency.
上级
da9f33a4
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
137 addition
and
127 deletion
+137
-127
include/libs/executor/storageapi.h
include/libs/executor/storageapi.h
+5
-35
include/libs/function/function.h
include/libs/function/function.h
+50
-7
include/libs/stream/streamState.h
include/libs/stream/streamState.h
+0
-10
source/dnode/vnode/src/vnd/vnodeInitApi.c
source/dnode/vnode/src/vnd/vnodeInitApi.c
+7
-0
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+1
-1
source/libs/executor/inc/executorInt.h
source/libs/executor/inc/executorInt.h
+2
-3
source/libs/executor/src/aggregateoperator.c
source/libs/executor/src/aggregateoperator.c
+4
-4
source/libs/executor/src/cachescanoperator.c
source/libs/executor/src/cachescanoperator.c
+1
-1
source/libs/executor/src/eventwindowoperator.c
source/libs/executor/src/eventwindowoperator.c
+2
-2
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+2
-1
source/libs/executor/src/executorInt.c
source/libs/executor/src/executorInt.c
+2
-2
source/libs/executor/src/filloperator.c
source/libs/executor/src/filloperator.c
+7
-6
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+6
-6
source/libs/executor/src/projectoperator.c
source/libs/executor/src/projectoperator.c
+3
-3
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+5
-5
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+2
-2
source/libs/executor/src/sysscanoperator.c
source/libs/executor/src/sysscanoperator.c
+1
-1
source/libs/executor/src/timesliceoperator.c
source/libs/executor/src/timesliceoperator.c
+2
-2
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+20
-18
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+15
-17
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+0
-1
未找到文件。
include/libs/executor/storageapi.h
浏览文件 @
09662138
...
...
@@ -22,6 +22,7 @@
#include "tmsg.h"
#include "tcommon.h"
#include "index.h"
#include "function.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -404,41 +405,9 @@ int32_t vnodeGetStbIdList(void *pVnode, int64_t suid, SArray *list);
*/
}
SStoreMeta
;
typedef
struct
STdbState
{
void
*
rocksdb
;
void
**
pHandle
;
void
*
writeOpts
;
void
*
readOpts
;
void
**
cfOpts
;
void
*
dbOpt
;
struct
SStreamTask
*
pOwner
;
void
*
param
;
void
*
env
;
SListNode
*
pComparNode
;
void
*
pBackendHandle
;
char
idstr
[
64
];
void
*
compactFactory
;
void
*
db
;
void
*
pStateDb
;
void
*
pFuncStateDb
;
void
*
pFillStateDb
;
// todo refactor
void
*
pSessionStateDb
;
void
*
pParNameDb
;
void
*
pParTagDb
;
void
*
txn
;
}
STdbState
;
// incremental state storage
typedef
struct
{
STdbState
*
pTdbState
;
struct
SStreamFileState
*
pFileState
;
int32_t
number
;
SSHashObj
*
parNameMap
;
int64_t
checkPointId
;
int32_t
taskId
;
int64_t
streamId
;
}
SStreamState
;
typedef
struct
SUpdateInfo
{
SArray
*
pTsBuckets
;
...
...
@@ -546,6 +515,7 @@ typedef struct SStorageAPI {
SStoreTqReader
tqReaderFn
;
SStateStore
stateStore
;
SMetaDataFilterAPI
metaFilter
;
SFunctionStateStore
functionStore
;
}
SStorageAPI
;
#ifdef __cplusplus
...
...
include/libs/function/function.h
浏览文件 @
09662138
...
...
@@ -22,6 +22,7 @@ extern "C" {
#include "tcommon.h"
#include "tvariant.h"
#include "tsimplehash.h"
struct
SqlFunctionCtx
;
struct
SResultRowEntryInfo
;
...
...
@@ -127,18 +128,59 @@ typedef struct SSerializeDataHandle {
void
*
pState
;
}
SSerializeDataHandle
;
// incremental state storage
typedef
struct
STdbState
{
void
*
rocksdb
;
void
**
pHandle
;
void
*
writeOpts
;
void
*
readOpts
;
void
**
cfOpts
;
void
*
dbOpt
;
struct
SStreamTask
*
pOwner
;
void
*
param
;
void
*
env
;
SListNode
*
pComparNode
;
void
*
pBackendHandle
;
char
idstr
[
64
];
void
*
compactFactory
;
void
*
db
;
void
*
pStateDb
;
void
*
pFuncStateDb
;
void
*
pFillStateDb
;
// todo refactor
void
*
pSessionStateDb
;
void
*
pParNameDb
;
void
*
pParTagDb
;
void
*
txn
;
}
STdbState
;
typedef
struct
{
STdbState
*
pTdbState
;
struct
SStreamFileState
*
pFileState
;
int32_t
number
;
SSHashObj
*
parNameMap
;
int64_t
checkPointId
;
int32_t
taskId
;
int64_t
streamId
;
}
SStreamState
;
typedef
struct
SFunctionStateStore
{
int32_t
(
*
streamStateFuncPut
)(
SStreamState
*
pState
,
const
SWinKey
*
key
,
const
void
*
value
,
int32_t
vLen
);
int32_t
(
*
streamStateFuncGet
)(
SStreamState
*
pState
,
const
SWinKey
*
key
,
void
**
ppVal
,
int32_t
*
pVLen
);
}
SFunctionStateStore
;
// sql function runtime context
typedef
struct
SqlFunctionCtx
{
SInputColumnInfoData
input
;
SResultDataInfo
resDataInfo
;
uint32_t
order
;
// data block scanner order: asc|desc
uint8_t
isPseudoFunc
;
// denote current function is pseudo function or not [added for perf reason]
uint8_t
isNotNullFunc
;
// not return null value.
uint8_t
scanFlag
;
// record current running step, default: 0
int16_t
functionId
;
// function id
char
*
pOutput
;
// final result output buffer, point to sdata->data
uint32_t
order
;
// data block scanner order: asc|desc
uint8_t
isPseudoFunc
;
// denote current function is pseudo function or not [added for perf reason]
uint8_t
isNotNullFunc
;
// not return null value.
uint8_t
scanFlag
;
// record current running step, default: 0
int16_t
functionId
;
// function id
char
*
pOutput
;
// final result output buffer, point to sdata->data
// input parameter, e.g., top(k, 20), the number of results of top query is kept in param
SFunctParam
*
param
;
SFunctParam
*
param
;
// corresponding output buffer for timestamp of each result, e.g., diff/csum
SColumnInfoData
*
pTsOutput
;
int32_t
numOfParams
;
...
...
@@ -155,6 +197,7 @@ typedef struct SqlFunctionCtx {
SSerializeDataHandle
saveHandle
;
int32_t
exprIdx
;
char
*
udfName
;
SFunctionStateStore
*
pStore
;
}
SqlFunctionCtx
;
typedef
struct
tExprNode
{
...
...
include/libs/stream/streamState.h
浏览文件 @
09662138
...
...
@@ -66,16 +66,6 @@ int32_t streamStateCommit(SStreamState* pState);
void
streamStateDestroy
(
SStreamState
*
pState
,
bool
remove
);
int32_t
streamStateDeleteCheckPoint
(
SStreamState
*
pState
,
TSKEY
mark
);
//typedef struct {
// rocksdb_iterator_t* iter;
// rocksdb_snapshot_t* snapshot;
// rocksdb_readoptions_t* readOpt;
// rocksdb_t* db;
//
// TBC* pCur;
// int64_t number;
//} SStreamStateCur;
int32_t
streamStateFuncPut
(
SStreamState
*
pState
,
const
SWinKey
*
key
,
const
void
*
value
,
int32_t
vLen
);
int32_t
streamStateFuncGet
(
SStreamState
*
pState
,
const
SWinKey
*
key
,
void
**
ppVal
,
int32_t
*
pVLen
);
...
...
source/dnode/vnode/src/vnd/vnodeInitApi.c
浏览文件 @
09662138
...
...
@@ -24,6 +24,7 @@ static void initTqAPI(SStoreTqReader* pTq);
static
void
initStateStoreAPI
(
SStateStore
*
pStore
);
static
void
initMetaReaderAPI
(
SStoreMetaReader
*
pMetaReader
);
static
void
initMetaFilterAPI
(
SMetaDataFilterAPI
*
pFilter
);
static
void
initFunctionStateStore
(
SFunctionStateStore
*
pStore
);
void
initStorageAPI
(
SStorageAPI
*
pAPI
)
{
initTsdbReaderAPI
(
&
pAPI
->
tsdReader
);
...
...
@@ -32,6 +33,7 @@ void initStorageAPI(SStorageAPI* pAPI) {
initStateStoreAPI
(
&
pAPI
->
stateStore
);
initMetaReaderAPI
(
&
pAPI
->
metaReaderFn
);
initMetaFilterAPI
(
&
pAPI
->
metaFilter
);
initFunctionStateStore
(
&
pAPI
->
functionStore
);
}
void
initTsdbReaderAPI
(
TsdReader
*
pReader
)
{
...
...
@@ -206,4 +208,9 @@ void initMetaFilterAPI(SMetaDataFilterAPI* pFilter) {
pFilter
->
metaFilterTableIds
=
metaFilterTableIds
;
pFilter
->
metaFilterTableName
=
metaFilterTableName
;
pFilter
->
metaFilterTtl
=
metaFilterTtl
;
}
void
initFunctionStateStore
(
SFunctionStateStore
*
pStore
)
{
pStore
->
streamStateFuncPut
=
streamStateFuncPut
;
pStore
->
streamStateFuncGet
=
streamStateFuncGet
;
}
\ No newline at end of file
source/libs/executor/inc/executil.h
浏览文件 @
09662138
...
...
@@ -166,7 +166,7 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId);
void
createExprFromTargetNode
(
SExprInfo
*
pExp
,
STargetNode
*
pTargetNode
);
SExprInfo
*
createExprInfo
(
SNodeList
*
pNodeList
,
SNodeList
*
pGroupKeys
,
int32_t
*
numOfExprs
);
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowEntryInfoOffset
);
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowEntryInfoOffset
,
SFunctionStateStore
*
pStore
);
void
relocateColumnData
(
SSDataBlock
*
pBlock
,
const
SArray
*
pColMatchInfo
,
SArray
*
pCols
,
bool
outputEveryColumn
);
void
initExecTimeWindowInfo
(
SColumnInfoData
*
pColData
,
STimeWindow
*
pQueryWindow
);
...
...
source/libs/executor/inc/executorInt.h
浏览文件 @
09662138
...
...
@@ -579,12 +579,11 @@ void cleanupQueriedTableScanInfo(SSchemaInfo* pSchemaInfo);
void
initBasicInfo
(
SOptrBasicInfo
*
pInfo
,
SSDataBlock
*
pBlock
);
void
cleanupBasicInfo
(
SOptrBasicInfo
*
pInfo
);
int32_t
initExprSupp
(
SExprSupp
*
pSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExpr
);
int32_t
initExprSupp
(
SExprSupp
*
pSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExpr
,
SFunctionStateStore
*
pStore
);
void
cleanupExprSupp
(
SExprSupp
*
pSup
);
int32_t
initAggSup
(
SExprSupp
*
pSup
,
SAggSupporter
*
pAggSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
size_t
keyBufSize
,
const
char
*
pkey
,
void
*
pState
);
const
char
*
pkey
,
void
*
pState
,
SFunctionStateStore
*
pStore
);
void
cleanupAggSup
(
SAggSupporter
*
pAggSup
);
void
initResultSizeInfo
(
SResultInfo
*
pResultInfo
,
int32_t
numOfRows
);
...
...
source/libs/executor/src/aggregateoperator.c
浏览文件 @
09662138
...
...
@@ -84,7 +84,7 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiN
int32_t
num
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pAggNode
->
pAggFuncs
,
pAggNode
->
pGroupKeys
,
&
num
);
int32_t
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -95,7 +95,7 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiN
pScalarExprInfo
=
createExprInfo
(
pAggNode
->
pExprs
,
NULL
,
&
numOfScalarExpr
);
}
code
=
initExprSupp
(
&
pInfo
->
scalarExprSup
,
pScalarExprInfo
,
numOfScalarExpr
);
code
=
initExprSupp
(
&
pInfo
->
scalarExprSup
,
pScalarExprInfo
,
numOfScalarExpr
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -485,8 +485,8 @@ void cleanupAggSup(SAggSupporter* pAggSup) {
}
int32_t
initAggSup
(
SExprSupp
*
pSup
,
SAggSupporter
*
pAggSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
size_t
keyBufSize
,
const
char
*
pkey
,
void
*
pState
)
{
int32_t
code
=
initExprSupp
(
pSup
,
pExprInfo
,
numOfCols
);
const
char
*
pkey
,
void
*
pState
,
SFunctionStateStore
*
pStore
)
{
int32_t
code
=
initExprSupp
(
pSup
,
pExprInfo
,
numOfCols
,
pStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
source/libs/executor/src/cachescanoperator.c
浏览文件 @
09662138
...
...
@@ -126,7 +126,7 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe
if
(
pScanNode
->
scan
.
pScanPseudoCols
!=
NULL
)
{
SExprSupp
*
p
=
&
pInfo
->
pseudoExprSup
;
p
->
pExprInfo
=
createExprInfo
(
pScanNode
->
scan
.
pScanPseudoCols
,
NULL
,
&
p
->
numOfExprs
);
p
->
pCtx
=
createSqlFunctionCtx
(
p
->
pExprInfo
,
p
->
numOfExprs
,
&
p
->
rowEntryInfoOffset
);
p
->
pCtx
=
createSqlFunctionCtx
(
p
->
pExprInfo
,
p
->
numOfExprs
,
&
p
->
rowEntryInfoOffset
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
}
setOperatorInfo
(
pOperator
,
"CachedRowScanOperator"
,
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN
,
false
,
OP_NOT_OPENED
,
...
...
source/libs/executor/src/eventwindowoperator.c
浏览文件 @
09662138
...
...
@@ -92,7 +92,7 @@ SOperatorInfo* createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNo
if
(
pEventWindowNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalarExpr
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pEventWindowNode
->
window
.
pExprs
,
NULL
,
&
numOfScalarExpr
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
numOfScalarExpr
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
numOfScalarExpr
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -110,7 +110,7 @@ SOperatorInfo* createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNo
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/executor/src/executil.c
浏览文件 @
09662138
...
...
@@ -1544,7 +1544,7 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
return
TSDB_CODE_SUCCESS
;
}
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowEntryInfoOffset
)
{
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowEntryInfoOffset
,
SFunctionStateStore
*
pStore
)
{
SqlFunctionCtx
*
pFuncCtx
=
(
SqlFunctionCtx
*
)
taosMemoryCalloc
(
numOfOutput
,
sizeof
(
SqlFunctionCtx
));
if
(
pFuncCtx
==
NULL
)
{
return
NULL
;
...
...
@@ -1607,6 +1607,7 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
pCtx
->
numOfParams
=
pExpr
->
base
.
numOfParams
;
pCtx
->
param
=
pFunct
->
pParam
;
pCtx
->
saveHandle
.
currentPage
=
-
1
;
pCtx
->
pStore
=
pStore
;
}
for
(
int32_t
i
=
1
;
i
<
numOfOutput
;
++
i
)
{
...
...
source/libs/executor/src/executorInt.c
浏览文件 @
09662138
...
...
@@ -979,11 +979,11 @@ static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
return
NULL
;
}
int32_t
initExprSupp
(
SExprSupp
*
pSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExpr
)
{
int32_t
initExprSupp
(
SExprSupp
*
pSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExpr
,
SFunctionStateStore
*
pStore
)
{
pSup
->
pExprInfo
=
pExprInfo
;
pSup
->
numOfExprs
=
numOfExpr
;
if
(
pSup
->
pExprInfo
!=
NULL
)
{
pSup
->
pCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfExpr
,
&
pSup
->
rowEntryInfoOffset
);
pSup
->
pCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfExpr
,
&
pSup
->
rowEntryInfoOffset
,
pStore
);
if
(
pSup
->
pCtx
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
source/libs/executor/src/filloperator.c
浏览文件 @
09662138
...
...
@@ -338,7 +338,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
goto
_error
;
}
code
=
initExprSupp
(
pNoFillSupp
,
pNoFillSupp
->
pExprInfo
,
pNoFillSupp
->
numOfExprs
);
code
=
initExprSupp
(
pNoFillSupp
,
pNoFillSupp
->
pExprInfo
,
pNoFillSupp
->
numOfExprs
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -355,7 +355,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
pInfo
->
numOfExpr
);
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
pInfo
->
numOfExpr
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -525,7 +525,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId,
pFillSup
->
cur
.
key
=
key
.
ts
;
pFillSup
->
cur
.
pRowVal
=
curVal
;
void
*
pCur
=
pAPI
->
stateStore
.
streamStateFillSeekKeyPrev
(
pState
,
&
key
);
SStreamStateCur
*
pCur
=
pAPI
->
stateStore
.
streamStateFillSeekKeyPrev
(
pState
,
&
key
);
SWinKey
preKey
=
{.
ts
=
INT64_MIN
,
.
groupId
=
groupId
};
void
*
preVal
=
NULL
;
int32_t
preVLen
=
0
;
...
...
@@ -1139,7 +1139,8 @@ static void doDeleteFillResult(SOperatorInfo* pOperator) {
TSKEY
endTs
=
ts
;
uint64_t
groupId
=
groupIds
[
pInfo
->
srcDelRowIndex
];
SWinKey
key
=
{.
ts
=
ts
,
.
groupId
=
groupId
};
void
*
pCur
=
pAPI
->
stateStore
.
streamStateGetAndCheckCur
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
SStreamStateCur
*
pCur
=
pAPI
->
stateStore
.
streamStateGetAndCheckCur
(
pOperator
->
pTaskInfo
->
streamInfo
.
pState
,
&
key
);
if
(
!
pCur
)
{
pInfo
->
srcDelRowIndex
++
;
continue
;
...
...
@@ -1355,7 +1356,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
}
SExprInfo
*
noFillExpr
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
numOfNotFillCols
);
code
=
initExprSupp
(
&
pFillSup
->
notFillExprSup
,
noFillExpr
,
numOfNotFillCols
);
code
=
initExprSupp
(
&
pFillSup
->
notFillExprSup
,
noFillExpr
,
numOfNotFillCols
,
&
pAPI
->
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
destroyStreamFillSupporter
(
pFillSup
);
return
NULL
;
...
...
@@ -1491,7 +1492,7 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
goto
_error
;
}
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pFillExprInfo
,
numOfFillCols
);
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pFillExprInfo
,
numOfFillCols
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
09662138
...
...
@@ -451,7 +451,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode*
}
pInfo
->
pGroupCols
=
extractColumnInfo
(
pAggNode
->
pGroupKeys
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
numOfScalarExpr
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
numOfScalarExpr
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -467,7 +467,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode*
int32_t
num
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pAggNode
->
pAggFuncs
,
pAggNode
->
pGroupKeys
,
&
num
);
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
pInfo
->
groupKeyLen
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -849,7 +849,7 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
if
(
pPartNode
->
pExprs
!=
NULL
)
{
int32_t
num
=
0
;
SExprInfo
*
pExprInfo1
=
createExprInfo
(
pPartNode
->
pExprs
,
NULL
,
&
num
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pExprInfo1
,
num
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pExprInfo1
,
num
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
pTaskInfo
->
code
=
terrno
;
...
...
@@ -1242,7 +1242,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr
if
(
pPartNode
->
part
.
pExprs
!=
NULL
)
{
int32_t
num
=
0
;
SExprInfo
*
pCalExprInfo
=
createExprInfo
(
pPartNode
->
part
.
pExprs
,
NULL
,
&
num
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pCalExprInfo
,
num
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pCalExprInfo
,
num
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -1257,7 +1257,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr
}
pInfo
->
tbnameCalSup
.
pExprInfo
=
pSubTableExpr
;
createExprFromOneNode
(
pSubTableExpr
,
pPartNode
->
pSubtable
,
0
);
code
=
initExprSupp
(
&
pInfo
->
tbnameCalSup
,
pSubTableExpr
,
1
);
code
=
initExprSupp
(
&
pInfo
->
tbnameCalSup
,
pSubTableExpr
,
1
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -1271,7 +1271,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
}
if
(
initExprSupp
(
&
pInfo
->
tagCalSup
,
pTagExpr
,
numOfTags
)
!=
0
)
{
if
(
initExprSupp
(
&
pInfo
->
tagCalSup
,
pTagExpr
,
numOfTags
,
&
pTaskInfo
->
storageAPI
.
functionStore
)
!=
0
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
}
...
...
source/libs/executor/src/projectoperator.c
浏览文件 @
09662138
...
...
@@ -115,7 +115,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
numOfRows
);
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -370,7 +370,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
if
(
pPhyNode
->
pExprs
!=
NULL
)
{
int32_t
num
=
0
;
SExprInfo
*
pSExpr
=
createExprInfo
(
pPhyNode
->
pExprs
,
NULL
,
&
num
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pSExpr
,
num
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pSExpr
,
num
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -392,7 +392,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
blockDataEnsureCapacity
(
pResBlock
,
numOfRows
);
int32_t
code
=
initAggSup
(
pSup
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfExpr
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
09662138
...
...
@@ -962,7 +962,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
if
(
pScanNode
->
pScanPseudoCols
!=
NULL
)
{
SExprSupp
*
pSup
=
&
pInfo
->
base
.
pseudoSup
;
pSup
->
pExprInfo
=
createExprInfo
(
pScanNode
->
pScanPseudoCols
,
NULL
,
&
pSup
->
numOfExprs
);
pSup
->
pCtx
=
createSqlFunctionCtx
(
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
&
pSup
->
rowEntryInfoOffset
);
pSup
->
pCtx
=
createSqlFunctionCtx
(
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
&
pSup
->
rowEntryInfoOffset
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
}
pInfo
->
scanInfo
=
(
SScanInfo
){.
numOfAsc
=
pTableScanNode
->
scanSeq
[
0
],
.
numOfDesc
=
pTableScanNode
->
scanSeq
[
1
]};
...
...
@@ -2349,7 +2349,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pInfo
->
tbnameCalSup
.
pExprInfo
=
pSubTableExpr
;
createExprFromOneNode
(
pSubTableExpr
,
pTableScanNode
->
pSubtable
,
0
);
if
(
initExprSupp
(
&
pInfo
->
tbnameCalSup
,
pSubTableExpr
,
1
)
!=
0
)
{
if
(
initExprSupp
(
&
pInfo
->
tbnameCalSup
,
pSubTableExpr
,
1
,
&
pTaskInfo
->
storageAPI
.
functionStore
)
!=
0
)
{
tableListDestroy
(
pTableListInfo
);
goto
_error
;
}
...
...
@@ -2363,7 +2363,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
tableListDestroy
(
pTableListInfo
);
goto
_error
;
}
if
(
initExprSupp
(
&
pInfo
->
tagCalSup
,
pTagExpr
,
numOfTags
)
!=
0
)
{
if
(
initExprSupp
(
&
pInfo
->
tagCalSup
,
pTagExpr
,
numOfTags
,
&
pTaskInfo
->
storageAPI
.
functionStore
)
!=
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
tableListDestroy
(
pTableListInfo
);
goto
_error
;
...
...
@@ -2612,7 +2612,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
int32_t
numOfExprs
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyNode
->
pScanPseudoCols
,
NULL
,
&
numOfExprs
);
int32_t
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
numOfExprs
);
int32_t
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
numOfExprs
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -3033,7 +3033,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
if
(
pTableScanNode
->
scan
.
pScanPseudoCols
!=
NULL
)
{
SExprSupp
*
pSup
=
&
pInfo
->
base
.
pseudoSup
;
pSup
->
pExprInfo
=
createExprInfo
(
pTableScanNode
->
scan
.
pScanPseudoCols
,
NULL
,
&
pSup
->
numOfExprs
);
pSup
->
pCtx
=
createSqlFunctionCtx
(
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
&
pSup
->
rowEntryInfoOffset
);
pSup
->
pCtx
=
createSqlFunctionCtx
(
pSup
->
pExprInfo
,
pSup
->
numOfExprs
,
&
pSup
->
rowEntryInfoOffset
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
}
pInfo
->
scanInfo
=
(
SScanInfo
){.
numOfAsc
=
pTableScanNode
->
scanSeq
[
0
],
.
numOfDesc
=
pTableScanNode
->
scanSeq
[
1
]};
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
09662138
...
...
@@ -60,7 +60,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
}
pOperator
->
exprSupp
.
pCtx
=
createSqlFunctionCtx
(
pOperator
->
exprSupp
.
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
);
createSqlFunctionCtx
(
pOperator
->
exprSupp
.
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
1024
);
code
=
filterInitFromNode
((
SNode
*
)
pSortNode
->
node
.
pConditions
,
&
pOperator
->
exprSupp
.
pFilterInfo
,
0
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -500,7 +500,7 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort
pSup
->
numOfExprs
=
numOfCols
;
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
1024
);
pOperator
->
exprSupp
.
pCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
);
pOperator
->
exprSupp
.
pCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
pInfo
->
binfo
.
pRes
=
createDataBlockFromDescNode
(
pDescNode
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
...
...
source/libs/executor/src/sysscanoperator.c
浏览文件 @
09662138
...
...
@@ -2301,7 +2301,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
int32_t
numOfCols
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pBlockScanNode
->
pScanPseudoCols
,
NULL
,
&
numOfCols
);
int32_t
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
numOfCols
);
int32_t
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pExprInfo
,
numOfCols
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/executor/src/timesliceoperator.c
浏览文件 @
09662138
...
...
@@ -818,7 +818,7 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
int32_t
numOfExprs
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pInterpPhyNode
->
pFuncs
,
NULL
,
&
numOfExprs
);
int32_t
code
=
initExprSupp
(
pSup
,
pExprInfo
,
numOfExprs
);
int32_t
code
=
initExprSupp
(
pSup
,
pExprInfo
,
numOfExprs
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -826,7 +826,7 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
if
(
pInterpPhyNode
->
pExprs
!=
NULL
)
{
int32_t
num
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pInterpPhyNode
->
pExprs
,
NULL
,
&
num
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
num
);
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
num
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
09662138
...
...
@@ -1656,7 +1656,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh
int32_t
num
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyNode
->
window
.
pFuncs
,
NULL
,
&
num
);
int32_t
code
=
initAggSup
(
pSup
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
initAggSup
(
pSup
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -1684,7 +1684,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh
if
(
pPhyNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pPhyNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -1884,7 +1884,7 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWi
if
(
pStateNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalarExpr
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pStateNode
->
window
.
pExprs
,
NULL
,
&
numOfScalarExpr
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
numOfScalarExpr
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSup
,
pScalarExprInfo
,
numOfScalarExpr
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -1910,7 +1910,7 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWi
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -1979,7 +1979,7 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionW
initBasicInfo
(
&
pInfo
->
binfo
,
pResBlock
);
int32_t
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -2744,7 +2744,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
if
(
pIntervalPhyNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pIntervalPhyNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -2757,9 +2757,10 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
pInfo
->
pState
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamState
));
*
(
pInfo
->
pState
)
=
*
(
pTaskInfo
->
streamInfo
.
pState
);
pAPI
->
stateStore
.
streamStateSetNumber
(
pInfo
->
pState
,
-
1
);
int32_t
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pInfo
->
pState
);
pInfo
->
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -2861,9 +2862,9 @@ void destroyStreamSessionAggOperatorInfo(void* param) {
}
int32_t
initBasicInfoEx
(
SOptrBasicInfo
*
pBasicInfo
,
SExprSupp
*
pSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResultBlock
)
{
SSDataBlock
*
pResultBlock
,
SFunctionStateStore
*
pStore
)
{
initBasicInfo
(
pBasicInfo
,
pResultBlock
);
int32_t
code
=
initExprSupp
(
pSup
,
pExprInfo
,
numOfCols
);
int32_t
code
=
initExprSupp
(
pSup
,
pExprInfo
,
numOfCols
,
pStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2936,6 +2937,7 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SqlFunctionCtx* pCtx,
if
(
bufSize
<=
pageSize
)
{
bufSize
=
pageSize
*
4
;
}
if
(
!
osTempSpaceAvailable
())
{
terrno
=
TSDB_CODE_NO_DISKSPACE
;
qError
(
"Init stream agg supporter failed since %s, tempDir:%s"
,
terrstr
(),
tsTempDir
);
...
...
@@ -3588,7 +3590,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
if
(
pSessionNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pSessionNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -3597,7 +3599,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
SExprInfo
*
pExprInfo
=
createExprInfo
(
pSessionNode
->
window
.
pFuncs
,
NULL
,
&
numOfCols
);
SSDataBlock
*
pResBlock
=
createDataBlockFromDescNode
(
pPhyNode
->
pOutputDataBlockDesc
);
code
=
initBasicInfoEx
(
&
pInfo
->
binfo
,
pSup
,
pExprInfo
,
numOfCols
,
pResBlock
);
code
=
initBasicInfoEx
(
&
pInfo
->
binfo
,
pSup
,
pExprInfo
,
numOfCols
,
pResBlock
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -4126,7 +4128,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
if
(
pStateNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pStateNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -4145,7 +4147,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
int32_t
numOfCols
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pStateNode
->
window
.
pFuncs
,
NULL
,
&
numOfCols
);
SSDataBlock
*
pResBlock
=
createDataBlockFromDescNode
(
pPhyNode
->
pOutputDataBlockDesc
);
code
=
initBasicInfoEx
(
&
pInfo
->
binfo
,
pSup
,
pExprInfo
,
numOfCols
,
pResBlock
);
code
=
initBasicInfoEx
(
&
pInfo
->
binfo
,
pSup
,
pExprInfo
,
numOfCols
,
pResBlock
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -4433,7 +4435,7 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream,
SExprInfo
*
pExprInfo
=
createExprInfo
(
pNode
->
window
.
pFuncs
,
NULL
,
&
num
);
code
=
initAggSup
(
&
pOperator
->
exprSupp
,
&
iaInfo
->
aggSup
,
pExprInfo
,
num
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -4719,7 +4721,7 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMerge
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
int32_t
code
=
initAggSup
(
pExprSupp
,
&
pIntervalInfo
->
aggSup
,
pExprInfo
,
num
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pTaskInfo
->
streamInfo
.
pState
);
pTaskInfo
->
streamInfo
.
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -4764,7 +4766,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SStorageAPI
*
pAPI
=
&
pOperator
->
pTaskInfo
->
storageAPI
;
SExprSupp
*
pSup
=
&
pOperator
->
exprSupp
;
SExprSupp
*
pSup
=
&
pOperator
->
exprSupp
;
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
...
...
@@ -4948,7 +4950,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
size_t
keyBufSize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
POINTER_BYTES
;
code
=
initAggSup
(
pSup
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
keyBufSize
,
pTaskInfo
->
id
.
str
,
pInfo
->
pState
);
pInfo
->
pState
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -4956,7 +4958,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
if
(
pIntervalPhyNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pIntervalPhyNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
,
&
pTaskInfo
->
storageAPI
.
functionStore
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
09662138
...
...
@@ -18,7 +18,6 @@
#include "function.h"
#include "query.h"
#include "querynodes.h"
//#include "streamState.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "tdigest.h"
...
...
@@ -1697,7 +1696,7 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
GET_TYPED_DATA
(
v
,
double
,
pVal
->
nType
,
&
pVal
->
i
);
int32_t
code
=
getPercentile
(
pMemBucket
,
v
,
&
ppInfo
->
result
);
code
=
getPercentile
(
pMemBucket
,
v
,
&
ppInfo
->
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_fin_error
;
}
...
...
@@ -3120,7 +3119,7 @@ void* serializeTupleData(const SSDataBlock* pSrcBlock, int32_t rowIndex, SSubsid
}
static
int32_t
doSaveTupleData
(
SSerializeDataHandle
*
pHandle
,
const
void
*
pBuf
,
size_t
length
,
SWinKey
*
key
,
STuplePos
*
pPos
)
{
STuplePos
*
pPos
,
SFunctionStateStore
*
pStore
)
{
STuplePos
p
=
{
0
};
if
(
pHandle
->
pBuf
!=
NULL
)
{
SFilePage
*
pPage
=
NULL
;
...
...
@@ -3153,11 +3152,10 @@ static int32_t doSaveTupleData(SSerializeDataHandle* pHandle, const void* pBuf,
pPage
->
num
+=
length
;
setBufPageDirty
(
pPage
,
true
);
releaseBufPage
(
pHandle
->
pBuf
,
pPage
);
}
else
{
// other tuple save policy
// if (streamStateFuncPut(pHandle->pState, key, pBuf, length) >= 0) {
// p.streamTupleKey = *key;
// }
}
else
{
// other tuple save policy
if
(
pStore
->
streamStateFuncPut
(
pHandle
->
pState
,
key
,
pBuf
,
length
)
>=
0
)
{
p
.
streamTupleKey
=
*
key
;
}
}
*
pPos
=
p
;
...
...
@@ -3179,10 +3177,10 @@ int32_t saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock*
}
char
*
buf
=
serializeTupleData
(
pSrcBlock
,
rowIndex
,
&
pCtx
->
subsidiaries
,
pCtx
->
subsidiaries
.
buf
);
return
doSaveTupleData
(
&
pCtx
->
saveHandle
,
buf
,
pCtx
->
subsidiaries
.
rowLen
,
&
key
,
pPos
);
return
doSaveTupleData
(
&
pCtx
->
saveHandle
,
buf
,
pCtx
->
subsidiaries
.
rowLen
,
&
key
,
pPos
,
pCtx
->
pStore
);
}
static
int32_t
doUpdateTupleData
(
SSerializeDataHandle
*
pHandle
,
const
void
*
pBuf
,
size_t
length
,
STuplePos
*
pPos
)
{
static
int32_t
doUpdateTupleData
(
SSerializeDataHandle
*
pHandle
,
const
void
*
pBuf
,
size_t
length
,
STuplePos
*
pPos
,
SFunctionStateStore
*
pStore
)
{
if
(
pHandle
->
pBuf
!=
NULL
)
{
SFilePage
*
pPage
=
getBufPage
(
pHandle
->
pBuf
,
pPos
->
pageId
);
if
(
pPage
==
NULL
)
{
...
...
@@ -3192,7 +3190,7 @@ static int32_t doUpdateTupleData(SSerializeDataHandle* pHandle, const void* pBuf
setBufPageDirty
(
pPage
,
true
);
releaseBufPage
(
pHandle
->
pBuf
,
pPage
);
}
else
{
//
streamStateFuncPut(pHandle->pState, &pPos->streamTupleKey, pBuf, length);
pStore
->
streamStateFuncPut
(
pHandle
->
pState
,
&
pPos
->
streamTupleKey
,
pBuf
,
length
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -3202,10 +3200,10 @@ int32_t updateTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBloc
prepareBuf
(
pCtx
);
char
*
buf
=
serializeTupleData
(
pSrcBlock
,
rowIndex
,
&
pCtx
->
subsidiaries
,
pCtx
->
subsidiaries
.
buf
);
return
doUpdateTupleData
(
&
pCtx
->
saveHandle
,
buf
,
pCtx
->
subsidiaries
.
rowLen
,
pPos
);
return
doUpdateTupleData
(
&
pCtx
->
saveHandle
,
buf
,
pCtx
->
subsidiaries
.
rowLen
,
pPos
,
pCtx
->
pStore
);
}
static
char
*
doLoadTupleData
(
SSerializeDataHandle
*
pHandle
,
const
STuplePos
*
pPos
)
{
static
char
*
doLoadTupleData
(
SSerializeDataHandle
*
pHandle
,
const
STuplePos
*
pPos
,
SFunctionStateStore
*
pStore
)
{
if
(
pHandle
->
pBuf
!=
NULL
)
{
SFilePage
*
pPage
=
getBufPage
(
pHandle
->
pBuf
,
pPos
->
pageId
);
if
(
pPage
==
NULL
)
{
...
...
@@ -3217,13 +3215,13 @@ static char* doLoadTupleData(SSerializeDataHandle* pHandle, const STuplePos* pPo
}
else
{
void
*
value
=
NULL
;
int32_t
vLen
;
//
streamStateFuncGet(pHandle->pState, &pPos->streamTupleKey, &value, &vLen);
pStore
->
streamStateFuncGet
(
pHandle
->
pState
,
&
pPos
->
streamTupleKey
,
&
value
,
&
vLen
);
return
(
char
*
)
value
;
}
}
const
char
*
loadTupleData
(
SqlFunctionCtx
*
pCtx
,
const
STuplePos
*
pPos
)
{
return
doLoadTupleData
(
&
pCtx
->
saveHandle
,
pPos
);
return
doLoadTupleData
(
&
pCtx
->
saveHandle
,
pPos
,
pCtx
->
pStore
);
}
int32_t
topBotFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
...
...
@@ -4991,7 +4989,7 @@ static int32_t saveModeTupleData(SqlFunctionCtx* pCtx, char* data, SModeInfo *pI
memcpy
(
pInfo
->
buf
,
data
,
pInfo
->
colBytes
);
}
return
doSaveTupleData
(
&
pCtx
->
saveHandle
,
pInfo
->
buf
,
pInfo
->
colBytes
,
NULL
,
pPos
);
return
doSaveTupleData
(
&
pCtx
->
saveHandle
,
pInfo
->
buf
,
pInfo
->
colBytes
,
NULL
,
pPos
,
pCtx
->
pStore
);
}
static
int32_t
doModeAdd
(
SModeInfo
*
pInfo
,
int32_t
rowIndex
,
SqlFunctionCtx
*
pCtx
,
char
*
data
)
{
...
...
@@ -5020,7 +5018,7 @@ static int32_t doModeAdd(SModeInfo* pInfo, int32_t rowIndex, SqlFunctionCtx* pCt
}
else
{
pHashItem
->
count
+=
1
;
if
(
pCtx
->
subsidiaries
.
num
>
0
)
{
int32_t
code
=
updateTupleData
(
pCtx
,
rowIndex
,
pCtx
->
pSrcBlock
,
&
pHashItem
->
tuplePos
);
code
=
updateTupleData
(
pCtx
,
rowIndex
,
pCtx
->
pSrcBlock
,
&
pHashItem
->
tuplePos
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
source/libs/stream/src/streamState.c
浏览文件 @
09662138
...
...
@@ -23,7 +23,6 @@
#include "tcommon.h"
#include "tcompare.h"
#include "tref.h"
#include "ttimer.h"
#define MAX_TABLE_NAME_NUM 2000000
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录