Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ec5135c9
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
ec5135c9
编写于
6月 16, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): optimization diff_function and remove assert
上级
3eb3e5fb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
8 addition
and
17 deletion
+8
-17
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+8
-17
未找到文件。
src/query/src/qAggMain.c
浏览文件 @
ec5135c9
...
...
@@ -3645,7 +3645,6 @@ static void diff_function(SQLFunctionCtx *pCtx) {
SDiffFuncInfo
*
pDiffInfo
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
void
*
data
=
GET_INPUT_DATA_LIST
(
pCtx
);
bool
isFirstBlock
=
(
pDiffInfo
->
valueAssigned
==
false
);
int32_t
notNullElems
=
0
;
...
...
@@ -3668,7 +3667,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
if
(
pDiffInfo
->
valueAssigned
)
{
int32_t
diff
=
(
int32_t
)(
pData
[
i
]
-
pDiffInfo
->
i64Prev
);
if
(
diff
>=
0
||
!
pDiffInfo
->
ignoreNegative
)
{
*
pOutput
=
(
int32_t
)(
pData
[
i
]
-
pDiffInfo
->
i64Prev
);
// direct previous may be null
*
pOutput
=
diff
;
*
pTimestamp
=
(
tsList
!=
NULL
)
?
tsList
[
i
]
:
0
;
pOutput
+=
1
;
pTimestamp
+=
1
;
...
...
@@ -3694,7 +3693,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
if
(
pDiffInfo
->
valueAssigned
)
{
int64_t
diff
=
pData
[
i
]
-
pDiffInfo
->
i64Prev
;
if
(
diff
>=
0
||
!
pDiffInfo
->
ignoreNegative
)
{
*
pOutput
=
pData
[
i
]
-
pDiffInfo
->
i64Prev
;
// direct previous may be null
*
pOutput
=
diff
;
*
pTimestamp
=
(
tsList
!=
NULL
)
?
tsList
[
i
]
:
0
;
pOutput
+=
1
;
pTimestamp
+=
1
;
...
...
@@ -3720,7 +3719,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
if
(
pDiffInfo
->
valueAssigned
)
{
double
diff
=
pData
[
i
]
-
pDiffInfo
->
d64Prev
;
if
(
diff
>=
0
||
!
pDiffInfo
->
ignoreNegative
)
{
SET_DOUBLE_VAL
(
pOutput
,
pData
[
i
]
-
pDiffInfo
->
d64Prev
);
// direct previous may be null
SET_DOUBLE_VAL
(
pOutput
,
diff
);
*
pTimestamp
=
(
tsList
!=
NULL
)
?
tsList
[
i
]
:
0
;
pOutput
+=
1
;
pTimestamp
+=
1
;
...
...
@@ -3746,7 +3745,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
if
(
pDiffInfo
->
valueAssigned
)
{
float
diff
=
(
float
)(
pData
[
i
]
-
pDiffInfo
->
d64Prev
);
if
(
diff
>=
0
||
!
pDiffInfo
->
ignoreNegative
)
{
*
pOutput
=
(
float
)(
pData
[
i
]
-
pDiffInfo
->
d64Prev
)
;
*
pOutput
=
diff
;
*
pTimestamp
=
(
tsList
!=
NULL
)
?
tsList
[
i
]
:
0
;
pOutput
+=
1
;
pTimestamp
+=
1
;
...
...
@@ -3772,7 +3771,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
if
(
pDiffInfo
->
valueAssigned
)
{
int16_t
diff
=
(
int16_t
)(
pData
[
i
]
-
pDiffInfo
->
i64Prev
);
if
(
diff
>=
0
||
!
pDiffInfo
->
ignoreNegative
)
{
*
pOutput
=
(
int16_t
)(
pData
[
i
]
-
pDiffInfo
->
i64Prev
)
;
*
pOutput
=
diff
;
*
pTimestamp
=
(
tsList
!=
NULL
)
?
tsList
[
i
]
:
0
;
pOutput
+=
1
;
pTimestamp
+=
1
;
...
...
@@ -3798,7 +3797,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
if
(
pDiffInfo
->
valueAssigned
)
{
int8_t
diff
=
(
int8_t
)(
pData
[
i
]
-
pDiffInfo
->
i64Prev
);
if
(
diff
>=
0
||
!
pDiffInfo
->
ignoreNegative
)
{
*
pOutput
=
(
int8_t
)(
pData
[
i
]
-
pDiffInfo
->
i64Prev
)
;
*
pOutput
=
diff
;
*
pTimestamp
=
(
tsList
!=
NULL
)
?
tsList
[
i
]
:
0
;
pOutput
+=
1
;
pTimestamp
+=
1
;
...
...
@@ -3816,23 +3815,15 @@ static void diff_function(SQLFunctionCtx *pCtx) {
qError
(
"error input type"
);
}
// initial value is not set yet
if
(
!
pDiffInfo
->
valueAssigned
||
notNullElems
<=
0
)
{
/*
* 1. current block and blocks before are full of null
* 2. current block may be null value
*/
assert
(
pCtx
->
hasNull
);
}
else
{
if
(
notNullElems
>
0
)
{
for
(
int
t
=
0
;
t
<
pCtx
->
tagInfo
.
numOfTagCols
;
++
t
)
{
SQLFunctionCtx
*
tagCtx
=
pCtx
->
tagInfo
.
pTagCtxList
[
t
];
if
(
tagCtx
->
functionId
==
TSDB_FUNC_TAG_DUMMY
)
{
aAggs
[
TSDB_FUNC_TAGPRJ
].
xFunction
(
tagCtx
);
}
}
int32_t
forwardStep
=
(
isFirstBlock
)
?
notNullElems
:
notNullElems
;
GET_RES_INFO
(
pCtx
)
->
numOfRes
+=
forwardStep
;
GET_RES_INFO
(
pCtx
)
->
numOfRes
+=
notNullElems
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录