Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b1f85ec0
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看板
提交
b1f85ec0
编写于
7月 06, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] fix bugs in sliding query
上级
1761b011
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
15 deletion
+36
-15
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+6
-4
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-2
src/query/src/qUtil.c
src/query/src/qUtil.c
+23
-8
src/query/src/qextbuffer.c
src/query/src/qextbuffer.c
+2
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+2
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
b1f85ec0
...
...
@@ -4487,10 +4487,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SUpdateTableTagValMsg
*
pUpdateMsg
=
(
SUpdateTableTagValMsg
*
)
pCmd
->
payload
;
pUpdateMsg
->
head
.
vgId
=
htonl
(
pTableMeta
->
vgroupInfo
.
vgId
);
pUpdateMsg
->
tid
=
htonl
(
pTableMeta
->
sid
);
pUpdateMsg
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pUpdateMsg
->
colId
=
htons
(
pTagsSchema
->
colId
);
pUpdateMsg
->
tversion
=
htons
(
pTableMeta
->
tversion
);
pUpdateMsg
->
tid
=
htonl
(
pTableMeta
->
sid
);
pUpdateMsg
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pUpdateMsg
->
colId
=
htons
(
pTagsSchema
->
colId
);
pUpdateMsg
->
type
=
htons
(
pTagsSchema
->
type
);
pUpdateMsg
->
bytes
=
htons
(
pTagsSchema
->
bytes
);
pUpdateMsg
->
tversion
=
htons
(
pTableMeta
->
tversion
);
pUpdateMsg
->
numOfTags
=
htons
(
numOfTags
);
pUpdateMsg
->
schemaLen
=
htonl
(
schemaLen
);
...
...
src/inc/taosmsg.h
浏览文件 @
b1f85ec0
...
...
@@ -285,6 +285,8 @@ typedef struct {
int32_t
tid
;
int16_t
tversion
;
int16_t
colId
;
int16_t
type
;
int16_t
bytes
;
int32_t
tagValLen
;
int16_t
numOfTags
;
int32_t
schemaLen
;
...
...
src/query/src/qExecutor.c
浏览文件 @
b1f85ec0
...
...
@@ -1099,7 +1099,6 @@ static bool functionNeedToExecute(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx
// todo add comments
if
((
functionId
==
TSDB_FUNC_LAST_DST
||
functionId
==
TSDB_FUNC_LAST
))
{
return
pCtx
->
param
[
0
].
i64Key
==
pQuery
->
order
.
order
;
// return !QUERY_IS_ASC_QUERY(pQuery);
}
// in the supplementary scan, only the following functions need to be executed
...
...
@@ -4716,8 +4715,8 @@ static void multiTableQueryProcess(SQInfo *pQInfo) {
el
=
scanMultiTableDataBlocks
(
pQInfo
);
qDebug
(
"QInfo:%p reversed scan completed, elapsed time: %"
PRId64
"ms"
,
pQInfo
,
el
);
doRestoreContext
(
pQInfo
);
doCloseAllTimeWindowAfterScan
(
pQInfo
);
doRestoreContext
(
pQInfo
);
}
else
{
qDebug
(
"QInfo:%p no need to do reversed scan, query completed"
,
pQInfo
);
}
...
...
src/query/src/qUtil.c
浏览文件 @
b1f85ec0
...
...
@@ -180,19 +180,34 @@ void closeAllTimeWindow(SWindowResInfo *pWindowResInfo) {
/*
* remove the results that are not the FIRST time window that spreads beyond the
* the last qualified time stamp in case of sliding query, which the sliding time is not equalled to the interval time
* the last qualified time stamp in case of sliding query, which the sliding time is not equalled to the interval time.
* NOTE: remove redundant, only when the result set order equals to traverse order
*/
void
removeRedundantWindow
(
SWindowResInfo
*
pWindowResInfo
,
TSKEY
lastKey
,
int32_t
order
)
{
assert
(
pWindowResInfo
->
size
>=
0
&&
pWindowResInfo
->
capacity
>=
pWindowResInfo
->
size
);
if
(
pWindowResInfo
->
size
<=
1
)
{
return
;
}
// get the result order
int32_t
resultOrder
=
(
pWindowResInfo
->
pResult
[
0
].
window
.
skey
<
pWindowResInfo
->
pResult
[
1
].
window
.
skey
)
?
TSDB_ORDER_ASC:
TSDB_ORDER_DESC
;
if
(
order
!=
resultOrder
)
{
return
;
}
int32_t
i
=
0
;
while
(
i
<
pWindowResInfo
->
size
&&
((
pWindowResInfo
->
pResult
[
i
].
window
.
ekey
<
lastKey
&&
order
==
QUERY_ASC_FORWARD_STEP
)
||
(
pWindowResInfo
->
pResult
[
i
].
window
.
skey
>
lastKey
&&
order
==
QUERY_DESC_FORWARD_STEP
)))
{
++
i
;
if
(
order
==
QUERY_ASC_FORWARD_STEP
)
{
while
(
i
<
pWindowResInfo
->
size
&&
(
pWindowResInfo
->
pResult
[
i
].
window
.
ekey
<
lastKey
))
{
++
i
;
}
}
else
if
(
order
==
QUERY_DESC_FORWARD_STEP
)
{
while
(
i
<
pWindowResInfo
->
size
&&
(
pWindowResInfo
->
pResult
[
i
].
window
.
skey
>
lastKey
))
{
++
i
;
}
}
// assert(i < pWindowResInfo->size);
if
(
i
<
pWindowResInfo
->
size
)
{
pWindowResInfo
->
size
=
(
i
+
1
);
}
...
...
src/query/src/qextbuffer.c
浏览文件 @
b1f85ec0
...
...
@@ -118,7 +118,7 @@ static bool tExtMemBufferAlloc(tExtMemBuffer *pMemBuffer) {
* To flush data to disk to accommodate more data
*/
if
(
pMemBuffer
->
numOfInMemPages
>
0
&&
pMemBuffer
->
numOfInMemPages
==
pMemBuffer
->
inMemCapacity
)
{
if
(
!
tExtMemBufferFlush
(
pMemBuffer
)
)
{
if
(
tExtMemBufferFlush
(
pMemBuffer
)
!=
0
)
{
return
false
;
}
}
...
...
@@ -268,6 +268,7 @@ int32_t tExtMemBufferFlush(tExtMemBuffer *pMemBuffer) {
size_t
retVal
=
fwrite
((
char
*
)
&
(
first
->
item
),
pMemBuffer
->
pageSize
,
1
,
pMemBuffer
->
file
);
if
(
retVal
<=
0
)
{
// failed to write to buffer, may be not enough space
ret
=
TAOS_SYSTEM_ERROR
(
errno
);
return
ret
;
}
pMemBuffer
->
fileMeta
.
numOfElemsInFile
+=
first
->
item
.
num
;
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
b1f85ec0
...
...
@@ -274,6 +274,8 @@ int tsdbUpdateTagValue(TSDB_REPO_T *repo, SUpdateTableTagValMsg *pMsg) {
pMsg
->
tid
=
htonl
(
pMsg
->
tid
);
pMsg
->
tversion
=
htons
(
pMsg
->
tversion
);
pMsg
->
colId
=
htons
(
pMsg
->
colId
);
pMsg
->
type
=
htons
(
pMsg
->
type
);
pMsg
->
bytes
=
htons
(
pMsg
->
bytes
);
pMsg
->
tagValLen
=
htonl
(
pMsg
->
tagValLen
);
pMsg
->
numOfTags
=
htons
(
pMsg
->
numOfTags
);
pMsg
->
schemaLen
=
htonl
(
pMsg
->
schemaLen
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录