Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
59e91409
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
59e91409
编写于
9月 14, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16806 from taosdata/fix/TD-18224
fix(query): twa function report error if input has overlap timestamps
上级
1479bc8a
64226e5e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
4 deletion
+46
-4
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+42
-2
source/util/src/terror.c
source/util/src/terror.c
+1
-0
tests/system-test/2-query/max_partition.py
tests/system-test/2-query/max_partition.py
+1
-1
tests/system-test/2-query/twa.py
tests/system-test/2-query/twa.py
+1
-1
未找到文件。
include/util/taoserror.h
浏览文件 @
59e91409
...
...
@@ -577,6 +577,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_FUNC_FUNTION_PARA_TYPE TAOS_DEF_ERROR_CODE(0, 0x2802)
#define TSDB_CODE_FUNC_FUNTION_PARA_VALUE TAOS_DEF_ERROR_CODE(0, 0x2803)
#define TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION TAOS_DEF_ERROR_CODE(0, 0x2804)
#define TSDB_CODE_FUNC_DUP_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x2805)
//udf
#define TSDB_CODE_UDF_STOPPING TAOS_DEF_ERROR_CODE(0, 0x2901)
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
59e91409
...
...
@@ -5398,8 +5398,8 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
int32_t
i
=
pInput
->
startRowIndex
;
if
(
pCtx
->
start
.
key
!=
INT64_MIN
)
{
ASSERT
((
pCtx
->
start
.
key
<
tsList
[
i
]
&&
pCtx
->
order
==
TSDB_ORDER_ASC
)
||
(
pCtx
->
start
.
key
>
tsList
[
i
]
&&
pCtx
->
order
==
TSDB_ORDER_DESC
));
//
ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) ||
//
(pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC));
ASSERT
(
last
->
key
==
INT64_MIN
);
for
(;
i
<
pInput
->
numOfRows
+
pInput
->
startRowIndex
;
++
i
)
{
...
...
@@ -5447,6 +5447,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5462,6 +5466,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5476,6 +5484,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5490,6 +5502,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5504,6 +5520,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5518,6 +5538,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5532,6 +5556,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5546,6 +5574,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5560,6 +5592,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
@@ -5574,6 +5610,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
numOfElems
++
;
INIT_INTP_POINT
(
st
,
tsList
[
i
],
val
[
i
]);
if
(
pInfo
->
p
.
key
==
st
.
key
)
{
return
TSDB_CODE_FUNC_DUP_TIMESTAMP
;
}
pInfo
->
dOutput
+=
twa_get_area
(
pInfo
->
p
,
st
);
pInfo
->
p
=
st
;
}
...
...
source/util/src/terror.c
浏览文件 @
59e91409
...
...
@@ -579,6 +579,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_NUM, "Invalid function par
TAOS_DEFINE_ERROR
(
TSDB_CODE_FUNC_FUNTION_PARA_TYPE
,
"Invalid function para type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FUNC_FUNTION_PARA_VALUE
,
"Invalid function para value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FUNC_NOT_BUILTIN_FUNTION
,
"Not buildin function"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_FUNC_DUP_TIMESTAMP
,
"Duplicate timestamps not allowed in function"
)
//udf
TAOS_DEFINE_ERROR
(
TSDB_CODE_UDF_STOPPING
,
"udf is stopping"
)
...
...
tests/system-test/2-query/max_partition.py
浏览文件 @
59e91409
...
...
@@ -181,7 +181,7 @@ class TDTestCase:
# bug need fix
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
query
(
f
"select c1 , twa(c1) from
{
dbname
}
.s
tb
partition by c1 order by c1"
)
tdSql
.
query
(
f
"select c1 , twa(c1) from
{
dbname
}
.s
ub_stb_1
partition by c1 order by c1"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
0
,
1
,
None
)
...
...
tests/system-test/2-query/twa.py
浏览文件 @
59e91409
...
...
@@ -124,7 +124,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
4.500000000
)
# mixup with other functions
tdSql
.
query
(
f
"select twa(c1),twa(c2),max(c1),elapsed(ts) from
{
dbname
}
.
stb
1 "
)
tdSql
.
query
(
f
"select twa(c1),twa(c2),max(c1),elapsed(ts) from
{
dbname
}
.
ct
1 "
)
tdSql
.
checkData
(
0
,
0
,
1.000000000
)
tdSql
.
checkData
(
0
,
1
,
11111.000000000
)
tdSql
.
checkData
(
0
,
2
,
1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录