fix the issue #504

This commit is contained in:
slguan 2019-09-12 15:30:48 +08:00
parent cd7e59cfc8
commit a721d0d23e
1 changed files with 7 additions and 1 deletions

View File

@ -457,7 +457,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
// projection query on metric, pipeline retrieve data from vnode list, instead
// of two-stage mergevnodeProcessMsgFromShell free qhandle
nRows = taos_fetch_block_impl(res, rows);
if (*rows == NULL && tscProjectionQueryOnMetric(pSql)) {
while (*rows == NULL && tscProjectionQueryOnMetric(pSql)) {
/* reach the maximum number of output rows, abort */
if (pCmd->globalLimit > 0 && pRes->numOfTotal >= pCmd->globalLimit) {
return 0;
@ -465,6 +465,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
/* update the limit value according to current retrieval results */
pCmd->limit.limit = pSql->cmd.globalLimit - pRes->numOfTotal;
pCmd->limit.offset = pRes->offset;
if ((++pSql->cmd.vnodeIdx) <= pSql->cmd.pMetricMeta->numOfVnodes) {
pSql->cmd.command = TSDB_SQL_SELECT;
@ -472,6 +473,11 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
tscProcessSql(pSql);
nRows = taos_fetch_block_impl(res, rows);
}
// check!!!
if (*rows != NULL || pCmd->vnodeIdx >= pCmd->pMetricMeta->numOfVnodes) {
break;
}
}
return nRows;