refact
This commit is contained in:
parent
763a5550d0
commit
3a50257aa3
|
@ -1432,7 +1432,6 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct SVCreateTbReq {
|
typedef struct SVCreateTbReq {
|
||||||
int64_t ver; // use a general definition
|
int64_t ver; // use a general definition
|
||||||
char* dbFName;
|
|
||||||
char* name;
|
char* name;
|
||||||
uint32_t ttl;
|
uint32_t ttl;
|
||||||
uint32_t keep;
|
uint32_t keep;
|
||||||
|
|
|
@ -398,7 +398,6 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
|
|
||||||
tlen += taosEncodeFixedI64(buf, pReq->ver);
|
tlen += taosEncodeFixedI64(buf, pReq->ver);
|
||||||
tlen += taosEncodeString(buf, pReq->dbFName);
|
|
||||||
tlen += taosEncodeString(buf, pReq->name);
|
tlen += taosEncodeString(buf, pReq->name);
|
||||||
tlen += taosEncodeFixedU32(buf, pReq->ttl);
|
tlen += taosEncodeFixedU32(buf, pReq->ttl);
|
||||||
tlen += taosEncodeFixedU32(buf, pReq->keep);
|
tlen += taosEncodeFixedU32(buf, pReq->keep);
|
||||||
|
@ -467,7 +466,6 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
|
||||||
|
|
||||||
void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
|
void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
|
||||||
buf = taosDecodeFixedI64(buf, &(pReq->ver));
|
buf = taosDecodeFixedI64(buf, &(pReq->ver));
|
||||||
buf = taosDecodeString(buf, &(pReq->dbFName));
|
|
||||||
buf = taosDecodeString(buf, &(pReq->name));
|
buf = taosDecodeString(buf, &(pReq->name));
|
||||||
buf = taosDecodeFixedU32(buf, &(pReq->ttl));
|
buf = taosDecodeFixedU32(buf, &(pReq->ttl));
|
||||||
buf = taosDecodeFixedU32(buf, &(pReq->keep));
|
buf = taosDecodeFixedU32(buf, &(pReq->keep));
|
||||||
|
|
|
@ -349,7 +349,6 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
|
||||||
|
|
||||||
SVCreateTbReq req = {0};
|
SVCreateTbReq req = {0};
|
||||||
req.ver = 0;
|
req.ver = 0;
|
||||||
req.dbFName = dbFName;
|
|
||||||
req.name = (char *)tNameGetTableName(&name);
|
req.name = (char *)tNameGetTableName(&name);
|
||||||
req.ttl = 0;
|
req.ttl = 0;
|
||||||
req.keep = 0;
|
req.keep = 0;
|
||||||
|
|
|
@ -217,7 +217,6 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, void *pReq) {
|
||||||
taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam->pFuncIds);
|
taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam->pFuncIds);
|
||||||
taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam);
|
taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam);
|
||||||
}
|
}
|
||||||
taosMemoryFree(vCreateTbReq.dbFName);
|
|
||||||
taosMemoryFree(vCreateTbReq.name);
|
taosMemoryFree(vCreateTbReq.name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -233,7 +232,7 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, SRpcMsg *pMsg, void *pReq, SR
|
||||||
|
|
||||||
char tableFName[TSDB_TABLE_FNAME_LEN];
|
char tableFName[TSDB_TABLE_FNAME_LEN];
|
||||||
SMsgHead *pHead = (SMsgHead *)pMsg->pCont;
|
SMsgHead *pHead = (SMsgHead *)pMsg->pCont;
|
||||||
sprintf(tableFName, "%s.%s", pCreateTbReq->dbFName, pCreateTbReq->name);
|
sprintf(tableFName, "%s.%s", pVnode->config.dbname, pCreateTbReq->name);
|
||||||
|
|
||||||
int32_t code = vnodeValidateTableHash(&pVnode->config, tableFName);
|
int32_t code = vnodeValidateTableHash(&pVnode->config, tableFName);
|
||||||
if (code) {
|
if (code) {
|
||||||
|
@ -249,7 +248,6 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, SRpcMsg *pMsg, void *pReq, SR
|
||||||
}
|
}
|
||||||
// TODO: to encapsule a free API
|
// TODO: to encapsule a free API
|
||||||
taosMemoryFree(pCreateTbReq->name);
|
taosMemoryFree(pCreateTbReq->name);
|
||||||
taosMemoryFree(pCreateTbReq->dbFName);
|
|
||||||
if (pCreateTbReq->type == TD_SUPER_TABLE) {
|
if (pCreateTbReq->type == TD_SUPER_TABLE) {
|
||||||
taosMemoryFree(pCreateTbReq->stbCfg.pSchema);
|
taosMemoryFree(pCreateTbReq->stbCfg.pSchema);
|
||||||
taosMemoryFree(pCreateTbReq->stbCfg.pTagSchema);
|
taosMemoryFree(pCreateTbReq->stbCfg.pTagSchema);
|
||||||
|
@ -298,7 +296,6 @@ static int vnodeProcessAlterStbReq(SVnode *pVnode, void *pReq) {
|
||||||
taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam->pFuncIds);
|
taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam->pFuncIds);
|
||||||
taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam);
|
taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam);
|
||||||
}
|
}
|
||||||
taosMemoryFree(vAlterTbReq.dbFName);
|
|
||||||
taosMemoryFree(vAlterTbReq.name);
|
taosMemoryFree(vAlterTbReq.name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
#include "parInsertData.h"
|
#include "parInsertData.h"
|
||||||
#include "parInt.h"
|
#include "parInt.h"
|
||||||
#include "parUtil.h"
|
|
||||||
#include "parToken.h"
|
#include "parToken.h"
|
||||||
|
#include "parUtil.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
#include "ttime.h"
|
#include "ttime.h"
|
||||||
#include "ttypes.h"
|
#include "ttypes.h"
|
||||||
|
@ -228,25 +228,23 @@ static int32_t getTableMetaImpl(SInsertParseContext* pCxt, SToken* pTname, bool
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
createSName(&name, pTname, pBasicCtx, &pCxt->msg);
|
createSName(&name, pTname, pBasicCtx, &pCxt->msg);
|
||||||
if (isStb) {
|
if (isStb) {
|
||||||
CHECK_CODE(catalogGetSTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &pCxt->pTableMeta));
|
CHECK_CODE(catalogGetSTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name,
|
||||||
|
&pCxt->pTableMeta));
|
||||||
} else {
|
} else {
|
||||||
CHECK_CODE(catalogGetTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &pCxt->pTableMeta));
|
CHECK_CODE(catalogGetTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name,
|
||||||
|
&pCxt->pTableMeta));
|
||||||
}
|
}
|
||||||
SVgroupInfo vg;
|
SVgroupInfo vg;
|
||||||
CHECK_CODE(catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &vg));
|
CHECK_CODE(
|
||||||
|
catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &vg));
|
||||||
CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)));
|
CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)));
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) {
|
static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) { return getTableMetaImpl(pCxt, pTname, false); }
|
||||||
return getTableMetaImpl(pCxt, pTname, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t getSTableMeta(SInsertParseContext* pCxt, SToken* pTname) {
|
|
||||||
return getTableMetaImpl(pCxt, pTname, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
static int32_t getSTableMeta(SInsertParseContext* pCxt, SToken* pTname) { return getTableMetaImpl(pCxt, pTname, true); }
|
||||||
|
|
||||||
static int32_t findCol(SToken* pColname, int32_t start, int32_t end, SSchema* pSchema) {
|
static int32_t findCol(SToken* pColname, int32_t start, int32_t end, SSchema* pSchema) {
|
||||||
while (start < end) {
|
while (start < end) {
|
||||||
|
@ -391,8 +389,10 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t checkAndTrimValue(SToken* pToken, uint32_t type, char* tmpTokenBuf, SMsgBuf* pMsgBuf) {
|
static FORCE_INLINE int32_t checkAndTrimValue(SToken* pToken, uint32_t type, char* tmpTokenBuf, SMsgBuf* pMsgBuf) {
|
||||||
if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT &&
|
if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER &&
|
||||||
pToken->type != TK_NK_BOOL && pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && pToken->type != TK_NK_BIN) ||
|
pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL &&
|
||||||
|
pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT &&
|
||||||
|
pToken->type != TK_NK_BIN) ||
|
||||||
(pToken->n == 0) || (pToken->type == TK_NK_RP)) {
|
(pToken->n == 0) || (pToken->type == TK_NK_RP)) {
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "invalid data or symbol", pToken->z);
|
return buildSyntaxErrMsg(pMsgBuf, "invalid data or symbol", pToken->z);
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,8 @@ static FORCE_INLINE int32_t toDouble(SToken *pToken, double *value, char **endPt
|
||||||
return pToken->type;
|
return pToken->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int16_t timePrec, char* tmpTokenBuf, _row_append_fn_t func, void* param, SMsgBuf* pMsgBuf) {
|
static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int16_t timePrec, char* tmpTokenBuf,
|
||||||
|
_row_append_fn_t func, void* param, SMsgBuf* pMsgBuf) {
|
||||||
int64_t iv;
|
int64_t iv;
|
||||||
char* endptr = NULL;
|
char* endptr = NULL;
|
||||||
bool isSigned = false;
|
bool isSigned = false;
|
||||||
|
@ -571,7 +572,8 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
|
||||||
if (TK_NK_ILLEGAL == toDouble(pToken, &dv, &endptr)) {
|
if (TK_NK_ILLEGAL == toDouble(pToken, &dv, &endptr)) {
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "illegal float data", pToken->z);
|
return buildSyntaxErrMsg(pMsgBuf, "illegal float data", pToken->z);
|
||||||
}
|
}
|
||||||
if (((dv == HUGE_VAL || dv == -HUGE_VAL) && errno == ERANGE) || dv > FLT_MAX || dv < -FLT_MAX || isinf(dv) || isnan(dv)) {
|
if (((dv == HUGE_VAL || dv == -HUGE_VAL) && errno == ERANGE) || dv > FLT_MAX || dv < -FLT_MAX || isinf(dv) ||
|
||||||
|
isnan(dv)) {
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "illegal float data", pToken->z);
|
return buildSyntaxErrMsg(pMsgBuf, "illegal float data", pToken->z);
|
||||||
}
|
}
|
||||||
float tmpVal = (float)dv;
|
float tmpVal = (float)dv;
|
||||||
|
@ -749,7 +751,8 @@ static int32_t KvRowAppend(SMsgBuf* pMsgBuf, const void *value, int32_t len, voi
|
||||||
if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(pa->buf), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) {
|
if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(pa->buf), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) {
|
||||||
char buf[512] = {0};
|
char buf[512] = {0};
|
||||||
snprintf(buf, tListLen(buf), "%s", strerror(errno));
|
snprintf(buf, tListLen(buf), "%s", strerror(errno));
|
||||||
return buildSyntaxErrMsg(pMsgBuf, buf, value);;
|
return buildSyntaxErrMsg(pMsgBuf, buf, value);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
varDataSetLen(pa->buf, output);
|
varDataSetLen(pa->buf, output);
|
||||||
|
@ -765,7 +768,6 @@ static int32_t buildCreateTbReq(SInsertParseContext* pCxt, const SName* pName, S
|
||||||
char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
char dbFName[TSDB_DB_FNAME_LEN] = {0};
|
||||||
tNameGetFullDbName(pName, dbFName);
|
tNameGetFullDbName(pName, dbFName);
|
||||||
pCxt->createTblReq.type = TD_CHILD_TABLE;
|
pCxt->createTblReq.type = TD_CHILD_TABLE;
|
||||||
pCxt->createTblReq.dbFName = strdup(dbFName);
|
|
||||||
pCxt->createTblReq.name = strdup(pName->tname);
|
pCxt->createTblReq.name = strdup(pName->tname);
|
||||||
pCxt->createTblReq.ctbCfg.suid = pCxt->pTableMeta->suid;
|
pCxt->createTblReq.ctbCfg.suid = pCxt->pTableMeta->suid;
|
||||||
pCxt->createTblReq.ctbCfg.pTag = row;
|
pCxt->createTblReq.ctbCfg.pTag = row;
|
||||||
|
@ -786,7 +788,8 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint
|
||||||
NEXT_TOKEN_WITH_PREV(pCxt->pSql, sToken);
|
NEXT_TOKEN_WITH_PREV(pCxt->pSql, sToken);
|
||||||
SSchema* pTagSchema = &pSchema[pCxt->tags.boundColumns[i] - 1]; // colId starts with 1
|
SSchema* pTagSchema = &pSchema[pCxt->tags.boundColumns[i] - 1]; // colId starts with 1
|
||||||
param.schema = pTagSchema;
|
param.schema = pTagSchema;
|
||||||
CHECK_CODE(parseValueToken(&pCxt->pSql, &sToken, pTagSchema, precision, tmpTokenBuf, KvRowAppend, ¶m, &pCxt->msg));
|
CHECK_CODE(
|
||||||
|
parseValueToken(&pCxt->pSql, &sToken, pTagSchema, precision, tmpTokenBuf, KvRowAppend, ¶m, &pCxt->msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
SKVRow row = tdGetKVRowFromBuilder(&pCxt->tagsBuilder);
|
SKVRow row = tdGetKVRowFromBuilder(&pCxt->tagsBuilder);
|
||||||
|
@ -864,7 +867,8 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken)
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, int16_t timePrec, int32_t* len, char* tmpTokenBuf) {
|
static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, int16_t timePrec, int32_t* len,
|
||||||
|
char* tmpTokenBuf) {
|
||||||
SParsedDataColInfo* spd = &pDataBlocks->boundColumnInfo;
|
SParsedDataColInfo* spd = &pDataBlocks->boundColumnInfo;
|
||||||
SRowBuilder* pBuilder = &pDataBlocks->rowBuilder;
|
SRowBuilder* pBuilder = &pDataBlocks->rowBuilder;
|
||||||
STSRow* row = (STSRow*)(pDataBlocks->pData + pDataBlocks->size); // skip the SSubmitBlk header
|
STSRow* row = (STSRow*)(pDataBlocks->pData + pDataBlocks->size); // skip the SSubmitBlk header
|
||||||
|
@ -968,7 +972,6 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* da
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyCreateSubTbReq(SVCreateTbReq* pReq) {
|
static void destroyCreateSubTbReq(SVCreateTbReq* pReq) {
|
||||||
taosMemoryFreeClear(pReq->dbFName);
|
|
||||||
taosMemoryFreeClear(pReq->name);
|
taosMemoryFreeClear(pReq->name);
|
||||||
taosMemoryFreeClear(pReq->ctbCfg.pTag);
|
taosMemoryFreeClear(pReq->ctbCfg.pTag);
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1026,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
|
||||||
// no data in the sql string anymore.
|
// no data in the sql string anymore.
|
||||||
if (sToken.n == 0) {
|
if (sToken.n == 0) {
|
||||||
if (0 == pCxt->totalNum) {
|
if (0 == pCxt->totalNum) {
|
||||||
return buildInvalidOperationMsg(&pCxt->msg, "no data in sql");;
|
return buildInvalidOperationMsg(&pCxt->msg, "no data in sql");
|
||||||
|
;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1045,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
|
||||||
|
|
||||||
STableDataBlocks* dataBuf = NULL;
|
STableDataBlocks* dataBuf = NULL;
|
||||||
CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, pCxt->pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE,
|
CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, pCxt->pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE,
|
||||||
sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL, &pCxt->createTblReq));
|
sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta,
|
||||||
|
&dataBuf, NULL, &pCxt->createTblReq));
|
||||||
|
|
||||||
if (TK_NK_LP == sToken.type) {
|
if (TK_NK_LP == sToken.type) {
|
||||||
// pSql -> field1_name, ...)
|
// pSql -> field1_name, ...)
|
||||||
|
@ -1071,7 +1076,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
|
||||||
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", sToken.z);
|
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", sToken.z);
|
||||||
}
|
}
|
||||||
// merge according to vgId
|
// merge according to vgId
|
||||||
if (!TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT) && taosHashGetSize(pCxt->pTableBlockHashObj) > 0) {
|
if (!TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT) &&
|
||||||
|
taosHashGetSize(pCxt->pTableBlockHashObj) > 0) {
|
||||||
CHECK_CODE(mergeTableDataBlocks(pCxt->pTableBlockHashObj, pCxt->pOutput->payloadType, &pCxt->pVgDataBlocks));
|
CHECK_CODE(mergeTableDataBlocks(pCxt->pTableBlockHashObj, pCxt->pOutput->payloadType, &pCxt->pVgDataBlocks));
|
||||||
}
|
}
|
||||||
return buildOutput(pCxt);
|
return buildOutput(pCxt);
|
||||||
|
@ -1093,11 +1099,10 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
|
||||||
.pTableBlockHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false),
|
.pTableBlockHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false),
|
||||||
.pSubTableHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, false),
|
.pSubTableHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, false),
|
||||||
.totalNum = 0,
|
.totalNum = 0,
|
||||||
.pOutput = (SVnodeModifOpStmt*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT)
|
.pOutput = (SVnodeModifOpStmt*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT)};
|
||||||
};
|
|
||||||
|
|
||||||
if (NULL == context.pVgroupsHashObj || NULL == context.pTableBlockHashObj ||
|
if (NULL == context.pVgroupsHashObj || NULL == context.pTableBlockHashObj || NULL == context.pSubTableHashObj ||
|
||||||
NULL == context.pSubTableHashObj || NULL == context.pOutput) {
|
NULL == context.pOutput) {
|
||||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2747,7 +2747,6 @@ static void toSchemaEx(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSch
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyCreateTbReq(SVCreateTbReq* pReq) {
|
static void destroyCreateTbReq(SVCreateTbReq* pReq) {
|
||||||
taosMemoryFreeClear(pReq->dbFName);
|
|
||||||
taosMemoryFreeClear(pReq->name);
|
taosMemoryFreeClear(pReq->name);
|
||||||
taosMemoryFreeClear(pReq->ntbCfg.pSchema);
|
taosMemoryFreeClear(pReq->ntbCfg.pSchema);
|
||||||
}
|
}
|
||||||
|
@ -2784,7 +2783,6 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
||||||
|
|
||||||
SVCreateTbReq req = {0};
|
SVCreateTbReq req = {0};
|
||||||
req.type = TD_NORMAL_TABLE;
|
req.type = TD_NORMAL_TABLE;
|
||||||
req.dbFName = strdup(dbFName);
|
|
||||||
req.name = strdup(pStmt->tableName);
|
req.name = strdup(pStmt->tableName);
|
||||||
req.ntbCfg.nCols = LIST_LENGTH(pStmt->pCols);
|
req.ntbCfg.nCols = LIST_LENGTH(pStmt->pCols);
|
||||||
req.ntbCfg.pSchema = taosMemoryCalloc(req.ntbCfg.nCols, sizeof(SSchema));
|
req.ntbCfg.pSchema = taosMemoryCalloc(req.ntbCfg.nCols, sizeof(SSchema));
|
||||||
|
@ -2843,7 +2841,6 @@ static void destroyCreateTbReqBatch(SVgroupTablesBatch* pTbBatch) {
|
||||||
size_t size = taosArrayGetSize(pTbBatch->req.pArray);
|
size_t size = taosArrayGetSize(pTbBatch->req.pArray);
|
||||||
for (int32_t i = 0; i < size; ++i) {
|
for (int32_t i = 0; i < size; ++i) {
|
||||||
SVCreateTbReq* pTableReq = taosArrayGet(pTbBatch->req.pArray, i);
|
SVCreateTbReq* pTableReq = taosArrayGet(pTbBatch->req.pArray, i);
|
||||||
taosMemoryFreeClear(pTableReq->dbFName);
|
|
||||||
taosMemoryFreeClear(pTableReq->name);
|
taosMemoryFreeClear(pTableReq->name);
|
||||||
|
|
||||||
if (pTableReq->type == TSDB_NORMAL_TABLE) {
|
if (pTableReq->type == TSDB_NORMAL_TABLE) {
|
||||||
|
@ -2929,7 +2926,6 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, c
|
||||||
|
|
||||||
struct SVCreateTbReq req = {0};
|
struct SVCreateTbReq req = {0};
|
||||||
req.type = TD_CHILD_TABLE;
|
req.type = TD_CHILD_TABLE;
|
||||||
req.dbFName = strdup(dbFName);
|
|
||||||
req.name = strdup(pTableName);
|
req.name = strdup(pTableName);
|
||||||
req.ctbCfg.suid = suid;
|
req.ctbCfg.suid = suid;
|
||||||
req.ctbCfg.pTag = row;
|
req.ctbCfg.pTag = row;
|
||||||
|
|
Loading…
Reference in New Issue