提交 0dcfd711 编写于 作者: H Haojun Liao

[td-255] avoid unnecessary one more check for super table query.

上级 604efc00
...@@ -230,6 +230,12 @@ static void destroyStateWindowOperatorInfo(void* param, int32_t numOfOutput); ...@@ -230,6 +230,12 @@ static void destroyStateWindowOperatorInfo(void* param, int32_t numOfOutput);
static void destroyAggOperatorInfo(void* param, int32_t numOfOutput); static void destroyAggOperatorInfo(void* param, int32_t numOfOutput);
static void destroyOperatorInfo(SOperatorInfo* pOperator); static void destroyOperatorInfo(SOperatorInfo* pOperator);
static void doSetOperatorCompleted(SOperatorInfo* pOperator) {
pOperator->status = OP_EXEC_DONE;
if (pOperator->pRuntimeEnv != NULL) {
setQueryStatus(pOperator->pRuntimeEnv, QUERY_COMPLETED);
}
}
static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo* pGroupResInfo, int32_t orderType, SSDataBlock* pBlock); static int32_t doCopyToSDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SGroupResInfo* pGroupResInfo, int32_t orderType, SSDataBlock* pBlock);
...@@ -5517,8 +5523,7 @@ static SSDataBlock* doSort(void* param, bool* newgroup) { ...@@ -5517,8 +5523,7 @@ static SSDataBlock* doSort(void* param, bool* newgroup) {
// start to flush data into disk and try do multiway merge sort // start to flush data into disk and try do multiway merge sort
if (pBlock == NULL) { if (pBlock == NULL) {
setQueryStatus(pOperator->pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
pOperator->status = OP_EXEC_DONE;
break; break;
} }
...@@ -5629,8 +5634,7 @@ static SSDataBlock* doAggregate(void* param, bool* newgroup) { ...@@ -5629,8 +5634,7 @@ static SSDataBlock* doAggregate(void* param, bool* newgroup) {
doAggregateImpl(pOperator, pQueryAttr->window.skey, pInfo->pCtx, pBlock); doAggregateImpl(pOperator, pQueryAttr->window.skey, pInfo->pCtx, pBlock);
} }
pOperator->status = OP_EXEC_DONE; doSetOperatorCompleted(pOperator);
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED);
finalizeQueryResult(pOperator, pInfo->pCtx, &pInfo->resultRowInfo, pInfo->rowCellInfoOffset); finalizeQueryResult(pOperator, pInfo->pCtx, &pInfo->resultRowInfo, pInfo->rowCellInfoOffset);
pInfo->pRes->info.rows = getNumOfResult(pRuntimeEnv, pInfo->pCtx, pOperator->numOfOutput); pInfo->pRes->info.rows = getNumOfResult(pRuntimeEnv, pInfo->pCtx, pOperator->numOfOutput);
...@@ -5706,7 +5710,7 @@ static SSDataBlock* doSTableAggregate(void* param, bool* newgroup) { ...@@ -5706,7 +5710,7 @@ static SSDataBlock* doSTableAggregate(void* param, bool* newgroup) {
toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pInfo->pRes); toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pInfo->pRes);
if (pInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { if (pInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) {
pOperator->status = OP_EXEC_DONE; doSetOperatorCompleted(pOperator);
} }
return pInfo->pRes; return pInfo->pRes;
...@@ -5824,8 +5828,7 @@ static SSDataBlock* doLimit(void* param, bool* newgroup) { ...@@ -5824,8 +5828,7 @@ static SSDataBlock* doLimit(void* param, bool* newgroup) {
publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_AFTER_OPERATOR_EXEC); publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_AFTER_OPERATOR_EXEC);
if (pBlock == NULL) { if (pBlock == NULL) {
setQueryStatus(pOperator->pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
pOperator->status = OP_EXEC_DONE;
return NULL; return NULL;
} }
...@@ -5853,8 +5856,7 @@ static SSDataBlock* doLimit(void* param, bool* newgroup) { ...@@ -5853,8 +5856,7 @@ static SSDataBlock* doLimit(void* param, bool* newgroup) {
pBlock->info.rows = (int32_t)(pInfo->limit - pInfo->total); pBlock->info.rows = (int32_t)(pInfo->limit - pInfo->total);
pInfo->total = pInfo->limit; pInfo->total = pInfo->limit;
setQueryStatus(pOperator->pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
pOperator->status = OP_EXEC_DONE;
} else { } else {
pInfo->total += pBlock->info.rows; pInfo->total += pBlock->info.rows;
} }
...@@ -5889,8 +5891,7 @@ static SSDataBlock* doFilter(void* param, bool* newgroup) { ...@@ -5889,8 +5891,7 @@ static SSDataBlock* doFilter(void* param, bool* newgroup) {
} }
} }
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
pOperator->status = OP_EXEC_DONE;
return NULL; return NULL;
} }
...@@ -5905,9 +5906,8 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) { ...@@ -5905,9 +5906,8 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) {
SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv;
if (pOperator->status == OP_RES_TO_RETURN) { if (pOperator->status == OP_RES_TO_RETURN) {
toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) {
pOperator->status = OP_EXEC_DONE; doSetOperatorCompleted(pOperator);
} }
return pIntervalInfo->pRes; return pIntervalInfo->pRes;
...@@ -5948,7 +5948,7 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) { ...@@ -5948,7 +5948,7 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) {
toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) {
pOperator->status = OP_EXEC_DONE; doSetOperatorCompleted(pOperator);
} }
return pIntervalInfo->pRes->info.rows == 0? NULL:pIntervalInfo->pRes; return pIntervalInfo->pRes->info.rows == 0? NULL:pIntervalInfo->pRes;
...@@ -5967,7 +5967,7 @@ static SSDataBlock* doAllIntervalAgg(void* param, bool* newgroup) { ...@@ -5967,7 +5967,7 @@ static SSDataBlock* doAllIntervalAgg(void* param, bool* newgroup) {
toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) {
pOperator->status = OP_EXEC_DONE; doSetOperatorCompleted(pOperator);
} }
return pIntervalInfo->pRes; return pIntervalInfo->pRes;
...@@ -6025,9 +6025,10 @@ static SSDataBlock* doSTableIntervalAgg(void* param, bool* newgroup) { ...@@ -6025,9 +6025,10 @@ static SSDataBlock* doSTableIntervalAgg(void* param, bool* newgroup) {
if (pOperator->status == OP_RES_TO_RETURN) { if (pOperator->status == OP_RES_TO_RETURN) {
int64_t st = taosGetTimestampUs(); int64_t st = taosGetTimestampUs();
copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset);
if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) {
pOperator->status = OP_EXEC_DONE; doSetOperatorCompleted(pOperator);
} }
SQInfo* pQInfo = pRuntimeEnv->qinfo; SQInfo* pQInfo = pRuntimeEnv->qinfo;
...@@ -7286,13 +7287,11 @@ static SSDataBlock* hashDistinct(void* param, bool* newgroup) { ...@@ -7286,13 +7287,11 @@ static SSDataBlock* hashDistinct(void* param, bool* newgroup) {
publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_AFTER_OPERATOR_EXEC); publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_AFTER_OPERATOR_EXEC);
if (pBlock == NULL) { if (pBlock == NULL) {
setQueryStatus(pOperator->pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
pOperator->status = OP_EXEC_DONE;
break; break;
} }
if (!initMultiDistinctInfo(pInfo, pOperator, pBlock)) { if (!initMultiDistinctInfo(pInfo, pOperator, pBlock)) {
setQueryStatus(pOperator->pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
pOperator->status = OP_EXEC_DONE;
break; break;
} }
// ensure result output buf // ensure result output buf
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册