Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c2069b7e
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c2069b7e
编写于
7月 08, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] fix bug in sliding query
上级
370fadb0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
7 deletion
+17
-7
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+8
-1
src/common/src/tname.c
src/common/src/tname.c
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+8
-5
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
c2069b7e
...
...
@@ -654,11 +654,14 @@ int32_t parseIntervalClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQ
int32_t
parseSlidingClause
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SQuerySQL
*
pQuerySql
)
{
const
char
*
msg0
=
"sliding value too small"
;
const
char
*
msg1
=
"sliding value no larger than the interval value"
;
const
char
*
msg2
=
"sliding value can not less than 1% of interval value"
;
const
static
int32_t
INTERVAL_SLIDING_FACTOR
=
100
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
SSQLToken
*
pSliding
=
&
pQuerySql
->
sliding
;
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
SSQLToken
*
pSliding
=
&
pQuerySql
->
sliding
;
if
(
pSliding
->
n
!=
0
)
{
getTimestampInUsFromStr
(
pSliding
->
z
,
pSliding
->
n
,
&
pQueryInfo
->
slidingTime
);
if
(
tinfo
.
precision
==
TSDB_TIME_PRECISION_MILLI
)
{
...
...
@@ -676,6 +679,10 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQu
pQueryInfo
->
slidingTime
=
pQueryInfo
->
intervalTime
;
}
if
((
pQueryInfo
->
intervalTime
!=
0
)
&&
(
pQueryInfo
->
intervalTime
/
pQueryInfo
->
slidingTime
>
INTERVAL_SLIDING_FACTOR
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
src/common/src/tname.c
浏览文件 @
c2069b7e
...
...
@@ -81,7 +81,7 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
return
startTime
;
}
int64_t
start
=
((
startTime
-
sliding
Time
)
/
slidingTime
+
1
)
*
slidingTime
;
int64_t
start
=
((
startTime
-
interval
Time
)
/
slidingTime
+
1
)
*
slidingTime
;
if
(
!
(
timeUnit
==
'a'
||
timeUnit
==
'm'
||
timeUnit
==
's'
||
timeUnit
==
'h'
))
{
/*
* here we revised the start time of day according to the local time zone,
...
...
src/query/src/qExecutor.c
浏览文件 @
c2069b7e
...
...
@@ -2294,10 +2294,10 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
)
&&
IS_MASTER_SCAN
(
pRuntimeEnv
))
{
if
(
Q_STATUS_EQUAL
(
pQuery
->
status
,
QUERY_COMPLETED
))
{
int32_t
step
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
QUERY_ASC_FORWARD_STEP
:
QUERY_DESC_FORWARD_STEP
;
//
int32_t step = QUERY_IS_ASC_QUERY(pQuery) ? QUERY_ASC_FORWARD_STEP : QUERY_DESC_FORWARD_STEP;
closeAllTimeWindow
(
&
pRuntimeEnv
->
windowResInfo
);
removeRedundantWindow
(
&
pRuntimeEnv
->
windowResInfo
,
pTableQueryInfo
->
lastKey
-
step
,
step
);
//
removeRedundantWindow(&pRuntimeEnv->windowResInfo, pTableQueryInfo->lastKey - step, step);
pRuntimeEnv
->
windowResInfo
.
curIndex
=
pRuntimeEnv
->
windowResInfo
.
size
-
1
;
// point to the last time window
}
else
{
assert
(
Q_STATUS_EQUAL
(
pQuery
->
status
,
QUERY_RESBUF_FULL
));
...
...
@@ -2914,6 +2914,9 @@ static void updateTableQueryInfoForReverseScan(SQuery *pQuery, STableQueryInfo *
SWITCH_ORDER
(
pTableQueryInfo
->
cur
.
order
);
pTableQueryInfo
->
cur
.
vgroupIndex
=
-
1
;
// set the index at the end of time window
pTableQueryInfo
->
windowResInfo
.
curIndex
=
pTableQueryInfo
->
windowResInfo
.
size
-
1
;
}
static
void
disableFuncInReverseScanImpl
(
SQInfo
*
pQInfo
,
SWindowResInfo
*
pWindowResInfo
,
int32_t
order
)
{
...
...
@@ -4690,7 +4693,7 @@ static void doRestoreContext(SQInfo *pQInfo) {
static
void
doCloseAllTimeWindowAfterScan
(
SQInfo
*
pQInfo
)
{
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
//
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order);
if
(
QUERY_IS_INTERVAL_QUERY
(
pQuery
))
{
size_t
numOfGroup
=
GET_NUM_OF_TABLEGROUP
(
pQInfo
);
...
...
@@ -4701,7 +4704,7 @@ static void doCloseAllTimeWindowAfterScan(SQInfo *pQInfo) {
for
(
int32_t
j
=
0
;
j
<
num
;
++
j
)
{
STableQueryInfo
*
item
=
taosArrayGetP
(
group
,
j
);
closeAllTimeWindow
(
&
item
->
windowResInfo
);
removeRedundantWindow
(
&
item
->
windowResInfo
,
item
->
lastKey
-
step
,
step
);
//
removeRedundantWindow(&item->windowResInfo, item->lastKey - step, step);
}
}
}
else
{
// close results for group result
...
...
@@ -4753,7 +4756,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) {
el
=
scanMultiTableDataBlocks
(
pQInfo
);
qDebug
(
"QInfo:%p reversed scan completed, elapsed time: %"
PRId64
"ms"
,
pQInfo
,
el
);
doCloseAllTimeWindowAfterScan
(
pQInfo
);
//
doCloseAllTimeWindowAfterScan(pQInfo);
doRestoreContext
(
pQInfo
);
}
else
{
qDebug
(
"QInfo:%p no need to do reversed scan, query completed"
,
pQInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录