Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
08169566
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看板
提交
08169566
编写于
8月 02, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor apercentile logs
上级
21308d78
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
11 deletion
+18
-11
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+18
-11
未找到文件。
source/libs/function/src/builtinsimpl.c
浏览文件 @
08169566
...
...
@@ -2494,6 +2494,8 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
}
else
{
buildHistogramInfo
(
pInfo
);
pInfo
->
pHisto
=
tHistogramCreateFrom
(
tmp
,
MAX_HISTOGRAM_BIN
);
qDebug
(
"%s set up histogram, numOfElems:%"
PRId64
", numOfEntry:%d, pHisto:%p, elems:%p"
,
__FUNCTION__
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
,
pInfo
->
pHisto
->
elems
);
}
return
true
;
...
...
@@ -2524,6 +2526,9 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
tdigestAdd
(
pInfo
->
pTDigest
,
v
,
w
);
}
}
else
{
qDebug
(
"%s before add %d elements into histogram, total:%d, numOfEntry:%d, pHisto:%p, elems: %p"
,
__FUNCTION__
,
numOfElems
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
,
pInfo
->
pHisto
->
elems
);
for
(
int32_t
i
=
start
;
i
<
pInput
->
numOfRows
+
start
;
++
i
)
{
if
(
colDataIsNull_f
(
pCol
->
nullbitmap
,
i
))
{
continue
;
...
...
@@ -2536,8 +2541,8 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
tHistogramAdd
(
&
pInfo
->
pHisto
,
v
);
}
qDebug
(
"
add %d elements into histogram, total:%d, numOfEntry:%d, %p"
,
numOfElems
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
);
qDebug
(
"
%s after add %d elements into histogram, total:%d, numOfEntry:%d, pHisto:%p, elems: %p"
,
__FUNCTION__
,
numOfElems
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
,
pInfo
->
pHisto
->
elems
);
}
SET_VAL
(
pResInfo
,
numOfElems
,
1
);
...
...
@@ -2577,17 +2582,19 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
memcpy
(
pHisto
,
pInput
->
pHisto
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"merge histo, total:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
);
qDebug
(
"%s merge histo, total:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
);
}
else
{
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"
input histogram, elem:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntrie
s
,
pInput
->
pHisto
);
qDebug
(
"
%s input histogram, elem:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElem
s
,
p
Histo
->
numOfEntries
,
p
Input
->
pHisto
);
SHistogramInfo
*
pRes
=
tHistogramMerge
(
pHisto
,
pInput
->
pHisto
,
MAX_HISTOGRAM_BIN
);
memcpy
(
pHisto
,
pRes
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
MAX_HISTOGRAM_BIN
);
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"merge histo, total:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
);
qDebug
(
"%s merge histo, total:%"
PRId64
", entry:%d, %p"
,
__FUNCTION__
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
);
tHistogramDestroy
(
&
pRes
);
}
}
...
...
@@ -2603,7 +2610,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
SAPercentileInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
qDebug
(
"
total %d rows will merge, %p"
,
pInput
->
numOfRows
,
pInfo
->
pHisto
);
qDebug
(
"
%s total %d rows will merge, %p"
,
__FUNCTION__
,
pInput
->
numOfRows
,
pInfo
->
pHisto
);
int32_t
start
=
pInput
->
startRowIndex
;
for
(
int32_t
i
=
start
;
i
<
start
+
pInput
->
numOfRows
;
++
i
)
{
...
...
@@ -2614,7 +2621,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
}
if
(
pInfo
->
algo
!=
APERCT_ALGO_TDIGEST
)
{
qDebug
(
"
after merge, total:%d, numOfEntry:%d, %p"
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
qDebug
(
"
%s after merge, total:%d, numOfEntry:%d, %p"
,
__FUNCTION__
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
);
}
...
...
@@ -2637,8 +2644,8 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
else
{
buildHistogramInfo
(
pInfo
);
if
(
pInfo
->
pHisto
->
numOfElems
>
0
)
{
qDebug
(
"
get the final res:%d, elements:%"
PRId64
", entry:%d"
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfE
ntrie
s
);
qDebug
(
"
%s get the final res, elements:%"
PRId64
", numOfEntry:%d, pHisto:%p, elems:%p"
,
__FUNCTION__
,
pInfo
->
pHisto
->
numOfE
lems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
,
pInfo
->
pHisto
->
elem
s
);
double
ratio
[]
=
{
pInfo
->
percent
};
double
*
res
=
tHistogramUniform
(
pInfo
->
pHisto
,
ratio
,
1
);
...
...
@@ -2693,7 +2700,7 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx)
SResultRowEntryInfo
*
pSResInfo
=
GET_RES_INFO
(
pSourceCtx
);
SAPercentileInfo
*
pSBuf
=
GET_ROWCELL_INTERBUF
(
pSResInfo
);
qDebug
(
"
start to combine apercentile, %p"
,
pDBuf
->
pHisto
);
qDebug
(
"
%s start to combine apercentile, %p"
,
__FUNCTION__
,
pDBuf
->
pHisto
);
apercentileTransferInfo
(
pSBuf
,
pDBuf
);
pDResInfo
->
numOfRes
=
TMAX
(
pDResInfo
->
numOfRes
,
pSResInfo
->
numOfRes
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录