diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 8d4e94663f..40963d5af2 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -121,6 +121,7 @@ typedef struct SCreateSubTableClause { bool ignoreExists; SNodeList* pSpecificTags; SNodeList* pValsOfTags; + STableOptions* pOptions; } SCreateSubTableClause; typedef struct SCreateMultiTableStmt { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 72666f833d..2d0e2861ca 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -508,6 +508,7 @@ void nodesDestroyNode(SNode* pNode) { SCreateSubTableClause* pStmt = (SCreateSubTableClause*)pNode; nodesDestroyList(pStmt->pSpecificTags); nodesDestroyList(pStmt->pValsOfTags); + nodesDestroyNode((SNode*)pStmt->pOptions); break; } case QUERY_NODE_CREATE_MULTI_TABLE_STMT: diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index ca066c7056..05b2b0c31c 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -957,9 +957,9 @@ SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SN pStmt->ignoreExists = ignoreExists; pStmt->pSpecificTags = pSpecificTags; pStmt->pValsOfTags = pValsOfTags; + pStmt->pOptions = (STableOptions*)pOptions; nodesDestroyNode(pRealTable); nodesDestroyNode(pUseRealTable); - nodesDestroyNode(pOptions); return (SNode*)pStmt; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index fcf2f57dec..e887d00e2c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -4252,6 +4252,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt* SVCreateTbReq req = {0}; req.type = TD_NORMAL_TABLE; req.name = strdup(pStmt->tableName); + req.ttl = pStmt->pOptions->ttl; req.ntb.schemaRow.nCols = LIST_LENGTH(pStmt->pCols); req.ntb.schemaRow.version = 1; req.ntb.schemaRow.pSchema = taosMemoryCalloc(req.ntb.schemaRow.nCols, sizeof(SSchema)); @@ -4402,6 +4403,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S struct SVCreateTbReq req = {0}; req.type = TD_CHILD_TABLE; req.name = strdup(pStmt->tableName); + req.ttl = pStmt->pOptions->ttl; req.ctb.suid = suid; req.ctb.pTag = (uint8_t*)pTag; if (pStmt->ignoreExists) {