Merge pull request #7467 from taosdata/fix/TD-6207-develop
Fix/td 6207 develop
This commit is contained in:
commit
032cea14fa
|
@ -1,4 +1,5 @@
|
||||||
build/
|
build/
|
||||||
|
.ycm_extra_conf.py
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
cmake-build-debug/
|
cmake-build-debug/
|
||||||
|
|
|
@ -517,6 +517,7 @@ void tdAppendMemRowToDataCol(SMemRow row, STSchema *pSchema, SDataCols *pCols, b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: refactor this function to eliminate additional memory copy
|
||||||
int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge, int *pOffset, bool forceSetNull) {
|
int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge, int *pOffset, bool forceSetNull) {
|
||||||
ASSERT(rowsToMerge > 0 && rowsToMerge <= source->numOfRows);
|
ASSERT(rowsToMerge > 0 && rowsToMerge <= source->numOfRows);
|
||||||
ASSERT(target->numOfCols == source->numOfCols);
|
ASSERT(target->numOfCols == source->numOfCols);
|
||||||
|
|
|
@ -1262,8 +1262,14 @@ static int tsdbEncodeTable(void **buf, STable *pTable) {
|
||||||
tlen += taosEncodeFixedU64(buf, TABLE_SUID(pTable));
|
tlen += taosEncodeFixedU64(buf, TABLE_SUID(pTable));
|
||||||
tlen += tdEncodeKVRow(buf, pTable->tagVal);
|
tlen += tdEncodeKVRow(buf, pTable->tagVal);
|
||||||
} else {
|
} else {
|
||||||
tlen += taosEncodeFixedU8(buf, (uint8_t)taosArrayGetSize(pTable->schema));
|
uint32_t arraySize = (uint32_t)taosArrayGetSize(pTable->schema);
|
||||||
for (int i = 0; i < taosArrayGetSize(pTable->schema); i++) {
|
if(arraySize > UINT8_MAX) {
|
||||||
|
tlen += taosEncodeFixedU8(buf, 0);
|
||||||
|
tlen += taosEncodeFixedU32(buf, arraySize);
|
||||||
|
} else {
|
||||||
|
tlen += taosEncodeFixedU8(buf, (uint8_t)arraySize);
|
||||||
|
}
|
||||||
|
for (uint32_t i = 0; i < arraySize; i++) {
|
||||||
STSchema *pSchema = taosArrayGetP(pTable->schema, i);
|
STSchema *pSchema = taosArrayGetP(pTable->schema, i);
|
||||||
tlen += tdEncodeSchema(buf, pSchema);
|
tlen += tdEncodeSchema(buf, pSchema);
|
||||||
}
|
}
|
||||||
|
@ -1296,8 +1302,11 @@ static void *tsdbDecodeTable(void *buf, STable **pRTable) {
|
||||||
buf = taosDecodeFixedU64(buf, &TABLE_SUID(pTable));
|
buf = taosDecodeFixedU64(buf, &TABLE_SUID(pTable));
|
||||||
buf = tdDecodeKVRow(buf, &(pTable->tagVal));
|
buf = tdDecodeKVRow(buf, &(pTable->tagVal));
|
||||||
} else {
|
} else {
|
||||||
uint8_t nSchemas;
|
uint32_t nSchemas = 0;
|
||||||
buf = taosDecodeFixedU8(buf, &nSchemas);
|
buf = taosDecodeFixedU8(buf, (uint8_t *)&nSchemas);
|
||||||
|
if(nSchemas == 0) {
|
||||||
|
buf = taosDecodeFixedU32(buf, &nSchemas);
|
||||||
|
}
|
||||||
for (int i = 0; i < nSchemas; i++) {
|
for (int i = 0; i < nSchemas; i++) {
|
||||||
STSchema *pSchema;
|
STSchema *pSchema;
|
||||||
buf = tdDecodeSchema(buf, &pSchema);
|
buf = tdDecodeSchema(buf, &pSchema);
|
||||||
|
@ -1497,4 +1506,4 @@ static void tsdbFreeTableSchema(STable *pTable) {
|
||||||
|
|
||||||
taosArrayDestroy(pTable->schema);
|
taosArrayDestroy(pTable->schema);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,23 +14,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tfunctional.h"
|
#include "tfunctional.h"
|
||||||
#include "tarray.h"
|
|
||||||
|
|
||||||
|
|
||||||
tGenericSavedFunc* genericSavedFuncInit(GenericVaFunc func, int numOfArgs) {
|
tGenericSavedFunc* genericSavedFuncInit(GenericVaFunc func, int numOfArgs) {
|
||||||
tGenericSavedFunc* pSavedFunc = malloc(sizeof(tGenericSavedFunc) + numOfArgs * (sizeof(void*)));
|
tGenericSavedFunc* pSavedFunc = malloc(sizeof(tGenericSavedFunc) + numOfArgs * (sizeof(void*)));
|
||||||
|
if(pSavedFunc == NULL) return NULL;
|
||||||
pSavedFunc->func = func;
|
pSavedFunc->func = func;
|
||||||
return pSavedFunc;
|
return pSavedFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
tI32SavedFunc* i32SavedFuncInit(I32VaFunc func, int numOfArgs) {
|
tI32SavedFunc* i32SavedFuncInit(I32VaFunc func, int numOfArgs) {
|
||||||
tI32SavedFunc* pSavedFunc = malloc(sizeof(tI32SavedFunc) + numOfArgs * sizeof(void *));
|
tI32SavedFunc* pSavedFunc = malloc(sizeof(tI32SavedFunc) + numOfArgs * sizeof(void *));
|
||||||
|
if(pSavedFunc == NULL) return NULL;
|
||||||
pSavedFunc->func = func;
|
pSavedFunc->func = func;
|
||||||
return pSavedFunc;
|
return pSavedFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
tVoidSavedFunc* voidSavedFuncInit(VoidVaFunc func, int numOfArgs) {
|
tVoidSavedFunc* voidSavedFuncInit(VoidVaFunc func, int numOfArgs) {
|
||||||
tVoidSavedFunc* pSavedFunc = malloc(sizeof(tVoidSavedFunc) + numOfArgs * sizeof(void*));
|
tVoidSavedFunc* pSavedFunc = malloc(sizeof(tVoidSavedFunc) + numOfArgs * sizeof(void*));
|
||||||
|
if(pSavedFunc == NULL) return NULL;
|
||||||
pSavedFunc->func = func;
|
pSavedFunc->func = func;
|
||||||
return pSavedFunc;
|
return pSavedFunc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue