提交 feaea3d1 编写于 作者: H Hongze Cheng

adjust row api

上级 e9241629
......@@ -87,7 +87,8 @@ int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData);
int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow);
void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);
void tRowDestroy(SRow *pRow);
int32_t tRowMergeSort(SArray *aRowP, STSchema *pTSchema, int8_t flag);
void tRowSort(SArray *aRowP);
int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag);
// SRowIter ================================
int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter);
......
......@@ -527,7 +527,7 @@ static int32_t tRowPCmprFn(const void *p1, const void *p2) {
return 0;
}
static void tRowPDestroy(SRow **ppRow) { tRowDestroy(*ppRow); }
static int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int32_t iStart, int32_t iEnd, int8_t flag) {
static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart, int32_t iEnd, int8_t flag) {
int32_t code = 0;
int32_t nRow = iEnd - iStart;
......@@ -591,12 +591,14 @@ _exit:
if (code) tRowDestroy(pRow);
return code;
}
int32_t tRowMergeSort(SArray *aRowP, STSchema *pTSchema, int8_t flag) {
if (aRowP->size <= 1) return 0;
int32_t code = 0;
void tRowSort(SArray *aRowP) {
if (TARRAY_SIZE(aRowP) <= 1) return;
taosArraySort(aRowP, tRowPCmprFn);
}
int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag) {
int32_t code = 0;
int32_t iStart = 0;
while (iStart < aRowP->size) {
......@@ -612,7 +614,7 @@ int32_t tRowMergeSort(SArray *aRowP, STSchema *pTSchema, int8_t flag) {
}
if (iEnd - iStart > 1) {
code = tRowMerge(aRowP, pTSchema, iStart, iEnd, flag);
code = tRowMergeImpl(aRowP, pTSchema, iStart, iEnd, flag);
}
// the array is also changing, so the iStart just ++ instead of iEnd
......
......@@ -1179,7 +1179,7 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks) {
void* p = taosHashIterate(pTableHash, NULL);
while (TSDB_CODE_SUCCESS == code && NULL != p) {
STableDataCxt* pTableCxt = *(STableDataCxt**)p;
code = tRowMergeSort(pTableCxt->pData->aRowP, pTableCxt->pSchema, 0);
code = tRowMerge(pTableCxt->pData->aRowP, pTableCxt->pSchema, 0);
if (TSDB_CODE_SUCCESS == code) {
SVgroupDataCxt* pVgCxt = NULL;
int32_t vgId = pTableCxt->pMeta->vgId;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册