From 527a142c9d59c685522216c589d502074a060d99 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Fri, 24 Sep 2021 15:16:46 +0800 Subject: [PATCH] rename tscIsDiffDeriveQuery function to tscIsDiffDerivLikeQuery --- src/client/inc/tscUtil.h | 2 +- src/client/src/tscSQLParser.c | 6 +++--- src/client/src/tscUtil.c | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index 5a68cc8797..06fe337be8 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -156,7 +156,7 @@ bool isSimpleAggregateRv(SQueryInfo* pQueryInfo); bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo *pQueryInfo, int32_t tableIndex); bool tscOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex); -bool tscIsDiffDerivQuery(SQueryInfo* pQueryInfo); +bool tscIsDiffDerivLikeQuery(SQueryInfo* pQueryInfo); bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex); bool tscIsProjectionQuery(SQueryInfo* pQueryInfo); diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index b42bcfbfb1..babbee9d50 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3418,7 +3418,7 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) } } - if (tscIsTWAQuery(pQueryInfo) || tscIsDiffDerivQuery(pQueryInfo) || tscIsIrateQuery(pQueryInfo) || + if (tscIsTWAQuery(pQueryInfo) || tscIsDiffDerivLikeQuery(pQueryInfo) || tscIsIrateQuery(pQueryInfo) || tscQueryContainsFunction(pQueryInfo, TSDB_FUNC_SAMPLE)) { if (pQueryInfo->groupbyExpr.numOfGroupCols == 0) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); @@ -7060,7 +7060,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo if (TSDB_COL_IS_TAG(pColIndex->flag)) { int32_t f = TSDB_FUNC_TAG; - if (tscIsDiffDerivQuery(pQueryInfo)) { + if (tscIsDiffDerivLikeQuery(pQueryInfo)) { f = TSDB_FUNC_TAGPRJ; } @@ -7224,7 +7224,7 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* } // projection query on super table does not compatible with "group by" syntax - if (tscIsProjectionQuery(pQueryInfo) && !(tscIsDiffDerivQuery(pQueryInfo))) { + if (tscIsProjectionQuery(pQueryInfo) && !(tscIsDiffDerivLikeQuery(pQueryInfo))) { return invalidOperationMsg(msg, msg3); } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index cf0fdaca1f..3d90c768af 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -320,7 +320,9 @@ bool tscIsProjectionQuery(SQueryInfo* pQueryInfo) { return true; } -bool tscIsDiffDerivQuery(SQueryInfo* pQueryInfo) { +// these functions diff/derivative/csum/mavg will return the result computed on current row and history row/rows +// as the result for current row +bool tscIsDiffDerivLikeQuery(SQueryInfo* pQueryInfo) { size_t size = tscNumOfExprs(pQueryInfo); for (int32_t i = 0; i < size; ++i) { @@ -605,7 +607,7 @@ bool isSimpleAggregateRv(SQueryInfo* pQueryInfo) { return false; } - if (tscIsDiffDerivQuery(pQueryInfo)) { + if (tscIsDiffDerivLikeQuery(pQueryInfo)) { return false; } @@ -4852,7 +4854,7 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt pQueryAttr->hasTagResults = hasTagValOutput(pQueryInfo); pQueryAttr->stabledev = isStabledev(pQueryInfo); pQueryAttr->tsCompQuery = isTsCompQuery(pQueryInfo); - pQueryAttr->diffQuery = tscIsDiffDerivQuery(pQueryInfo); + pQueryAttr->diffQuery = tscIsDiffDerivLikeQuery(pQueryInfo); pQueryAttr->simpleAgg = isSimpleAggregateRv(pQueryInfo); pQueryAttr->needReverseScan = tscNeedReverseScan(pQueryInfo); pQueryAttr->stableQuery = QUERY_IS_STABLE_QUERY(pQueryInfo->type); -- GitLab