Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e333bc28
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e333bc28
编写于
2月 28, 2020
作者:
S
slguan
提交者:
GitHub
2月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1272 from taosdata/feature/liaohj
fix bugs founded in regression test(reverse scan failed).
上级
05534734
3642a950
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
37 addition
and
19 deletion
+37
-19
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-11
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+35
-8
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
e333bc28
...
...
@@ -4623,18 +4623,9 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg3
);
}
// for projection query on super table, all queries are subqueries
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
// if (pQueryInfo->order.orderColId >= 0) {
// if (pQueryInfo->limit.limit == -1) {
// return invalidSqlErrMsg(pQueryInfo->msg, msg4);
// } else if (pQueryInfo->limit.limit > 10000) { // the result set can not be larger than 10000
// //todo use global config parameter
// return invalidSqlErrMsg(pQueryInfo->msg, msg5);
// }
// }
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_SUBQUERY
;
// for projection query on super table, all queries are subqueries
pQueryInfo
->
type
|=
TSDB_QUERY_TYPE_SUBQUERY
;
}
}
}
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
e333bc28
...
...
@@ -5288,7 +5288,7 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
}
// while(1)
if
(
isIntervalQuery
(
pQuery
))
{
if
(
isIntervalQuery
(
pQuery
)
&&
IS_MASTER_SCAN
(
pRuntimeEnv
)
)
{
if
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_COMPLETED
|
QUERY_NO_DATA_TO_CHECK
))
{
closeAllTimeWindow
(
&
pRuntimeEnv
->
windowResInfo
);
}
else
if
(
Q_STATUS_EQUAL
(
pQuery
->
over
,
QUERY_RESBUF_FULL
))
{
// check if window needs to be closed
...
...
@@ -6219,7 +6219,12 @@ bool needScanDataBlocksAgain(SQueryRuntimeEnv *pRuntimeEnv) {
setWindowResOutputBuf
(
pRuntimeEnv
,
pResult
);
for
(
int32_t
j
=
0
;
j
<
pQuery
->
numOfOutputCols
;
++
j
)
{
aAggs
[
pQuery
->
pSelectExpr
[
j
].
pBase
.
functionId
].
xNextStep
(
&
pRuntimeEnv
->
pCtx
[
j
]);
int16_t
functId
=
pQuery
->
pSelectExpr
[
j
].
pBase
.
functionId
;
if
(
functId
==
TSDB_FUNC_TS
)
{
continue
;
}
aAggs
[
functId
].
xNextStep
(
&
pRuntimeEnv
->
pCtx
[
j
]);
SResultInfo
*
pResInfo
=
GET_RES_INFO
(
&
pRuntimeEnv
->
pCtx
[
j
]);
toContinue
|=
(
!
pResInfo
->
complete
);
...
...
@@ -6227,7 +6232,12 @@ bool needScanDataBlocksAgain(SQueryRuntimeEnv *pRuntimeEnv) {
}
}
else
{
for
(
int32_t
j
=
0
;
j
<
pQuery
->
numOfOutputCols
;
++
j
)
{
aAggs
[
pQuery
->
pSelectExpr
[
j
].
pBase
.
functionId
].
xNextStep
(
&
pRuntimeEnv
->
pCtx
[
j
]);
int16_t
functId
=
pQuery
->
pSelectExpr
[
j
].
pBase
.
functionId
;
if
(
functId
==
TSDB_FUNC_TS
)
{
continue
;
}
aAggs
[
functId
].
xNextStep
(
&
pRuntimeEnv
->
pCtx
[
j
]);
SResultInfo
*
pResInfo
=
GET_RES_INFO
(
&
pRuntimeEnv
->
pCtx
[
j
]);
toContinue
|=
(
!
pResInfo
->
complete
);
...
...
@@ -6243,13 +6253,23 @@ void vnodeScanAllData(SQueryRuntimeEnv *pRuntimeEnv) {
/* store the start query position */
savePointPosition
(
&
pRuntimeEnv
->
startPos
,
pQuery
->
fileId
,
pQuery
->
slot
,
pQuery
->
pos
);
int64_t
oldSkey
=
pQuery
->
skey
;
int64_t
oldEkey
=
pQuery
->
ekey
;
int64_t
skey
=
pQuery
->
lastKey
;
int32_t
status
=
pQuery
->
over
;
SET_MASTER_SCAN_FLAG
(
pRuntimeEnv
);
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
while
(
1
)
{
doScanAllDataBlocks
(
pRuntimeEnv
);
if
(
!
needScanDataBlocksAgain
(
pRuntimeEnv
))
{
// restore the status
if
(
pRuntimeEnv
->
scanFlag
==
REPEAT_SCAN
)
{
pQuery
->
over
=
status
;
}
break
;
}
...
...
@@ -6260,8 +6280,11 @@ void vnodeScanAllData(SQueryRuntimeEnv *pRuntimeEnv) {
TSKEY
key
=
loadRequiredBlockIntoMem
(
pRuntimeEnv
,
&
pRuntimeEnv
->
startPos
);
assert
((
QUERY_IS_ASC_QUERY
(
pQuery
)
&&
key
>=
pQuery
->
skey
)
||
(
!
QUERY_IS_ASC_QUERY
(
pQuery
)
&&
key
<=
pQuery
->
skey
));
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
status
=
pQuery
->
over
;
pQuery
->
ekey
=
pQuery
->
lastKey
-
step
;
pQuery
->
lastKey
=
pQuery
->
skey
;
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
pRuntimeEnv
->
scanFlag
=
REPEAT_SCAN
;
/* check if query is killed or not */
...
...
@@ -6271,13 +6294,17 @@ void vnodeScanAllData(SQueryRuntimeEnv *pRuntimeEnv) {
}
}
int64_t
newSkey
=
pQuery
->
skey
;
// no need to set the end key
int64_t
curLastKey
=
pQuery
->
lastKey
;
pQuery
->
skey
=
skey
;
pQuery
->
ekey
=
pQuery
->
lastKey
-
step
;
doSingleMeterSupplementScan
(
pRuntimeEnv
);
// update the pQuery->skey/pQuery->ekey to limit the scan scope of sliding query during supplementary scan
pQuery
->
skey
=
newSkey
;
pQuery
->
skey
=
oldSkey
;
pQuery
->
ekey
=
oldEkey
;
pQuery
->
lastKey
=
curLastKey
;
}
void
doFinalizeResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录