From 3c0121ef1ad5fe422071d520e73b5e321339db00 Mon Sep 17 00:00:00 2001 From: facetosea <285808407@qq.com> Date: Tue, 11 Feb 2025 07:38:12 +0000 Subject: [PATCH] unused code --- include/libs/function/function.h | 2 +- include/util/taoserror.h | 2 +- source/libs/executor/src/executil.c | 6 ++++-- source/libs/parser/inc/parAst.h | 1 - source/libs/parser/src/parAstCreater.c | 19 +----------------- source/libs/planner/src/planPhysiCreater.c | 23 ---------------------- 6 files changed, 7 insertions(+), 46 deletions(-) diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 715f257688..8c299d2c8c 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -276,13 +276,13 @@ typedef struct tExprNode { int32_t num; struct SFunctionNode *pFunctNode; int32_t functionType; + int32_t bindTupleFuncIdx; } _function; struct { struct SNode *pRootNode; } _optrRoot; }; - int32_t bindTupleFuncIdx; int32_t tupleFuncIdx; } tExprNode; diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 5c83aa90b2..c1c85ea060 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -911,7 +911,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_PAR_INVALID_COLS_FUNCTION TAOS_DEF_ERROR_CODE(0, 0x2687) #define TSDB_CODE_PAR_INVALID_COLS_SELECTFUNC TAOS_DEF_ERROR_CODE(0, 0x2688) #define TSDB_CODE_INVALID_MULITI_COLS_FUNC TAOS_DEF_ERROR_CODE(0, 0x2689) -#define TSDB_CODE_INVALID_COLS_ALIAS TAOS_DEF_ERROR_CODE(0, 0x2690) +#define TSDB_CODE_INVALID_COLS_ALIAS TAOS_DEF_ERROR_CODE(0, 0x268A) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index c57accfa66..95e76e8599 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1992,7 +1992,9 @@ int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) { code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; QUERY_CHECK_CODE(code, lino, _end); } - pExp->pExpr->bindTupleFuncIdx = ((SExprNode*)pNode)->bindTupleFuncIdx; + if(type == QUERY_NODE_FUNCTION) { + pExp->pExpr->_function.bindTupleFuncIdx = ((SExprNode*)pNode)->bindTupleFuncIdx; + } pExp->pExpr->tupleFuncIdx = ((SExprNode*)pNode)->tupleFuncIdx; _end: if (code != TSDB_CODE_SUCCESS) { @@ -2132,7 +2134,7 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu if (pValCtxArray == NULL) { pValCtx[num++] = &pCtx[i]; } else { - int32_t bindFuncIndex = pCtx[i].pExpr->pExpr->bindTupleFuncIdx; // start from index 1; + int32_t bindFuncIndex = pCtx[i].pExpr->pExpr->_function.bindTupleFuncIdx; // start from index 1; if (bindFuncIndex > 0) { // 0 is default index related to the select function bindFuncIndex -= 1; } diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index f2b1059a84..857c2e03bc 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -170,7 +170,6 @@ SNode* createInterpTimeAround(SAstCreateContext* pCxt, SNode* pTimepoint, SN SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen); SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse); SNode* createAlterSingleTagColumnNode(SAstCreateContext* pCtx, SToken* token, SNode* pVal); -SNode* createColsFunctionNode(SAstCreateContext* pCxt, SNode* pFunc, SNodeList* pList); SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere); SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList); diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 478d277d83..caf409338d 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -375,6 +375,7 @@ SNodeList* createColsFuncParamNodeList(SAstCreateContext* pCxt, SNode* pNode, SN pCxt->errCode = nodesListAppend(list, pFuncNode); CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesListAppendList(list, pNodeList); + CHECK_PARSER_STATUS(pCxt); return list; _err: @@ -1177,24 +1178,6 @@ _err: return NULL; } -SNode* createColsFunctionNode(SAstCreateContext* pCxt, SNode* pColFunc, SNodeList* pExpr){ - SFunctionNode* func = NULL; - CHECK_PARSER_STATUS(pCxt); - pCxt->errCode = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&func); - CHECK_MAKE_NODE(func); - strcpy(func->functionName, "cols"); - pCxt->errCode = nodesListMakeAppend(&func->pParameterList, pColFunc); - CHECK_PARSER_STATUS(pCxt); - pCxt->errCode = nodesListMakeStrictAppendList(&func->pParameterList, pExpr); - CHECK_PARSER_STATUS(pCxt); - return (SNode*)func; -_err: - nodesDestroyNode((SNode*)func); - nodesDestroyNode(pColFunc); - nodesDestroyList(pExpr); - return NULL; -} - SNode* createSubstrFunctionNodeExt(SAstCreateContext* pCxt, SNode* pExpr, SNode* pExpr2, SNode* pExpr3) { SFunctionNode* func = NULL; CHECK_PARSER_STATUS(pCxt); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 5902f1c3e9..33818feb39 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -31,25 +31,6 @@ typedef struct SSlotIndex { SArray* pSlotIdsInfo; // duplicate name slot } SSlotIndex; -static int64_t getExprBindIndexStr(SNode* pNode, char* bindInfo) { - if (nodeType(pNode) == QUERY_NODE_COLUMN) { - SColumnNode* pCol = (SColumnNode*)pNode; - if (pCol->dataBlockId == 0) { - return 0; - } - } - if (nodesIsExprNode(pNode)) { - SExprNode* pExpr = (SExprNode*)pNode; - if (pExpr->bindTupleFuncIdx > 0 && pExpr->bindTupleFuncIdx <= 9) { - bindInfo[0] = '0' + pExpr->bindTupleFuncIdx; - return 1; - } else if (pExpr->bindTupleFuncIdx != 0) { - return tsnprintf(bindInfo, sizeof(bindInfo), "%d", pExpr->bindTupleFuncIdx); - } - } - return 0; -} - enum { SLOT_KEY_TYPE_ALL = 1, SLOT_KEY_TYPE_COLNAME = 2, @@ -59,7 +40,6 @@ static int32_t getSlotKeyHelper(SNode* pNode, const char* pPreName, const char* int32_t* pLen, uint16_t extraBufLen, int8_t slotKeyType) { int32_t code = 0; char bindInfo[16] = {0}; - //int exBindInfoLen = getExprBindIndexStr(pNode, bindInfo); *ppKey = taosMemoryCalloc(1, callocLen); if (!*ppKey) { return terrno; @@ -68,9 +48,6 @@ static int32_t getSlotKeyHelper(SNode* pNode, const char* pPreName, const char* TAOS_STRNCAT(*ppKey, pPreName, TSDB_TABLE_NAME_LEN); TAOS_STRNCAT(*ppKey, ".", 2); TAOS_STRNCAT(*ppKey, name, TSDB_COL_NAME_LEN); - // if (exBindInfoLen > 0) { - // TAOS_STRNCAT(*ppKey, bindInfo, exBindInfoLen); - // } *pLen = taosHashBinary(*ppKey, strlen(*ppKey)); } else { TAOS_STRNCAT(*ppKey, name, TSDB_COL_NAME_LEN);