diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index 4c61cbb0f730780c6c7106a02c765974b2d21706..bd8a77b352b05ee7a8f5ceeaee0b3223c1d17287 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -588,6 +588,12 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { op = OP_Fill; taosArrayPush(plan, &op); } + // outer query order by support + int32_t orderColId = pQueryAttr->order.orderColId; + if (pQueryAttr->vgId == 0 && orderColId != INT32_MIN) { + op = OP_Order; + taosArrayPush(plan, &op); + } } } else if (pQueryAttr->groupbyColumn) { @@ -658,7 +664,7 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { // outer query order by support int32_t orderColId = pQueryAttr->order.orderColId; - if (pQueryAttr->vgId == 0 && orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX && orderColId != INT32_MIN) { + if (pQueryAttr->vgId == 0 && orderColId != INT32_MIN) { op = OP_Order; taosArrayPush(plan, &op); }