merge 3.0
This commit is contained in:
commit
3eda47e159
|
@ -1345,8 +1345,24 @@ static int32_t smlDealCols(SSmlTableInfo *oneTable, bool dataFormat, SArray *col
|
||||||
void *p = taosArraySearch(oneTable->cols, &cols, smlKvTimeArrayCompare, TD_GE);
|
void *p = taosArraySearch(oneTable->cols, &cols, smlKvTimeArrayCompare, TD_GE);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
taosArrayPush(oneTable->cols, &cols);
|
taosArrayPush(oneTable->cols, &cols);
|
||||||
} else {
|
} else { // to make the sort stable for update data
|
||||||
taosArrayInsert(oneTable->cols, TARRAY_ELEM_IDX(oneTable->cols, p), &cols);
|
SArray *sa = (SArray *)p;
|
||||||
|
SSmlKv *cur = (SSmlKv *)taosArrayGet(sa, 0);
|
||||||
|
SSmlKv *dCur = (SSmlKv *)taosArrayGet(cols, 0);
|
||||||
|
if (cur->i > dCur->i) {
|
||||||
|
taosArrayInsert(oneTable->cols, TARRAY_ELEM_IDX(oneTable->cols, p), &cols);
|
||||||
|
} else {
|
||||||
|
ASSERT(cur->i == dCur->i);
|
||||||
|
int32_t index = TARRAY_ELEM_IDX(oneTable->cols, p) + 1;
|
||||||
|
for (; index < taosArrayGetSize(oneTable->cols); index++) {
|
||||||
|
SArray *tmp = (SArray *)taosArrayGet(oneTable->cols, index);
|
||||||
|
SSmlKv *curTs = (SSmlKv *)taosArrayGet(tmp, 0);
|
||||||
|
if (curTs->i > dCur->i) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taosArrayInsert(oneTable->cols, index, &cols);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1364,8 +1380,24 @@ static int32_t smlDealCols(SSmlTableInfo *oneTable, bool dataFormat, SArray *col
|
||||||
void *p = taosArraySearch(oneTable->cols, &kvHash, smlKvTimeHashCompare, TD_GE);
|
void *p = taosArraySearch(oneTable->cols, &kvHash, smlKvTimeHashCompare, TD_GE);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
taosArrayPush(oneTable->cols, &kvHash);
|
taosArrayPush(oneTable->cols, &kvHash);
|
||||||
} else {
|
} else { // to make the sort stable for update data
|
||||||
taosArrayInsert(oneTable->cols, TARRAY_ELEM_IDX(oneTable->cols, p), &kvHash);
|
SHashObj *sa = (SHashObj *)p;
|
||||||
|
SSmlKv *cur = (SSmlKv *)taosHashGet(sa, TS, TS_LEN);
|
||||||
|
SSmlKv *dCur = (SSmlKv *)taosArrayGet(cols, 0);
|
||||||
|
if (cur->i > dCur->i) {
|
||||||
|
taosArrayInsert(oneTable->cols, TARRAY_ELEM_IDX(oneTable->cols, p), &cols);
|
||||||
|
} else {
|
||||||
|
ASSERT(cur->i == dCur->i);
|
||||||
|
int32_t index = TARRAY_ELEM_IDX(oneTable->cols, p) + 1;
|
||||||
|
for (; index < taosArrayGetSize(oneTable->cols); index++) {
|
||||||
|
SHashObj *tmp = (SHashObj *)taosArrayGet(oneTable->cols, index);
|
||||||
|
SSmlKv *curTs = (SSmlKv *)taosHashGet(tmp, TS, TS_LEN);
|
||||||
|
if (curTs->i > dCur->i) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taosArrayInsert(oneTable->cols, index, &cols);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue