Merge pull request #17772 from taosdata/feature/TD-19893

fix(planner):add semantic check
This commit is contained in:
Shengliang Guan 2022-10-31 20:08:21 +08:00 committed by GitHub
commit a0c7b7d512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 4 deletions

View File

@ -674,6 +674,10 @@ static bool isSelectFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsSelectFunc(((SFunctionNode*)pNode)->funcId)); return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsSelectFunc(((SFunctionNode*)pNode)->funcId));
} }
static bool isWindowPseudoColumnFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsWindowPseudoColumnFunc(((SFunctionNode*)pNode)->funcId));
}
static bool isTimelineFunc(const SNode* pNode) { static bool isTimelineFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsTimelineFunc(((SFunctionNode*)pNode)->funcId)); return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsTimelineFunc(((SFunctionNode*)pNode)->funcId));
} }
@ -1264,10 +1268,7 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
} }
static EDealRes haveVectorFunction(SNode* pNode, void* pContext) { static EDealRes haveVectorFunction(SNode* pNode, void* pContext) {
if (isAggFunc(pNode)) { if (isAggFunc(pNode) || isIndefiniteRowsFunc(pNode) || isWindowPseudoColumnFunc(pNode)) {
*((bool*)pContext) = true;
return DEAL_RES_END;
} else if (isIndefiniteRowsFunc(pNode)) {
*((bool*)pContext) = true; *((bool*)pContext) = true;
return DEAL_RES_END; return DEAL_RES_END;
} }

View File

@ -995,3 +995,22 @@ endi
if $data00 != 0.000000000 then if $data00 != 0.000000000 then
return -1 return -1
endi endi
sql create table ft1(ts timestamp, a int, b int , c int, d double);
sql insert into ft1 values(1648791213000,1,2,3,1.0);
sql_error select sum(_wduration), a from ft1 state_window(a);
sql_error select count(_wduration), a from ft1 state_window(a);
sql_error select max(_wduration), a from ft1 state_window(a);
sql_error select sum(1 + _wduration), a from ft1 state_window(a);
sql_error select sum(cast(_wstart as bigint)), a from ft1 state_window(a);
sql_error select sum(cast(_wend as bigint)), a from ft1 state_window(a);
sql_error create stream streams1 trigger at_once into streamt as select _wstart, sum(_wduration) from ft1 interval(10s);
sql_error create stream streams1 trigger at_once into streamt as select _wstart, sum(cast(_wend as bigint)) from ft1 interval(10s);