remove (void) from parser/planner/nodes/sma

This commit is contained in:
wangjiaming0909 2024-09-11 08:56:39 +08:00
parent 77a5ab8721
commit 11b3faee8e
9 changed files with 110 additions and 84 deletions

View File

@ -37,7 +37,7 @@ typedef struct SName {
char tname[TSDB_TABLE_NAME_LEN]; char tname[TSDB_TABLE_NAME_LEN];
} SName; } SName;
SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName); void toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName);
int32_t tNameExtractFullName(const SName* name, char* dst); int32_t tNameExtractFullName(const SName* name, char* dst);

View File

@ -1526,7 +1526,7 @@ int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId
conn.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); conn.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
SName tableName; SName tableName;
(void)toName(pTscObj->acctId, db, table, &tableName); toName(pTscObj->acctId, db, table, &tableName);
SVgroupInfo vgInfo; SVgroupInfo vgInfo;
code = catalogGetTableHashVgroup(pCtg, &conn, &tableName, &vgInfo); code = catalogGetTableHashVgroup(pCtg, &conn, &tableName, &vgInfo);

View File

@ -946,7 +946,8 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
pReq.suid); pReq.suid);
STscObj* pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
SName tableName = {0}; SName tableName = {0};
RAW_RETURN_CHECK(tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name)); toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName);
RAW_RETURN_CHECK(tNameExtractFullName(&tableName, pReq.name));
SCmdMsgInfo pCmdMsg = {0}; SCmdMsgInfo pCmdMsg = {0};
pCmdMsg.epSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); pCmdMsg.epSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
pCmdMsg.msgType = TDMT_MND_CREATE_STB; pCmdMsg.msgType = TDMT_MND_CREATE_STB;
@ -1021,7 +1022,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
.requestObjRefId = pRequest->self, .requestObjRefId = pRequest->self,
.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)};
SName pName = {0}; SName pName = {0};
(void)toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name, toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name,
&pName); // ignore the return value, always return pName &pName); // ignore the return value, always return pName
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta); code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta);
@ -1045,7 +1046,8 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
pReq.suid); pReq.suid);
STscObj* pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
SName tableName = {0}; SName tableName = {0};
if (tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name) != 0) { toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName);
if (tNameExtractFullName(&tableName, pReq.name) != 0) {
code = TSDB_CODE_INVALID_PARA; code = TSDB_CODE_INVALID_PARA;
goto end; goto end;
} }
@ -1150,7 +1152,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
SVgroupInfo pInfo = {0}; SVgroupInfo pInfo = {0};
SName pName = {0}; SName pName = {0};
(void)toName(pTscObj->acctId, pRequest->pDb, pCreateReq->name, &pName); toName(pTscObj->acctId, pRequest->pDb, pCreateReq->name, &pName);
code = catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo); code = catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
goto end; goto end;
@ -1163,7 +1165,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
SName sName = {0}; SName sName = {0};
tb_uid_t oldSuid = pCreateReq->ctb.suid; tb_uid_t oldSuid = pCreateReq->ctb.suid;
// pCreateReq->ctb.suid = processSuid(pCreateReq->ctb.suid, pRequest->pDb); // pCreateReq->ctb.suid = processSuid(pCreateReq->ctb.suid, pRequest->pDb);
(void)toName(pTscObj->acctId, pRequest->pDb, pCreateReq->ctb.stbName, &sName); toName(pTscObj->acctId, pRequest->pDb, pCreateReq->ctb.stbName, &sName);
code = catalogGetTableMeta(pCatalog, &conn, &sName, &pTableMeta); code = catalogGetTableMeta(pCatalog, &conn, &sName, &pTableMeta);
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) { if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
code = TSDB_CODE_SUCCESS; code = TSDB_CODE_SUCCESS;
@ -1307,7 +1309,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
SVgroupInfo pInfo = {0}; SVgroupInfo pInfo = {0};
SName pName = {0}; SName pName = {0};
(void)toName(pTscObj->acctId, pRequest->pDb, pDropReq->name, &pName); toName(pTscObj->acctId, pRequest->pDb, pDropReq->name, &pName);
RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo)); RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo));
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
@ -1451,7 +1453,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
SVgroupInfo pInfo = {0}; SVgroupInfo pInfo = {0};
SName pName = {0}; SName pName = {0};
(void)toName(pTscObj->acctId, pRequest->pDb, req.tbName, &pName); toName(pTscObj->acctId, pRequest->pDb, req.tbName, &pName);
RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo)); RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo));
pArray = taosArrayInit(1, sizeof(void*)); pArray = taosArrayInit(1, sizeof(void*));
RAW_NULL_CHECK(pArray); RAW_NULL_CHECK(pArray);

