fix: some problems of parser
This commit is contained in:
parent
b8efdd3e28
commit
adc8bd236b
|
@ -552,6 +552,8 @@ typedef struct SQueryPlan {
|
||||||
|
|
||||||
void nodesWalkPhysiPlan(SNode* pNode, FNodeWalker walker, void* pContext);
|
void nodesWalkPhysiPlan(SNode* pNode, FNodeWalker walker, void* pContext);
|
||||||
|
|
||||||
|
const char* dataOrderStr(EDataOrderLevel order);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1818,3 +1818,19 @@ int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc) {
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
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";
|
||||||
|
}
|
||||||
|
|
|
@ -159,7 +159,10 @@ static bool isKeepOrderAggFunc(SNodeList* pFuncs) {
|
||||||
static int32_t adjustAggDataRequirement(SAggLogicNode* pAgg, EDataOrderLevel requirement) {
|
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
|
// 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))) {
|
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;
|
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
pAgg->node.resultDataOrder = requirement;
|
pAgg->node.resultDataOrder = requirement;
|
||||||
|
@ -232,7 +235,10 @@ static int32_t adjustSortDataRequirement(SSortLogicNode* pSort, EDataOrderLevel
|
||||||
|
|
||||||
static int32_t adjustPartitionDataRequirement(SPartitionLogicNode* pPart, EDataOrderLevel requirement) {
|
static int32_t adjustPartitionDataRequirement(SPartitionLogicNode* pPart, EDataOrderLevel requirement) {
|
||||||
if (DATA_ORDER_LEVEL_GLOBAL == 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;
|
return TSDB_CODE_PLAN_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
pPart->node.resultDataOrder = requirement;
|
pPart->node.resultDataOrder = requirement;
|
||||||
|
|
Loading…
Reference in New Issue