Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a24f5bbd
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
a24f5bbd
编写于
9月 13, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-255]remove unused code.
上级
c90d48a7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
144 deletion
+4
-144
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/query/src/qUtil.c
src/query/src/qUtil.c
+3
-143
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
a24f5bbd
...
@@ -4143,7 +4143,7 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
...
@@ -4143,7 +4143,7 @@ static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo*
int32_t
start
=
0
;
int32_t
start
=
0
;
int32_t
step
=
-
1
;
int32_t
step
=
-
1
;
qDebug
(
"QInfo:0x%"
PRIx64
" start to copy data from
windowRes
Info to output buf"
,
GET_QID
(
pRuntimeEnv
));
qDebug
(
"QInfo:0x%"
PRIx64
" start to copy data from
resultrow
Info to output buf"
,
GET_QID
(
pRuntimeEnv
));
assert
(
orderType
==
TSDB_ORDER_ASC
||
orderType
==
TSDB_ORDER_DESC
);
assert
(
orderType
==
TSDB_ORDER_ASC
||
orderType
==
TSDB_ORDER_DESC
);
if
(
orderType
==
TSDB_ORDER_ASC
)
{
if
(
orderType
==
TSDB_ORDER_ASC
)
{
...
...
src/query/src/qUtil.c
浏览文件 @
a24f5bbd
...
@@ -416,46 +416,6 @@ static int64_t getNumOfResultWindowRes(SQueryRuntimeEnv* pRuntimeEnv, SResultRow
...
@@ -416,46 +416,6 @@ static int64_t getNumOfResultWindowRes(SQueryRuntimeEnv* pRuntimeEnv, SResultRow
return
0
;
return
0
;
}
}
static
int32_t
tableResultComparFn
(
const
void
*
pLeft
,
const
void
*
pRight
,
void
*
param
)
{
int32_t
left
=
*
(
int32_t
*
)
pLeft
;
int32_t
right
=
*
(
int32_t
*
)
pRight
;
SCompSupporter
*
supporter
=
(
SCompSupporter
*
)
param
;
int32_t
leftPos
=
supporter
->
rowIndex
[
left
];
int32_t
rightPos
=
supporter
->
rowIndex
[
right
];
/* left source is exhausted */
if
(
leftPos
==
-
1
)
{
return
1
;
}
/* right source is exhausted*/
if
(
rightPos
==
-
1
)
{
return
-
1
;
}
STableQueryInfo
**
pList
=
supporter
->
pTableQueryInfo
;
SResultRow
*
pWindowRes1
=
pList
[
left
]
->
resInfo
.
pResult
[
leftPos
];
// SResultRow * pWindowRes1 = getResultRow(&(pList[left]->resInfo), leftPos);
TSKEY
leftTimestamp
=
pWindowRes1
->
win
.
skey
;
// SResultRowInfo *pWindowResInfo2 = &(pList[right]->resInfo);
// SResultRow * pWindowRes2 = getResultRow(pWindowResInfo2, rightPos);
SResultRow
*
pWindowRes2
=
pList
[
right
]
->
resInfo
.
pResult
[
rightPos
];
TSKEY
rightTimestamp
=
pWindowRes2
->
win
.
skey
;
if
(
leftTimestamp
==
rightTimestamp
)
{
return
0
;
}
if
(
supporter
->
order
==
TSDB_ORDER_ASC
)
{
return
(
leftTimestamp
>
rightTimestamp
)
?
1
:-
1
;
}
else
{
return
(
leftTimestamp
<
rightTimestamp
)
?
1
:-
1
;
}
}
int32_t
tsAscOrder
(
const
void
*
p1
,
const
void
*
p2
)
{
int32_t
tsAscOrder
(
const
void
*
p1
,
const
void
*
p2
)
{
SResultRowCell
*
pc1
=
(
SResultRowCell
*
)
p1
;
SResultRowCell
*
pc1
=
(
SResultRowCell
*
)
p1
;
SResultRowCell
*
pc2
=
(
SResultRowCell
*
)
p2
;
SResultRowCell
*
pc2
=
(
SResultRowCell
*
)
p2
;
...
@@ -486,7 +446,9 @@ int32_t tsDescOrder(const void* p1, const void* p2) {
...
@@ -486,7 +446,9 @@ int32_t tsDescOrder(const void* p1, const void* p2) {
}
}
}
}
void
orderTheResultRows
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
void
orderTheResultRows
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
__compar_fn_t
fn
=
NULL
;
__compar_fn_t
fn
=
NULL
;
if
(
pRuntimeEnv
->
pQueryAttr
->
order
.
order
==
TSDB_ORDER_ASC
)
{
if
(
pRuntimeEnv
->
pQueryAttr
->
order
.
order
==
TSDB_ORDER_ASC
)
{
fn
=
tsAscOrder
;
fn
=
tsAscOrder
;
...
@@ -526,108 +488,6 @@ static int32_t mergeIntoGroupResultImplRv(SQueryRuntimeEnv *pRuntimeEnv, SGroupR
...
@@ -526,108 +488,6 @@ static int32_t mergeIntoGroupResultImplRv(SQueryRuntimeEnv *pRuntimeEnv, SGroupR
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
UNUSED_FUNC
int32_t
mergeIntoGroupResultImpl
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SGroupResInfo
*
pGroupResInfo
,
SArray
*
pTableList
,
int32_t
*
rowCellInfoOffset
)
{
bool
ascQuery
=
QUERY_IS_ASC_QUERY
(
pRuntimeEnv
->
pQueryAttr
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
*
posList
=
NULL
;
SLoserTreeInfo
*
pTree
=
NULL
;
STableQueryInfo
**
pTableQueryInfoList
=
NULL
;
size_t
size
=
taosArrayGetSize
(
pTableList
);
if
(
pGroupResInfo
->
pRows
==
NULL
)
{
pGroupResInfo
->
pRows
=
taosArrayInit
(
100
,
POINTER_BYTES
);
}
posList
=
calloc
(
size
,
sizeof
(
int32_t
));
pTableQueryInfoList
=
malloc
(
POINTER_BYTES
*
size
);
if
(
pTableQueryInfoList
==
NULL
||
posList
==
NULL
||
pGroupResInfo
->
pRows
==
NULL
||
pGroupResInfo
->
pRows
==
NULL
)
{
qError
(
"QInfo:%"
PRIu64
" failed alloc memory"
,
GET_QID
(
pRuntimeEnv
));
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_end
;
}
int32_t
numOfTables
=
0
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
STableQueryInfo
*
item
=
taosArrayGetP
(
pTableList
,
i
);
if
(
item
->
resInfo
.
size
>
0
)
{
pTableQueryInfoList
[
numOfTables
++
]
=
item
;
}
}
// there is no data in current group
// no need to merge results since only one table in each group
if
(
numOfTables
==
0
)
{
goto
_end
;
}
SCompSupporter
cs
=
{
pTableQueryInfoList
,
posList
,
pRuntimeEnv
->
pQueryAttr
->
order
.
order
};
int32_t
ret
=
tLoserTreeCreate
(
&
pTree
,
numOfTables
,
&
cs
,
tableResultComparFn
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_end
;
}
int64_t
lastTimestamp
=
ascQuery
?
INT64_MIN
:
INT64_MAX
;
int64_t
startt
=
taosGetTimestampMs
();
while
(
1
)
{
int32_t
tableIndex
=
pTree
->
pNode
[
0
].
index
;
SResultRowInfo
*
pWindowResInfo
=
&
pTableQueryInfoList
[
tableIndex
]
->
resInfo
;
SResultRow
*
pWindowRes
=
getResultRow
(
pWindowResInfo
,
cs
.
rowIndex
[
tableIndex
]);
int64_t
num
=
getNumOfResultWindowRes
(
pRuntimeEnv
,
pWindowRes
,
rowCellInfoOffset
);
if
(
num
<=
0
)
{
cs
.
rowIndex
[
tableIndex
]
+=
1
;
if
(
cs
.
rowIndex
[
tableIndex
]
>=
pWindowResInfo
->
size
)
{
cs
.
rowIndex
[
tableIndex
]
=
-
1
;
if
(
--
numOfTables
==
0
)
{
// all input sources are exhausted
break
;
}
}
}
else
{
assert
((
pWindowRes
->
win
.
skey
>=
lastTimestamp
&&
ascQuery
)
||
(
pWindowRes
->
win
.
skey
<=
lastTimestamp
&&
!
ascQuery
));
if
(
pWindowRes
->
win
.
skey
!=
lastTimestamp
)
{
taosArrayPush
(
pGroupResInfo
->
pRows
,
&
pWindowRes
);
pWindowRes
->
numOfRows
=
(
uint32_t
)
num
;
}
lastTimestamp
=
pWindowRes
->
win
.
skey
;
// move to the next row of current entry
if
((
++
cs
.
rowIndex
[
tableIndex
])
>=
pWindowResInfo
->
size
)
{
cs
.
rowIndex
[
tableIndex
]
=
-
1
;
// all input sources are exhausted
if
((
--
numOfTables
)
==
0
)
{
break
;
}
}
}
tLoserTreeAdjust
(
pTree
,
tableIndex
+
pTree
->
numOfEntries
);
}
int64_t
endt
=
taosGetTimestampMs
();
qDebug
(
"QInfo:%"
PRIx64
" result merge completed for group:%d, elapsed time:%"
PRId64
" ms"
,
GET_QID
(
pRuntimeEnv
),
pGroupResInfo
->
currentGroup
,
endt
-
startt
);
_end:
tfree
(
pTableQueryInfoList
);
tfree
(
posList
);
tfree
(
pTree
);
return
code
;
}
int32_t
mergeIntoGroupResult
(
SGroupResInfo
*
pGroupResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
*
offset
)
{
int32_t
mergeIntoGroupResult
(
SGroupResInfo
*
pGroupResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
*
offset
)
{
int64_t
st
=
taosGetTimestampUs
();
int64_t
st
=
taosGetTimestampUs
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录