View File

@ -116,7 +116,7 @@ static int32_t smlCheckAuth(SSmlHandle *info, SRequestConnInfo *conn, const char
return TSDB_CODE_SML_INVALID_DATA; return TSDB_CODE_SML_INVALID_DATA;
} }
} else { } else {
(void)toName(info->taos->acctId, info->pRequest->pDb, pTabName, &pAuth.tbName); //ignore toName(info->taos->acctId, info->pRequest->pDb, pTabName, &pAuth.tbName); //ignore
} }
pAuth.type = type; pAuth.type = type;
@ -1113,7 +1113,10 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
pReq.commentLen = -1; pReq.commentLen = -1;
pReq.igExists = true; pReq.igExists = true;
(void)tNameExtractFullName(pName, pReq.name); code = tNameExtractFullName(pName, pReq.name);
if (TSDB_CODE_SUCCESS != code) {
goto end;
}
pCmdMsg.epSet = getEpSet_s(&info->taos->pAppInfo->mgmtEp); pCmdMsg.epSet = getEpSet_s(&info->taos->pAppInfo->mgmtEp);
pCmdMsg.msgType = TDMT_MND_CREATE_STB; pCmdMsg.msgType = TDMT_MND_CREATE_STB;

View File

@ -87,12 +87,11 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
#endif #endif
SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName) { void toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName) {
pName->type = TSDB_TABLE_NAME_T; pName->type = TSDB_TABLE_NAME_T;
pName->acctId = acctId; pName->acctId = acctId;
snprintf(pName->dbname, sizeof(pName->dbname), "%s", pDbName); snprintf(pName->dbname, sizeof(pName->dbname), "%s", pDbName);
snprintf(pName->tname, sizeof(pName->tname), "%s", pTableName); snprintf(pName->tname, sizeof(pName->tname), "%s", pTableName);
return pName;
} }
int32_t tNameExtractFullName(const SName* name, char* dst) { int32_t tNameExtractFullName(const SName* name, char* dst) {

View File

@ -368,7 +368,11 @@ static void *mndBuildVDropSmaReq(SMnode *pMnode, SVgObj *pVgroup, SSmaObj *pSma,
SEncoder encoder = {0}; SEncoder encoder = {0};
int32_t contLen; int32_t contLen;
SName name = {0}; SName name = {0};
(void)tNameFromString(&name, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); int32_t code = tNameFromString(&name, pSma->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
if (TSDB_CODE_SUCCESS != code) {
terrno = code;
return NULL;
}
SVDropTSmaReq req = {0}; SVDropTSmaReq req = {0};
req.indexUid = pSma->uid; req.indexUid = pSma->uid;
@ -1669,8 +1673,7 @@ static int32_t mndSetUpdateDbTsmaVersionPrepareLogs(SMnode *pMnode, STrans *pTra
TAOS_RETURN(code); TAOS_RETURN(code);
} }
(void)sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY); TAOS_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY));
TAOS_RETURN(code);
} }
static int32_t mndSetUpdateDbTsmaVersionCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) { static int32_t mndSetUpdateDbTsmaVersionCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) {
@ -1686,8 +1689,7 @@ static int32_t mndSetUpdateDbTsmaVersionCommitLogs(SMnode *pMnode, STrans *pTran
TAOS_RETURN(code); TAOS_RETURN(code);
} }
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); TAOS_RETURN(sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY));
TAOS_RETURN(code);
} }
static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) { static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) {

View File

@ -235,7 +235,10 @@ void nodesDestroyAllocatorSet() {
int64_t refId = 0; int64_t refId = 0;
while (NULL != pAllocator) { while (NULL != pAllocator) {
refId = pAllocator->self; refId = pAllocator->self;
(void)taosRemoveRef(g_allocatorReqRefPool, refId); int32_t code = taosRemoveRef(g_allocatorReqRefPool, refId);
if (TSDB_CODE_SUCCESS != code) {
nodesError("failed to remove ref at: %s:%d, rsetId:%d, refId:%"PRId64, __func__, __LINE__, g_allocatorReqRefPool, refId);
}
pAllocator = taosIterateRef(g_allocatorReqRefPool, refId); pAllocator = taosIterateRef(g_allocatorReqRefPool, refId);
} }
taosCloseRef(g_allocatorReqRefPool); taosCloseRef(g_allocatorReqRefPool);
@ -328,7 +331,10 @@ void nodesDestroyAllocator(int64_t allocatorId) {
return; return;
} }
(void)taosRemoveRef(g_allocatorReqRefPool, allocatorId); int32_t code = taosRemoveRef(g_allocatorReqRefPool, allocatorId);
if (TSDB_CODE_SUCCESS != code) {
nodesError("failed to remove ref at: %s:%d, rsetId:%d, refId:%"PRId64, __func__, __LINE__, g_allocatorReqRefPool, allocatorId);
}
} }
static int32_t makeNode(ENodeType type, int32_t size, SNode** ppNode) { static int32_t makeNode(ENodeType type, int32_t size, SNode** ppNode) {
@ -1090,7 +1096,10 @@ void nodesDestroyNode(SNode* pNode) {
pStmt->destroyParseFileCxt(&pStmt->pParFileCxt); pStmt->destroyParseFileCxt(&pStmt->pParFileCxt);
} }
(void)taosCloseFile(&pStmt->fp); int32_t code = taosCloseFile(&pStmt->fp);
if (TSDB_CODE_SUCCESS != code) {
nodesError("failed to close file: %s:%d", __func__, __LINE__);
}
break; break;
} }
case QUERY_NODE_CREATE_DATABASE_STMT: case QUERY_NODE_CREATE_DATABASE_STMT:

