enhance: begin parse cols

This commit is contained in:
slzhou 2023-10-20 17:16:45 +08:00
parent ce6be3d3e7
commit 3fe5c447e7
3 changed files with 24 additions and 4 deletions

View File

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

View File

@ -1783,6 +1783,25 @@ static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStm
pStmt->stbSyntax = false;
}
static int32_t parseStbBoundColumnsClause(SInsertParseContext* pCxt, const char* pBoundCols,
STableMeta* pTableMeta, SBoundColInfo* pBoundColsInfo) {
return TSDB_CODE_SUCCESS;
}
static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS;
STableComInfo tblInfo = getTableInfo(pStmt->pTableMeta);
SBoundColInfo stbBoundColInfo;
insInitBoundColsInfo(tblInfo.numOfColumns + tblInfo.numOfTags + 1, &stbBoundColInfo);
if (!pStmt->pBoundCols) {
return buildSyntaxErrMsg(&pCxt->msg, "(...tbname...) bounded cols is expected", pStmt->pSql);
}
SToken token;
int32_t index = 0;
parseStbBoundColumnsClause(pCxt, pStmt->pBoundCols, pStmt->pTableMeta, &stbBoundColInfo);
return code;
}
// input pStmt->pSql: [(field1_name, ...)] [ USING ... ] VALUES ... | FILE ...
static int32_t parseInsertTableClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, SToken* pTbName) {
resetEnvPreTable(pCxt, pStmt);
@ -1791,8 +1810,7 @@ static int32_t parseInsertTableClause(SInsertParseContext* pCxt, SVnodeModifyOpS
if (!pStmt->stbSyntax) {
code = parseInsertTableClauseBottom(pCxt, pStmt);
} else {
//code = parseInsertStbClauseBottom(pCxt, pStmt);
code = TSDB_CODE_SUCCESS;
code = parseInsertStbClauseBottom(pCxt, pStmt);
}
}

View File

@ -177,7 +177,9 @@ int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo* pInfo) {
if (NULL == pInfo->pColIndex) {
return TSDB_CODE_OUT_OF_MEMORY;
}
initBoundCols(numOfBound, pInfo->pColIndex);
for (int32_t i = 0; i < numOfBound; ++i) {
pInfo->pColIndex[i] = i;
}
return TSDB_CODE_SUCCESS;
}