Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ab2ad2cc
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看板
未验证
提交
ab2ad2cc
编写于
7月 22, 2022
作者:
H
Haojun Liao
提交者:
GitHub
7月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15269 from taosdata/feature/3_liaohj
refactor: do some internal refactor.
上级
048572e9
72bbc27e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
28 addition
and
22 deletion
+28
-22
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+5
-0
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+1
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+15
-13
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+2
-6
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+1
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+2
-0
tests/script/tsim/sma/rsmaCreateInsertQuery.sim
tests/script/tsim/sma/rsmaCreateInsertQuery.sim
+1
-0
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
ab2ad2cc
...
...
@@ -1107,6 +1107,11 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
void
blockDataCleanup
(
SSDataBlock
*
pDataBlock
)
{
pDataBlock
->
info
.
rows
=
0
;
pDataBlock
->
info
.
groupId
=
0
;
pDataBlock
->
info
.
window
.
ekey
=
0
;
pDataBlock
->
info
.
window
.
skey
=
0
;
size_t
numOfCols
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
ab2ad2cc
...
...
@@ -788,11 +788,11 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
doCopyColVal
(
pColData
,
rowIndex
++
,
i
,
&
cv
,
pSupInfo
);
}
colIndex
+=
1
;
ASSERT
(
rowIndex
==
remain
);
}
else
{
// the specified column does not exist in file block, fill with null data
colDataAppendNNULL
(
pColData
,
0
,
remain
);
}
ASSERT
(
rowIndex
==
remain
);
i
+=
1
;
}
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
ab2ad2cc
...
...
@@ -869,7 +869,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SReadHandle* re
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createStreamScanOperatorInfo
(
SReadHandle
*
pHandle
,
STableScanPhysiNode
*
pTableScanNode
,
SNode
*
pTagCond
,
SExecTaskInfo
*
pTaskInfo
);
S
TimeWindowAggSupp
*
pTwAggSup
,
S
ExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createFillOperatorInfo
(
SOperatorInfo
*
downstream
,
SFillPhysiNode
*
pPhyFillNode
,
SExecTaskInfo
*
pTaskInfo
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
ab2ad2cc
...
...
@@ -1334,12 +1334,10 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
static
void
extractQualifiedTupleByFilterResult
(
SSDataBlock
*
pBlock
,
const
int8_t
*
rowRes
,
bool
keep
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
)
{
if
(
pFilterNode
==
NULL
)
{
return
;
}
if
(
pBlock
->
info
.
rows
==
0
)
{
if
(
pFilterNode
==
NULL
||
pBlock
->
info
.
rows
==
0
)
{
return
;
}
SFilterInfo
*
filter
=
NULL
;
// todo move to the initialization function
...
...
@@ -1356,8 +1354,6 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
filterFreeInfo
(
filter
);
extractQualifiedTupleByFilterResult
(
pBlock
,
rowRes
,
keep
);
blockDataUpdateTsWindow
(
pBlock
,
0
);
taosMemoryFree
(
rowRes
);
}
...
...
@@ -3412,6 +3408,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
doHandleRemainBlockFromNewGroup
(
pInfo
,
pResultInfo
,
pTaskInfo
);
if
(
pResBlock
->
info
.
rows
>
pResultInfo
->
threshold
||
pResBlock
->
info
.
rows
>
0
)
{
pResBlock
->
info
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
}
...
...
@@ -3454,17 +3451,20 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
// 1. The result in current group not reach the threshold of output result, continue
// 2. If multiple group results existing in one SSDataBlock is not allowed, return immediately
if
(
pResBlock
->
info
.
rows
>
pResultInfo
->
threshold
||
pBlock
==
NULL
||
pInfo
->
existNewGroupBlock
!=
NULL
)
{
pResBlock
->
info
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
}
doHandleRemainBlockFromNewGroup
(
pInfo
,
pResultInfo
,
pTaskInfo
);
if
(
pResBlock
->
info
.
rows
>=
pOperator
->
resultInfo
.
threshold
||
pBlock
==
NULL
)
{
pResBlock
->
info
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
}
}
else
if
(
pInfo
->
existNewGroupBlock
)
{
// try next group
assert
(
pBlock
!=
NULL
);
doHandleRemainBlockForNewGroupImpl
(
pInfo
,
pResultInfo
,
pTaskInfo
);
if
(
pResBlock
->
info
.
rows
>
pResultInfo
->
threshold
)
{
pResBlock
->
info
.
groupId
=
pInfo
->
curGroupId
;
return
pResBlock
;
}
}
else
{
...
...
@@ -3484,23 +3484,19 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
SSDataBlock
*
fillResult
=
NULL
;
while
(
true
)
{
fillResult
=
doFillImpl
(
pOperator
);
if
(
fillResult
!=
NULL
)
{
doFilter
(
pInfo
->
pCondition
,
fillResult
);
}
if
(
fillResult
==
NULL
)
{
doSetOperatorCompleted
(
pOperator
);
break
;
}
doFilter
(
pInfo
->
pCondition
,
fillResult
);
if
(
fillResult
->
info
.
rows
>
0
)
{
break
;
}
}
if
(
fillResult
!=
NULL
)
{
size_t
rows
=
fillResult
->
info
.
rows
;
pOperator
->
resultInfo
.
totalRows
+=
rows
;
pOperator
->
resultInfo
.
totalRows
+=
fillResult
->
info
.
rows
;
}
return
fillResult
;
...
...
@@ -4444,6 +4440,12 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return
createExchangeOperatorInfo
(
pHandle
->
pMsgCb
->
clientRpc
,
(
SExchangePhysiNode
*
)
pPhyNode
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
==
type
)
{
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
STimeWindowAggSupp
aggSup
=
(
STimeWindowAggSupp
){
.
waterMark
=
pTableScanNode
->
watermark
,
.
calTrigger
=
pTableScanNode
->
triggerType
,
.
maxTs
=
INT64_MIN
,
};
if
(
pHandle
->
vnode
)
{
int32_t
code
=
createScanTableListInfo
(
&
pTableScanNode
->
scan
,
pTableScanNode
->
pGroupTags
,
pTableScanNode
->
groupSort
,
...
...
@@ -4463,7 +4465,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
#endif
pTaskInfo
->
schemaInfo
.
qsw
=
extractQueriedColumnSchema
(
&
pTableScanNode
->
scan
);
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pHandle
,
pTableScanNode
,
pTagCond
,
pTaskInfo
);
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pHandle
,
pTableScanNode
,
pTagCond
,
&
aggSup
,
pTaskInfo
);
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
==
type
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
ab2ad2cc
...
...
@@ -1525,7 +1525,7 @@ static void destroyStreamScanOperatorInfo(void* param, int32_t numOfOutput) {
}
SOperatorInfo
*
createStreamScanOperatorInfo
(
SReadHandle
*
pHandle
,
STableScanPhysiNode
*
pTableScanNode
,
SNode
*
pTagCond
,
SExecTaskInfo
*
pTaskInfo
)
{
S
TimeWindowAggSupp
*
pTwSup
,
S
ExecTaskInfo
*
pTaskInfo
)
{
SStreamScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamScanInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
...
...
@@ -1539,11 +1539,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pInfo
->
pTagCond
=
pTagCond
;
pInfo
->
twAggSup
=
(
STimeWindowAggSupp
){
.
waterMark
=
pTableScanNode
->
watermark
,
.
calTrigger
=
pTableScanNode
->
triggerType
,
.
maxTs
=
INT64_MIN
,
};
pInfo
->
twAggSup
=
*
pTwSup
;
int32_t
numOfCols
=
0
;
pInfo
->
pColMatchInfo
=
extractColMatchInfo
(
pScanPhyNode
->
pScanCols
,
pDescNode
,
&
numOfCols
,
COL_MATCH_FROM_COL_ID
);
...
...
source/libs/function/src/builtins.c
浏览文件 @
ab2ad2cc
...
...
@@ -2088,7 +2088,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateApercentileMerge
,
.
getEnvFunc
=
getApercentileFuncEnv
,
.
initFunc
=
f
unctionSetup
,
.
initFunc
=
apercentileF
unctionSetup
,
.
processFunc
=
apercentileFunctionMerge
,
.
finalizeFunc
=
apercentileFinalize
,
.
invertFunc
=
NULL
,
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
ab2ad2cc
...
...
@@ -2592,6 +2592,7 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SAPercentileInfo
*
pInfo
=
(
SAPercentileInfo
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
if
(
pInfo
->
algo
==
APERCT_ALGO_TDIGEST
)
{
buildTDigestInfo
(
pInfo
);
if
(
pInfo
->
pTDigest
->
size
>
0
)
{
pInfo
->
result
=
tdigestQuantile
(
pInfo
->
pTDigest
,
pInfo
->
percent
/
100
);
}
else
{
// no need to free
...
...
@@ -2599,6 +2600,7 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return
TSDB_CODE_SUCCESS
;
}
}
else
{
buildHistogramInfo
(
pInfo
);
if
(
pInfo
->
pHisto
->
numOfElems
>
0
)
{
qDebug
(
"get the final res:%d, elements:%"
PRId64
", entry:%d"
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
);
...
...
tests/script/tsim/sma/rsmaCreateInsertQuery.sim
浏览文件 @
ab2ad2cc
...
...
@@ -43,6 +43,7 @@ endi
if $data01 != 1 then
if $data01 != 10 then
print =============> $data01
print retention level 2 file result $data01 != 1 or 10
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录