Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
78acaed8
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看板
提交
78acaed8
编写于
4月 06, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix error in sort logic
上级
9b66bb16
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
22 deletion
+31
-22
cmake/cmake.define
cmake/cmake.define
+5
-3
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+3
-3
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+6
-1
source/libs/executor/test/sortTests.cpp
source/libs/executor/test/sortTests.cpp
+17
-15
未找到文件。
cmake/cmake.define
浏览文件 @
78acaed8
...
@@ -36,11 +36,13 @@ IF (TD_WINDOWS)
...
@@ -36,11 +36,13 @@ IF (TD_WINDOWS)
ENDIF ()
ENDIF ()
ELSE ()
ELSE ()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3")
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -g3")
MESSAGE("System processor ID: ${CMAKE_SYSTEM_PROCESSOR}")
MESSAGE("System processor ID: ${CMAKE_SYSTEM_PROCESSOR}")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64"
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64"
)
ADD_DEFINITIONS("-D_TD_ARM_")
ADD_DEFINITIONS("-D_TD_ARM_")
ELSE ()
ELSE ()
ADD_DEFINITIONS("-msse4.2 -mfma")
ADD_DEFINITIONS("-msse4.2 -mfma")
...
...
source/common/src/tdatablock.c
浏览文件 @
78acaed8
...
@@ -373,9 +373,9 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
...
@@ -373,9 +373,9 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
size_t
payloadSize
=
pageSize
-
(
headerSize
+
colHeaderSize
);
size_t
payloadSize
=
pageSize
-
(
headerSize
+
colHeaderSize
);
// TODO speedup by checking if the whole page can fit in firstly.
// TODO speedup by checking if the whole page can fit in firstly.
if
(
!
hasVarCol
)
{
/*
if (!hasVarCol) {
size_t rowSize = blockDataGetRowSize(pBlock);
size_t rowSize = blockDataGetRowSize(pBlock);
int32_t
capacity
=
(
payloadSize
/
(
rowSize
*
8
+
bitmapChar
*
numOfCols
))
*
8
;
int32_t capacity = (payloadSize / (rowSize * 8 + bitmapChar * numOfCols)) * 8;
//if pageSize = 128, rowSize = 2, it will core in doAddToBuf:assert(size <= getBufPageSize(pHandle->pBuf));
*stopIndex = startIndex + capacity;
*stopIndex = startIndex + capacity;
if (*stopIndex >= numOfRows) {
if (*stopIndex >= numOfRows) {
...
@@ -383,7 +383,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
...
@@ -383,7 +383,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
}
}
return TSDB_CODE_SUCCESS;
return TSDB_CODE_SUCCESS;
}
}
*/
// iterate the rows that can be fit in this buffer page
// iterate the rows that can be fit in this buffer page
int32_t
size
=
(
headerSize
+
colHeaderSize
);
int32_t
size
=
(
headerSize
+
colHeaderSize
);
...
...
source/libs/executor/src/tsort.c
浏览文件 @
78acaed8
...
@@ -131,7 +131,12 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
...
@@ -131,7 +131,12 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
destroyDiskbasedBuf
(
pSortHandle
->
pBuf
);
destroyDiskbasedBuf
(
pSortHandle
->
pBuf
);
taosMemoryFreeClear
(
pSortHandle
->
idStr
);
taosMemoryFreeClear
(
pSortHandle
->
idStr
);
blockDataDestroy
(
pSortHandle
->
pDataBlock
);
blockDataDestroy
(
pSortHandle
->
pDataBlock
);
sortComparClearup
(
&
pSortHandle
->
cmpParam
);
// pOrderedSource is in cmpParam
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
pSortHandle
->
pOrderedSource
);
i
++
){
SExternalMemSource
*
pSource
=
taosArrayGet
(
pSortHandle
->
pOrderedSource
,
i
);
blockDataDestroy
(
pSource
->
src
.
pBlock
);
taosMemoryFreeClear
(
pSource
);
}
taosArrayDestroy
(
pSortHandle
->
pOrderedSource
);
taosMemoryFreeClear
(
pSortHandle
);
taosMemoryFreeClear
(
pSortHandle
);
}
}
...
...
source/libs/executor/test/sortTests.cpp
浏览文件 @
78acaed8
...
@@ -122,7 +122,8 @@ SSDataBlock* getSingleColDummyBlock(void* param) {
...
@@ -122,7 +122,8 @@ SSDataBlock* getSingleColDummyBlock(void* param) {
}
}
colDataAppend
(
pColInfo
,
i
,
result
,
false
);
colDataAppend
(
pColInfo
,
i
,
result
,
false
);
printf
(
"int: %lld
\n
"
,
v
);
printf
(
"int: %ld
\n
"
,
v
);
taosMemoryFree
(
result
);
}
}
}
}
...
@@ -238,11 +239,12 @@ TEST(testCase, inMem_sort_Test) {
...
@@ -238,11 +239,12 @@ TEST(testCase, inMem_sort_Test) {
}
}
taosArrayDestroy
(
orderInfo
);
taosArrayDestroy
(
orderInfo
);
tsortDestroySortHandle
(
phandle
);
tsortDestroySortHandle
(
phandle
);
taosMemoryFree
(
pInfo
);
}
}
TEST
(
testCase
,
external_mem_sort_Test
)
{
TEST
(
testCase
,
external_mem_sort_Test
)
{
_info
*
pInfo
=
(
_info
*
)
taosMemoryCalloc
(
7
,
sizeof
(
_info
));
_info
*
pInfo
=
(
_info
*
)
taosMemoryCalloc
(
8
,
sizeof
(
_info
));
pInfo
[
0
].
startVal
=
0
;
pInfo
[
0
].
startVal
=
0
;
pInfo
[
0
].
pageRows
=
10
;
pInfo
[
0
].
pageRows
=
10
;
pInfo
[
0
].
count
=
6
;
pInfo
[
0
].
count
=
6
;
...
@@ -258,32 +260,32 @@ TEST(testCase, external_mem_sort_Test) {
...
@@ -258,32 +260,32 @@ TEST(testCase, external_mem_sort_Test) {
pInfo
[
2
].
count
=
6
;
pInfo
[
2
].
count
=
6
;
pInfo
[
2
].
type
=
TSDB_DATA_TYPE_USMALLINT
;
pInfo
[
2
].
type
=
TSDB_DATA_TYPE_USMALLINT
;
pInfo
[
2
].
startVal
=
0
;
pInfo
[
2
].
pageRows
=
100
;
pInfo
[
2
].
count
=
6
;
pInfo
[
2
].
type
=
TSDB_DATA_TYPE_INT
;
pInfo
[
3
].
startVal
=
0
;
pInfo
[
3
].
startVal
=
0
;
pInfo
[
3
].
pageRows
=
100
;
pInfo
[
3
].
pageRows
=
100
;
pInfo
[
3
].
count
=
6
;
pInfo
[
3
].
count
=
6
;
pInfo
[
3
].
type
=
TSDB_DATA_TYPE_
UBIG
INT
;
pInfo
[
3
].
type
=
TSDB_DATA_TYPE_INT
;
pInfo
[
4
].
startVal
=
0
;
pInfo
[
4
].
startVal
=
0
;
pInfo
[
4
].
pageRows
=
100
;
pInfo
[
4
].
pageRows
=
100
;
pInfo
[
4
].
count
=
6
;
pInfo
[
4
].
count
=
6
;
pInfo
[
4
].
type
=
TSDB_DATA_TYPE_
DOUBLE
;
pInfo
[
4
].
type
=
TSDB_DATA_TYPE_
UBIGINT
;
pInfo
[
5
].
startVal
=
0
;
pInfo
[
5
].
startVal
=
0
;
pInfo
[
5
].
pageRows
=
5
0
;
pInfo
[
5
].
pageRows
=
10
0
;
pInfo
[
5
].
count
=
6
;
pInfo
[
5
].
count
=
6
;
pInfo
[
5
].
type
=
TSDB_DATA_TYPE_
NCHAR
;
pInfo
[
5
].
type
=
TSDB_DATA_TYPE_
DOUBLE
;
pInfo
[
6
].
startVal
=
0
;
pInfo
[
6
].
startVal
=
0
;
pInfo
[
6
].
pageRows
=
10
0
;
pInfo
[
6
].
pageRows
=
5
0
;
pInfo
[
6
].
count
=
6
;
pInfo
[
6
].
count
=
6
;
pInfo
[
6
].
type
=
TSDB_DATA_TYPE_BINARY
;
pInfo
[
6
].
type
=
TSDB_DATA_TYPE_NCHAR
;
pInfo
[
7
].
startVal
=
0
;
pInfo
[
7
].
pageRows
=
100
;
pInfo
[
7
].
count
=
6
;
pInfo
[
7
].
type
=
TSDB_DATA_TYPE_BINARY
;
for
(
int
i
=
0
;
i
<
7
;
i
++
){
for
(
int
i
=
0
;
i
<
8
;
i
++
){
SBlockOrderInfo
oi
=
{
0
};
SBlockOrderInfo
oi
=
{
0
};
oi
.
order
=
TSDB_ORDER_ASC
;
oi
.
order
=
TSDB_ORDER_ASC
;
oi
.
slotId
=
0
;
oi
.
slotId
=
0
;
...
@@ -326,7 +328,7 @@ TEST(testCase, external_mem_sort_Test) {
...
@@ -326,7 +328,7 @@ TEST(testCase, external_mem_sort_Test) {
}
else
{
}
else
{
memcpy
((
char
*
)(
&
result
)
+
sizeof
(
int64_t
)
-
tDataTypes
[
pInfo
[
i
].
type
].
bytes
,
v
,
tDataTypes
[
pInfo
[
i
].
type
].
bytes
);
memcpy
((
char
*
)(
&
result
)
+
sizeof
(
int64_t
)
-
tDataTypes
[
pInfo
[
i
].
type
].
bytes
,
v
,
tDataTypes
[
pInfo
[
i
].
type
].
bytes
);
}
}
printf
(
"%d: %l
l
d
\n
"
,
row
++
,
result
);
printf
(
"%d: %ld
\n
"
,
row
++
,
result
);
}
}
}
}
taosArrayDestroy
(
orderInfo
);
taosArrayDestroy
(
orderInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录