Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e7585db2
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e7585db2
编写于
4月 02, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix error in order by logic
上级
155b1438
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
10 addition
and
8 deletion
+10
-8
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-2
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+3
-3
source/libs/executor/test/sortTests.cpp
source/libs/executor/test/sortTests.cpp
+5
-3
未找到文件。
source/libs/executor/src/executorimpl.c
浏览文件 @
e7585db2
...
...
@@ -6513,9 +6513,9 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSDataBlock* pR
return
NULL
;
}
pInfo
->
bufPageSize
=
rowSize
<
1024
?
1024
:
rowSize
;
pInfo
->
bufPageSize
=
rowSize
<
1024
?
1024
:
rowSize
*
2
;
pInfo
->
sortBufSize
=
pInfo
->
bufPageSize
*
16
;
//
1MB,
TODO dynamic set the available sort buffer
pInfo
->
sortBufSize
=
pInfo
->
bufPageSize
*
16
;
// TODO dynamic set the available sort buffer
pInfo
->
numOfRowsInRes
=
1024
;
pInfo
->
pDataBlock
=
pResBlock
;
pInfo
->
pSortInfo
=
pSortInfo
;
...
...
source/libs/executor/src/tsort.c
浏览文件 @
e7585db2
...
...
@@ -141,8 +141,8 @@ static int32_t doAddNewExternalMemSource(SDiskbasedBuf *pBuf, SArray* pAllSource
(
*
sourceId
)
+=
1
;
int32_t
rowSize
=
blockDataGetSerialRowSize
(
pSource
->
src
.
pBlock
);
int32_t
numOfRows
=
(
getBufPageSize
(
pBuf
)
-
blockDataGetSerialMetaSize
(
pBlock
))
/
rowSize
;
int32_t
numOfRows
=
(
getBufPageSize
(
pBuf
)
-
blockDataGetSerialMetaSize
(
pBlock
))
/
rowSize
;
// The value of numOfRows must be greater than 0, which is guaranteed by the previous memory allocation
ASSERT
(
numOfRows
>
0
);
return
blockDataEnsureCapacity
(
pSource
->
src
.
pBlock
,
numOfRows
);
}
...
...
@@ -421,7 +421,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
size_t
pgSize
=
pHandle
->
pageSize
;
int32_t
numOfRows
=
(
pgSize
-
blockDataGetSerialMetaSize
(
pHandle
->
pDataBlock
))
/
blockDataGetSerialRowSize
(
pHandle
->
pDataBlock
);
//
blockDataEnsureCapacity(pHandle->pDataBlock, numOfRows); // useless, it is already enough
blockDataEnsureCapacity
(
pHandle
->
pDataBlock
,
numOfRows
);
// useless, it is already enough
size_t
numOfSorted
=
taosArrayGetSize
(
pHandle
->
pOrderedSource
);
for
(
int32_t
t
=
0
;
t
<
sortPass
;
++
t
)
{
...
...
source/libs/executor/test/sortTests.cpp
浏览文件 @
e7585db2
...
...
@@ -83,7 +83,7 @@ SSDataBlock* getSingleColStrBlock(void* param) {
SColumnInfoData
colInfo
=
{
0
};
colInfo
.
info
.
type
=
TSDB_DATA_TYPE_NCHAR
;
colInfo
.
info
.
bytes
=
TSDB_NCHAR_SIZE
*
32
;
colInfo
.
info
.
bytes
=
TSDB_NCHAR_SIZE
*
16
;
colInfo
.
info
.
colId
=
1
;
colInfo
.
varmeta
.
offset
=
static_cast
<
int32_t
*>
(
taosMemoryCalloc
(
pInfo
->
pageRows
,
sizeof
(
int32_t
)));
...
...
@@ -92,7 +92,7 @@ SSDataBlock* getSingleColStrBlock(void* param) {
for
(
int32_t
i
=
0
;
i
<
pInfo
->
pageRows
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
static_cast
<
SColumnInfoData
*>
(
TARRAY_GET_ELEM
(
pBlock
->
pDataBlock
,
0
));
int32_t
size
=
taosRand
()
%
32
;
int32_t
size
=
taosRand
()
%
16
;
char
str
[
64
]
=
{
0
};
taosRandStr
(
varDataVal
(
str
),
size
);
varDataSetLen
(
str
,
size
);
...
...
@@ -101,6 +101,8 @@ SSDataBlock* getSingleColStrBlock(void* param) {
pBlock
->
info
.
rows
=
pInfo
->
pageRows
;
pBlock
->
info
.
numOfCols
=
1
;
pBlock
->
info
.
hasVarCol
=
true
;
return
pBlock
;
}
...
...
@@ -218,7 +220,7 @@ TEST(testCase, external_mem_sort_Test) {
SArray
*
orderInfo
=
taosArrayInit
(
1
,
sizeof
(
SBlockOrderInfo
));
taosArrayPush
(
orderInfo
,
&
oi
);
SSortHandle
*
phandle
=
tsortCreateSortHandle
(
orderInfo
,
SORT_SINGLESOURCE_SORT
,
32
,
6
,
NULL
,
"test_abc"
);
SSortHandle
*
phandle
=
tsortCreateSortHandle
(
orderInfo
,
SORT_SINGLESOURCE_SORT
,
128
,
6
,
NULL
,
"test_abc"
);
tsortSetFetchRawDataFp
(
phandle
,
getSingleColDummyBlock
);
_info
*
pInfo
=
(
_info
*
)
taosMemoryCalloc
(
1
,
sizeof
(
_info
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录