Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
730e91d4
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
提交
730e91d4
编写于
11月 12, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10971]fix int64 overflow issue
上级
dd734a05
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
11 deletion
+29
-11
src/query/inc/qFill.h
src/query/inc/qFill.h
+1
-1
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+16
-5
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-1
src/query/src/qFill.c
src/query/src/qFill.c
+10
-4
未找到文件。
src/query/inc/qFill.h
浏览文件 @
730e91d4
...
...
@@ -86,7 +86,7 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo);
int64_t
getNumOfResultsAfterFillGap
(
SFillInfo
*
pFillInfo
,
int64_t
ekey
,
int32_t
maxNumOfRows
);
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
);
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
,
bool
*
exceedMax
);
int64_t
taosFillResultDataBlock
(
SFillInfo
*
pFillInfo
,
void
**
output
,
int32_t
capacity
);
...
...
src/query/src/qAggMain.c
浏览文件 @
730e91d4
...
...
@@ -28,6 +28,7 @@
#include "qTsbuf.h"
#include "queryLog.h"
#include "qUdf.h"
#include "tcompare.h"
#define GET_INPUT_DATA_LIST(x) ((char *)((x)->pInput))
#define GET_INPUT_DATA(x, y) (GET_INPUT_DATA_LIST(x) + (y) * (x)->inputBytes)
...
...
@@ -3937,18 +3938,28 @@ static void interp_function(SQLFunctionCtx *pCtx) {
goto
interp_exit
;
}
GET_TYPED_DATA
(
pCtx
->
start
.
val
,
double
,
pCtx
->
inputType
,
&
pCtx
->
start
.
val
);
GET_TYPED_DATA
(
pCtx
->
end
.
val
,
double
,
pCtx
->
inputType
,
&
pCtx
->
end
.
val
);
double
v1
=
-
1
,
v2
=
-
1
;
GET_TYPED_DATA
(
v1
,
double
,
pCtx
->
inputType
,
&
pCtx
->
start
.
val
);
GET_TYPED_DATA
(
v2
,
double
,
pCtx
->
inputType
,
&
pCtx
->
end
.
val
);
SPoint
point1
=
{.
key
=
pCtx
->
start
.
key
,
.
val
=
&
pCtx
->
start
.
val
};
SPoint
point2
=
{.
key
=
pCtx
->
end
.
key
,
.
val
=
&
pCtx
->
end
.
val
};
SPoint
point1
=
{.
key
=
pCtx
->
start
.
key
,
.
val
=
&
v1
};
SPoint
point2
=
{.
key
=
pCtx
->
end
.
key
,
.
val
=
&
v2
};
SPoint
point
=
{.
key
=
pCtx
->
startTs
,
.
val
=
pCtx
->
pOutput
};
int32_t
srcType
=
pCtx
->
inputType
;
if
(
isNull
((
char
*
)
&
pCtx
->
start
.
val
,
srcType
)
||
isNull
((
char
*
)
&
pCtx
->
end
.
val
,
srcType
))
{
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
}
else
{
taosGetLinearInterpolationVal
(
&
point
,
pCtx
->
outputType
,
&
point1
,
&
point2
,
TSDB_DATA_TYPE_DOUBLE
);
bool
exceedMax
=
false
;
taosGetLinearInterpolationVal
(
&
point
,
pCtx
->
outputType
,
&
point1
,
&
point2
,
TSDB_DATA_TYPE_DOUBLE
,
&
exceedMax
);
if
(
exceedMax
)
{
__compar_fn_t
func
=
getComparFunc
((
int32_t
)
pCtx
->
inputType
,
0
);
if
(
func
(
&
pCtx
->
start
.
val
,
&
pCtx
->
end
.
val
)
<=
0
)
{
COPY_TYPED_DATA
(
pCtx
->
pOutput
,
pCtx
->
inputType
,
&
pCtx
->
start
.
val
);
}
else
{
COPY_TYPED_DATA
(
pCtx
->
pOutput
,
pCtx
->
inputType
,
&
pCtx
->
end
.
val
);
}
}
}
break
;
...
...
src/query/src/qExecutor.c
浏览文件 @
730e91d4
...
...
@@ -1303,7 +1303,8 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo,
SPoint
point2
=
(
SPoint
){.
key
=
curTs
,
.
val
=
&
v2
};
SPoint
point
=
(
SPoint
){.
key
=
windowKey
,
.
val
=
&
v
};
taosGetLinearInterpolationVal
(
&
point
,
TSDB_DATA_TYPE_DOUBLE
,
&
point1
,
&
point2
,
TSDB_DATA_TYPE_DOUBLE
);
bool
exceedMax
=
false
;
taosGetLinearInterpolationVal
(
&
point
,
TSDB_DATA_TYPE_DOUBLE
,
&
point1
,
&
point2
,
TSDB_DATA_TYPE_DOUBLE
,
&
exceedMax
);
if
(
type
==
RESULT_ROW_START_INTERP
)
{
pCtx
[
k
].
start
.
key
=
point
.
key
;
...
...
src/query/src/qFill.c
浏览文件 @
730e91d4
...
...
@@ -118,10 +118,11 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
continue
;
}
bool
exceedMax
=
false
;
point1
=
(
SPoint
){.
key
=
*
(
TSKEY
*
)(
prev
),
.
val
=
prev
+
pCol
->
col
.
offset
};
point2
=
(
SPoint
){.
key
=
ts
,
.
val
=
srcData
[
i
]
+
pFillInfo
->
index
*
bytes
};
point
=
(
SPoint
){.
key
=
pFillInfo
->
currentKey
,
.
val
=
val1
};
taosGetLinearInterpolationVal
(
&
point
,
type
,
&
point1
,
&
point2
,
type
);
taosGetLinearInterpolationVal
(
&
point
,
type
,
&
point1
,
&
point2
,
type
,
&
exceedMax
);
}
}
else
{
setNullValueForRow
(
pFillInfo
,
data
,
pFillInfo
->
numOfCols
,
index
);
...
...
@@ -493,12 +494,17 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
return
(
numOfRes
>
maxNumOfRows
)
?
maxNumOfRows
:
numOfRes
;
}
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
)
{
double
v1
=
-
1
,
v2
=
-
1
;
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
,
bool
*
exceedMax
)
{
double
v1
=
-
1
,
v2
=
-
1
,
vmax
=
-
1
;
GET_TYPED_DATA
(
v1
,
double
,
inputType
,
point1
->
val
);
GET_TYPED_DATA
(
v2
,
double
,
inputType
,
point2
->
val
);
GET_TYPED_DATA
(
vmax
,
double
,
outputType
,
getDataMax
(
outputType
));
double
r
=
DO_INTERPOLATION
(
v1
,
v2
,
point1
->
key
,
point2
->
key
,
point
->
key
);
if
(
r
>=
vmax
)
{
*
exceedMax
=
true
;
}
SET_TYPED_DATA
(
point
->
val
,
outputType
,
r
);
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录