Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4703ccc4
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看板
提交
4703ccc4
编写于
11月 18, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix fill prev/next error
上级
7291f2bd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
24 deletion
+64
-24
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+18
-10
tests/system-test/2-query/interp.py
tests/system-test/2-query/interp.py
+46
-14
未找到文件。
source/libs/executor/src/timewindowoperator.c
浏览文件 @
4703ccc4
...
...
@@ -1945,10 +1945,8 @@ static void doKeepPrevRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
// null data should not be kept since it can not be used to perform interpolation
if
(
!
colDataIsNull_s
(
pColInfoData
,
i
))
{
SGroupKeys
*
pkey
=
taosArrayGet
(
pSliceInfo
->
pPrevRow
,
i
);
SGroupKeys
*
pkey
=
taosArrayGet
(
pSliceInfo
->
pPrevRow
,
i
);
if
(
!
colDataIsNull_s
(
pColInfoData
,
rowIndex
))
{
pkey
->
isNull
=
false
;
char
*
val
=
colDataGetData
(
pColInfoData
,
rowIndex
);
if
(
!
IS_VAR_DATA_TYPE
(
pkey
->
type
))
{
...
...
@@ -1956,6 +1954,8 @@ static void doKeepPrevRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
}
else
{
memcpy
(
pkey
->
pData
,
val
,
varDataLen
(
val
));
}
}
else
{
pkey
->
isNull
=
true
;
}
}
...
...
@@ -1967,10 +1967,8 @@ static void doKeepNextRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
// null data should not be kept since it can not be used to perform interpolation
if
(
!
colDataIsNull_s
(
pColInfoData
,
i
))
{
SGroupKeys
*
pkey
=
taosArrayGet
(
pSliceInfo
->
pNextRow
,
i
);
SGroupKeys
*
pkey
=
taosArrayGet
(
pSliceInfo
->
pNextRow
,
i
);
if
(
!
colDataIsNull_s
(
pColInfoData
,
rowIndex
))
{
pkey
->
isNull
=
false
;
char
*
val
=
colDataGetData
(
pColInfoData
,
rowIndex
);
if
(
!
IS_VAR_DATA_TYPE
(
pkey
->
type
))
{
...
...
@@ -1978,6 +1976,8 @@ static void doKeepNextRows(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlock
}
else
{
memcpy
(
pkey
->
pData
,
val
,
varDataLen
(
val
));
}
}
else
{
pkey
->
isNull
=
true
;
}
}
...
...
@@ -2100,7 +2100,11 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
SGroupKeys
*
pkey
=
taosArrayGet
(
pSliceInfo
->
pPrevRow
,
srcSlot
);
colDataAppend
(
pDst
,
rows
,
pkey
->
pData
,
false
);
if
(
pkey
->
isNull
==
false
)
{
colDataAppend
(
pDst
,
rows
,
pkey
->
pData
,
false
);
}
else
{
colDataAppendNULL
(
pDst
,
rows
);
}
break
;
}
...
...
@@ -2111,7 +2115,11 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
}
SGroupKeys
*
pkey
=
taosArrayGet
(
pSliceInfo
->
pNextRow
,
srcSlot
);
colDataAppend
(
pDst
,
rows
,
pkey
->
pData
,
false
);
if
(
pkey
->
isNull
==
false
)
{
colDataAppend
(
pDst
,
rows
,
pkey
->
pData
,
false
);
}
else
{
colDataAppendNULL
(
pDst
,
rows
);
}
break
;
}
...
...
tests/system-test/2-query/interp.py
浏览文件 @
4703ccc4
...
...
@@ -39,8 +39,6 @@ class TDTestCase:
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
tbname
}
values ('2020-02-01 00:00:10', 10, 10, 10, 10, 10.0, 10.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
tbname
}
values ('2020-02-01 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar')"
)
tdSql
.
execute
(
f
"insert into
{
dbname
}
.
{
tbname
}
(ts) values (now)"
)
tdLog
.
printNoPrefix
(
"==========step3:fill null"
)
## {. . .}
...
...
@@ -248,7 +246,7 @@ class TDTestCase:
## {. . .}
tdSql
.
query
(
f
"select interp(c0) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(next)"
)
tdSql
.
checkRows
(
1
3
)
tdSql
.
checkRows
(
1
2
)
tdSql
.
checkData
(
0
,
0
,
5
)
tdSql
.
checkData
(
1
,
0
,
5
)
tdSql
.
checkData
(
2
,
0
,
10
)
...
...
@@ -298,14 +296,14 @@ class TDTestCase:
## ..{.}
tdSql
.
query
(
f
"select interp(c0) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:13', '2020-02-01 00:00:17') every(1s) fill(next)"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
15
)
tdSql
.
checkData
(
1
,
0
,
15
)
tdSql
.
checkData
(
2
,
0
,
15
)
## ... {}
tdSql
.
query
(
f
"select interp(c0) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(next)"
)
tdSql
.
checkRows
(
4
)
tdSql
.
checkRows
(
0
)
tdLog
.
printNoPrefix
(
"==========step7:fill linear"
)
...
...
@@ -513,7 +511,7 @@ class TDTestCase:
tdSql
.
checkData
(
8
,
0
,
'2020-02-01 00:00:12.000'
)
tdSql
.
query
(
f
"select _irowts,interp(c0) from
{
dbname
}
.
{
tbname
}
range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(next)"
)
tdSql
.
checkRows
(
1
3
)
tdSql
.
checkRows
(
1
2
)
tdSql
.
checkCols
(
2
)
tdSql
.
checkData
(
0
,
0
,
'2020-02-01 00:00:04.000'
)
...
...
@@ -925,7 +923,7 @@ class TDTestCase:
tdSql
.
query
(
f
"select interp(c0) from
{
dbname
}
.
{
tbname1
}
range('2020-02-01 23:59:59', '2020-02-02 00:00:08') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
0
,
0
,
0
)
tdSql
.
checkData
(
1
,
0
,
None
)
tdSql
.
checkData
(
2
,
0
,
None
)
tdSql
.
checkData
(
3
,
0
,
None
)
...
...
@@ -1274,18 +1272,18 @@ class TDTestCase:
tdSql
.
query
(
f
"select interp(c1) from
{
dbname
}
.
{
tbname1
}
range('2020-02-02 00:00:00', '2020-02-02 00:00:35') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
36
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
30
,
0
,
30
)
tdSql
.
query
(
f
"select interp(c1) from
{
dbname
}
.
{
tbname1
}
range('2020-02-02 00:00:00', '2020-02-02 00:00:40') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
41
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
30
,
0
,
30
)
tdSql
.
checkData
(
40
,
0
,
40
)
tdSql
.
query
(
f
"select interp(c1) from
{
dbname
}
.
{
tbname1
}
range('2020-02-02 00:00:00', '2020-02-02 00:00:45') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
46
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
30
,
0
,
30
)
tdSql
.
checkData
(
40
,
0
,
40
)
tdSql
.
checkData
(
41
,
0
,
41
)
...
...
@@ -1296,7 +1294,7 @@ class TDTestCase:
tdSql
.
query
(
f
"select interp(c1) from
{
dbname
}
.
{
tbname1
}
range('2020-02-02 00:00:00', '2020-02-02 00:00:50') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
51
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
30
,
0
,
30
)
tdSql
.
checkData
(
40
,
0
,
40
)
tdSql
.
checkData
(
41
,
0
,
41
)
...
...
@@ -1308,7 +1306,7 @@ class TDTestCase:
tdSql
.
query
(
f
"select interp(c1) from
{
dbname
}
.
{
tbname1
}
range('2020-02-02 00:00:00', '2020-02-02 00:00:55') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
56
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
30
,
0
,
30
)
tdSql
.
checkData
(
40
,
0
,
40
)
tdSql
.
checkData
(
41
,
0
,
41
)
...
...
@@ -1319,8 +1317,8 @@ class TDTestCase:
tdSql
.
query
(
f
"select interp(c1) from
{
dbname
}
.
{
tbname1
}
range('2020-02-02 00:00:00', '2020-02-02 00:01:00') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
6
0
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkRows
(
6
1
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
30
,
0
,
30
)
tdSql
.
checkData
(
40
,
0
,
40
)
tdSql
.
checkData
(
41
,
0
,
41
)
...
...
@@ -1368,6 +1366,40 @@ class TDTestCase:
tdSql
.
checkData
(
15
,
0
,
45
)
tdSql
.
checkData
(
30
,
0
,
60
)
# two interps
tdSql
.
query
(
f
"select interp(c0),interp(c1) from
{
dbname
}
.
{
tbname1
}
range('2020-02-02 00:00:00', '2020-02-02 00:01:00') every(1s) fill(linear)"
)
tdSql
.
checkRows
(
61
)
tdSql
.
checkCols
(
2
)
tdSql
.
checkData
(
0
,
0
,
0
)
tdSql
.
checkData
(
10
,
0
,
10
)
tdSql
.
checkData
(
20
,
0
,
20
)
tdSql
.
checkData
(
30
,
0
,
30
)
tdSql
.
checkData
(
31
,
0
,
31
)
tdSql
.
checkData
(
32
,
0
,
32
)
tdSql
.
checkData
(
33
,
0
,
33
)
tdSql
.
checkData
(
34
,
0
,
34
)
tdSql
.
checkData
(
35
,
0
,
35
)
tdSql
.
checkData
(
36
,
0
,
36
)
tdSql
.
checkData
(
37
,
0
,
37
)
tdSql
.
checkData
(
38
,
0
,
38
)
tdSql
.
checkData
(
39
,
0
,
39
)
tdSql
.
checkData
(
40
,
0
,
40
)
tdSql
.
checkData
(
50
,
0
,
50
)
tdSql
.
checkData
(
60
,
0
,
55
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
10
,
1
,
10
)
tdSql
.
checkData
(
20
,
1
,
None
)
tdSql
.
checkData
(
30
,
1
,
30
)
tdSql
.
checkData
(
40
,
1
,
40
)
tdSql
.
checkData
(
41
,
1
,
41
)
tdSql
.
checkData
(
42
,
1
,
42
)
tdSql
.
checkData
(
43
,
1
,
43
)
tdSql
.
checkData
(
44
,
1
,
44
)
tdSql
.
checkData
(
45
,
1
,
45
)
tdSql
.
checkData
(
50
,
1
,
None
)
tdSql
.
checkData
(
60
,
1
,
60
)
tdLog
.
printNoPrefix
(
"==========step11:test multi-interp cases"
)
tdSql
.
query
(
f
"select interp(c0),interp(c1),interp(c2),interp(c3) from
{
dbname
}
.
{
tbname
}
range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(null)"
)
tdSql
.
checkRows
(
5
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录