View File

@ -46,7 +46,7 @@ static int32_t setUserAuthInfo(SParseContext* pCxt, const char* pDbName, const c
int32_t code = tNameSetDbName(&pAuth->tbName, pCxt->acctId, pDbName, strlen(pDbName)); int32_t code = tNameSetDbName(&pAuth->tbName, pCxt->acctId, pDbName, strlen(pDbName));
if (TSDB_CODE_SUCCESS != code) return code; if (TSDB_CODE_SUCCESS != code) return code;
} else { } else {
(void)toName(pCxt->acctId, pDbName, pTabName, &pAuth->tbName); toName(pCxt->acctId, pDbName, pTabName, &pAuth->tbName);
} }
pAuth->type = type; pAuth->type = type;
pAuth->isView = isView; pAuth->isView = isView;
@ -171,8 +171,9 @@ static EDealRes authSelectImpl(SNode* pNode, void* pContext) {
#ifdef TD_ENTERPRISE #ifdef TD_ENTERPRISE
SName name; SName name;
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
toName(pAuthCxt->pParseCxt->acctId, pTable->dbName, pTable->tableName, &name);
int32_t code = getTargetMetaImpl( int32_t code = getTargetMetaImpl(
pAuthCxt->pParseCxt, pAuthCxt->pMetaCache, toName(pAuthCxt->pParseCxt->acctId, pTable->dbName, pTable->tableName, &name), &pTableMeta, true); pAuthCxt->pParseCxt, pAuthCxt->pMetaCache, &name, &pTableMeta, true);
if (TSDB_CODE_SUCCESS == code && TSDB_VIEW_TABLE == pTableMeta->tableType) { if (TSDB_CODE_SUCCESS == code && TSDB_VIEW_TABLE == pTableMeta->tableType) {
isView = true; isView = true;
} }

View File

@ -526,7 +526,8 @@ static int32_t getTargetMeta(STranslateContext* pCxt, const SName* pName, STable
static int32_t getTableMeta(STranslateContext* pCxt, const char* pDbName, const char* pTableName, STableMeta** pMeta) { static int32_t getTableMeta(STranslateContext* pCxt, const char* pDbName, const char* pTableName, STableMeta** pMeta) {
SName name; SName name;
return getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pDbName, pTableName, &name), pMeta, false); toName(pCxt->pParseCxt->acctId, pDbName, pTableName, &name);
return getTargetMeta(pCxt, &name, pMeta, false);
} }
static int32_t getTableCfg(STranslateContext* pCxt, const SName* pName, STableCfg** pCfg) { static int32_t getTableCfg(STranslateContext* pCxt, const SName* pName, STableCfg** pCfg) {
@ -557,7 +558,7 @@ static int32_t refreshGetTableMeta(STranslateContext* pCxt, const char* pDbName,
STableMeta** pMeta) { STableMeta** pMeta) {
SParseContext* pParCxt = pCxt->pParseCxt; SParseContext* pParCxt = pCxt->pParseCxt;
SName name; SName name;
(void)toName(pCxt->pParseCxt->acctId, pDbName, pTableName, &name); toName(pCxt->pParseCxt->acctId, pDbName, pTableName, &name);
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
if (pParCxt->async) { if (pParCxt->async) {
code = getTableMetaFromCache(pCxt->pMetaCache, &name, pMeta); code = getTableMetaFromCache(pCxt->pMetaCache, &name, pMeta);
@ -635,7 +636,8 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam
static int32_t getTableHashVgroup(STranslateContext* pCxt, const char* pDbName, const char* pTableName, static int32_t getTableHashVgroup(STranslateContext* pCxt, const char* pDbName, const char* pTableName,
SVgroupInfo* pInfo) { SVgroupInfo* pInfo) {
SName name; SName name;
return getTableHashVgroupImpl(pCxt, toName(pCxt->pParseCxt->acctId, pDbName, pTableName, &name), pInfo); toName(pCxt->pParseCxt->acctId, pDbName, pTableName, &name);
return getTableHashVgroupImpl(pCxt, &name, pInfo);
} }
static int32_t getDBVgVersion(STranslateContext* pCxt, const char* pDbFName, int32_t* pVersion, int64_t* pDbId, static int32_t getDBVgVersion(STranslateContext* pCxt, const char* pDbFName, int32_t* pVersion, int64_t* pDbId,
@ -4016,7 +4018,7 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
SName tsmaTargetTbName = {0}; SName tsmaTargetTbName = {0};
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
bool exists = false; bool exists = false;
(void)toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName); toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName);
int32_t len = snprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name, int32_t len = snprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name,
pRealTable->table.tableName); pRealTable->table.tableName);
len = taosCreateMD5Hash(buf, len); len = taosCreateMD5Hash(buf, len);
@ -4678,9 +4680,8 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare
// The SRealTableNode created through ROLLUP already has STableMeta. // The SRealTableNode created through ROLLUP already has STableMeta.
if (NULL == pRealTable->pMeta) { if (NULL == pRealTable->pMeta) {
SName name; SName name;
code = getTargetMeta( toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, pRealTable->table.tableName, &name);
pCxt, toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, pRealTable->table.tableName, &name), code = getTargetMeta( pCxt, &name, &(pRealTable->pMeta), true);
&(pRealTable->pMeta), true);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
(void)generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); (void)generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
return code; return code;
@ -6232,7 +6233,7 @@ static void findVgroupsFromEqualTbname(STranslateContext* pCxt, SArray* aTbnames
for (int j = 0; j < nTbls; ++j) { for (int j = 0; j < nTbls; ++j) {
SName snameTb; SName snameTb;
char* tbName = taosArrayGetP(aTbnames, j); char* tbName = taosArrayGetP(aTbnames, j);
(void)toName(pCxt->pParseCxt->acctId, dbName, tbName, &snameTb); toName(pCxt->pParseCxt->acctId, dbName, tbName, &snameTb);
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
bool bExists; bool bExists;
int32_t code = catalogGetCachedTableHashVgroup(pCxt->pParseCxt->pCatalog, &snameTb, &vgInfo, &bExists); int32_t code = catalogGetCachedTableHashVgroup(pCxt->pParseCxt->pCatalog, &snameTb, &vgInfo, &bExists);
@ -6261,7 +6262,7 @@ static int32_t replaceToChildTableQuery(STranslateContext* pCxt, SEqCondTbNameTa
int32_t code = 0; int32_t code = 0;
SRealTableNode* pRealTable = pInfo->pRealTable; SRealTableNode* pRealTable = pInfo->pRealTable;
char* tbName = taosArrayGetP(pInfo->aTbnames, 0); char* tbName = taosArrayGetP(pInfo->aTbnames, 0);
(void)toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, tbName, &snameTb); toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, tbName, &snameTb);
STableMeta* pMeta = NULL; STableMeta* pMeta = NULL;
TAOS_CHECK_RETURN(catalogGetCachedTableMeta(pCxt->pParseCxt->pCatalog, &snameTb, &pMeta)); TAOS_CHECK_RETURN(catalogGetCachedTableMeta(pCxt->pParseCxt->pCatalog, &snameTb, &pMeta));
@ -6282,7 +6283,7 @@ static int32_t replaceToChildTableQuery(STranslateContext* pCxt, SEqCondTbNameTa
for (int32_t i = 0; i < pRealTable->pTsmas->size; ++i) { for (int32_t i = 0; i < pRealTable->pTsmas->size; ++i) {
STableTSMAInfo* pTsma = taosArrayGetP(pRealTable->pTsmas, i); STableTSMAInfo* pTsma = taosArrayGetP(pRealTable->pTsmas, i);
SName tsmaTargetTbName = {0}; SName tsmaTargetTbName = {0};
(void)toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName); toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName);
int32_t len = snprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name, int32_t len = snprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name,
pRealTable->table.tableName); pRealTable->table.tableName);
len = taosCreateMD5Hash(buf, len); len = taosCreateMD5Hash(buf, len);
@ -8822,7 +8823,8 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pReq->numOfFuncs = taosArrayGetSize(pReq->pFuncs); pReq->numOfFuncs = taosArrayGetSize(pReq->pFuncs);
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName);
code = tNameExtractFullName(&tableName, pReq->name);
} }
if (TSDB_CODE_SUCCESS == code) if (TSDB_CODE_SUCCESS == code)
code = collectUseTable(&tableName, pCxt->pTables); code = collectUseTable(&tableName, pCxt->pTables);
@ -8866,19 +8868,20 @@ static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt
SDropTableClause* pClause = (SDropTableClause*)nodesListGetNode(pStmt->pTables, 0); SDropTableClause* pClause = (SDropTableClause*)nodesListGetNode(pStmt->pTables, 0);
SName tableName; SName tableName;
if (pStmt->withTsma) return TSDB_CODE_SUCCESS; if (pStmt->withTsma) return TSDB_CODE_SUCCESS;
return doTranslateDropSuperTable( toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &tableName);
pCxt, toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &tableName), pClause->ignoreNotExists); return doTranslateDropSuperTable( pCxt, &tableName, pClause->ignoreNotExists);
} }
static int32_t translateDropSuperTable(STranslateContext* pCxt, SDropSuperTableStmt* pStmt) { static int32_t translateDropSuperTable(STranslateContext* pCxt, SDropSuperTableStmt* pStmt) {
SName tableName; SName tableName;
return doTranslateDropSuperTable(pCxt, toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName);
pStmt->ignoreNotExists); return doTranslateDropSuperTable(pCxt, &tableName, pStmt->ignoreNotExists);
} }
static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, SMAlterStbReq* pAlterReq) { static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, SMAlterStbReq* pAlterReq) {
SName tableName; SName tableName;
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pAlterReq->name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName);
int32_t code = tNameExtractFullName(&tableName, pAlterReq->name);
if (TSDB_CODE_SUCCESS != code) return code; if (TSDB_CODE_SUCCESS != code) return code;
pAlterReq->alterType = pStmt->alterType; pAlterReq->alterType = pStmt->alterType;
@ -9394,10 +9397,12 @@ static int32_t getSmaIndexAst(STranslateContext* pCxt, SCreateIndexStmt* pStmt,
static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) { static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) {
SName name; SName name;
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), pReq->name); toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name);
int32_t code = tNameExtractFullName(&name, pReq->name);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
memset(&name, 0, sizeof(SName)); memset(&name, 0, sizeof(SName));
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stb); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
code = tNameExtractFullName(&name, pReq->stb);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pReq->igExists = pStmt->ignoreExists; pReq->igExists = pStmt->ignoreExists;
@ -9545,10 +9550,12 @@ static int32_t buildCreateFullTextReq(STranslateContext* pCxt, SCreateIndexStmt*
static int32_t buildCreateTagIndexReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SCreateTagIndexReq* pReq) { static int32_t buildCreateTagIndexReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SCreateTagIndexReq* pReq) {
SName name; SName name;
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), pReq->idxName); toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name);
int32_t code = tNameExtractFullName(&name, pReq->idxName);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
memset(&name, 0, sizeof(SName)); memset(&name, 0, sizeof(SName));
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stbName); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
code = tNameExtractFullName(&name, pReq->stbName);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
memset(&name, 0, sizeof(SName)); memset(&name, 0, sizeof(SName));
@ -9584,8 +9591,8 @@ static int32_t translateCreateNormalIndex(STranslateContext* pCxt, SCreateIndexS
int32_t code = 0; int32_t code = 0;
SName name; SName name;
STableMeta* pMeta = NULL; STableMeta* pMeta = NULL;
toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
code = getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), &pMeta, false); code = getTargetMeta(pCxt, &name, &pMeta, false);
if (code) { if (code) {
taosMemoryFree(pMeta); taosMemoryFree(pMeta);
return code; return code;
@ -9627,7 +9634,8 @@ static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* p
static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) { static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) {
SMDropSmaReq dropSmaReq = {0}; SMDropSmaReq dropSmaReq = {0};
SName name; SName name;
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), dropSmaReq.name); toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name);
int32_t code = tNameExtractFullName(&name, dropSmaReq.name);
if (TSDB_CODE_SUCCESS != code) return code; if (TSDB_CODE_SUCCESS != code) return code;
dropSmaReq.igNotExists = pStmt->ignoreNotExists; dropSmaReq.igNotExists = pStmt->ignoreNotExists;
return buildCmdMsg(pCxt, TDMT_MND_DROP_SMA, (FSerializeFunc)tSerializeSMDropSmaReq, &dropSmaReq); return buildCmdMsg(pCxt, TDMT_MND_DROP_SMA, (FSerializeFunc)tSerializeSMDropSmaReq, &dropSmaReq);
@ -9702,11 +9710,11 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
SName name; SName name;
if ('\0' != pStmt->subSTbName[0]) { if ('\0' != pStmt->subSTbName[0]) {
pReq->subType = TOPIC_SUB_TYPE__TABLE; pReq->subType = TOPIC_SUB_TYPE__TABLE;
(void)toName(pCxt->pParseCxt->acctId, pStmt->subDbName, pStmt->subSTbName, &name); toName(pCxt->pParseCxt->acctId, pStmt->subDbName, pStmt->subSTbName, &name);
(void)tNameGetFullDbName(&name, pReq->subDbName); (void)tNameGetFullDbName(&name, pReq->subDbName);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
(void)tNameExtractFullName(&name, pReq->subStbName); code = tNameExtractFullName(&name, pReq->subStbName);
if (pStmt->pQuery != NULL) { if (TSDB_CODE_SUCCESS == code && pStmt->pQuery != NULL) {
code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL); code = nodesNodeToString(pStmt->pQuery, false, &pReq->ast, NULL);
} }
} }
@ -9829,8 +9837,8 @@ static int32_t buildQueryForTableTopic(STranslateContext* pCxt, SCreateTopicStmt
.mgmtEps = pParCxt->mgmtEpSet}; .mgmtEps = pParCxt->mgmtEpSet};
SName name; SName name;
STableMeta* pMeta = NULL; STableMeta* pMeta = NULL;
int32_t code = toName(pParCxt->acctId, pStmt->subDbName, pStmt->subSTbName, &name);
getTargetMeta(pCxt, toName(pParCxt->acctId, pStmt->subDbName, pStmt->subSTbName, &name), &pMeta, false); int32_t code = getTargetMeta(pCxt, &name, &pMeta, false);
if (code) { if (code) {
taosMemoryFree(pMeta); taosMemoryFree(pMeta);
return code; return code;
@ -9952,7 +9960,7 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt)
if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) { if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) {
int32_t origCode = code; int32_t origCode = code;
SName name; SName name;
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
SViewMeta* pMeta = NULL; SViewMeta* pMeta = NULL;
code = getViewMetaFromMetaCache(pCxt, &name, &pMeta); code = getViewMetaFromMetaCache(pCxt, &name, &pMeta);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
@ -10072,9 +10080,8 @@ static int32_t checkCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pSt
SName name; SName name;
STableMeta* pMeta = NULL; STableMeta* pMeta = NULL;
int8_t tableType = 0; int8_t tableType = 0;
int32_t code = toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, pRealTable->table.tableName, &name);
getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, pRealTable->table.tableName, &name), int32_t code = getTargetMeta(pCxt, &name, &pMeta, true);
&pMeta, true);
if (NULL != pMeta) { if (NULL != pMeta) {
tableType = pMeta->tableType; tableType = pMeta->tableType;
taosMemoryFree(pMeta); taosMemoryFree(pMeta);
@ -11103,10 +11110,11 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt*
if ('\0' != pStmt->targetTabName[0]) { if ('\0' != pStmt->targetTabName[0]) {
strcpy(name.dbname, pStmt->targetDbName); strcpy(name.dbname, pStmt->targetDbName);
strcpy(name.tname, pStmt->targetTabName); strcpy(name.tname, pStmt->targetTabName);
(void)tNameExtractFullName(&name, pReq->targetStbFullName); code = tNameExtractFullName(&name, pReq->targetStbFullName);
} }
if (TSDB_CODE_SUCCESS == code) {
code = buildCreateStreamQuery(pCxt, pStmt, pReq); code = buildCreateStreamQuery(pCxt, pStmt, pReq);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pReq->sql = taosStrdup(pCxt->pParseCxt->pSql); pReq->sql = taosStrdup(pCxt->pParseCxt->pSql);
if (NULL == pReq->sql) { if (NULL == pReq->sql) {
@ -11312,7 +11320,7 @@ static int32_t translateCreateView(STranslateContext* pCxt, SCreateViewStmt* pSt
SParseSqlRes res = {.resType = PARSE_SQL_RES_SCHEMA}; SParseSqlRes res = {.resType = PARSE_SQL_RES_SCHEMA};
SName name; SName name;
char dbFName[TSDB_DB_FNAME_LEN]; char dbFName[TSDB_DB_FNAME_LEN];
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, &name);
(void)tNameGetFullDbName(&name, dbFName); (void)tNameGetFullDbName(&name, dbFName);
int32_t code = validateCreateView(pCxt, pStmt); int32_t code = validateCreateView(pCxt, pStmt);
@ -11363,7 +11371,7 @@ static int32_t translateDropView(STranslateContext* pCxt, SDropViewStmt* pStmt)
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
dropReq.igNotExists = pStmt->ignoreNotExists; dropReq.igNotExists = pStmt->ignoreNotExists;
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, &name);
code = collectUseTable(&name, pCxt->pTargetTables); code = collectUseTable(&name, pCxt->pTargetTables);
} }
@ -11399,7 +11407,8 @@ static int32_t readFromFile(char* pName, int32_t* len, char** buf) {
int64_t s = taosReadFile(tfile, *buf, *len); int64_t s = taosReadFile(tfile, *buf, *len);
if (s != *len) { if (s != *len) {
(void)taosCloseFile(&tfile); int32_t code = taosCloseFile(&tfile);
qError("failed to close file: %s in %s:%d, err: %s", pName, __func__, __LINE__, tstrerror(code));
taosMemoryFreeClear(*buf); taosMemoryFreeClear(*buf);
return TSDB_CODE_APP_ERROR; return TSDB_CODE_APP_ERROR;
} }
@ -11473,8 +11482,8 @@ static int32_t translateGrantTagCond(STranslateContext* pCxt, SGrantStmt* pStmt,
int32_t code = createRealTableForGrantTable(pStmt, &pTable); int32_t code = createRealTableForGrantTable(pStmt, &pTable);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
SName name; SName name;
code = getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pTable->table.dbName, pTable->table.tableName, &name), toName(pCxt->pParseCxt->acctId, pTable->table.dbName, pTable->table.tableName, &name);
&(pTable->pMeta), false); code = getTargetMeta(pCxt, &name, &(pTable->pMeta), false);
if (code) { if (code) {
nodesDestroyNode((SNode*)pTable); nodesDestroyNode((SNode*)pTable);
return code; return code;
@ -11516,8 +11525,8 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) {
if (0 != pStmt->tabName[0]) { if (0 != pStmt->tabName[0]) {
SName name; SName name;
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
code = toName(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, &name);
getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, &name), &pTableMeta, true); code = getTargetMeta(pCxt, &name, &pTableMeta, true);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
if (TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { if (TSDB_CODE_PAR_TABLE_NOT_EXIST != code) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
@ -11552,8 +11561,8 @@ static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) {
if (0 != pStmt->tabName[0]) { if (0 != pStmt->tabName[0]) {
SName name; SName name;
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
code = toName(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, &name);
getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, &name), &pTableMeta, true); code = getTargetMeta(pCxt, &name, &pTableMeta, true);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
if (TSDB_CODE_PAR_TABLE_NOT_EXIST != code) { if (TSDB_CODE_PAR_TABLE_NOT_EXIST != code) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
@ -11667,7 +11676,7 @@ static int32_t translateShowCreateTable(STranslateContext* pCxt, SShowCreateTabl
int32_t code = getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pDbCfg); int32_t code = getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pDbCfg);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
SName name; SName name;
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
code = getTableCfg(pCxt, &name, (STableCfg**)&pStmt->pTableCfg); code = getTableCfg(pCxt, &name, (STableCfg**)&pStmt->pTableCfg);
} }
return code; return code;
@ -11678,7 +11687,7 @@ static int32_t translateShowCreateView(STranslateContext* pCxt, SShowCreateViewS
return TSDB_CODE_OPS_NOT_SUPPORT; return TSDB_CODE_OPS_NOT_SUPPORT;
#else #else
SName name; SName name;
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, &name);
return getViewMetaFromMetaCache(pCxt, &name, (SViewMeta**)&pStmt->pViewMeta); return getViewMetaFromMetaCache(pCxt, &name, (SViewMeta**)&pStmt->pViewMeta);
#endif #endif
} }
@ -11949,10 +11958,11 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm
SName name; SName name;
SDbCfgInfo pDbInfo = {0}; SDbCfgInfo pDbInfo = {0};
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tsmaName, &name), pReq->name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tsmaName, &name);
code = tNameExtractFullName(&name, pReq->name);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
memset(&name, 0, sizeof(SName)); memset(&name, 0, sizeof(SName));
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, useTbName); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, useTbName);
code = tNameExtractFullName(useTbName, pReq->stb); code = tNameExtractFullName(useTbName, pReq->stb);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
@ -12025,7 +12035,8 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
memset(useTbName, 0, sizeof(SName)); memset(useTbName, 0, sizeof(SName));
memcpy(pStmt->originalTbName, pRecursiveTsma->tb, TSDB_TABLE_NAME_LEN); memcpy(pStmt->originalTbName, pRecursiveTsma->tb, TSDB_TABLE_NAME_LEN);
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pRecursiveTsma->tb, useTbName), pReq->stb); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pRecursiveTsma->tb, useTbName);
code = tNameExtractFullName(useTbName, pReq->stb);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
numOfCols = pRecursiveTsma->pUsedCols->size; numOfCols = pRecursiveTsma->pUsedCols->size;
@ -12146,7 +12157,7 @@ int32_t translatePostCreateTSMA(SParseContext* pParseCxt, SQuery* pQuery, SSData
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
SName name = {0}; SName name = {0};
(void)toName(pParseCxt->acctId, pStmt->dbName, pStmt->originalTbName, &name); toName(pParseCxt->acctId, pStmt->dbName, pStmt->originalTbName, &name);
code = collectUseTable(&name, cxt.pTargetTables); code = collectUseTable(&name, cxt.pTargetTables);
} }
@ -12165,13 +12176,14 @@ static int32_t translateDropTSMA(STranslateContext* pCxt, SDropTSMAStmt* pStmt)
SMDropSmaReq dropReq = {0}; SMDropSmaReq dropReq = {0};
SName name; SName name;
STableTSMAInfo* pTsma = NULL; STableTSMAInfo* pTsma = NULL;
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tsmaName, &name), dropReq.name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tsmaName, &name);
code = tNameExtractFullName(&name, dropReq.name);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
dropReq.igNotExists = pStmt->ignoreNotExists; dropReq.igNotExists = pStmt->ignoreNotExists;
code = getTsma(pCxt, &name, &pTsma); code = getTsma(pCxt, &name, &pTsma);
} }
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pTsma->tb, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pTsma->tb, &name);
code = collectUseTable(&name, pCxt->pTargetTables); code = collectUseTable(&name, pCxt->pTargetTables);
} }
if (TSDB_CODE_SUCCESS == code) if (TSDB_CODE_SUCCESS == code)
@ -13071,10 +13083,8 @@ static int32_t checkShowTags(STranslateContext* pCxt, const SShowStmt* pShow) {
int32_t code = 0; int32_t code = 0;
SName name; SName name;
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
code = getTargetMeta(pCxt, toName(pCxt->pParseCxt->acctId, ((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal, &name);
toName(pCxt->pParseCxt->acctId, ((SValueNode*)pShow->pDbName)->literal, code = getTargetMeta(pCxt, &name, &pTableMeta, true);
((SValueNode*)pShow->pTbName)->literal, &name),
&pTableMeta, true);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
goto _exit; goto _exit;
@ -13433,7 +13443,7 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) {
int32_t code = checkCreateTable(pCxt, pStmt, false); int32_t code = checkCreateTable(pCxt, pStmt, false);
SVgroupInfo info = {0}; SVgroupInfo info = {0};
SName name; SName name;
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = getTableHashVgroupImpl(pCxt, &name, &info); code = getTableHashVgroupImpl(pCxt, &name, &info);
} }
@ -13681,7 +13691,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
SName name; SName name;
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
code = collectUseTable(&name, pCxt->pTargetTables); code = collectUseTable(&name, pCxt->pTargetTables);
} }
@ -14447,7 +14457,7 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) {
FOREACH(pNode, pStmt->pTables) { FOREACH(pNode, pStmt->pTables) {
SDropTableClause* pClause = (SDropTableClause*)pNode; SDropTableClause* pClause = (SDropTableClause*)pNode;
SName name; SName name;
(void)toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &name); toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &name);
int32_t code = buildDropTableVgroupHashmap(pCxt, pClause, &name, &tableType, pVgroupHashmap); int32_t code = buildDropTableVgroupHashmap(pCxt, pClause, &name, &tableType, pVgroupHashmap);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
taosHashCleanup(pVgroupHashmap); taosHashCleanup(pVgroupHashmap);
@ -14523,7 +14533,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
SArray* pTsmas = NULL; SArray* pTsmas = NULL;
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
if (pCxt->pMetaCache) { if (pCxt->pMetaCache) {
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tbName); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tbName);
code = getTableTsmasFromCache(pCxt->pMetaCache, &tbName, &pTsmas); code = getTableTsmasFromCache(pCxt->pMetaCache, &tbName, &pTsmas);
if (code != TSDB_CODE_SUCCESS) return code; if (code != TSDB_CODE_SUCCESS) return code;
if (pTsmas && pTsmas->size > 0) return TSDB_CODE_TSMA_MUST_BE_DROPPED; if (pTsmas && pTsmas->size > 0) return TSDB_CODE_TSMA_MUST_BE_DROPPED;
@ -14707,7 +14717,7 @@ static int32_t buildRenameColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt
SArray* pTsmas = NULL; SArray* pTsmas = NULL;
SName tbName; SName tbName;
int32_t code = 0; int32_t code = 0;
(void)toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tbName); toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tbName);
if (pCxt->pMetaCache) code = getTableTsmasFromCache(pCxt->pMetaCache, &tbName, &pTsmas); if (pCxt->pMetaCache) code = getTableTsmasFromCache(pCxt->pMetaCache, &tbName, &pTsmas);
if (TSDB_CODE_SUCCESS != code) return code; if (TSDB_CODE_SUCCESS != code) return code;
if (pTsmas && pTsmas->size > 0) { if (pTsmas && pTsmas->size > 0) {