From e0c4cdf664677daa32066686952256599ddb5821 Mon Sep 17 00:00:00 2001 From: "pengrongkun94@qq.com" Date: Thu, 19 Dec 2024 10:15:02 +0800 Subject: [PATCH] fix TD-33219 2 --- include/libs/parser/parser.h | 2 -- source/client/src/clientMain.c | 5 +++ source/client/src/clientStmt2.c | 11 +++---- source/libs/parser/src/parInsertStmt.c | 42 -------------------------- 4 files changed, 10 insertions(+), 50 deletions(-) diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 23ad151787..95f522f504 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -137,8 +137,6 @@ int32_t qResetStmtDataBlock(STableDataCxt* block, bool keepBuf); int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool reset); int32_t qRebuildStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_t uid, uint64_t suid, int32_t vgId, bool rebuildCreateTb); -int32_t qRebuildStmt2DataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_t uid, uint64_t suid, int32_t vgId, - bool rebuildCreateTb, const char* tName, const char* sTableName); void qDestroyStmtDataBlock(STableDataCxt* pBlock); STableMeta* qGetTableMetaInDataBlock(STableDataCxt* pDataBlock); int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData** pData); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index dfc18da8cd..ecd835c76f 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -2182,6 +2182,11 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col if (code) { return code; } + } else { + code = stmtSetTbTags2(stmt, NULL); + if (code) { + return code; + } } if (bindv->bind_cols && bindv->bind_cols[i]) { diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index f63d12e298..340bc299fd 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -488,8 +488,7 @@ static int32_t stmtTryAddTableVgroupInfo(STscStmt2* pStmt, int32_t* vgId) { static int32_t stmtRebuildDataBlock(STscStmt2* pStmt, STableDataCxt* pDataBlock, STableDataCxt** newBlock, uint64_t uid, uint64_t suid, int32_t vgId) { STMT_ERR_RET(stmtTryAddTableVgroupInfo(pStmt, &vgId)); - STMT_ERR_RET(qRebuildStmt2DataBlock(newBlock, pDataBlock, uid, suid, vgId, pStmt->sql.autoCreateTbl, pStmt->bInfo.sname.tname, - pStmt->bInfo.stbFName)); + STMT_ERR_RET(qRebuildStmtDataBlock(newBlock, pDataBlock, uid, suid, vgId, pStmt->sql.autoCreateTbl)); STMT_DLOG("tableDataCxt rebuilt, uid:%" PRId64 ", vgId:%d", uid, vgId); @@ -1013,10 +1012,10 @@ int stmtSetTbTags2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* tags) { } SBoundColInfo* tags_info = (SBoundColInfo*)pStmt->bInfo.boundTags; - if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) { - tscWarn("no tags or cols bound in sql, will not bound tags"); - return TSDB_CODE_SUCCESS; - } + // if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) { + // tscWarn("no tags or cols bound in sql, will not bound tags"); + // return TSDB_CODE_SUCCESS; + // } STableDataCxt** pDataBlock = (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)); diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index cf476567d7..4ecc18d189 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -1212,48 +1212,6 @@ int32_t qRebuildStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_ return TSDB_CODE_SUCCESS; } -int32_t qRebuildStmt2DataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_t uid, uint64_t suid, int32_t vgId, - bool rebuildCreateTb, const char* tName, const char* sTableName) { - int32_t code = qCloneStmtDataBlock(pDst, pSrc, false); - if (code) { - return code; - } - - STableDataCxt* pBlock = (STableDataCxt*)*pDst; - if (pBlock->pMeta) { - pBlock->pMeta->uid = uid; - pBlock->pMeta->vgId = vgId; - pBlock->pMeta->suid = suid; - } - - pBlock->pData->suid = suid; - pBlock->pData->uid = uid; - - if (rebuildCreateTb && NULL == pBlock->pData->pCreateTbReq) { - pBlock->pData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq)); - if (NULL == pBlock->pData->pCreateTbReq) { - return terrno; - } - SArray* pTagArray = taosArrayInit(0, sizeof(STagVal)); - SArray* tagName = taosArrayInit(0, TSDB_COL_NAME_LEN); - - STag* tag = NULL; - code = tTagNew(pTagArray, 1, false, &tag); - - code = insBuildCreateTbReq(pBlock->pData->pCreateTbReq, tName, tag, suid, sTableName, tagName, 0, - TSDB_DEFAULT_TABLE_TTL); - - taosArrayDestroy(pTagArray); - taosArrayDestroy(tagName); - taosMemoryFree(tag); - if (code) { - return code; - } - } - - return TSDB_CODE_SUCCESS; -} - STableMeta* qGetTableMetaInDataBlock(STableDataCxt* pDataBlock) { return ((STableDataCxt*)pDataBlock)->pMeta; } void qDestroyStmtDataBlock(STableDataCxt* pBlock) {