From 08ab6c304698498e767f2853e105334860fee9dd Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 11 Mar 2022 12:44:25 +0800 Subject: [PATCH] [TD-11216]: Time window related keywords add _qstart/_qstop/_qduration --- src/client/src/tscSQLParser.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 7146a2bd72..23c349a67e 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4306,6 +4306,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool int32_t scalarFuncNum = 0; int32_t funcCompatFactor = INT_MAX; int32_t countTbname = 0; + int32_t queryWinNum = 0; size_t numOfExpr = tscNumOfExprs(pQueryInfo); assert(numOfExpr > 0); @@ -4315,7 +4316,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool // diff function cannot be executed with other function // arithmetic function can be executed with other arithmetic functions size_t size = tscNumOfExprs(pQueryInfo); - + for (int32_t i = startIdx; i < size; ++i) { SExprInfo* pExpr1 = tscExprGet(pQueryInfo, i); @@ -4345,6 +4346,10 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool ++scalarFuncNum; } + if (functionId == TSDB_FUNC_QSTART || functionId == TSDB_FUNC_QSTOP || functionId == TSDB_FUNC_QDURATION) { + ++queryWinNum; + } + if (functionId == TSDB_FUNC_PRJ && (pExpr1->base.colInfo.colId == PRIMARYKEY_TIMESTAMP_COL_INDEX || TSDB_COL_IS_UD_COL(pExpr1->base.colInfo.flag))) { continue; } @@ -4376,7 +4381,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool } } - aggNum = (int32_t)size - prjNum - scalarFuncNum - aggUdf - scalarUdf - countTbname; + aggNum = (int32_t)size - prjNum - scalarFuncNum - aggUdf - scalarUdf - countTbname - queryWinNum; assert(aggNum >= 0); -- GitLab