fix some bugs
This commit is contained in:
parent
7705a5856e
commit
e844eea30f
|
@ -1094,7 +1094,10 @@ static int stmtFetchStbColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIEL
|
|||
}
|
||||
|
||||
STMT_ERR_RET(qBuildStmtStbColFields(*pDataBlock, pStmt->bInfo.boundTags, pStmt->bInfo.preCtbname, fieldNum, fields));
|
||||
|
||||
if (taosHashRemove(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)) != 0) {
|
||||
tscError("get fileds %s remove exec blockHash fail", pStmt->bInfo.tbFName);
|
||||
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -1848,7 +1848,6 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
// bind column
|
||||
} else {
|
||||
pCxt->tags.mixTagsCols = true;
|
||||
pCxt->tags.pColIndex = pStbRowsCxt->boundColsInfo.pColIndex;
|
||||
pCxt->tags.numOfBound++;
|
||||
pCxt->tags.numOfCols++;
|
||||
}
|
||||
|
@ -1895,6 +1894,16 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pCxt->isStmtBind && pCxt->tags.mixTagsCols) {
|
||||
taosMemoryFreeClear(pCxt->tags.pColIndex);
|
||||
pCxt->tags.pColIndex = taosMemoryCalloc(pStbRowsCxt->boundColsInfo.numOfBound, sizeof(int16_t));
|
||||
if (NULL == pCxt->tags.pColIndex) {
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(pCxt->tags.pColIndex, pStbRowsCxt->boundColsInfo.pColIndex,
|
||||
sizeof(int16_t) * pStbRowsCxt->boundColsInfo.numOfBound);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -504,10 +504,12 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
|||
}
|
||||
|
||||
SSchema* pSchema;
|
||||
int start = 0;
|
||||
if (!tags->mixTagsCols) {
|
||||
pSchema = getTableTagSchema(pDataBlock->pMeta);
|
||||
} else {
|
||||
pSchema = getTableColumnSchema(pDataBlock->pMeta);
|
||||
start = pDataBlock->pMeta->tableInfo.numOfColumns;
|
||||
}
|
||||
|
||||
bool isJson = false;
|
||||
|
@ -518,7 +520,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
|||
continue;
|
||||
}
|
||||
|
||||
SSchema* pTagSchema = &pSchema[tags->pColIndex[c]];
|
||||
SSchema* pTagSchema = &pSchema[tags->pColIndex[start + c]];
|
||||
int32_t colLen = pTagSchema->bytes;
|
||||
if (IS_VAR_DATA_TYPE(pTagSchema->type)) {
|
||||
if (!bind[c].length) {
|
||||
|
@ -946,8 +948,8 @@ int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSc
|
|||
int32_t buildStbBoundFields(SBoundColInfo boundColsInfo, SSchema* pSchema, int32_t* fieldNum, TAOS_FIELD_STB** fields,
|
||||
STableMeta* pMeta, void* boundTags, bool preCtbname) {
|
||||
SBoundColInfo* tags = (SBoundColInfo*)boundTags;
|
||||
int32_t numOfBound = boundColsInfo.numOfBound + tags->numOfBound + (preCtbname ? 1 : 0);
|
||||
int32_t idx = 0;
|
||||
int32_t numOfBound = boundColsInfo.numOfBound + (tags->mixTagsCols ? 0 : tags->numOfBound) + (preCtbname ? 1 : 0);
|
||||
int32_t idx = 0;
|
||||
if (fields != NULL) {
|
||||
*fields = taosMemoryCalloc(numOfBound, sizeof(TAOS_FIELD_STB));
|
||||
if (NULL == *fields) {
|
||||
|
@ -962,7 +964,7 @@ int32_t buildStbBoundFields(SBoundColInfo boundColsInfo, SSchema* pSchema, int32
|
|||
idx++;
|
||||
}
|
||||
|
||||
if (tags->numOfBound > 0) {
|
||||
if (tags->numOfBound > 0 && !tags->mixTagsCols) {
|
||||
SSchema* tagSchema = getTableTagSchema(pMeta);
|
||||
|
||||
for (int32_t i = 0; i < tags->numOfBound; ++i) {
|
||||
|
|
|
@ -741,7 +741,7 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks, bool
|
|||
STableDataCxt* pTableCxt = *(STableDataCxt**)p;
|
||||
if (colFormat) {
|
||||
SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, 0);
|
||||
if (pCol->nVal <= 0) {
|
||||
if (pCol && pCol->nVal <= 0) {
|
||||
p = taosHashIterate(pTableHash, p);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue