提交 2d804fa4 编写于 作者: H Hongze Cheng

more code

上级 bffb92b9
......@@ -120,7 +120,6 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow) {
while (pTColumn) {
if (pColVal) {
if (pColVal->cid == pTColumn->colId) {
ntp += TYPE_BYTES[pTColumn->type];
if (COL_VAL_IS_VALUE(pColVal)) { // VALUE
flag |= HAS_VALUE;
maxIdx = nkv;
......@@ -146,14 +145,12 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow) {
pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
} else if (pColVal->cid > pTColumn->colId) { // NONE
flag |= HAS_NONE;
ntp += TYPE_BYTES[pTColumn->type];
pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
} else {
pColVal = (++iColVal < nColVal) ? &colVals[iColVal] : NULL;
}
} else { // NONE
flag |= HAS_NONE;
ntp += TYPE_BYTES[pTColumn->type];
pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL;
}
}
......@@ -165,17 +162,17 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow) {
ntp = sizeof(SRow);
break;
case HAS_VALUE:
ntp = sizeof(SRow) + ntp;
ntp = sizeof(SRow) + pTSchema->flen;
break;
case (HAS_NULL | HAS_NONE):
ntp = sizeof(SRow) + BIT1_SIZE(pTSchema->numOfCols - 1);
break;
case (HAS_VALUE | HAS_NONE):
case (HAS_VALUE | HAS_NULL):
ntp = sizeof(SRow) + BIT1_SIZE(pTSchema->numOfCols - 1) + ntp;
ntp = sizeof(SRow) + BIT1_SIZE(pTSchema->numOfCols - 1) + pTSchema->flen + ntp;
break;
case (HAS_VALUE | HAS_NULL | HAS_NONE):
ntp = sizeof(SRow) + BIT2_SIZE(pTSchema->numOfCols - 1) + ntp;
ntp = sizeof(SRow) + BIT2_SIZE(pTSchema->numOfCols - 1) + pTSchema->flen + ntp;
break;
default:
ASSERT(0);
......
......@@ -6807,26 +6807,30 @@ _exit:
return code;
}
void destroySSubmitTbData(SSubmitTbData *pTbData) {
// if (pTbData->isColFmt) {
// // todo
// } else {
// taosArrayDestroyP(pTbData->aRowP, (FDelete)tRowDestroy);
// }
}
void tDestroySSubmitTbData(SSubmitTbData *pTbData) {
if (NULL == pTbData) {
return;
if (pTbData->pCreateTbReq) {
// todo
taosMemoryFree(pTbData->pCreateTbReq);
}
if (pTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
ASSERT(0); // TODO
} else {
if (pTbData->aRowP) {
int32_t nRow = TARRAY_SIZE(pTbData->aRowP);
SRow **rows = (SRow **)TARRAY_DATA(pTbData->aRowP);
for (int32_t i = 0; i < nRow; ++i) {
tRowDestroy(rows[i]);
}
taosArrayDestroy(pTbData->aRowP);
}
}
destroySSubmitTbData(pTbData);
taosMemoryFree(pTbData);
}
void tDestroySSubmitReq2(SSubmitReq2 *pReq) {
if (NULL == pReq) return;
taosArrayDestroyEx(pReq->aSubmitTbData, (FDelete)destroySSubmitTbData);
taosArrayDestroyEx(pReq->aSubmitTbData, (FDelete)tDestroySSubmitTbData);
}
int32_t tEncodeSSubmitRsp2(SEncoder *pCoder, const SSubmitRsp2 *pRsp) {
......
......@@ -1069,7 +1069,10 @@ void insDestroyTableDataCxt(STableDataCxt* pTableCxt) {
tDestroyTSchema(pTableCxt->pSchema);
destroyBoundColInfo(&pTableCxt->boundColsInfo);
taosArrayDestroyEx(pTableCxt->pValues, destroyColVal);
tDestroySSubmitTbData(pTableCxt->pData);
if (pTableCxt->pData) {
tDestroySSubmitTbData(pTableCxt->pData);
taosMemoryFree(pTableCxt->pData);
}
taosMemoryFree(pTableCxt);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册