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

more code

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