diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index d2fdc2fc93f2e86d181df2734aea1eb5026a1edf..553c61d16049f7b087751116d88b656b103be8be 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -282,18 +282,8 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { // } pthread_mutex_lock(&pSql->subState.mutex); if (pSql->pSubs != NULL && pSql->subState.states != NULL) { - for (int32_t i = 0; i < pQdesc->numOfSub; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { // because subState maybe free on anytime by any thread, check validate from here - if(pSql->subState.numOfSub != pQdesc->numOfSub || - pSql->pSubs == NULL || - pSql->subState.states == NULL) { - tscError(" QUERY-HEART STscObj=%p subState maybe free. numOfSub=%d pSubs=%p states=%p", - pObj, pSql->subState.numOfSub, pSql->pSubs, pSql->subState.states); - pQdesc->numOfSub = 0; - // break for - break; - } - SSqlObj *psub = pSql->pSubs[i]; int64_t self = (psub != NULL)? psub->self : 0; @@ -306,6 +296,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { p += len; } } + pQdesc->numOfSub = pSql->subState.numOfSub; pthread_mutex_unlock(&pSql->subState.mutex); } diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index ad303f31e181560d9831b49b18dec269ba66d439..c835ff4c7245ed234d91c8dcaf53dd2fad18e44d 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -7994,7 +7994,15 @@ static bool check_expr_in_groupby_colum(SGroupbyExpr* pGroupbyExpr, SExprInfo* p return false; for (int32_t k = 0; k < pGroupbyExpr->numOfGroupCols ; ++k) { pIndex = taosArrayGet(pGroupbyExpr->columnInfo, k); - if (!strcmp(pIndex->name,&pExpr->base.colInfo.name[1])){ // notes:first char is dot, skip one char. + + // find last dot + char * name = strrchr(pExpr->base.colInfo.name, '.'); + if(name) + name += 1; + else + name = pExpr->base.colInfo.name; + + if (!strcmp(pIndex->name, name)){ return true; } } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 83e8105d48d482aefb159c9bb48864432c96f8f4..9cd36cce2ba83b9dacebd7297b06e0c7e332e55e 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -357,7 +357,7 @@ void checkBrokenQueries(STscObj *pTscObj) { pthread_mutex_lock(&pSql->subState.mutex); if (pSql->pSubs) { // have sub sql - for (int i = 0; i < numOfSub; i++) { + for (int i = 0; i < pSql->subState.numOfSub; i++) { SSqlObj *pSubSql = pSql->pSubs[i]; if(pSubSql) { tscInfo("PROBE 0x%" PRIx64 " sub sql app is 0x%" PRIx64, pSql->self, pSubSql->self); diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 9941055df2918a907178b1d05e455c4ae3c418e5..8306a47ffaa1779debbf42b65df323be5334704e 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -101,13 +101,12 @@ static bool allSubqueryDone(SSqlObj *pParentSql) { bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) { SSubqueryState *subState = &pParentSql->subState; - assert(idx < subState->numOfSub); pthread_mutex_lock(&subState->mutex); - - tscDebug("0x%"PRIx64" subquery:0x%"PRIx64", index:%d state set to 1", pParentSql->self, pSql->self, idx); - subState->states[idx] = 1; - + if (idx < subState->numOfSub) { + tscDebug("0x%"PRIx64" subquery:0x%"PRIx64", index:%d state set to 1", pParentSql->self, pSql->self, idx); + subState->states[idx] = 1; + } bool done = allSubqueryDone(pParentSql); if (!done) { tscDebug("0x%"PRIx64" sub:%p,%d completed, total:%d", pParentSql->self, pSql, idx, pParentSql->subState.numOfSub);