set super table name for stb syntax and rename setRefreshMate to setRefreshMeta

This commit is contained in:
slzhou 2023-10-19 15:55:24 +08:00
parent cb2311fde6
commit 332268fd4b
3 changed files with 20 additions and 8 deletions

View File

@ -439,7 +439,10 @@ typedef struct SVnodeModifyOpStmt {
FFreeVgourpBlockArray freeArrayFunc;
bool usingTableProcessing;
bool fileProcessing;
bool stbSyntax;
SName superTableName;
SName childTableName;
} SVnodeModifyOpStmt;
typedef struct SExplainOptions {

View File

@ -1068,6 +1068,7 @@ static int32_t getTargetTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModi
if (NULL != pStmt->pTableMeta) {
if (pStmt->pTableMeta->tableType == TSDB_SUPER_TABLE) {
pStmt->stbSyntax = true;
tNameAssign(&pStmt->superTableName, &pStmt->targetTableName);
} else {
code = taosHashPut(pStmt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg));
}
@ -1081,6 +1082,7 @@ static int32_t getTargetTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModi
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
if (TSDB_SUPER_TABLE == pStmt->pTableMeta->tableType) {
pStmt->stbSyntax = true;
tNameAssign(&pStmt->superTableName, &pStmt->targetTableName);
}
if (!pStmt->stbSyntax) {
code = getTableVgroup(pCxt->pComCxt, pStmt, false, &pCxt->missCache);
@ -1795,6 +1797,7 @@ static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStm
pStmt->usingTableProcessing = false;
pStmt->fileProcessing = false;
pStmt->usingTableName.type = 0;
pStmt->stbSyntax = false;
}
// input pStmt->pSql: [(field1_name, ...)] [ USING ... ] VALUES ... | FILE ...
@ -1802,8 +1805,14 @@ static int32_t parseInsertTableClause(SInsertParseContext* pCxt, SVnodeModifyOpS
resetEnvPreTable(pCxt, pStmt);
int32_t code = parseSchemaClauseTop(pCxt, pStmt, pTbName);
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
code = parseInsertTableClauseBottom(pCxt, pStmt);
if (!pStmt->stbSyntax) {
code = parseInsertTableClauseBottom(pCxt, pStmt);
} else {
//code = parseInsertStbClauseBottom(pCxt, pStmt);
code = TSDB_CODE_SUCCESS;
}
}
return code;
}
@ -2142,7 +2151,7 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR
return TSDB_CODE_SUCCESS;
}
static int32_t setRefreshMate(SQuery* pQuery) {
static int32_t setRefreshMeta(SQuery* pQuery) {
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) {
@ -2315,7 +2324,7 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal
}
if ((TSDB_CODE_SUCCESS == code || NEED_CLIENT_HANDLE_ERROR(code)) &&
QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) {
code = setRefreshMate(*pQuery);
code = setRefreshMeta(*pQuery);
}
insDestroyBoundColInfo(&context.tags);
return code;

View File

@ -261,7 +261,7 @@ static int32_t createSimpleSelectStmtFromProjList(const char* pDb, const char*
SSelectStmt** pStmt);
static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta, SNode** pQuery);
static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery);
static int32_t setRefreshMate(STranslateContext* pCxt, SQuery* pQuery);
static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery);
static bool afterGroupBy(ESqlClause clause) { return clause > SQL_CLAUSE_GROUP_BY; }
@ -6147,7 +6147,7 @@ int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, vo
if (TSDB_CODE_SUCCESS == code) {
code = setQuery(&pCxt, pQuery);
}
setRefreshMate(&pCxt, pQuery);
setRefreshMeta(&pCxt, pQuery);
destroyTranslateContext(&pCxt);
tFreeSMCreateSmaReq(pStmt->pReq);
taosMemoryFreeClear(pStmt->pReq);
@ -7366,7 +7366,7 @@ int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void
if (TSDB_CODE_SUCCESS == code) {
code = setQuery(&cxt, pQuery);
}
setRefreshMate(&cxt, pQuery);
setRefreshMeta(&cxt, pQuery);
destroyTranslateContext(&cxt);
tFreeSCMCreateStreamReq(pStmt->pReq);
@ -9590,7 +9590,7 @@ static int32_t toMsgType(ENodeType type) {
return TDMT_VND_CREATE_TABLE;
}
static int32_t setRefreshMate(STranslateContext* pCxt, SQuery* pQuery) {
static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
if (NULL != pCxt->pDbs) {
taosArrayDestroy(pQuery->pDbList);
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
@ -9724,7 +9724,7 @@ int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMe
if (TSDB_CODE_SUCCESS == code) {
code = setQuery(&cxt, pQuery);
}
setRefreshMate(&cxt, pQuery);
setRefreshMeta(&cxt, pQuery);
destroyTranslateContext(&cxt);
return code;
}