提交 65bbd256 编写于 作者: A Alex Duan

[TS-580] add top buttom check

上级 107783e7
......@@ -9141,7 +9141,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
const char* msg4 = "interval query not supported, since the result of sub query not include valid timestamp column";
const char* msg5 = "only tag query not compatible with normal column filter";
const char* msg6 = "not support stddev/percentile/interp in the outer query yet";
const char* msg7 = "derivative/twa/rate/irate/diff requires timestamp column exists in subquery";
const char* msg7 = "derivative/twa/rate/irate/diff/top/bottom requires timestamp column exists in subquery";
const char* msg8 = "condition missing for join query";
const char* msg9 = "not support 3 level select";
......@@ -9226,7 +9226,8 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
SExprInfo* pExpr = tscExprGet(pQueryInfo, i);
int32_t f = pExpr->base.functionId;
if (f == TSDB_FUNC_DERIVATIVE || f == TSDB_FUNC_TWA || f == TSDB_FUNC_IRATE || f == TSDB_FUNC_RATE || f== TSDB_FUNC_DIFF) {
if (f == TSDB_FUNC_DERIVATIVE || f == TSDB_FUNC_TWA || f == TSDB_FUNC_IRATE || f == TSDB_FUNC_RATE ||
f == TSDB_FUNC_DIFF || f == TSDB_FUNC_TOP || f == TSDB_FUNC_BOTTOM) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
}
}
......
......@@ -342,9 +342,9 @@ endi
sql select sample(x, 20) from (select c1 x from nest_tb0);
sql select top(x, 20) from (select c1 x from nest_tb0);
sql select top(x, 20) from (select c1 cs,x from nest_tb0);
sql select bottom(x, 20) from (select c1 x from nest_tb0)
sql select bottom(x, 20) from (select cs,c1 x from nest_tb0)
print ===================> group by + having
......@@ -419,12 +419,14 @@ if $data03 != @20-09-15 00:00:00.000@ then
return -1
endi
sql_error select diff(val) from (select c1 val from nest_tb0);
sql select diff(val) from (select ts,c1 val from nest_tb0);
if $rows != 9999 then
return -1
endi
if $data00 != @70-01-01 08:00:00.000@ then
if $data00 != @20-09-15 00:01:00.000@ then
return -1
endi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册