Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5e4b1393
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看板
提交
5e4b1393
编写于
1月 03, 2023
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix assert in tpercentile.c
上级
d454ec97
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+12
-12
未找到文件。
source/libs/function/src/tpercentile.c
浏览文件 @
5e4b1393
...
...
@@ -88,7 +88,7 @@ static void resetPosInfo(SSlotInfo *pInfo) {
}
double
findOnlyResult
(
tMemBucket
*
pMemBucket
)
{
ASSERT
S
(
pMemBucket
->
total
==
1
);
ASSERT
(
pMemBucket
->
total
==
1
);
for
(
int32_t
i
=
0
;
i
<
pMemBucket
->
numOfSlots
;
++
i
)
{
tMemBucketSlot
*
pSlot
=
&
pMemBucket
->
pSlots
[
i
];
...
...
@@ -100,11 +100,11 @@ double findOnlyResult(tMemBucket *pMemBucket) {
SArray
**
pList
=
taosHashGet
(
pMemBucket
->
groupPagesMap
,
&
groupId
,
sizeof
(
groupId
));
if
(
pList
!=
NULL
)
{
SArray
*
list
=
*
pList
;
ASSERT
S
(
list
->
size
==
1
);
ASSERT
(
list
->
size
==
1
);
int32_t
*
pageId
=
taosArrayGet
(
list
,
0
);
SFilePage
*
pPage
=
getBufPage
(
pMemBucket
->
pBuffer
,
*
pageId
);
ASSERT
S
(
pPage
->
num
==
1
);
ASSERT
(
pPage
->
num
==
1
);
double
v
=
0
;
GET_TYPED_DATA
(
v
,
double
,
pMemBucket
->
type
,
pPage
->
data
);
...
...
@@ -168,7 +168,7 @@ int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) {
}
}
ASSERT
S
(
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
ASSERT
(
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
return
index
;
}
...
...
@@ -199,7 +199,7 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value) {
}
}
ASSERT
S
(
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
ASSERT
(
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
return
index
;
}
...
...
@@ -332,7 +332,7 @@ void tMemBucketUpdateBoundingBox(MinMaxEntry *r, const char *data, int32_t dataT
r
->
dMaxVal
=
v
;
}
}
else
{
ASSERT
S
(
0
);
ASSERT
(
0
);
}
}
...
...
@@ -340,7 +340,7 @@ void tMemBucketUpdateBoundingBox(MinMaxEntry *r, const char *data, int32_t dataT
* in memory bucket, we only accept data array list
*/
int32_t
tMemBucketPut
(
tMemBucket
*
pBucket
,
const
void
*
data
,
size_t
size
)
{
ASSERT
S
(
pBucket
!=
NULL
&&
data
!=
NULL
&&
size
>
0
);
ASSERT
(
pBucket
!=
NULL
&&
data
!=
NULL
&&
size
>
0
);
int32_t
count
=
0
;
int32_t
bytes
=
pBucket
->
bytes
;
...
...
@@ -362,7 +362,7 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
if
(
pSlot
->
info
.
data
==
NULL
||
pSlot
->
info
.
data
->
num
>=
pBucket
->
elemPerPage
)
{
if
(
pSlot
->
info
.
data
!=
NULL
)
{
ASSERT
S
(
pSlot
->
info
.
data
->
num
>=
pBucket
->
elemPerPage
&&
pSlot
->
info
.
size
>
0
);
ASSERT
(
pSlot
->
info
.
data
->
num
>=
pBucket
->
elemPerPage
&&
pSlot
->
info
.
size
>
0
);
// keep the pointer in memory
setBufPageDirty
(
pSlot
->
info
.
data
,
true
);
...
...
@@ -408,14 +408,14 @@ static MinMaxEntry getMinMaxEntryOfNextSlotWithData(tMemBucket *pMemBucket, int3
++
j
;
}
ASSERT
S
(
j
<
pMemBucket
->
numOfSlots
);
ASSERT
(
j
<
pMemBucket
->
numOfSlots
);
return
pMemBucket
->
pSlots
[
j
].
range
;
}
static
bool
isIdenticalData
(
tMemBucket
*
pMemBucket
,
int32_t
index
);
static
double
getIdenticalDataVal
(
tMemBucket
*
pMemBucket
,
int32_t
slotIndex
)
{
ASSERT
S
(
isIdenticalData
(
pMemBucket
,
slotIndex
));
ASSERT
(
isIdenticalData
(
pMemBucket
,
slotIndex
));
tMemBucketSlot
*
pSlot
=
&
pMemBucket
->
pSlots
[
slotIndex
];
...
...
@@ -462,7 +462,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
minOfNextSlot
=
(
double
)
next
.
dMinVal
;
}
ASSERT
S
(
minOfNextSlot
>
maxOfThisSlot
);
ASSERT
(
minOfNextSlot
>
maxOfThisSlot
);
double
val
=
(
1
-
fraction
)
*
maxOfThisSlot
+
fraction
*
minOfNextSlot
;
return
val
;
...
...
@@ -500,7 +500,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
int32_t
groupId
=
getGroupId
(
pMemBucket
->
numOfSlots
,
i
,
pMemBucket
->
times
-
1
);
SArray
*
list
=
*
(
SArray
**
)
taosHashGet
(
pMemBucket
->
groupPagesMap
,
&
groupId
,
sizeof
(
groupId
));
ASSERT
S
(
list
!=
NULL
&&
list
->
size
>
0
);
ASSERT
(
list
!=
NULL
&&
list
->
size
>
0
);
for
(
int32_t
f
=
0
;
f
<
list
->
size
;
++
f
)
{
int32_t
*
pageId
=
taosArrayGet
(
list
,
f
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录