Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8ae068ff
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看板
提交
8ae068ff
编写于
8月 20, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6046]<fix> fix bottom,top,diff,derivative ts bugs
上级
fb1ecd9c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
112 addition
and
12 deletion
+112
-12
src/client/src/tscGlobalmerge.c
src/client/src/tscGlobalmerge.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-4
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+37
-7
tests/pytest/functions/function_bottom.py
tests/pytest/functions/function_bottom.py
+15
-0
tests/pytest/functions/function_derivative.py
tests/pytest/functions/function_derivative.py
+22
-0
tests/pytest/functions/function_diff.py
tests/pytest/functions/function_diff.py
+17
-0
tests/pytest/functions/function_top.py
tests/pytest/functions/function_top.py
+15
-0
未找到文件。
src/client/src/tscGlobalmerge.c
浏览文件 @
8ae068ff
...
@@ -643,7 +643,7 @@ static void doExecuteFinalMerge(SOperatorInfo* pOperator, int32_t numOfExpr, SSD
...
@@ -643,7 +643,7 @@ static void doExecuteFinalMerge(SOperatorInfo* pOperator, int32_t numOfExpr, SSD
for
(
int32_t
j
=
0
;
j
<
numOfExpr
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
numOfExpr
;
++
j
)
{
pCtx
[
j
].
pOutput
+=
(
pCtx
[
j
].
outputBytes
*
numOfRows
);
pCtx
[
j
].
pOutput
+=
(
pCtx
[
j
].
outputBytes
*
numOfRows
);
if
(
pCtx
[
j
].
functionId
==
TSDB_FUNC_TOP
||
pCtx
[
j
].
functionId
==
TSDB_FUNC_BOTTOM
)
{
if
(
pCtx
[
j
].
functionId
==
TSDB_FUNC_TOP
||
pCtx
[
j
].
functionId
==
TSDB_FUNC_BOTTOM
)
{
pCtx
[
j
].
ptsOutputBuf
=
pCtx
[
0
].
pOutput
;
if
(
j
>
0
)
pCtx
[
j
].
ptsOutputBuf
=
pCtx
[
j
-
1
].
pOutput
;
}
}
}
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
8ae068ff
...
@@ -2603,13 +2603,12 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2603,13 +2603,12 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
// set the first column ts for diff query
// set the first column ts for diff query
if
(
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
if
(
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
colIndex
+=
1
;
SColumnIndex
indexTS
=
{.
tableIndex
=
index
.
tableIndex
,
.
columnIndex
=
0
};
SColumnIndex
indexTS
=
{.
tableIndex
=
index
.
tableIndex
,
.
columnIndex
=
0
};
SExprInfo
*
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
indexTS
,
TSDB_DATA_TYPE_TIMESTAMP
,
SExprInfo
*
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
indexTS
,
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_KEYSIZE
,
getNewResColId
(
pCmd
),
TSDB_KEYSIZE
,
false
);
TSDB_KEYSIZE
,
getNewResColId
(
pCmd
),
TSDB_KEYSIZE
,
false
);
SColumnList
ids
=
createColumnList
(
1
,
0
,
0
);
SColumnList
ids
=
createColumnList
(
1
,
0
,
0
);
insertResultField
(
pQueryInfo
,
0
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
aAggs
[
TSDB_FUNC_TS_DUMMY
].
name
,
pExpr
);
insertResultField
(
pQueryInfo
,
colIndex
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
aAggs
[
TSDB_FUNC_TS_DUMMY
].
name
,
pExpr
);
}
}
SExprInfo
*
pExpr
=
tscExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
resultType
,
resultSize
,
getNewResColId
(
pCmd
),
intermediateResSize
,
false
);
SExprInfo
*
pExpr
=
tscExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
resultType
,
resultSize
,
getNewResColId
(
pCmd
),
intermediateResSize
,
false
);
...
@@ -2882,7 +2881,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2882,7 +2881,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
const
int32_t
TS_COLUMN_INDEX
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
;
const
int32_t
TS_COLUMN_INDEX
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
;
SColumnList
ids
=
createColumnList
(
1
,
index
.
tableIndex
,
TS_COLUMN_INDEX
);
SColumnList
ids
=
createColumnList
(
1
,
index
.
tableIndex
,
TS_COLUMN_INDEX
);
insertResultField
(
pQueryInfo
,
TS_COLUMN_INDEX
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
insertResultField
(
pQueryInfo
,
colIndex
,
&
ids
,
TSDB_KEYSIZE
,
TSDB_DATA_TYPE_TIMESTAMP
,
aAggs
[
TSDB_FUNC_TS
].
name
,
pExpr
);
aAggs
[
TSDB_FUNC_TS
].
name
,
pExpr
);
colIndex
+=
1
;
// the first column is ts
colIndex
+=
1
;
// the first column is ts
...
@@ -5693,7 +5692,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
...
@@ -5693,7 +5692,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
}
}
if
(
!
validOrder
)
{
if
(
!
validOrder
)
{
return
invalidOperationMsg
(
pMsgBuf
,
msg2
);
return
invalidOperationMsg
(
pMsgBuf
,
msg2
);
qExecutor
.
h
}
}
tVariantListItem
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
tVariantListItem
*
p1
=
taosArrayGet
(
pSqlNode
->
pSortOrder
,
0
);
...
...
src/query/inc/qExecutor.h
浏览文件 @
8ae068ff
...
@@ -597,6 +597,8 @@ bool doFilterDataBlock(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFilter
...
@@ -597,6 +597,8 @@ bool doFilterDataBlock(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFilter
void
doCompactSDataBlock
(
SSDataBlock
*
pBlock
,
int32_t
numOfRows
,
int8_t
*
p
);
void
doCompactSDataBlock
(
SSDataBlock
*
pBlock
,
int32_t
numOfRows
,
int8_t
*
p
);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
void
copyTsColoum
(
SSDataBlock
*
pRes
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
...
...
src/query/src/qExecutor.c
浏览文件 @
8ae068ff
...
@@ -3616,7 +3616,7 @@ void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, i
...
@@ -3616,7 +3616,7 @@ void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, i
// set the timestamp output buffer for top/bottom/diff query
// set the timestamp output buffer for top/bottom/diff query
int32_t
fid
=
pCtx
[
i
].
functionId
;
int32_t
fid
=
pCtx
[
i
].
functionId
;
if
(
fid
==
TSDB_FUNC_TOP
||
fid
==
TSDB_FUNC_BOTTOM
||
fid
==
TSDB_FUNC_DIFF
||
fid
==
TSDB_FUNC_DERIVATIVE
)
{
if
(
fid
==
TSDB_FUNC_TOP
||
fid
==
TSDB_FUNC_BOTTOM
||
fid
==
TSDB_FUNC_DIFF
||
fid
==
TSDB_FUNC_DERIVATIVE
)
{
pCtx
[
i
].
ptsOutputBuf
=
pCtx
[
0
].
pOutput
;
if
(
i
>
0
)
pCtx
[
i
].
ptsOutputBuf
=
pCtx
[
i
-
1
].
pOutput
;
}
}
}
}
...
@@ -3651,7 +3651,37 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
...
@@ -3651,7 +3651,37 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
// re-estabilish output buffer pointer.
// re-estabilish output buffer pointer.
int32_t
functionId
=
pBInfo
->
pCtx
[
i
].
functionId
;
int32_t
functionId
=
pBInfo
->
pCtx
[
i
].
functionId
;
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
pBInfo
->
pCtx
[
i
].
ptsOutputBuf
=
pBInfo
->
pCtx
[
i
-
1
].
pOutput
;
if
(
i
>
0
)
pBInfo
->
pCtx
[
i
].
ptsOutputBuf
=
pBInfo
->
pCtx
[
i
-
1
].
pOutput
;
}
}
}
void
copyTsColoum
(
SSDataBlock
*
pRes
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
bool
needCopyTs
=
false
;
int32_t
tsNum
=
0
;
char
*
src
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
i
++
)
{
int32_t
functionId
=
pCtx
[
i
].
functionId
;
if
(
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
needCopyTs
=
true
;
if
(
i
>
0
&&
pCtx
[
i
-
1
].
functionId
==
TSDB_FUNC_TS_DUMMY
){
SColumnInfoData
*
pColRes
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
-
1
);
// find ts data
src
=
pColRes
->
pData
;
}
}
else
if
(
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
tsNum
++
;
}
}
if
(
!
needCopyTs
)
return
;
if
(
tsNum
<
2
)
return
;
if
(
src
==
NULL
)
return
;
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
i
++
)
{
int32_t
functionId
=
pCtx
[
i
].
functionId
;
if
(
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
SColumnInfoData
*
pColRes
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
);
memcpy
(
pColRes
->
pData
,
src
,
pColRes
->
info
.
bytes
*
pRes
->
info
.
rows
);
}
}
}
}
}
}
...
@@ -3851,7 +3881,7 @@ void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pRe
...
@@ -3851,7 +3881,7 @@ void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pRe
}
}
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
)
{
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
)
{
pCtx
[
i
].
ptsOutputBuf
=
pCtx
[
0
].
pOutput
;
if
(
i
>
0
)
pCtx
[
i
].
ptsOutputBuf
=
pCtx
[
i
-
1
].
pOutput
;
}
}
if
(
!
pResInfo
->
initialized
)
{
if
(
!
pResInfo
->
initialized
)
{
...
@@ -3912,7 +3942,7 @@ void setResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult, SQLF
...
@@ -3912,7 +3942,7 @@ void setResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult, SQLF
int32_t
functionId
=
pCtx
[
i
].
functionId
;
int32_t
functionId
=
pCtx
[
i
].
functionId
;
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
||
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_DERIVATIVE
)
{
pCtx
[
i
].
ptsOutputBuf
=
pCtx
[
0
].
pOutput
;
if
(
i
>
0
)
pCtx
[
i
].
ptsOutputBuf
=
pCtx
[
i
-
1
].
pOutput
;
}
}
/*
/*
...
@@ -5698,6 +5728,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
...
@@ -5698,6 +5728,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
pRes
->
info
.
rows
=
getNumOfResult
(
pRuntimeEnv
,
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
pRes
->
info
.
rows
=
getNumOfResult
(
pRuntimeEnv
,
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
if
(
pRes
->
info
.
rows
>=
pRuntimeEnv
->
resultInfo
.
threshold
)
{
if
(
pRes
->
info
.
rows
>=
pRuntimeEnv
->
resultInfo
.
threshold
)
{
copyTsColoum
(
pRes
,
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
clearNumOfRes
(
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
clearNumOfRes
(
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
return
pRes
;
return
pRes
;
}
}
...
@@ -5723,8 +5754,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
...
@@ -5723,8 +5754,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
if
(
*
newgroup
)
{
if
(
*
newgroup
)
{
if
(
pRes
->
info
.
rows
>
0
)
{
if
(
pRes
->
info
.
rows
>
0
)
{
pProjectInfo
->
existDataBlock
=
pBlock
;
pProjectInfo
->
existDataBlock
=
pBlock
;
clearNumOfRes
(
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
break
;
return
pInfo
->
pRes
;
}
else
{
// init output buffer for a new group data
}
else
{
// init output buffer for a new group data
for
(
int32_t
j
=
0
;
j
<
pOperator
->
numOfOutput
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pOperator
->
numOfOutput
;
++
j
)
{
aAggs
[
pInfo
->
pCtx
[
j
].
functionId
].
xFinalize
(
&
pInfo
->
pCtx
[
j
]);
aAggs
[
pInfo
->
pCtx
[
j
].
functionId
].
xFinalize
(
&
pInfo
->
pCtx
[
j
]);
...
@@ -5754,7 +5784,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
...
@@ -5754,7 +5784,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
break
;
break
;
}
}
}
}
copyTsColoum
(
pRes
,
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
clearNumOfRes
(
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
clearNumOfRes
(
pInfo
->
pCtx
,
pOperator
->
numOfOutput
);
return
(
pInfo
->
pRes
->
info
.
rows
>
0
)
?
pInfo
->
pRes
:
NULL
;
return
(
pInfo
->
pRes
->
info
.
rows
>
0
)
?
pInfo
->
pRes
:
NULL
;
}
}
...
...
tests/pytest/functions/function_bottom.py
浏览文件 @
8ae068ff
...
@@ -104,6 +104,21 @@ class TDTestCase:
...
@@ -104,6 +104,21 @@ class TDTestCase:
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select ts,bottom(col1, 2),ts from test1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.001"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.001"
)
tdSql
.
query
(
"select ts,bottom(col1, 2),ts from test group by tbname"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.001"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.001"
)
#TD-2457 bottom + interval + order by
#TD-2457 bottom + interval + order by
tdSql
.
error
(
'select top(col2,1) from test interval(1y) order by col2;'
)
tdSql
.
error
(
'select top(col2,1) from test interval(1y) order by col2;'
)
...
...
tests/pytest/functions/function_derivative.py
浏览文件 @
8ae068ff
...
@@ -54,6 +54,28 @@ class TDTestCase:
...
@@ -54,6 +54,28 @@ class TDTestCase:
tdSql
.
query
(
"select derivative(col, 10s, 0) from stb group by tbname"
)
tdSql
.
query
(
"select derivative(col, 10s, 0) from stb group by tbname"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select ts,derivative(col, 10s, 1),ts from stb group by tbname"
)
tdSql
.
checkRows
(
4
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:10.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:10.000"
)
tdSql
.
checkData
(
0
,
3
,
"2018-09-17 09:00:10.000"
)
tdSql
.
checkData
(
3
,
0
,
"2018-09-17 09:01:20.000"
)
tdSql
.
checkData
(
3
,
1
,
"2018-09-17 09:01:20.000"
)
tdSql
.
checkData
(
3
,
3
,
"2018-09-17 09:01:20.000"
)
tdSql
.
query
(
"select ts,derivative(col, 10s, 1),ts from tb1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:10.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:10.000"
)
tdSql
.
checkData
(
0
,
3
,
"2018-09-17 09:00:10.000"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:20.009"
)
tdSql
.
checkData
(
1
,
1
,
"2018-09-17 09:00:20.009"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:20.009"
)
tdSql
.
query
(
"select ts from(select ts,derivative(col, 10s, 0) from stb group by tbname)"
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:10.000"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb1 group by tbname"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb1 group by tbname"
)
tdSql
.
query
(
"select derivative(col, 10s, 1) from tb1"
)
tdSql
.
query
(
"select derivative(col, 10s, 1) from tb1"
)
...
...
tests/pytest/functions/function_diff.py
浏览文件 @
8ae068ff
...
@@ -94,6 +94,23 @@ class TDTestCase:
...
@@ -94,6 +94,23 @@ class TDTestCase:
tdSql
.
error
(
"select diff(col13) from test"
)
tdSql
.
error
(
"select diff(col13) from test"
)
tdSql
.
error
(
"select diff(col14) from test"
)
tdSql
.
error
(
"select diff(col14) from test"
)
tdSql
.
query
(
"select ts,diff(col1),ts from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
3
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
9
,
0
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
9
,
1
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
9
,
3
,
"2018-09-17 09:00:00.009"
)
tdSql
.
query
(
"select ts,diff(col1),ts from test group by tbname"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
0
,
3
,
"2018-09-17 09:00:00.000"
)
tdSql
.
checkData
(
9
,
0
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
9
,
1
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
9
,
3
,
"2018-09-17 09:00:00.009"
)
tdSql
.
query
(
"select diff(col1) from test1"
)
tdSql
.
query
(
"select diff(col1) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
...
tests/pytest/functions/function_top.py
浏览文件 @
8ae068ff
...
@@ -117,6 +117,21 @@ class TDTestCase:
...
@@ -117,6 +117,21 @@ class TDTestCase:
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
tdSql
.
checkData
(
1
,
1
,
9.1
)
tdSql
.
checkData
(
1
,
1
,
9.1
)
tdSql
.
query
(
"select ts,top(col1, 2),ts from test1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.009"
)
tdSql
.
query
(
"select ts,top(col1, 2),ts from test group by tbname"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
0
,
1
,
"2018-09-17 09:00:00.008"
)
tdSql
.
checkData
(
1
,
0
,
"2018-09-17 09:00:00.009"
)
tdSql
.
checkData
(
1
,
3
,
"2018-09-17 09:00:00.009"
)
#TD-2563 top + super_table + interval
#TD-2563 top + super_table + interval
tdSql
.
execute
(
"create table meters(ts timestamp, c int) tags (d int)"
)
tdSql
.
execute
(
"create table meters(ts timestamp, c int) tags (d int)"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录