fix: refactor dependency between community and enterprise

This commit is contained in:
slzhou 2023-11-22 08:47:35 +08:00
parent 1fc16355de
commit 40a28a6e4b
2 changed files with 8 additions and 10 deletions

View File

@ -46,8 +46,7 @@ typedef struct STranslateContext {
SNode* pPostRoot; SNode* pPostRoot;
} STranslateContext; } STranslateContext;
EDealRes biRewriteToTbnameFuncAndTranslate(STranslateContext* pCxt, SColumnNode** ppCol); bool biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode);
EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc);
int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect); int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect);
int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput); int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput);
int32_t getTargetMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta, bool couldBeView); int32_t getTargetMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta, bool couldBeView);

View File

@ -263,6 +263,7 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode); static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode);
static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode); static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode);
static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal); static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal);
static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc);
static int32_t createSimpleSelectStmtFromProjList(const char* pDb, const char* pTable, SNodeList* pProjectionList, static int32_t createSimpleSelectStmtFromProjList(const char* pDb, const char* pTable, SNodeList* pProjectionList,
SSelectStmt** pStmt); SSelectStmt** pStmt);
static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta, SNode** pQuery); static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta, SNode** pQuery);
@ -1092,8 +1093,8 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p
} }
#ifndef TD_ENTERPRISE #ifndef TD_ENTERPRISE
EDealRes biRewriteToTbnameFuncAndTranslate(STranslateContext* pCxt, SColumnNode** ppCol) { bool biRewriteToTbnameFunc(STranslateContext* pCxt, SNode** ppNode) {
return DEAL_RES_CONTINUE; return false;
} }
#endif #endif
@ -1109,11 +1110,9 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
} }
if (pCxt->pParseCxt->biMode) { if (pCxt->pParseCxt->biMode) {
if ((strcasecmp((*pCol)->colName, "tbname") == 0) && SNode** ppNode = (SNode**)pCol;
((SSelectStmt*)pCxt->pCurrStmt)->pFromTable && if (biRewriteToTbnameFunc(pCxt, ppNode)) {
QUERY_NODE_REAL_TABLE == nodeType(((SSelectStmt*)pCxt->pCurrStmt)->pFromTable)) { translateFunction(pCxt, (SFunctionNode**)ppNode);
EDealRes res = biRewriteToTbnameFuncAndTranslate(pCxt, pCol);
return res;
} }
} }
@ -2219,7 +2218,7 @@ static int32_t translateFunctionImpl(STranslateContext* pCxt, SFunctionNode** pF
return translateNormalFunction(pCxt, (SNode**)pFunc); return translateNormalFunction(pCxt, (SNode**)pFunc);
} }
EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc) { static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc) {
SNode* pParam = NULL; SNode* pParam = NULL;
FOREACH(pParam, (*pFunc)->pParameterList) { FOREACH(pParam, (*pFunc)->pParameterList) {
if (isMultiResFunc(pParam)) { if (isMultiResFunc(pParam)) {