From 504a8af0cda197bec3ed3ea80c039ed2dd4f7efb Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Wed, 25 Dec 2024 17:40:09 +0800 Subject: [PATCH] fix: select_value function slotid --- include/libs/nodes/querynodes.h | 2 +- include/util/tdef.h | 1 + source/libs/parser/src/parTranslater.c | 2 ++ source/libs/planner/src/planLogicCreater.c | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index e14a43b1c2..161d713ecc 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -55,7 +55,7 @@ typedef struct SDataType { typedef struct SExprNode { ENodeType type; SDataType resType; - char aliasName[TSDB_COL_NAME_LEN]; + char aliasName[TSDB_COL_NAME_LEN + TSDB_COL_NAME_EXLEN]; char userAlias[TSDB_COL_NAME_LEN]; SArray* pAssociation; bool asAlias; diff --git a/include/util/tdef.h b/include/util/tdef.h index 2ee84b42bd..5deec72176 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -271,6 +271,7 @@ typedef enum ELogicConditionType { #define TSDB_SUBSCRIBE_KEY_LEN (TSDB_CGROUP_LEN + TSDB_TOPIC_FNAME_LEN + 2) #define TSDB_PARTITION_KEY_LEN (TSDB_SUBSCRIBE_KEY_LEN + 20) #define TSDB_COL_NAME_LEN 65 +#define TSDB_COL_NAME_EXLEN 2 #define TSDB_COL_FNAME_LEN (TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN + TSDB_NAME_DELIMITER_LEN) #define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64 #define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 6535c70c82..8da19736a4 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -7377,6 +7377,8 @@ static EDealRes pushDownBindSelectFunc(SNode** pNode, void* pContext) { SBindTupleFuncCxt* pCxt = pContext; if (nodesIsExprNode(*pNode)) { ((SExprNode*)*pNode)->bindTupleFuncIdx = pCxt->bindTupleFuncIdx; + int32_t len = strlen(((SExprNode*)*pNode)->aliasName); + tsnprintf(((SExprNode*)*pNode)->aliasName + len, TSDB_COL_NAME_EXLEN, "%d", pCxt->bindTupleFuncIdx); SFunctionNode* pFunc = (SFunctionNode*)*pNode; } return DEAL_RES_CONTINUE; diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 363aa71479..519194ef8a 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -710,6 +710,8 @@ static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr) if (NULL != pStmtName) { snprintf(pCol->tableAlias, sizeof(pCol->tableAlias), "%s", pStmtName); } + pCol->node.bindTupleFuncIdx = pExpr->bindTupleFuncIdx; + pCol->node.tupleFuncIdx = pExpr->tupleFuncIdx; return pCol; }