Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
004a84ac
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看板
提交
004a84ac
编写于
9月 02, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory leak
上级
d653da79
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
42 deletion
+46
-42
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+3
-2
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+1
-2
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+5
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+37
-37
未找到文件。
source/dnode/vnode/src/tq/tq.c
浏览文件 @
004a84ac
...
@@ -829,8 +829,6 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
...
@@ -829,8 +829,6 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
tDecoderInit
(
pCoder
,
pReq
,
len
);
tDecoderInit
(
pCoder
,
pReq
,
len
);
tDecodeDeleteRes
(
pCoder
,
pRes
);
tDecodeDeleteRes
(
pCoder
,
pRes
);
/*ASSERT(pRes->skey != 0);*/
/*ASSERT(pRes->ekey != 0);*/
tDecoderClear
(
pCoder
);
tDecoderClear
(
pCoder
);
int32_t
sz
=
taosArrayGetSize
(
pRes
->
uidList
);
int32_t
sz
=
taosArrayGetSize
(
pRes
->
uidList
);
...
@@ -859,6 +857,8 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
...
@@ -859,6 +857,8 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
colDataAppendNULL
(
taosArrayGet
(
pDelBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
),
i
);
colDataAppendNULL
(
taosArrayGet
(
pDelBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
),
i
);
}
}
taosArrayDestroy
(
pRes
->
uidList
);
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
while
(
1
)
{
pIter
=
taosHashIterate
(
pTq
->
pStreamMeta
->
pTasks
,
pIter
);
pIter
=
taosHashIterate
(
pTq
->
pStreamMeta
->
pTasks
,
pIter
);
...
@@ -890,6 +890,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
...
@@ -890,6 +890,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
streamTaskInputFail
(
pTask
);
streamTaskInputFail
(
pTask
);
}
}
}
}
blockDataDestroy
(
pDelBlock
);
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
004a84ac
...
@@ -1107,8 +1107,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq
...
@@ -1107,8 +1107,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq
tDecoderInit
(
pCoder
,
pReq
,
len
);
tDecoderInit
(
pCoder
,
pReq
,
len
);
tDecodeDeleteRes
(
pCoder
,
pRes
);
tDecodeDeleteRes
(
pCoder
,
pRes
);
ASSERT
(
pRes
->
skey
!=
0
);
ASSERT
(
taosArrayGetSize
(
pRes
->
uidList
)
==
0
||
(
pRes
->
skey
!=
0
&&
pRes
->
ekey
!=
0
));
ASSERT
(
pRes
->
ekey
!=
0
);
for
(
int32_t
iUid
=
0
;
iUid
<
taosArrayGetSize
(
pRes
->
uidList
);
iUid
++
)
{
for
(
int32_t
iUid
=
0
;
iUid
<
taosArrayGetSize
(
pRes
->
uidList
);
iUid
++
)
{
code
=
tsdbDeleteTableData
(
pVnode
->
pTsdb
,
version
,
pRes
->
suid
,
*
(
uint64_t
*
)
taosArrayGet
(
pRes
->
uidList
,
iUid
),
code
=
tsdbDeleteTableData
(
pVnode
->
pTsdb
,
version
,
pRes
->
suid
,
*
(
uint64_t
*
)
taosArrayGet
(
pRes
->
uidList
,
iUid
),
...
...
source/libs/executor/src/executor.c
浏览文件 @
004a84ac
...
@@ -52,7 +52,11 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -52,7 +52,11 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
// TODO: if a block was set but not consumed,
// TODO: if a block was set but not consumed,
// prevent setting a different type of block
// prevent setting a different type of block
pInfo
->
validBlockIndex
=
0
;
pInfo
->
validBlockIndex
=
0
;
taosArrayClear
(
pInfo
->
pBlockLists
);
if
(
pInfo
->
blockType
==
STREAM_INPUT__DATA_BLOCK
)
{
taosArrayClearP
(
pInfo
->
pBlockLists
,
taosMemoryFree
);
}
else
{
taosArrayClear
(
pInfo
->
pBlockLists
);
}
if
(
type
==
STREAM_INPUT__MERGED_SUBMIT
)
{
if
(
type
==
STREAM_INPUT__MERGED_SUBMIT
)
{
// ASSERT(numOfBlocks > 1);
// ASSERT(numOfBlocks > 1);
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
004a84ac
...
@@ -76,11 +76,11 @@ typedef struct STopBotResItem {
...
@@ -76,11 +76,11 @@ typedef struct STopBotResItem {
}
STopBotResItem
;
}
STopBotResItem
;
typedef
struct
STopBotRes
{
typedef
struct
STopBotRes
{
int32_t
maxSize
;
int32_t
maxSize
;
int16_t
type
;
int16_t
type
;
STuplePos
nullTuplePos
;
STuplePos
nullTuplePos
;
bool
nullTupleSaved
;
bool
nullTupleSaved
;
STopBotResItem
*
pItems
;
STopBotResItem
*
pItems
;
}
STopBotRes
;
}
STopBotRes
;
...
@@ -223,14 +223,14 @@ typedef struct SMavgInfo {
...
@@ -223,14 +223,14 @@ typedef struct SMavgInfo {
}
SMavgInfo
;
}
SMavgInfo
;
typedef
struct
SSampleInfo
{
typedef
struct
SSampleInfo
{
int32_t
samples
;
int32_t
samples
;
int32_t
totalPoints
;
int32_t
totalPoints
;
int32_t
numSampled
;
int32_t
numSampled
;
uint8_t
colType
;
uint8_t
colType
;
int16_t
colBytes
;
int16_t
colBytes
;
STuplePos
nullTuplePos
;
STuplePos
nullTuplePos
;
bool
nullTupleSaved
;
bool
nullTupleSaved
;
char
*
data
;
char
*
data
;
STuplePos
*
tuplePos
;
STuplePos
*
tuplePos
;
...
@@ -1147,7 +1147,7 @@ bool getMinmaxFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) {
...
@@ -1147,7 +1147,7 @@ bool getMinmaxFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) {
}
}
static
STuplePos
saveTupleData
(
SqlFunctionCtx
*
pCtx
,
int32_t
rowIndex
,
const
SSDataBlock
*
pSrcBlock
);
static
STuplePos
saveTupleData
(
SqlFunctionCtx
*
pCtx
,
int32_t
rowIndex
,
const
SSDataBlock
*
pSrcBlock
);
static
int32_t
updateTupleData
(
SqlFunctionCtx
*
pCtx
,
int32_t
rowIndex
,
const
SSDataBlock
*
pSrcBlock
,
STuplePos
*
pPos
);
static
int32_t
updateTupleData
(
SqlFunctionCtx
*
pCtx
,
int32_t
rowIndex
,
const
SSDataBlock
*
pSrcBlock
,
STuplePos
*
pPos
);
static
const
char
*
loadTupleData
(
SqlFunctionCtx
*
pCtx
,
const
STuplePos
*
pPos
);
static
const
char
*
loadTupleData
(
SqlFunctionCtx
*
pCtx
,
const
STuplePos
*
pPos
);
static
int32_t
findRowIndex
(
int32_t
start
,
int32_t
num
,
SColumnInfoData
*
pCol
,
const
char
*
tval
)
{
static
int32_t
findRowIndex
(
int32_t
start
,
int32_t
num
,
SColumnInfoData
*
pCol
,
const
char
*
tval
)
{
...
@@ -1357,8 +1357,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
...
@@ -1357,8 +1357,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
numOfElems
+=
1
;
numOfElems
+=
1
;
}
}
}
else
if
(
type
==
TSDB_DATA_TYPE_BIGINT
||
}
else
if
(
type
==
TSDB_DATA_TYPE_BIGINT
||
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
int64_t
*
pData
=
(
int64_t
*
)
pCol
->
pData
;
int64_t
*
pData
=
(
int64_t
*
)
pCol
->
pData
;
int64_t
*
val
=
(
int64_t
*
)
&
pBuf
->
v
;
int64_t
*
val
=
(
int64_t
*
)
&
pBuf
->
v
;
...
@@ -1581,7 +1580,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
...
@@ -1581,7 +1580,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
}
}
_min_max_over:
_min_max_over:
if
(
numOfElems
==
0
&&
pCtx
->
subsidiaries
.
num
>
0
&&
!
pBuf
->
nullTupleSaved
)
{
if
(
numOfElems
==
0
&&
pCtx
->
subsidiaries
.
num
>
0
&&
!
pBuf
->
nullTupleSaved
)
{
pBuf
->
nullTuplePos
=
saveTupleData
(
pCtx
,
pInput
->
startRowIndex
,
pCtx
->
pSrcBlock
);
pBuf
->
nullTuplePos
=
saveTupleData
(
pCtx
,
pInput
->
startRowIndex
,
pCtx
->
pSrcBlock
);
pBuf
->
nullTupleSaved
=
true
;
pBuf
->
nullTupleSaved
=
true
;
}
}
...
@@ -1601,7 +1600,8 @@ int32_t maxFunction(SqlFunctionCtx* pCtx) {
...
@@ -1601,7 +1600,8 @@ int32_t maxFunction(SqlFunctionCtx* pCtx) {
}
}
static
void
setNullSelectivityValue
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
rowIndex
);
static
void
setNullSelectivityValue
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
rowIndex
);
static
void
setSelectivityValue
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
const
STuplePos
*
pTuplePos
,
int32_t
rowIndex
);
static
void
setSelectivityValue
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
const
STuplePos
*
pTuplePos
,
int32_t
rowIndex
);
int32_t
minmaxFunctionFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
int32_t
minmaxFunctionFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SResultRowEntryInfo
*
pEntryInfo
=
GET_RES_INFO
(
pCtx
);
SResultRowEntryInfo
*
pEntryInfo
=
GET_RES_INFO
(
pCtx
);
...
@@ -1651,7 +1651,7 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple
...
@@ -1651,7 +1651,7 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple
if
(
pCtx
->
saveHandle
.
pBuf
!=
NULL
)
{
if
(
pCtx
->
saveHandle
.
pBuf
!=
NULL
)
{
if
(
pTuplePos
->
pageId
!=
-
1
)
{
if
(
pTuplePos
->
pageId
!=
-
1
)
{
int32_t
numOfCols
=
pCtx
->
subsidiaries
.
num
;
int32_t
numOfCols
=
pCtx
->
subsidiaries
.
num
;
const
char
*
p
=
loadTupleData
(
pCtx
,
pTuplePos
);
const
char
*
p
=
loadTupleData
(
pCtx
,
pTuplePos
);
bool
*
nullList
=
(
bool
*
)
p
;
bool
*
nullList
=
(
bool
*
)
p
;
...
@@ -1660,7 +1660,7 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple
...
@@ -1660,7 +1660,7 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple
// todo set the offset value to optimize the performance.
// todo set the offset value to optimize the performance.
for
(
int32_t
j
=
0
;
j
<
numOfCols
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
numOfCols
;
++
j
)
{
SqlFunctionCtx
*
pc
=
pCtx
->
subsidiaries
.
pCtx
[
j
];
SqlFunctionCtx
*
pc
=
pCtx
->
subsidiaries
.
pCtx
[
j
];
int32_t
dstSlotId
=
pc
->
pExpr
->
base
.
resSchema
.
slotId
;
int32_t
dstSlotId
=
pc
->
pExpr
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pDstCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
dstSlotId
);
SColumnInfoData
*
pDstCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
dstSlotId
);
ASSERT
(
pc
->
pExpr
->
base
.
resSchema
.
bytes
==
pDstCol
->
info
.
bytes
);
ASSERT
(
pc
->
pExpr
->
base
.
resSchema
.
bytes
==
pDstCol
->
info
.
bytes
);
...
@@ -1701,7 +1701,7 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos)
...
@@ -1701,7 +1701,7 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos)
char
*
pData
=
colDataGetData
(
pSrcCol
,
rowIndex
);
char
*
pData
=
colDataGetData
(
pSrcCol
,
rowIndex
);
// append to dest col
// append to dest col
int32_t
dstSlotId
=
pc
->
pExpr
->
base
.
resSchema
.
slotId
;
int32_t
dstSlotId
=
pc
->
pExpr
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pDstCol
=
taosArrayGet
(
pCtx
->
pDstBlock
->
pDataBlock
,
dstSlotId
);
SColumnInfoData
*
pDstCol
=
taosArrayGet
(
pCtx
->
pDstBlock
->
pDataBlock
,
dstSlotId
);
ASSERT
(
pc
->
pExpr
->
base
.
resSchema
.
bytes
==
pDstCol
->
info
.
bytes
);
ASSERT
(
pc
->
pExpr
->
base
.
resSchema
.
bytes
==
pDstCol
->
info
.
bytes
);
...
@@ -1712,7 +1712,6 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos)
...
@@ -1712,7 +1712,6 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos)
colDataAppend
(
pDstCol
,
pos
,
pData
,
false
);
colDataAppend
(
pDstCol
,
pos
,
pData
,
false
);
}
}
}
}
}
}
void
replaceTupleData
(
STuplePos
*
pDestPos
,
STuplePos
*
pSourcePos
)
{
void
replaceTupleData
(
STuplePos
*
pDestPos
,
STuplePos
*
pSourcePos
)
{
...
@@ -2590,8 +2589,8 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
...
@@ -2590,8 +2589,8 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
memcpy
(
pHisto
,
pInput
->
pHisto
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
));
memcpy
(
pHisto
,
pInput
->
pHisto
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"%s merge histo, total:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
qDebug
(
"%s merge histo, total:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
->
numOfEntries
,
pHisto
);
pHisto
);
}
else
{
}
else
{
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"%s input histogram, elem:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
qDebug
(
"%s input histogram, elem:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
...
@@ -2601,8 +2600,8 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
...
@@ -2601,8 +2600,8 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
memcpy
(
pHisto
,
pRes
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
MAX_HISTOGRAM_BIN
);
memcpy
(
pHisto
,
pRes
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
MAX_HISTOGRAM_BIN
);
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"%s merge histo, total:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
qDebug
(
"%s merge histo, total:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
->
numOfEntries
,
pHisto
);
pHisto
);
tHistogramDestroy
(
&
pRes
);
tHistogramDestroy
(
&
pRes
);
}
}
}
}
...
@@ -2629,8 +2628,8 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
...
@@ -2629,8 +2628,8 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
}
}
if
(
pInfo
->
algo
!=
APERCT_ALGO_TDIGEST
)
{
if
(
pInfo
->
algo
!=
APERCT_ALGO_TDIGEST
)
{
qDebug
(
"%s after merge, total:%d, numOfEntry:%d, %p"
,
__FUNCTION__
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
qDebug
(
"%s after merge, total:%d, numOfEntry:%d, %p"
,
__FUNCTION__
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
);
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
);
}
}
SET_VAL
(
pResInfo
,
1
,
1
);
SET_VAL
(
pResInfo
,
1
,
1
);
...
@@ -2709,7 +2708,7 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx)
...
@@ -2709,7 +2708,7 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx)
}
}
EFuncDataRequired
lastDynDataReq
(
void
*
pRes
,
STimeWindow
*
pTimeWindow
)
{
EFuncDataRequired
lastDynDataReq
(
void
*
pRes
,
STimeWindow
*
pTimeWindow
)
{
SResultRowEntryInfo
*
pEntry
=
(
SResultRowEntryInfo
*
)
pRes
;
SResultRowEntryInfo
*
pEntry
=
(
SResultRowEntryInfo
*
)
pRes
;
// not initialized yet, data is required
// not initialized yet, data is required
if
(
pEntry
==
NULL
)
{
if
(
pEntry
==
NULL
)
{
...
@@ -2752,7 +2751,8 @@ static FORCE_INLINE TSKEY getRowPTs(SColumnInfoData* pTsColInfo, int32_t rowInde
...
@@ -2752,7 +2751,8 @@ static FORCE_INLINE TSKEY getRowPTs(SColumnInfoData* pTsColInfo, int32_t rowInde
return
*
(
TSKEY
*
)
colDataGetData
(
pTsColInfo
,
rowIndex
);
return
*
(
TSKEY
*
)
colDataGetData
(
pTsColInfo
,
rowIndex
);
}
}
static
void
firstlastSaveTupleData
(
const
SSDataBlock
*
pSrcBlock
,
int32_t
rowIndex
,
SqlFunctionCtx
*
pCtx
,
SFirstLastRes
*
pInfo
)
{
static
void
firstlastSaveTupleData
(
const
SSDataBlock
*
pSrcBlock
,
int32_t
rowIndex
,
SqlFunctionCtx
*
pCtx
,
SFirstLastRes
*
pInfo
)
{
if
(
pCtx
->
subsidiaries
.
num
<=
0
)
{
if
(
pCtx
->
subsidiaries
.
num
<=
0
)
{
return
;
return
;
}
}
...
@@ -3176,7 +3176,7 @@ bool diffFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
...
@@ -3176,7 +3176,7 @@ bool diffFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
static
void
doSetPrevVal
(
SDiffInfo
*
pDiffInfo
,
int32_t
type
,
const
char
*
pv
)
{
static
void
doSetPrevVal
(
SDiffInfo
*
pDiffInfo
,
int32_t
type
,
const
char
*
pv
)
{
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_BOOL
:
pDiffInfo
->
prev
.
i64
=
*
(
bool
*
)
pv
?
1
:
0
;
pDiffInfo
->
prev
.
i64
=
*
(
bool
*
)
pv
?
1
:
0
;
break
;
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
pDiffInfo
->
prev
.
i64
=
*
(
int8_t
*
)
pv
;
pDiffInfo
->
prev
.
i64
=
*
(
int8_t
*
)
pv
;
...
@@ -3537,7 +3537,8 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
...
@@ -3537,7 +3537,8 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
* |(n columns, one bit for each column)| src column #1| src column #2|
* |(n columns, one bit for each column)| src column #1| src column #2|
* +------------------------------------+--------------+--------------+
* +------------------------------------+--------------+--------------+
*/
*/
void
*
serializeTupleData
(
const
SSDataBlock
*
pSrcBlock
,
int32_t
rowIndex
,
SSubsidiaryResInfo
*
pSubsidiaryies
,
char
*
buf
)
{
void
*
serializeTupleData
(
const
SSDataBlock
*
pSrcBlock
,
int32_t
rowIndex
,
SSubsidiaryResInfo
*
pSubsidiaryies
,
char
*
buf
)
{
char
*
nullList
=
buf
;
char
*
nullList
=
buf
;
char
*
pStart
=
(
char
*
)(
nullList
+
sizeof
(
bool
)
*
pSubsidiaryies
->
num
);
char
*
pStart
=
(
char
*
)(
nullList
+
sizeof
(
bool
)
*
pSubsidiaryies
->
num
);
...
@@ -3585,7 +3586,7 @@ static STuplePos doSaveTupleData(SSerializeDataHandle* pHandle, const void* pBuf
...
@@ -3585,7 +3586,7 @@ static STuplePos doSaveTupleData(SSerializeDataHandle* pHandle, const void* pBuf
}
}
}
}
p
=
(
STuplePos
)
{.
pageId
=
pHandle
->
currentPage
,
.
offset
=
pPage
->
num
};
p
=
(
STuplePos
){.
pageId
=
pHandle
->
currentPage
,
.
offset
=
pPage
->
num
};
memcpy
(
pPage
->
data
+
pPage
->
num
,
pBuf
,
length
);
memcpy
(
pPage
->
data
+
pPage
->
num
,
pBuf
,
length
);
pPage
->
num
+=
length
;
pPage
->
num
+=
length
;
...
@@ -3621,7 +3622,6 @@ static int32_t doUpdateTupleData(SSerializeDataHandle* pHandle, const void* pBuf
...
@@ -3621,7 +3622,6 @@ static int32_t doUpdateTupleData(SSerializeDataHandle* pHandle, const void* pBuf
setBufPageDirty
(
pPage
,
true
);
setBufPageDirty
(
pPage
,
true
);
releaseBufPage
(
pHandle
->
pBuf
,
pPage
);
releaseBufPage
(
pHandle
->
pBuf
,
pPage
);
}
else
{
}
else
{
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -3636,7 +3636,7 @@ static int32_t updateTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSD
...
@@ -3636,7 +3636,7 @@ static int32_t updateTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSD
static
char
*
doLoadTupleData
(
SSerializeDataHandle
*
pHandle
,
const
STuplePos
*
pPos
)
{
static
char
*
doLoadTupleData
(
SSerializeDataHandle
*
pHandle
,
const
STuplePos
*
pPos
)
{
if
(
pHandle
->
pBuf
!=
NULL
)
{
if
(
pHandle
->
pBuf
!=
NULL
)
{
SFilePage
*
pPage
=
getBufPage
(
pHandle
->
pBuf
,
pPos
->
pageId
);
SFilePage
*
pPage
=
getBufPage
(
pHandle
->
pBuf
,
pPos
->
pageId
);
char
*
p
=
pPage
->
data
+
pPos
->
offset
;
char
*
p
=
pPage
->
data
+
pPos
->
offset
;
releaseBufPage
(
pHandle
->
pBuf
,
pPage
);
releaseBufPage
(
pHandle
->
pBuf
,
pPage
);
return
p
;
return
p
;
}
else
{
}
else
{
...
@@ -3980,8 +3980,8 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
...
@@ -3980,8 +3980,8 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
}
}
if
(
pCtx
->
end
.
key
==
INT64_MIN
)
{
if
(
pCtx
->
end
.
key
==
INT64_MIN
)
{
pInfo
->
min
=
(
pInfo
->
min
>
ptsList
[
start
+
pInput
->
numOfRows
-
1
])
?
pInfo
->
min
=
ptsList
[
start
+
pInput
->
numOfRows
-
1
]
:
pInfo
->
min
;
(
pInfo
->
min
>
ptsList
[
start
+
pInput
->
numOfRows
-
1
])
?
ptsList
[
start
+
pInput
->
numOfRows
-
1
]
:
pInfo
->
min
;
}
else
{
}
else
{
pInfo
->
min
=
pCtx
->
end
.
key
;
pInfo
->
min
=
pCtx
->
end
.
key
;
}
}
...
@@ -3993,8 +3993,8 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
...
@@ -3993,8 +3993,8 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
}
}
if
(
pCtx
->
end
.
key
==
INT64_MIN
)
{
if
(
pCtx
->
end
.
key
==
INT64_MIN
)
{
pInfo
->
max
=
(
pInfo
->
max
<
ptsList
[
start
+
pInput
->
numOfRows
-
1
])
?
pInfo
->
max
=
ptsList
[
start
+
pInput
->
numOfRows
-
1
]
:
pInfo
->
max
;
(
pInfo
->
max
<
ptsList
[
start
+
pInput
->
numOfRows
-
1
])
?
ptsList
[
start
+
pInput
->
numOfRows
-
1
]
:
pInfo
->
max
;
}
else
{
}
else
{
pInfo
->
max
=
pCtx
->
end
.
key
+
1
;
pInfo
->
max
=
pCtx
->
end
.
key
+
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录