Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
622b4f8d
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看板
提交
622b4f8d
编写于
6月 08, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add spread split partial/merge function
上级
183fcac0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
7 deletion
+50
-7
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+50
-7
未找到文件。
source/libs/function/src/builtinsimpl.c
浏览文件 @
622b4f8d
...
@@ -2190,19 +2190,19 @@ int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -2190,19 +2190,19 @@ int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t
bytesHist
=
(
int32_t
)(
sizeof
(
SAPercentileInfo
)
+
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
));
int32_t
bytesHist
=
(
int32_t
)(
sizeof
(
SAPercentileInfo
)
+
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
));
int32_t
bytesDigest
=
(
int32_t
)(
sizeof
(
SAPercentileInfo
)
+
TDIGEST_SIZE
(
COMPRESSION
));
int32_t
bytesDigest
=
(
int32_t
)(
sizeof
(
SAPercentileInfo
)
+
TDIGEST_SIZE
(
COMPRESSION
));
int32_t
resultBytes
=
TMAX
(
bytesHist
,
bytesDigest
);
int32_t
resultBytes
=
TMAX
(
bytesHist
,
bytesDigest
);
char
*
tmp
=
taosMemoryCalloc
(
resultBytes
+
VARSTR_HEADER_SIZE
,
sizeof
(
char
));
char
*
res
=
taosMemoryCalloc
(
resultBytes
+
VARSTR_HEADER_SIZE
,
sizeof
(
char
));
if
(
pInfo
->
algo
==
APERCT_ALGO_TDIGEST
)
{
if
(
pInfo
->
algo
==
APERCT_ALGO_TDIGEST
)
{
if
(
pInfo
->
pTDigest
->
size
>
0
)
{
if
(
pInfo
->
pTDigest
->
size
>
0
)
{
memcpy
(
varDataVal
(
tmp
),
pInfo
,
resultBytes
);
memcpy
(
varDataVal
(
res
),
pInfo
,
resultBytes
);
varDataSetLen
(
tmp
,
resultBytes
);
varDataSetLen
(
res
,
resultBytes
);
}
else
{
}
else
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
}
else
{
}
else
{
if
(
pInfo
->
pHisto
->
numOfElems
>
0
)
{
if
(
pInfo
->
pHisto
->
numOfElems
>
0
)
{
memcpy
(
varDataVal
(
tmp
),
pInfo
,
resultBytes
);
memcpy
(
varDataVal
(
res
),
pInfo
,
resultBytes
);
varDataSetLen
(
tmp
,
resultBytes
);
varDataSetLen
(
res
,
resultBytes
);
}
else
{
}
else
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -2211,9 +2211,9 @@ int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -2211,9 +2211,9 @@ int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t
slotId
=
pCtx
->
pExpr
->
base
.
resSchema
.
slotId
;
int32_t
slotId
=
pCtx
->
pExpr
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
colDataAppend
(
pCol
,
pBlock
->
info
.
rows
,
tmp
,
false
);
colDataAppend
(
pCol
,
pBlock
->
info
.
rows
,
res
,
false
);
taosMemoryFree
(
tmp
);
taosMemoryFree
(
res
);
return
pResInfo
->
numOfRes
;
return
pResInfo
->
numOfRes
;
}
}
...
@@ -2957,6 +2957,31 @@ _spread_over:
...
@@ -2957,6 +2957,31 @@ _spread_over:
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
spreadFunctionMerge
(
SqlFunctionCtx
*
pCtx
)
{
SInputColumnInfoData
*
pInput
=
&
pCtx
->
input
;
SColumnInfoData
*
pCol
=
pInput
->
pData
[
0
];
ASSERT
(
pCol
->
info
.
type
==
TSDB_DATA_TYPE_BINARY
);
SSpreadInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
SSpreadInfo
*
pInputInfo
;
int32_t
start
=
pInput
->
startRowIndex
;
char
*
data
=
colDataGetData
(
pCol
,
start
);
pInputInfo
=
(
SSpreadInfo
*
)
varDataVal
(
data
);
if
(
pInputInfo
->
max
>
pInfo
->
max
)
{
pInfo
->
max
=
pInputInfo
->
max
;
}
if
(
pInputInfo
->
min
<
pInfo
->
min
)
{
pInfo
->
min
=
pInputInfo
->
min
;
}
SET_VAL
(
GET_RES_INFO
(
pCtx
),
1
,
1
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
spreadFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
int32_t
spreadFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SSpreadInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
SSpreadInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
if
(
pInfo
->
hasResult
==
true
)
{
if
(
pInfo
->
hasResult
==
true
)
{
...
@@ -2965,6 +2990,24 @@ int32_t spreadFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -2965,6 +2990,24 @@ int32_t spreadFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return
functionFinalize
(
pCtx
,
pBlock
);
return
functionFinalize
(
pCtx
,
pBlock
);
}
}
int32_t
spreadPartialFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SSpreadInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
int32_t
resultBytes
=
(
int32_t
)
sizeof
(
SSpreadInfo
);
char
*
res
=
taosMemoryCalloc
(
resultBytes
+
VARSTR_HEADER_SIZE
,
sizeof
(
char
));
memcpy
(
varDataVal
(
res
),
pInfo
,
resultBytes
);
varDataSetLen
(
res
,
resultBytes
);
int32_t
slotId
=
pCtx
->
pExpr
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
slotId
);
colDataAppend
(
pCol
,
pBlock
->
info
.
rows
,
res
,
false
);
taosMemoryFree
(
res
);
return
pResInfo
->
numOfRes
;
}
bool
getElapsedFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
bool
getElapsedFuncEnv
(
SFunctionNode
*
UNUSED_PARAM
(
pFunc
),
SFuncExecEnv
*
pEnv
)
{
pEnv
->
calcMemSize
=
sizeof
(
SElapsedInfo
);
pEnv
->
calcMemSize
=
sizeof
(
SElapsedInfo
);
return
true
;
return
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录