diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 5fae336d22..6224345a39 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -55,8 +55,8 @@ typedef struct SDataType { typedef struct SExprNode { ENodeType type; SDataType resType; - char aliasName[TSDB_COL_NAME_LEN]; - char userAlias[TSDB_COL_NAME_LEN]; + char aliasName[TSDB_COL_NAME_LEN + TSDB_COL_NAME_EXLEN]; + char userAlias[TSDB_COL_NAME_LEN + TSDB_COL_NAME_EXLEN]; SArray* pAssociation; bool asAlias; bool asParam; diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c index bd4eb2e61d..2b9db7542f 100644 --- a/source/libs/executor/src/aggregateoperator.c +++ b/source/libs/executor/src/aggregateoperator.c @@ -15,6 +15,7 @@ #include "filter.h" #include "function.h" +#include "nodes.h" #include "os.h" #include "querynodes.h" #include "tfill.h" @@ -395,10 +396,12 @@ static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBloc return TSDB_CODE_SUCCESS; } - // if the last expression is a tuple function, we don't need to create a empty data block - int32_t lastExprIndex = pOperator->exprSupp.numOfExprs - 1; - if(pOperator->exprSupp.pExprInfo[lastExprIndex].pExpr->_function.bindExprID > 0) { - return TSDB_CODE_SUCCESS; + // if the expression is a bind expression, we don't need to create a empty data block + for (int i = pOperator->exprSupp.numOfExprs - 1; i >= 0; i--) { + SExprInfo* pExprInfo = &pOperator->exprSupp.pExprInfo[i]; + if (nodeType(pExprInfo->pExpr) == QUERY_NODE_FUNCTION && pExprInfo->pExpr->_function.bindExprID > 0) { + return TSDB_CODE_SUCCESS; + } } code = createDataBlock(&pBlock); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a318eaa2db..27688d7366 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3585,8 +3585,7 @@ static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode if (isRelatedToOtherExpr((SExprNode*)*pNode)) { int len = strlen(((SExprNode*)*pNode)->aliasName); if (len + TSDB_COL_NAME_EXLEN >= TSDB_COL_NAME_LEN) { - parserError("%s The alias name is too long, the extra part will be truncated", __func__); - return DEAL_RES_ERROR; + parserWarn("%s The alias name is too long, the extra part will be truncated", __func__); } tsnprintf(pFunc->node.aliasName + len, TSDB_COL_NAME_EXLEN, ".%d", ((SExprNode*)*pNode)->relatedTo); }