Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c4c736ab
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看板
未验证
提交
c4c736ab
编写于
1月 23, 2021
作者:
H
haojun Liao
提交者:
GitHub
1月 23, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5014 from taosdata/hotfix/TD-2787
[TD-2787]taosd percentile query crashes
上级
b135fc9e
861ad5af
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
4 deletion
+22
-4
src/query/src/qPercentile.c
src/query/src/qPercentile.c
+22
-4
未找到文件。
src/query/src/qPercentile.c
浏览文件 @
c4c736ab
...
@@ -115,6 +115,11 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) {
...
@@ -115,6 +115,11 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) {
GET_TYPED_DATA
(
v
,
int64_t
,
pBucket
->
type
,
value
);
GET_TYPED_DATA
(
v
,
int64_t
,
pBucket
->
type
,
value
);
int32_t
index
=
-
1
;
int32_t
index
=
-
1
;
if
(
v
>
pBucket
->
range
.
i64MaxVal
||
v
<
pBucket
->
range
.
i64MinVal
)
{
return
index
;
}
// divide the value range into 1024 buckets
// divide the value range into 1024 buckets
uint64_t
span
=
pBucket
->
range
.
i64MaxVal
-
pBucket
->
range
.
i64MinVal
;
uint64_t
span
=
pBucket
->
range
.
i64MaxVal
-
pBucket
->
range
.
i64MinVal
;
if
(
span
<
pBucket
->
numOfSlots
)
{
if
(
span
<
pBucket
->
numOfSlots
)
{
...
@@ -128,7 +133,7 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) {
...
@@ -128,7 +133,7 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) {
}
}
}
}
assert
(
v
>=
pBucket
->
range
.
i64MinVal
&&
v
<=
pBucket
->
range
.
i64MaxVal
&&
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
assert
(
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
return
index
;
return
index
;
}
}
...
@@ -137,6 +142,11 @@ int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) {
...
@@ -137,6 +142,11 @@ int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) {
GET_TYPED_DATA
(
v
,
uint64_t
,
pBucket
->
type
,
value
);
GET_TYPED_DATA
(
v
,
uint64_t
,
pBucket
->
type
,
value
);
int32_t
index
=
-
1
;
int32_t
index
=
-
1
;
if
(
v
>
pBucket
->
range
.
u64MaxVal
||
v
<
pBucket
->
range
.
u64MinVal
)
{
return
index
;
}
// divide the value range into 1024 buckets
// divide the value range into 1024 buckets
uint64_t
span
=
pBucket
->
range
.
u64MaxVal
-
pBucket
->
range
.
u64MinVal
;
uint64_t
span
=
pBucket
->
range
.
u64MaxVal
-
pBucket
->
range
.
u64MinVal
;
if
(
span
<
pBucket
->
numOfSlots
)
{
if
(
span
<
pBucket
->
numOfSlots
)
{
...
@@ -150,7 +160,7 @@ int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) {
...
@@ -150,7 +160,7 @@ int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) {
}
}
}
}
assert
(
v
>=
pBucket
->
range
.
u64MinVal
&&
v
<=
pBucket
->
range
.
i64MaxVal
&&
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
assert
(
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
return
index
;
return
index
;
}
}
...
@@ -164,6 +174,10 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value) {
...
@@ -164,6 +174,10 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value) {
int32_t
index
=
-
1
;
int32_t
index
=
-
1
;
if
(
v
>
pBucket
->
range
.
dMaxVal
||
v
<
pBucket
->
range
.
dMinVal
)
{
return
index
;
}
// divide a range of [dMinVal, dMaxVal] into 1024 buckets
// divide a range of [dMinVal, dMaxVal] into 1024 buckets
double
span
=
pBucket
->
range
.
dMaxVal
-
pBucket
->
range
.
dMinVal
;
double
span
=
pBucket
->
range
.
dMaxVal
-
pBucket
->
range
.
dMinVal
;
if
(
span
<
pBucket
->
numOfSlots
)
{
if
(
span
<
pBucket
->
numOfSlots
)
{
...
@@ -177,7 +191,7 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value) {
...
@@ -177,7 +191,7 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value) {
}
}
}
}
assert
(
v
>=
pBucket
->
range
.
dMinVal
&&
v
<=
pBucket
->
range
.
dMaxVal
&&
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
assert
(
index
>=
0
&&
index
<
pBucket
->
numOfSlots
);
return
index
;
return
index
;
}
}
...
@@ -309,9 +323,13 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
...
@@ -309,9 +323,13 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
int32_t
bytes
=
pBucket
->
bytes
;
int32_t
bytes
=
pBucket
->
bytes
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
char
*
d
=
(
char
*
)
data
+
i
*
bytes
;
char
*
d
=
(
char
*
)
data
+
i
*
bytes
;
count
+=
1
;
int32_t
index
=
(
pBucket
->
hashFunc
)(
pBucket
,
d
);
int32_t
index
=
(
pBucket
->
hashFunc
)(
pBucket
,
d
);
if
(
index
<
0
)
{
continue
;
}
count
+=
1
;
tMemBucketSlot
*
pSlot
=
&
pBucket
->
pSlots
[
index
];
tMemBucketSlot
*
pSlot
=
&
pBucket
->
pSlots
[
index
];
tMemBucketUpdateBoundingBox
(
&
pSlot
->
range
,
d
,
pBucket
->
type
);
tMemBucketUpdateBoundingBox
(
&
pSlot
->
range
,
d
,
pBucket
->
type
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录