Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
127945b7
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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,发现更多精彩内容 >>
未验证
提交
127945b7
编写于
6月 16, 2022
作者:
H
Haojun Liao
提交者:
GitHub
6月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13902 from taosdata/feature/3_liaohj
fix(query): remove group info during sort.
上级
111c3451
dfce7e72
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
38 addition
and
150 deletion
+38
-150
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+0
-8
source/libs/executor/inc/tsort.h
source/libs/executor/inc/tsort.h
+0
-6
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+7
-24
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-13
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+12
-58
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+17
-40
tools/taos-tools
tools/taos-tools
+1
-1
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
127945b7
...
...
@@ -696,10 +696,6 @@ typedef struct SSortedMergeOperatorInfo {
int32_t
numOfResPerPage
;
char
**
groupVal
;
SArray
*
groupInfo
;
bool
hasGroupId
;
uint64_t
groupId
;
STupleHandle
*
prefetchedTuple
;
}
SSortedMergeOperatorInfo
;
typedef
struct
SSortOperatorInfo
{
...
...
@@ -712,10 +708,6 @@ typedef struct SSortOperatorInfo {
int64_t
startTs
;
// sort start time
uint64_t
sortElapsed
;
// sort elapsed time, time to flush to disk not included.
STupleHandle
*
prefetchedTuple
;
bool
hasGroupId
;
uint64_t
groupId
;
}
SSortOperatorInfo
;
typedef
struct
STagFilterOperatorInfo
{
...
...
source/libs/executor/inc/tsort.h
浏览文件 @
127945b7
...
...
@@ -130,12 +130,6 @@ bool tsortIsNullVal(STupleHandle* pVHandle, int32_t colId);
*/
void
*
tsortGetValue
(
STupleHandle
*
pVHandle
,
int32_t
colId
);
/**
*
* @param pVHandle
* @return
*/
uint64_t
tsortGetGroupId
(
STupleHandle
*
pVHandle
);
/**
*
* @param pSortHandle
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
127945b7
...
...
@@ -3031,31 +3031,12 @@ SSDataBlock* getSortedMergeBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo
blockDataEnsureCapacity
(
p
,
capacity
);
while
(
1
)
{
STupleHandle
*
pTupleHandle
=
NULL
;
if
(
pInfo
->
prefetchedTuple
==
NULL
)
{
pTupleHandle
=
tsortNextTuple
(
pHandle
);
}
else
{
pTupleHandle
=
pInfo
->
prefetchedTuple
;
pInfo
->
groupId
=
tsortGetGroupId
(
pTupleHandle
);
pInfo
->
prefetchedTuple
=
NULL
;
}
STupleHandle
*
pTupleHandle
=
tsortNextTuple
(
pHandle
);
if
(
pTupleHandle
==
NULL
)
{
break
;
}
uint64_t
tupleGroupId
=
tsortGetGroupId
(
pTupleHandle
);
if
(
!
pInfo
->
hasGroupId
)
{
pInfo
->
groupId
=
tupleGroupId
;
pInfo
->
hasGroupId
=
true
;
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
if
(
pInfo
->
groupId
==
tupleGroupId
)
{
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
{
pInfo
->
prefetchedTuple
=
pTupleHandle
;
break
;
}
if
(
p
->
info
.
rows
>=
capacity
)
{
break
;
}
...
...
@@ -3074,7 +3055,6 @@ SSDataBlock* getSortedMergeBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
capacity
=
p
->
info
.
rows
;
pDataBlock
->
info
.
groupId
=
pInfo
->
groupId
;
}
blockDataDestroy
(
p
);
...
...
@@ -3340,7 +3320,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
doSetOperatorCompleted
(
pOperator
);
}
size_t
rows
=
blockDataGetNumOfRows
(
pInfo
->
pRes
);
// pInfo->pRes : NULL;
size_t
rows
=
blockDataGetNumOfRows
(
pInfo
->
pRes
);
pOperator
->
resultInfo
.
totalRows
+=
rows
;
return
(
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
...
...
@@ -4920,7 +4900,10 @@ SArray* extractColumnInfo(SNodeList* pNodeList) {
}
SArray
*
extractPartitionColInfo
(
SNodeList
*
pNodeList
)
{
if
(
!
pNodeList
)
return
NULL
;
if
(
!
pNodeList
)
{
return
NULL
;
}
size_t
numOfCols
=
LIST_LENGTH
(
pNodeList
);
SArray
*
pList
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumn
));
if
(
pList
==
NULL
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
127945b7
...
...
@@ -2175,25 +2175,13 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, int32_t capa
pTupleHandle
=
tsortNextTuple
(
pHandle
);
}
else
{
pTupleHandle
=
pInfo
->
prefetchedTuple
;
pInfo
->
groupId
=
tsortGetGroupId
(
pTupleHandle
);
pInfo
->
prefetchedTuple
=
NULL
;
}
if
(
pTupleHandle
==
NULL
)
{
break
;
}
uint64_t
tupleGroupId
=
tsortGetGroupId
(
pTupleHandle
);
if
(
!
pInfo
->
hasGroupId
)
{
pInfo
->
groupId
=
tupleGroupId
;
pInfo
->
hasGroupId
=
true
;
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
if
(
pInfo
->
groupId
==
tupleGroupId
)
{
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
{
pInfo
->
prefetchedTuple
=
pTupleHandle
;
break
;
}
if
(
p
->
info
.
rows
>=
capacity
)
{
break
;
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
127945b7
...
...
@@ -42,8 +42,6 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSDataBlock* pR
pInfo
->
pSortInfo
=
pSortInfo
;
pInfo
->
pColMatchInfo
=
pColMatchColInfo
;
pInfo
->
hasGroupId
=
false
;
pInfo
->
prefetchedTuple
=
NULL
;
pOperator
->
name
=
"SortOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_SORT
;
pOperator
->
blocking
=
true
;
...
...
@@ -97,31 +95,12 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
blockDataEnsureCapacity
(
p
,
capacity
);
while
(
1
)
{
STupleHandle
*
pTupleHandle
=
NULL
;
if
(
pInfo
->
prefetchedTuple
==
NULL
)
{
pTupleHandle
=
tsortNextTuple
(
pHandle
);
}
else
{
pTupleHandle
=
pInfo
->
prefetchedTuple
;
pInfo
->
groupId
=
tsortGetGroupId
(
pTupleHandle
);
pInfo
->
prefetchedTuple
=
NULL
;
}
STupleHandle
*
pTupleHandle
=
tsortNextTuple
(
pHandle
);
if
(
pTupleHandle
==
NULL
)
{
break
;
}
uint64_t
tupleGroupId
=
tsortGetGroupId
(
pTupleHandle
);
if
(
!
pInfo
->
hasGroupId
)
{
pInfo
->
groupId
=
tupleGroupId
;
pInfo
->
hasGroupId
=
true
;
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
if
(
pInfo
->
groupId
==
tupleGroupId
)
{
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
{
pInfo
->
prefetchedTuple
=
pTupleHandle
;
break
;
}
if
(
p
->
info
.
rows
>=
capacity
)
{
break
;
}
...
...
@@ -140,7 +119,6 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
capacity
=
p
->
info
.
rows
;
pDataBlock
->
info
.
groupId
=
pInfo
->
groupId
;
}
blockDataDestroy
(
p
);
...
...
@@ -255,10 +233,7 @@ typedef struct SMultiwaySortMergeOperatorInfo {
SSDataBlock
*
pInputBlock
;
int64_t
startTs
;
// sort start time
bool
hasGroupId
;
uint64_t
groupId
;
STupleHandle
*
prefetchedTuple
;
}
SMultiwaySortMergeOperatorInfo
;
int32_t
doOpenMultiwaySortMergeOperator
(
SOperatorInfo
*
pOperator
)
{
...
...
@@ -312,31 +287,12 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
blockDataEnsureCapacity
(
p
,
capacity
);
while
(
1
)
{
STupleHandle
*
pTupleHandle
=
NULL
;
if
(
pInfo
->
prefetchedTuple
==
NULL
)
{
pTupleHandle
=
tsortNextTuple
(
pHandle
);
}
else
{
pTupleHandle
=
pInfo
->
prefetchedTuple
;
pInfo
->
groupId
=
tsortGetGroupId
(
pTupleHandle
);
pInfo
->
prefetchedTuple
=
NULL
;
}
STupleHandle
*
pTupleHandle
=
tsortNextTuple
(
pHandle
);
if
(
pTupleHandle
==
NULL
)
{
break
;
}
uint64_t
tupleGroupId
=
tsortGetGroupId
(
pTupleHandle
);
if
(
!
pInfo
->
hasGroupId
)
{
pInfo
->
groupId
=
tupleGroupId
;
pInfo
->
hasGroupId
=
true
;
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
if
(
pInfo
->
groupId
==
tupleGroupId
)
{
appendOneRowToDataBlock
(
p
,
pTupleHandle
);
}
else
{
pInfo
->
prefetchedTuple
=
pTupleHandle
;
break
;
}
if
(
p
->
info
.
rows
>=
capacity
)
{
break
;
}
...
...
@@ -432,14 +388,12 @@ SOperatorInfo* createMultiwaySortMergeOperatorInfo(SOperatorInfo** downStreams,
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pInfo
->
hasGroupId
=
false
;
pInfo
->
prefetchedTuple
=
NULL
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pInfo
->
bufPageSize
=
getProperSortPageSize
(
rowSize
);
uint32_t
numOfSources
=
taosArrayGetSize
(
pSortInfo
);
numOfSources
=
TMAX
(
2
,
numOfSources
);
numOfSources
=
TMAX
(
4
,
numOfSources
);
pInfo
->
sortBufSize
=
numOfSources
*
pInfo
->
bufPageSize
;
...
...
source/libs/executor/src/tsort.c
浏览文件 @
127945b7
...
...
@@ -557,36 +557,21 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
SSortSource
*
source
=
taosArrayGetP
(
pHandle
->
pOrderedSource
,
0
);
taosArrayClear
(
pHandle
->
pOrderedSource
);
bool
hasGroupId
=
false
;
SSDataBlock
*
prefetchedDataBlock
=
NULL
;
while
(
1
)
{
SSDataBlock
*
pBlock
=
NULL
;
if
(
prefetchedDataBlock
==
NULL
)
{
pBlock
=
pHandle
->
fetchfp
(
source
->
param
);
}
else
{
pBlock
=
prefetchedDataBlock
;
prefetchedDataBlock
=
NULL
;
}
SSDataBlock
*
pBlock
=
pHandle
->
fetchfp
(
source
->
param
);
if
(
pBlock
==
NULL
)
{
break
;
}
if
(
!
hasGroupId
)
{
// calculate the buffer pages according to the total available buffers.
if
(
pHandle
->
pDataBlock
==
NULL
)
{
pHandle
->
pageSize
=
getProperSortPageSize
(
blockDataGetRowSize
(
pBlock
));
// todo, number of pages are set according to the total available sort buffer
pHandle
->
numOfPages
=
1024
;
sortBufSize
=
pHandle
->
numOfPages
*
pHandle
->
pageSize
;
hasGroupId
=
true
;
pHandle
->
pDataBlock
=
createOneDataBlock
(
pBlock
,
false
);
}
if
(
pHandle
->
pDataBlock
->
info
.
groupId
==
pBlock
->
info
.
groupId
)
{
// perform the scalar function calculation before apply the sort
if
(
pHandle
->
beforeFp
!=
NULL
)
{
pHandle
->
beforeFp
(
pBlock
,
pHandle
->
param
);
}
...
...
@@ -607,10 +592,6 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
doAddToBuf
(
pHandle
->
pDataBlock
,
pHandle
);
}
}
else
{
prefetchedDataBlock
=
pBlock
;
pHandle
->
pDataBlock
=
createOneDataBlock
(
pBlock
,
false
);
}
}
if
(
pHandle
->
pDataBlock
!=
NULL
&&
pHandle
->
pDataBlock
->
info
.
rows
>
0
)
{
...
...
@@ -758,10 +739,6 @@ void* tsortGetValue(STupleHandle* pVHandle, int32_t colIndex) {
}
}
uint64_t
tsortGetGroupId
(
STupleHandle
*
pVHandle
)
{
return
pVHandle
->
pBlock
->
info
.
groupId
;
}
SSortExecInfo
tsortGetSortExecInfo
(
SSortHandle
*
pHandle
)
{
SSortExecInfo
info
=
{
0
};
...
...
taos-tools
@
3d5aa76f
比较
0a814804
...
3d5aa76f
Subproject commit
0a81480420d6601bbdb57770ee64e40f24c4ea83
Subproject commit
3d5aa76f8c718dcffa100b45e4cbf313d499c356
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录