diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 2f6bb603c1..fbdb520bf3 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -552,6 +552,8 @@ typedef struct SQueryPlan { void nodesWalkPhysiPlan(SNode* pNode, FNodeWalker walker, void* pContext); +const char* dataOrderStr(EDataOrderLevel order); + #ifdef __cplusplus } #endif diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 958db6f6e2..6f71b58aef 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1818,3 +1818,19 @@ int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc) { return TSDB_CODE_SUCCESS; } + +const char* dataOrderStr(EDataOrderLevel order) { + switch (order) { + case DATA_ORDER_LEVEL_NONE: + return "no order required"; + case DATA_ORDER_LEVEL_IN_BLOCK: + return "in-datablock order"; + case DATA_ORDER_LEVEL_IN_GROUP: + return "in-group order"; + case DATA_ORDER_LEVEL_GLOBAL: + return "global order"; + default: + break; + } + return "unknown"; +} diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c index f0593ab482..6ec9fecfdb 100644 --- a/source/libs/planner/src/planUtil.c +++ b/source/libs/planner/src/planUtil.c @@ -159,7 +159,10 @@ static bool isKeepOrderAggFunc(SNodeList* pFuncs) { static int32_t adjustAggDataRequirement(SAggLogicNode* pAgg, EDataOrderLevel requirement) { // The sort level of agg with group by output data can only be DATA_ORDER_LEVEL_NONE if (requirement > DATA_ORDER_LEVEL_NONE && (NULL != pAgg->pGroupKeys || !isKeepOrderAggFunc(pAgg->pAggFuncs))) { - planError("Illegal statement, should be intercepted in parser"); + planError( + "The output of aggregate cannot meet the requirements(%s) of the upper operator. " + "Illegal statement, should be intercepted in parser", + dataOrderStr(requirement)); return TSDB_CODE_PLAN_INTERNAL_ERROR; } pAgg->node.resultDataOrder = requirement; @@ -232,7 +235,10 @@ static int32_t adjustSortDataRequirement(SSortLogicNode* pSort, EDataOrderLevel static int32_t adjustPartitionDataRequirement(SPartitionLogicNode* pPart, EDataOrderLevel requirement) { if (DATA_ORDER_LEVEL_GLOBAL == requirement) { - planError("Illegal statement, should be intercepted in parser"); + planError( + "The output of partition cannot meet the requirements(%s) of the upper operator. " + "Illegal statement, should be intercepted in parser", + dataOrderStr(requirement)); return TSDB_CODE_PLAN_INTERNAL_ERROR; } pPart->node.resultDataOrder = requirement;