Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e4e4c7fc
T
TDengine
项目概览
慢慢CG
/
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看板
提交
e4e4c7fc
编写于
8月 22, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1067]
上级
51290fd1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
31 deletion
+12
-31
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+11
-26
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-5
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
e4e4c7fc
...
...
@@ -97,7 +97,8 @@ typedef struct {
#if 0
static UNUSED_FUNC void *u_malloc (size_t __size) {
uint32_t v = rand();
if (v % 5 <= 1) {
if (v % 1000 <= 0) {
return NULL;
} else {
return malloc(__size);
...
...
@@ -106,7 +107,7 @@ static UNUSED_FUNC void *u_malloc (size_t __size) {
static UNUSED_FUNC void* u_calloc(size_t num, size_t __size) {
uint32_t v = rand();
if (v %
5 <= 1
) {
if (v %
1000 <= 0
) {
return NULL;
} else {
return calloc(num, __size);
...
...
@@ -1887,16 +1888,12 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, bool stableQuery) {
// descending order query for last_row query
if
(
isFirstLastRowQuery
(
pQuery
))
{
qDebug
(
"QInfo:%p scan order changed for last_row query, old:%d, new:%d"
,
GET_QINFO_ADDR
(
pQuery
),
pQuery
->
order
.
order
,
TSDB_ORDER_DESC
);
pQuery
->
order
.
order
=
TSDB_ORDER_DESC
;
int64_t
skey
=
MIN
(
pQuery
->
window
.
skey
,
pQuery
->
window
.
ekey
);
int64_t
ekey
=
MAX
(
pQuery
->
window
.
skey
,
pQuery
->
window
.
ekey
);
pQuery
->
window
.
skey
=
ekey
;
pQuery
->
window
.
ekey
=
skey
;
pQuery
->
order
.
order
,
TSDB_ORDER_ASC
);
pQuery
->
order
.
order
=
TSDB_ORDER_ASC
;
if
(
pQuery
->
window
.
skey
>
pQuery
->
window
.
ekey
)
{
SWAP
(
pQuery
->
window
.
skey
,
pQuery
->
window
.
ekey
,
TSKEY
);
}
return
;
}
...
...
@@ -4316,30 +4313,18 @@ static int32_t setupQueryHandle(void* tsdb, SQInfo* pQInfo, bool isSTableQuery)
// update the query time window
pQuery
->
window
=
cond
.
twindow
;
int32_t
numOfGroups
=
(
int32_t
)(
GET_NUM_OF_TABLEGROUP
(
pQInfo
));
size_t
numOfGroups
=
GET_NUM_OF_TABLEGROUP
(
pQInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfGroups
;
++
i
)
{
SArray
*
group
=
GET_TABLEGROUP
(
pQInfo
,
i
);
SArray
*
tableKeyGroup
=
taosArrayGetP
(
pQInfo
->
tableGroupInfo
.
pGroupList
,
i
);
size_t
t
=
taosArrayGetSize
(
group
);
for
(
int32_t
j
=
0
;
j
<
t
;
++
j
)
{
STableQueryInfo
*
pCheckInfo
=
taosArrayGetP
(
group
,
j
);
updateTableQueryInfoForReverseScan
(
pQuery
,
pCheckInfo
);
// update the last key in tableKeyInfo list, the tableKeyInfo is used to build the tsdbQueryHandle and decide
// the start check timestamp of tsdbQueryHandle
STableKeyInfo
*
pTableKeyInfo
=
taosArrayGet
(
tableKeyGroup
,
j
);
pCheckInfo
->
win
.
skey
=
pTableKeyInfo
->
lastKey
;
pCheckInfo
->
win
.
ekey
=
pTableKeyInfo
->
lastKey
;
pCheckInfo
->
lastKey
=
pTableKeyInfo
->
lastKey
;
assert
(
pCheckInfo
->
pTable
==
pTableKeyInfo
->
pTable
);
pCheckInfo
->
win
=
pQuery
->
window
;
pCheckInfo
->
lastKey
=
pCheckInfo
->
win
.
skey
;
}
}
}
else
if
(
isPointInterpoQuery
(
pQuery
))
{
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryRowsInExternalWindow
(
tsdb
,
&
cond
,
&
pQInfo
->
tableGroupInfo
,
pQInfo
);
}
else
{
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
e4e4c7fc
...
...
@@ -295,12 +295,8 @@ out_of_memory:
}
TsdbQueryHandleT
tsdbQueryLastRow
(
TSDB_REPO_T
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
)
{
pCond
->
order
=
TSDB_ORDER_
DE
SC
;
pCond
->
order
=
TSDB_ORDER_
A
SC
;
pCond
->
twindow
=
changeTableGroupByLastrow
(
groupList
);
//descending order query, skey >= ekey
SWAP
(
pCond
->
twindow
.
skey
,
pCond
->
twindow
.
ekey
,
TSKEY
);
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
groupList
,
qinfo
);
return
pQueryHandle
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录