Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
4f527aef
T
TDengine
项目概览
小楼昨夜-听风雨
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4f527aef
编写于
3月 09, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor.
上级
8a45eedd
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
82 addition
and
66 deletion
+82
-66
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+64
-55
tests/script/general/cache/new_metrics.sim
tests/script/general/cache/new_metrics.sim
+3
-2
tests/script/general/cache/restart_metrics.sim
tests/script/general/cache/restart_metrics.sim
+1
-1
tests/script/general/cache/restart_table.sim
tests/script/general/cache/restart_table.sim
+2
-3
tests/script/general/parser/function.sim
tests/script/general/parser/function.sim
+9
-1
tests/script/general/stream/restart_stream.sim
tests/script/general/stream/restart_stream.sim
+3
-2
tests/script/jenkins/basic_1.txt
tests/script/jenkins/basic_1.txt
+0
-2
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
4f527aef
...
...
@@ -179,6 +179,7 @@ static void destroyBasicOperatorInfo(void* param, int32_t numOfOutput);
static
void
destroySFillOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyGroupbyOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyArithOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyTagScanOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
int32_t
doCopyToSDataBlock
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SGroupResInfo
*
pGroupResInfo
,
int32_t
orderType
,
SSDataBlock
*
pBlock
);
...
...
@@ -1665,20 +1666,25 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
*
(
int64_t
*
)
pRuntimeEnv
->
prevRow
[
0
]
=
INT64_MIN
;
}
qDebug
(
"QInfo:%p init runtime completed"
,
pRuntimeEnv
->
qinfo
);
qDebug
(
"QInfo:%p init runtime
environment
completed"
,
pRuntimeEnv
->
qinfo
);
// group by normal column, sliding window query, interval query are handled by interval query processor
// interval (down sampling operation)
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
{
if
(
onlyQueryTags
(
pQuery
))
{
// do nothing for tags query
}
else
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
{
if
(
pQuery
->
stableQuery
)
{
pRuntimeEnv
->
proot
=
createMultiTableTimeIntervalOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
pRuntimeEnv
->
proot
=
createMultiTableTimeIntervalOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
}
else
{
pRuntimeEnv
->
proot
=
createTimeIntervalOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
pRuntimeEnv
->
proot
=
createTimeIntervalOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
if
(
pQuery
->
pExpr2
!=
NULL
)
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
}
if
(
pQuery
->
fillType
!=
TSDB_FILL_NONE
&&
!
isPointInterpoQuery
(
pQuery
))
{
...
...
@@ -1687,42 +1693,46 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
}
}
}
else
if
(
pQuery
->
groupbyColumn
)
{
pRuntimeEnv
->
proot
=
createGroupbyOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
}
else
if
(
pQuery
->
groupbyColumn
)
{
pRuntimeEnv
->
proot
=
createGroupbyOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
if
(
pQuery
->
pExpr2
!=
NULL
)
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
}
}
else
if
(
isFixedOutputQuery
(
pQuery
))
{
if
(
pQuery
->
stableQuery
&&
!
isTsCompQuery
(
pQuery
))
{
pRuntimeEnv
->
proot
=
createMultiTableAggOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
}
else
{
pRuntimeEnv
->
proot
=
createAggregateOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
}
if
(
pQuery
->
pExpr2
!=
NULL
)
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
}
}
else
if
(
isFixedOutputQuery
(
pQuery
))
{
if
(
pQuery
->
stableQuery
&&
!
isTsCompQuery
(
pQuery
))
{
pRuntimeEnv
->
proot
=
createMultiTableAggOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
}
else
{
pRuntimeEnv
->
proot
=
createAggregateOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
}
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
if
(
pQuery
->
pExpr2
!=
NULL
)
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
}
}
else
{
// diff/add/multiply/subtract/division
assert
(
pQuery
->
checkResultBuf
==
1
);
if
(
!
onlyQueryTags
(
pQuery
))
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
}
if
(
pQuery
->
pExpr2
!=
NULL
)
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
}
if
(
pQuery
->
limit
.
offset
>
0
)
{
pRuntimeEnv
->
proot
=
createOffsetOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
);
}
else
{
// diff/add/multiply/subtract/division
assert
(
pQuery
->
checkResultBuf
==
1
);
if
(
!
onlyQueryTags
(
pQuery
))
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
pTableScanner
,
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
setTableScanFilterOperatorInfo
(
pRuntimeEnv
->
pTableScanner
->
info
,
pRuntimeEnv
->
proot
);
}
}
if
(
pQuery
->
limit
.
limi
t
>
0
)
{
pRuntimeEnv
->
proot
=
createLimi
tOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
);
}
if
(
pQuery
->
limit
.
offse
t
>
0
)
{
pRuntimeEnv
->
proot
=
createOffse
tOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
);
}
return
TSDB_CODE_SUCCESS
;
if
(
pQuery
->
limit
.
limit
>
0
)
{
pRuntimeEnv
->
proot
=
createLimitOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
);
}
return
TSDB_CODE_SUCCESS
;
_clean:
tfree
(
pRuntimeEnv
->
sasArray
);
...
...
@@ -3881,9 +3891,6 @@ static int32_t setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery)
// TODO set the tags scan handle
if
(
onlyQueryTags
(
pQuery
))
{
return
TSDB_CODE_SUCCESS
;
// } else if (isTsCompQuery(pQuery)) {
// setTableQueryHandle(pRuntimeEnv, 0);
// return terrno;
}
STsdbQueryCond
cond
=
createTsdbQueryCond
(
pQuery
,
&
pQuery
->
window
);
...
...
@@ -4011,21 +4018,12 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, SArray* prevResult, void *ts
}
int32_t
ps
=
DEFAULT_PAGE_SIZE
;
int32_t
rowsize
=
0
;
getIntermediateBufInfo
(
pRuntimeEnv
,
&
ps
,
&
pQuery
->
intermediateResultRowSize
);
int32_t
TENMB
=
1024
*
1024
*
10
;
if
(
isSTableQuery
&&
!
onlyQueryTags
(
pQuery
))
{
code
=
createDiskbasedResultBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
TENMB
,
pQInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
else
if
(
pQuery
->
groupbyColumn
||
QUERY_IS_INTERVAL_QUERY
(
pQuery
)
||
(
!
isSTableQuery
))
{
getIntermediateBufInfo
(
pRuntimeEnv
,
&
ps
,
&
rowsize
);
code
=
createDiskbasedResultBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
TENMB
,
pQInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
int32_t
TENMB
=
1024
*
1024
*
10
;
code
=
createDiskbasedResultBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
TENMB
,
pQInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
// create runtime environment
...
...
@@ -4916,6 +4914,11 @@ static void destroyArithOperatorInfo(void* param, int32_t numOfOutput) {
doDestroyBasicInfo
(
&
pInfo
->
binfo
,
numOfOutput
);
}
static
void
destroyTagScanOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
STagScanInfo
*
pInfo
=
(
STagScanInfo
*
)
param
;
pInfo
->
pRes
=
destroyOutputBuf
(
pInfo
->
pRes
);
}
SOperatorInfo
*
createMultiTableAggOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
)
{
SAggOperatorInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SAggOperatorInfo
));
...
...
@@ -5191,13 +5194,14 @@ static SSDataBlock* doTagScan(void* param) {
}
qDebug
(
"QInfo:%p create (tableId, tag) info completed, rows:%d"
,
pRuntimeEnv
->
qinfo
,
count
);
}
/*
else if (functionId == TSDB_FUNC_COUNT) {// handle the "count(tbname)" query
*(int64_t*) pQuery->sdata[0]->data = num
;
}
else
if
(
functionId
==
TSDB_FUNC_COUNT
)
{
// handle the "count(tbname)" query
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pRes
->
pDataBlock
,
0
)
;
*
(
int64_t
*
)
pColInfo
->
pData
=
pInfo
->
totalTables
;
count
=
1
;
SET_STABLE_QUERY_OVER(pRuntimeEnv);
pOperator
->
status
=
OP_EXEC_DONE
;
qDebug
(
"QInfo:%p create count(tbname) query, res:%d rows:1"
,
pRuntimeEnv
->
qinfo
,
count
);
}
*/
else
{
// return only the tags|table name etc.
}
else
{
// return only the tags|table name etc.
SExprInfo
*
pExprInfo
=
pOperator
->
pExpr
;
// todo use the column list instead of exprinfo
count
=
0
;
...
...
@@ -5231,6 +5235,10 @@ static SSDataBlock* doTagScan(void* param) {
count
+=
1
;
}
if
(
pInfo
->
currentIndex
>=
pInfo
->
totalTables
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
}
qDebug
(
"QInfo:%p create tag values results completed, rows:%d"
,
pRuntimeEnv
->
qinfo
,
count
);
}
...
...
@@ -5258,6 +5266,7 @@ SOperatorInfo* createTagScanOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SExprInf
pOperator
->
pExpr
=
pExpr
;
pOperator
->
numOfOutput
=
numOfOutput
;
pOperator
->
pRuntimeEnv
=
pRuntimeEnv
;
pOperator
->
cleanup
=
destroyTagScanOperatorInfo
;
return
pOperator
;
}
...
...
tests/script/general/cache/new_metrics.sim
浏览文件 @
4f527aef
...
...
@@ -94,8 +94,9 @@ while $i < 10
$i = $i + 1
endw
print ==> sleep 8 seconds to renew cache
sleep 8000
print ==> sleep 1 seconds to renew cache
sql reset query cache
sleep 1000
print =============== step5
...
...
tests/script/general/cache/restart_metrics.sim
浏览文件 @
4f527aef
...
...
@@ -55,7 +55,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/exec.sh -n dnode1 -s start
print =============== step3
print ==> sleep
8
seconds to renew cache
print ==> sleep
1
seconds to renew cache
sql reset query cache
sleep 1000
...
...
tests/script/general/cache/restart_table.sim
浏览文件 @
4f527aef
...
...
@@ -39,10 +39,9 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/exec.sh -n dnode1 -s start
print =============== step3
print ==> sleep 8 seconds to renew cache
sleep 2000
print ==> sleep 1 seconds to renew cache
sql reset query cache
sleep 1
8
000
sleep 1000
print =============== step4
sql create database $db
...
...
tests/script/general/parser/function.sim
浏览文件 @
4f527aef
...
...
@@ -775,8 +775,16 @@ if $rows != 1 then
return -1
endi
if $data00 != 0.000000000 then
return -1
endi
sql select count(tbname) from st1
if $rows != 1 then
return -1
endi
sql select count(id) from st1
if $rows != 1 then
return -1
endi
\ No newline at end of file
tests/script/general/stream/restart_stream.sim
浏览文件 @
4f527aef
...
...
@@ -100,8 +100,9 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/exec.sh -n dnode1 -s start
print =============== step5
print ==> sleep 8 seconds to renew cache
sleep 8000
print ==> renew cache
sql reset query cache
sleep 1000
print =============== step6
...
...
tests/script/jenkins/basic_1.txt
浏览文件 @
4f527aef
...
...
@@ -22,8 +22,6 @@
./test.sh -f general/http/grafana_bug.sim
./test.sh -f general/http/grafana.sim
./test.sh -f general/insert/basic.sim
./test.sh -f general/insert/insert_drop.sim
./test.sh -f general/insert/query_block1_memory.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录