From 26936892850bb2ac57ee9601bd63f2263f05a60f Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 12 May 2022 23:10:23 +0800 Subject: [PATCH] fix(query): set the ascending scan order for exchange operator. --- source/libs/executor/src/executorimpl.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 78ecae864f..704a4e1045 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3656,18 +3656,23 @@ _error: } int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t *order, int32_t* scanFlag) { - if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { + // todo add more information about exchange operation + if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_EXCHANGE) { + *order = TSDB_ORDER_ASC; + *scanFlag = MAIN_SCAN; + return TSDB_CODE_SUCCESS; + } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { + STableScanInfo* pTableScanInfo = pOperator->info; + *order = pTableScanInfo->cond.order; + *scanFlag = pTableScanInfo->scanFlag; + return TSDB_CODE_SUCCESS; + } else { if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) { return TSDB_CODE_INVALID_PARA; } else { return getTableScanInfo(pOperator->pDownstream[0], order, scanFlag); } } - - STableScanInfo* pTableScanInfo = pOperator->info; - *order = pTableScanInfo->cond.order; - *scanFlag = pTableScanInfo->scanFlag; - return TSDB_CODE_SUCCESS; } // this is a blocking operator