Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
e534490a
T
TDengine
项目概览
~笨蛋陪你哭
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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,发现更多精彩内容 >>
提交
e534490a
编写于
1月 04, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]refactor.
上级
03f361ec
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
20 deletion
+16
-20
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+15
-19
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
e534490a
...
...
@@ -152,7 +152,7 @@ typedef struct SQuery {
int16_t
precision
;
int16_t
numOfOutput
;
int16_t
fillType
;
int16_t
check
Buffer
;
// check if the buffer is full during scan each block
int16_t
check
ResultBuf
;
// check if the buffer is full during scan each block
SLimitVal
limit
;
int32_t
rowSize
;
SSqlGroupbyExpr
*
pGroupbyExpr
;
...
...
src/query/src/qExecutor.c
浏览文件 @
e534490a
...
...
@@ -1708,7 +1708,7 @@ static int32_t tableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBl
numOfRes
=
(
int32_t
)
getNumOfResult
(
pRuntimeEnv
);
// update the number of output result
if
(
numOfRes
>
0
&&
pQuery
->
check
Buffer
==
1
)
{
if
(
numOfRes
>
0
&&
pQuery
->
check
ResultBuf
==
1
)
{
assert
(
numOfRes
>=
pQuery
->
rec
.
rows
);
pQuery
->
rec
.
rows
=
numOfRes
;
...
...
@@ -2222,9 +2222,9 @@ void getAlignQueryTimeWindow(SQuery *pQuery, int64_t key, int64_t keyFirst, int6
static
void
setScanLimitationByResultBuffer
(
SQuery
*
pQuery
)
{
if
(
isTopBottomQuery
(
pQuery
))
{
pQuery
->
check
Buffer
=
0
;
pQuery
->
check
ResultBuf
=
0
;
}
else
if
(
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
))
{
pQuery
->
check
Buffer
=
0
;
pQuery
->
check
ResultBuf
=
0
;
}
else
{
bool
hasMultioutput
=
false
;
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
...
...
@@ -2239,7 +2239,7 @@ static void setScanLimitationByResultBuffer(SQuery *pQuery) {
}
}
pQuery
->
check
Buffer
=
hasMultioutput
?
1
:
0
;
pQuery
->
check
ResultBuf
=
hasMultioutput
?
1
:
0
;
}
}
...
...
@@ -4761,20 +4761,21 @@ static void enableExecutionForNextTable(SQueryRuntimeEnv *pRuntimeEnv) {
}
}
// TODO refactor: setAdditionalInfo
static
FORCE_INLINE
void
setEnvForEachBlock
(
SQInfo
*
pQInfo
,
STableQueryInfo
*
pTableQueryInfo
,
SDataBlockInfo
*
pBlockInfo
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
if
(
!
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
{
setExecutionContext
(
pQInfo
,
pTableQueryInfo
->
groupIndex
,
pBlockInfo
->
window
.
ekey
+
step
);
}
else
{
// interval query
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
{
TSKEY
nextKey
=
pBlockInfo
->
window
.
skey
;
setIntervalQueryRange
(
pQInfo
,
nextKey
);
if
(
pRuntimeEnv
->
hasTagResults
||
pRuntimeEnv
->
pTsBuf
!=
NULL
)
{
setAdditionalInfo
(
pQInfo
,
pTableQueryInfo
->
pTable
,
pTableQueryInfo
);
}
}
else
{
// non-interval query
setExecutionContext
(
pQInfo
,
pTableQueryInfo
->
groupIndex
,
pBlockInfo
->
window
.
ekey
+
step
);
}
}
...
...
@@ -5630,8 +5631,6 @@ static void tableAggregationProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo)
return
;
}
pQuery
->
current
=
pTableInfo
;
// set current query table info
scanOneTableDataBlocks
(
pRuntimeEnv
,
pTableInfo
->
lastKey
);
finalizeQueryResult
(
pRuntimeEnv
);
...
...
@@ -5650,10 +5649,8 @@ static void tableAggregationProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo)
static
void
tableProjectionProcess
(
SQInfo
*
pQInfo
,
STableQueryInfo
*
pTableInfo
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
pQuery
->
current
=
pTableInfo
;
// for ts_comp query, re-initialized is not allowed
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
if
(
!
isTSCompQuery
(
pQuery
))
{
resetDefaultResInfoOutputBuf
(
pRuntimeEnv
);
}
...
...
@@ -5705,9 +5702,7 @@ static void tableProjectionProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo)
// handle time interval query on table
static
void
tableIntervalProcess
(
SQInfo
*
pQInfo
,
STableQueryInfo
*
pTableInfo
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
(
pQInfo
->
runtimeEnv
);
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
pQuery
->
current
=
pTableInfo
;
TSKEY
newStartKey
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
INT64_MIN
:
INT64_MAX
;
...
...
@@ -5777,7 +5772,6 @@ static void tableQueryImpl(SQInfo *pQInfo) {
}
qDebug
(
"QInfo:%p current:%"
PRId64
" returned, total:%"
PRId64
,
pQInfo
,
pQuery
->
rec
.
rows
,
pQuery
->
rec
.
total
);
return
;
}
else
{
pQuery
->
rec
.
rows
=
0
;
assert
(
pRuntimeEnv
->
windowResInfo
.
size
>
0
);
...
...
@@ -5795,9 +5789,9 @@ static void tableQueryImpl(SQInfo *pQInfo) {
if
(
pQuery
->
rec
.
rows
<=
0
||
pRuntimeEnv
->
windowResInfo
.
size
<=
pQInfo
->
groupIndex
)
{
qDebug
(
"QInfo:%p query over, %"
PRId64
" rows are returned"
,
pQInfo
,
pQuery
->
rec
.
total
);
}
return
;
}
return
;
}
// number of points returned during this query
...
...
@@ -5806,7 +5800,9 @@ static void tableQueryImpl(SQInfo *pQInfo) {
assert
(
pQInfo
->
tableqinfoGroupInfo
.
numOfTables
==
1
);
SArray
*
g
=
GET_TABLEGROUP
(
pQInfo
,
0
);
STableQueryInfo
*
item
=
taosArrayGetP
(
g
,
0
);
pQuery
->
current
=
item
;
// group by normal column, sliding window query, interval query are handled by interval query processor
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
)
||
pRuntimeEnv
->
groupbyColumn
)
{
// interval (down sampling operation)
...
...
@@ -5814,7 +5810,7 @@ static void tableQueryImpl(SQInfo *pQInfo) {
}
else
if
(
isFixedOutputQuery
(
pRuntimeEnv
))
{
tableAggregationProcess
(
pQInfo
,
item
);
}
else
{
// diff/add/multiply/subtract/division
assert
(
pQuery
->
check
Buffer
==
1
);
assert
(
pQuery
->
check
ResultBuf
==
1
);
tableProjectionProcess
(
pQInfo
,
item
);
}
...
...
@@ -5834,7 +5830,7 @@ static void stableQueryImpl(SQInfo *pQInfo) {
(
isFixedOutputQuery
(
pRuntimeEnv
)
&&
(
!
isPointInterpoQuery
(
pQuery
))
&&
(
!
pRuntimeEnv
->
groupbyColumn
)))
{
multiTableQueryProcess
(
pQInfo
);
}
else
{
assert
((
pQuery
->
check
Buffer
==
1
&&
pQuery
->
interval
.
interval
==
0
)
||
isPointInterpoQuery
(
pQuery
)
||
assert
((
pQuery
->
check
ResultBuf
==
1
&&
pQuery
->
interval
.
interval
==
0
)
||
isPointInterpoQuery
(
pQuery
)
||
pRuntimeEnv
->
groupbyColumn
);
sequentialTableProcess
(
pQInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录