set super table name for stb syntax and rename setRefreshMate to setRefreshMeta
This commit is contained in:
parent
cb2311fde6
commit
332268fd4b
|
@ -439,7 +439,10 @@ typedef struct SVnodeModifyOpStmt {
|
||||||
FFreeVgourpBlockArray freeArrayFunc;
|
FFreeVgourpBlockArray freeArrayFunc;
|
||||||
bool usingTableProcessing;
|
bool usingTableProcessing;
|
||||||
bool fileProcessing;
|
bool fileProcessing;
|
||||||
|
|
||||||
bool stbSyntax;
|
bool stbSyntax;
|
||||||
|
SName superTableName;
|
||||||
|
SName childTableName;
|
||||||
} SVnodeModifyOpStmt;
|
} SVnodeModifyOpStmt;
|
||||||
|
|
||||||
typedef struct SExplainOptions {
|
typedef struct SExplainOptions {
|
||||||
|
|
|
@ -1068,6 +1068,7 @@ static int32_t getTargetTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModi
|
||||||
if (NULL != pStmt->pTableMeta) {
|
if (NULL != pStmt->pTableMeta) {
|
||||||
if (pStmt->pTableMeta->tableType == TSDB_SUPER_TABLE) {
|
if (pStmt->pTableMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
pStmt->stbSyntax = true;
|
pStmt->stbSyntax = true;
|
||||||
|
tNameAssign(&pStmt->superTableName, &pStmt->targetTableName);
|
||||||
} else {
|
} else {
|
||||||
code = taosHashPut(pStmt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg));
|
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_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
if (TSDB_SUPER_TABLE == pStmt->pTableMeta->tableType) {
|
if (TSDB_SUPER_TABLE == pStmt->pTableMeta->tableType) {
|
||||||
pStmt->stbSyntax = true;
|
pStmt->stbSyntax = true;
|
||||||
|
tNameAssign(&pStmt->superTableName, &pStmt->targetTableName);
|
||||||
}
|
}
|
||||||
if (!pStmt->stbSyntax) {
|
if (!pStmt->stbSyntax) {
|
||||||
code = getTableVgroup(pCxt->pComCxt, pStmt, false, &pCxt->missCache);
|
code = getTableVgroup(pCxt->pComCxt, pStmt, false, &pCxt->missCache);
|
||||||
|
@ -1795,6 +1797,7 @@ static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStm
|
||||||
pStmt->usingTableProcessing = false;
|
pStmt->usingTableProcessing = false;
|
||||||
pStmt->fileProcessing = false;
|
pStmt->fileProcessing = false;
|
||||||
pStmt->usingTableName.type = 0;
|
pStmt->usingTableName.type = 0;
|
||||||
|
pStmt->stbSyntax = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// input pStmt->pSql: [(field1_name, ...)] [ USING ... ] VALUES ... | FILE ...
|
// input pStmt->pSql: [(field1_name, ...)] [ USING ... ] VALUES ... | FILE ...
|
||||||
|
@ -1802,8 +1805,14 @@ static int32_t parseInsertTableClause(SInsertParseContext* pCxt, SVnodeModifyOpS
|
||||||
resetEnvPreTable(pCxt, pStmt);
|
resetEnvPreTable(pCxt, pStmt);
|
||||||
int32_t code = parseSchemaClauseTop(pCxt, pStmt, pTbName);
|
int32_t code = parseSchemaClauseTop(pCxt, pStmt, pTbName);
|
||||||
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
if (TSDB_CODE_SUCCESS == code && !pCxt->missCache) {
|
||||||
|
if (!pStmt->stbSyntax) {
|
||||||
code = parseInsertTableClauseBottom(pCxt, pStmt);
|
code = parseInsertTableClauseBottom(pCxt, pStmt);
|
||||||
|
} else {
|
||||||
|
//code = parseInsertStbClauseBottom(pCxt, pStmt);
|
||||||
|
code = TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2142,7 +2151,7 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t setRefreshMate(SQuery* pQuery) {
|
static int32_t setRefreshMeta(SQuery* pQuery) {
|
||||||
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
||||||
|
|
||||||
if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) {
|
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)) &&
|
if ((TSDB_CODE_SUCCESS == code || NEED_CLIENT_HANDLE_ERROR(code)) &&
|
||||||
QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) {
|
QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) {
|
||||||
code = setRefreshMate(*pQuery);
|
code = setRefreshMeta(*pQuery);
|
||||||
}
|
}
|
||||||
insDestroyBoundColInfo(&context.tags);
|
insDestroyBoundColInfo(&context.tags);
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -261,7 +261,7 @@ static int32_t createSimpleSelectStmtFromProjList(const char* pDb, const char*
|
||||||
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);
|
||||||
static int32_t setQuery(STranslateContext* pCxt, SQuery* 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; }
|
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) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setQuery(&pCxt, pQuery);
|
code = setQuery(&pCxt, pQuery);
|
||||||
}
|
}
|
||||||
setRefreshMate(&pCxt, pQuery);
|
setRefreshMeta(&pCxt, pQuery);
|
||||||
destroyTranslateContext(&pCxt);
|
destroyTranslateContext(&pCxt);
|
||||||
tFreeSMCreateSmaReq(pStmt->pReq);
|
tFreeSMCreateSmaReq(pStmt->pReq);
|
||||||
taosMemoryFreeClear(pStmt->pReq);
|
taosMemoryFreeClear(pStmt->pReq);
|
||||||
|
@ -7366,7 +7366,7 @@ int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setQuery(&cxt, pQuery);
|
code = setQuery(&cxt, pQuery);
|
||||||
}
|
}
|
||||||
setRefreshMate(&cxt, pQuery);
|
setRefreshMeta(&cxt, pQuery);
|
||||||
destroyTranslateContext(&cxt);
|
destroyTranslateContext(&cxt);
|
||||||
|
|
||||||
tFreeSCMCreateStreamReq(pStmt->pReq);
|
tFreeSCMCreateStreamReq(pStmt->pReq);
|
||||||
|
@ -9590,7 +9590,7 @@ static int32_t toMsgType(ENodeType type) {
|
||||||
return TDMT_VND_CREATE_TABLE;
|
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) {
|
if (NULL != pCxt->pDbs) {
|
||||||
taosArrayDestroy(pQuery->pDbList);
|
taosArrayDestroy(pQuery->pDbList);
|
||||||
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
|
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) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setQuery(&cxt, pQuery);
|
code = setQuery(&cxt, pQuery);
|
||||||
}
|
}
|
||||||
setRefreshMate(&cxt, pQuery);
|
setRefreshMeta(&cxt, pQuery);
|
||||||
destroyTranslateContext(&cxt);
|
destroyTranslateContext(&cxt);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue