diff --git a/include/util/taoserror.h b/include/util/taoserror.h index f626f496618147eb41b2710acea69eeae35c83bb..6489304bdaf1bdac3fc4f6a74d63fc35e8dc1a2c 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -688,6 +688,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_NOT_SUPPORT_JOIN TAOS_DEF_ERROR_CODE(0, 0x2664) #define TSDB_CODE_PAR_INVALID_TAGS_PC TAOS_DEF_ERROR_CODE(0, 0x2665) #define TSDB_CODE_PAR_INVALID_TIMELINE_QUERY TAOS_DEF_ERROR_CODE(0, 0x2666) +#define TSDB_CODE_PAR_INVALID_OPTR_USAGE TAOS_DEF_ERROR_CODE(0, 0x2667) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 25e54fc5c428fb1d26fc7c9d2815048fa43536ad..1bc59763712fa7dd915dc24b39a493babb4e3d04 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2041,7 +2041,7 @@ static int32_t getGroupByErrorCode(STranslateContext* pCxt) { if (isSelectStmt(pCxt->pCurrStmt) && NULL != ((SSelectStmt*)pCxt->pCurrStmt)->pGroupByList) { return TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION; } - return TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN; + return TSDB_CODE_PAR_INVALID_OPTR_USAGE; } static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode) { @@ -2114,13 +2114,13 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { } if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) { if (pSelect->selectFuncNum > 1 || pSelect->hasOtherVectorFunc || !pSelect->hasSelectFunc) { - return generateDealNodeErrMsg(pCxt, getGroupByErrorCode(pCxt)); + return generateDealNodeErrMsg(pCxt, getGroupByErrorCode(pCxt), ((SExprNode*)(*pNode))->aliasName); } else { return rewriteColToSelectValFunc(pCxt, pNode); } } if (isVectorFunc(*pNode) && isDistinctOrderBy(pCxt)) { - return generateDealNodeErrMsg(pCxt, getGroupByErrorCode(pCxt)); + return generateDealNodeErrMsg(pCxt, getGroupByErrorCode(pCxt), ((SExprNode*)(*pNode))->aliasName); } return DEAL_RES_CONTINUE; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index a4cf2f603d417e05b13567194499d284bcffc34d..793d05721ec5e35cee4a3afd85375e2826ccffc2 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -174,6 +174,8 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "Invalid usage of RANGE clause, EVERY clause or FILL clause"; case TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN: return "No valid function in window query"; + case TSDB_CODE_PAR_INVALID_OPTR_USAGE: + return "Invalid usage of expr: %s"; case TSDB_CODE_OUT_OF_MEMORY: return "Out of memory"; default: