fix asserts
This commit is contained in:
parent
028ded935a
commit
4b81962269
|
@ -342,8 +342,8 @@ typedef struct tDataTypeDescriptor {
|
||||||
extern tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX];
|
extern tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX];
|
||||||
bool isValidDataType(int32_t type);
|
bool isValidDataType(int32_t type);
|
||||||
|
|
||||||
|
int32_t operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type);
|
||||||
void assignVal(char *val, const char *src, int32_t len, int32_t type);
|
void assignVal(char *val, const char *src, int32_t len, int32_t type);
|
||||||
void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type);
|
|
||||||
void *getDataMin(int32_t type, void* value);
|
void *getDataMin(int32_t type, void* value);
|
||||||
void *getDataMax(int32_t type, void* value);
|
void *getDataMax(int32_t type, void* value);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#define MALLOC_ALIGN_BYTES 256
|
#define MALLOC_ALIGN_BYTES 256
|
||||||
|
|
||||||
int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) {
|
int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) {
|
||||||
ASSERT(pColumnInfoData != NULL);
|
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
return pColumnInfoData->varmeta.length;
|
return pColumnInfoData->varmeta.length;
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,8 +64,6 @@ int32_t getJsonValueLen(const char* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, bool isNull) {
|
int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, bool isNull) {
|
||||||
ASSERT(pColumnInfoData != NULL);
|
|
||||||
|
|
||||||
if (isNull) {
|
if (isNull) {
|
||||||
// There is a placehold for each NULL value of binary or nchar type.
|
// There is a placehold for each NULL value of binary or nchar type.
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
|
@ -177,8 +174,6 @@ static void doCopyNItems(struct SColumnInfoData* pColumnInfoData, int32_t curren
|
||||||
|
|
||||||
int32_t colDataAppendNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData,
|
int32_t colDataAppendNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData,
|
||||||
uint32_t numOfRows) {
|
uint32_t numOfRows) {
|
||||||
ASSERT(pData != NULL && pColumnInfoData != NULL);
|
|
||||||
|
|
||||||
int32_t len = pColumnInfoData->info.bytes;
|
int32_t len = pColumnInfoData->info.bytes;
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
len = varDataTLen(pData);
|
len = varDataTLen(pData);
|
||||||
|
@ -236,7 +231,10 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c
|
||||||
|
|
||||||
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
|
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
|
||||||
const SColumnInfoData* pSource, int32_t numOfRow2) {
|
const SColumnInfoData* pSource, int32_t numOfRow2) {
|
||||||
ASSERT(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type);
|
if (pColumnInfoData->info.type != pSource->info.type) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
if (numOfRow2 == 0) {
|
if (numOfRow2 == 0) {
|
||||||
return numOfRow1;
|
return numOfRow1;
|
||||||
}
|
}
|
||||||
|
@ -316,13 +314,13 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int
|
||||||
|
|
||||||
int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows,
|
int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows,
|
||||||
const SDataBlockInfo* pBlockInfo) {
|
const SDataBlockInfo* pBlockInfo) {
|
||||||
ASSERT(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type);
|
if (pColumnInfoData->info.type != pSource->info.type ||
|
||||||
if (numOfRows <= 0) {
|
pBlockInfo->capacity < numOfRows) {
|
||||||
return numOfRows;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBlockInfo != NULL) {
|
if (numOfRows <= 0) {
|
||||||
ASSERT(pBlockInfo->capacity >= numOfRows);
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
|
@ -388,7 +386,6 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc) {
|
int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc) {
|
||||||
assert(pSrc != NULL && pDest != NULL);
|
|
||||||
int32_t capacity = pDest->info.capacity;
|
int32_t capacity = pDest->info.capacity;
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pDest->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pDest->pDataBlock);
|
||||||
|
@ -406,8 +403,6 @@ int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t blockDataGetSize(const SSDataBlock* pBlock) {
|
size_t blockDataGetSize(const SSDataBlock* pBlock) {
|
||||||
assert(pBlock != NULL);
|
|
||||||
|
|
||||||
size_t total = 0;
|
size_t total = 0;
|
||||||
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
|
@ -422,8 +417,6 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) {
|
||||||
// Actual data rows pluses the corresponding meta data must fit in one memory buffer of the given page size.
|
// Actual data rows pluses the corresponding meta data must fit in one memory buffer of the given page size.
|
||||||
int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startIndex, int32_t* stopIndex,
|
int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startIndex, int32_t* stopIndex,
|
||||||
int32_t pageSize) {
|
int32_t pageSize) {
|
||||||
ASSERT(pBlock != NULL && stopIndex != NULL);
|
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
int32_t numOfRows = pBlock->info.rows;
|
int32_t numOfRows = pBlock->info.rows;
|
||||||
|
|
||||||
|
@ -437,7 +430,9 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
|
||||||
if (!hasVarCol) {
|
if (!hasVarCol) {
|
||||||
size_t rowSize = blockDataGetRowSize(pBlock);
|
size_t rowSize = blockDataGetRowSize(pBlock);
|
||||||
int32_t capacity = payloadSize / (rowSize + numOfCols * bitmapChar / 8.0);
|
int32_t capacity = payloadSize / (rowSize + numOfCols * bitmapChar / 8.0);
|
||||||
ASSERT(capacity > 0);
|
if (capacity <= 0) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
*stopIndex = startIndex + capacity - 1;
|
*stopIndex = startIndex + capacity - 1;
|
||||||
if (*stopIndex >= numOfRows) {
|
if (*stopIndex >= numOfRows) {
|
||||||
|
@ -469,7 +464,9 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
|
||||||
|
|
||||||
if (size > pageSize) { // pageSize must be able to hold one row
|
if (size > pageSize) { // pageSize must be able to hold one row
|
||||||
*stopIndex = j - 1;
|
*stopIndex = j - 1;
|
||||||
ASSERT(*stopIndex >= startIndex);
|
if (*stopIndex < startIndex) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -540,8 +537,6 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) {
|
int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) {
|
||||||
ASSERT(pBlock != NULL);
|
|
||||||
|
|
||||||
// write the number of rows
|
// write the number of rows
|
||||||
*(uint32_t*)buf = pBlock->info.rows;
|
*(uint32_t*)buf = pBlock->info.rows;
|
||||||
|
|
||||||
|
@ -612,7 +607,9 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pCol->varmeta.length = colLength;
|
pCol->varmeta.length = colLength;
|
||||||
ASSERT(pCol->varmeta.length <= pCol->varmeta.allocLen);
|
if (pCol->varmeta.length > pCol->varmeta.allocLen) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pCol->pData, pStart, colLength);
|
memcpy(pCol->pData, pStart, colLength);
|
||||||
|
@ -659,7 +656,9 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
pCol->varmeta.length = colLength;
|
pCol->varmeta.length = colLength;
|
||||||
ASSERT(pCol->varmeta.length <= pCol->varmeta.allocLen);
|
if (pCol->varmeta.length > pCol->varmeta.allocLen) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!colDataIsNNull_s(pCol, 0, pBlock->info.rows)) {
|
if (!colDataIsNNull_s(pCol, 0, pBlock->info.rows)) {
|
||||||
|
@ -673,7 +672,6 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t blockDataGetRowSize(SSDataBlock* pBlock) {
|
size_t blockDataGetRowSize(SSDataBlock* pBlock) {
|
||||||
ASSERT(pBlock != NULL);
|
|
||||||
if (pBlock->info.rowSize == 0) {
|
if (pBlock->info.rowSize == 0) {
|
||||||
size_t rowSize = 0;
|
size_t rowSize = 0;
|
||||||
|
|
||||||
|
@ -702,7 +700,6 @@ size_t blockDataGetSerialMetaSize(uint32_t numOfCols) {
|
||||||
}
|
}
|
||||||
|
|
||||||
double blockDataGetSerialRowSize(const SSDataBlock* pBlock) {
|
double blockDataGetSerialRowSize(const SSDataBlock* pBlock) {
|
||||||
ASSERT(pBlock != NULL);
|
|
||||||
double rowSize = 0;
|
double rowSize = 0;
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
|
@ -905,7 +902,6 @@ static int32_t* createTupleIndex(size_t rows) {
|
||||||
static void destroyTupleIndex(int32_t* index) { taosMemoryFreeClear(index); }
|
static void destroyTupleIndex(int32_t* index) { taosMemoryFreeClear(index); }
|
||||||
|
|
||||||
int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
|
int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
|
||||||
ASSERT(pDataBlock != NULL && pOrderInfo != NULL);
|
|
||||||
if (pDataBlock->info.rows <= 1) {
|
if (pDataBlock->info.rows <= 1) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1149,8 +1145,7 @@ void blockDataCleanup(SSDataBlock* pDataBlock) {
|
||||||
|
|
||||||
void blockDataEmpty(SSDataBlock* pDataBlock) {
|
void blockDataEmpty(SSDataBlock* pDataBlock) {
|
||||||
SDataBlockInfo* pInfo = &pDataBlock->info;
|
SDataBlockInfo* pInfo = &pDataBlock->info;
|
||||||
ASSERT(pInfo->rows <= pDataBlock->info.capacity);
|
if (pInfo->capacity == 0 || pInfo->rows <= pDataBlock->info.capacity) {
|
||||||
if (pInfo->capacity == 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,8 +1163,7 @@ void blockDataEmpty(SSDataBlock* pDataBlock) {
|
||||||
|
|
||||||
// todo temporarily disable it
|
// todo temporarily disable it
|
||||||
static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows, bool clearPayload) {
|
static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows, bool clearPayload) {
|
||||||
ASSERT(numOfRows > 0);
|
if (numOfRows <= 0 || numOfRows <= pBlockInfo->capacity) {
|
||||||
if (numOfRows <= pBlockInfo->capacity) {
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1196,7 +1190,9 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
|
||||||
int32_t oldLen = BitmapLen(existedRows);
|
int32_t oldLen = BitmapLen(existedRows);
|
||||||
pColumn->nullbitmap = tmp;
|
pColumn->nullbitmap = tmp;
|
||||||
memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen);
|
memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen);
|
||||||
ASSERT(pColumn->info.bytes);
|
if (pColumn->info.bytes == 0) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
// make sure the allocated memory is MALLOC_ALIGN_BYTES aligned
|
// make sure the allocated memory is MALLOC_ALIGN_BYTES aligned
|
||||||
tmp = taosMemoryMallocAlign(MALLOC_ALIGN_BYTES, numOfRows * pColumn->info.bytes);
|
tmp = taosMemoryMallocAlign(MALLOC_ALIGN_BYTES, numOfRows * pColumn->info.bytes);
|
||||||
|
@ -1214,7 +1210,9 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
|
||||||
|
|
||||||
// todo remove it soon
|
// todo remove it soon
|
||||||
#if defined LINUX
|
#if defined LINUX
|
||||||
ASSERT((((uint64_t)pColumn->pData) & (MALLOC_ALIGN_BYTES - 1)) == 0x0);
|
if ((((uint64_t)pColumn->pData) & (MALLOC_ALIGN_BYTES - 1)) != 0x0) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (clearPayload) {
|
if (clearPayload) {
|
||||||
|
@ -1308,8 +1306,6 @@ void* blockDataDestroy(SSDataBlock* pBlock) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
||||||
ASSERT(src != NULL);
|
|
||||||
|
|
||||||
dst->info = src->info;
|
dst->info = src->info;
|
||||||
dst->info.rows = 0;
|
dst->info.rows = 0;
|
||||||
dst->info.capacity = 0;
|
dst->info.capacity = 0;
|
||||||
|
@ -1344,8 +1340,6 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
||||||
ASSERT(src != NULL && dst != NULL);
|
|
||||||
|
|
||||||
blockDataCleanup(dst);
|
blockDataCleanup(dst);
|
||||||
int32_t code = blockDataEnsureCapacity(dst, src->info.rows);
|
int32_t code = blockDataEnsureCapacity(dst, src->info.rows);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -1501,7 +1495,6 @@ SSDataBlock* createDataBlock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData) {
|
int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData) {
|
||||||
ASSERT(pBlock != NULL && pColInfoData != NULL);
|
|
||||||
if (pBlock->pDataBlock == NULL) {
|
if (pBlock->pDataBlock == NULL) {
|
||||||
pBlock->pDataBlock = taosArrayInit(4, sizeof(SColumnInfoData));
|
pBlock->pDataBlock = taosArrayInit(4, sizeof(SColumnInfoData));
|
||||||
if (pBlock->pDataBlock == NULL) {
|
if (pBlock->pDataBlock == NULL) {
|
||||||
|
@ -1536,7 +1529,6 @@ SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId)
|
||||||
}
|
}
|
||||||
|
|
||||||
SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index) {
|
SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index) {
|
||||||
ASSERT(pBlock != NULL);
|
|
||||||
if (index >= taosArrayGetSize(pBlock->pDataBlock)) {
|
if (index >= taosArrayGetSize(pBlock->pDataBlock)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2142,7 +2134,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
|
||||||
case TSDB_DATA_TYPE_JSON:
|
case TSDB_DATA_TYPE_JSON:
|
||||||
case TSDB_DATA_TYPE_MEDIUMBLOB:
|
case TSDB_DATA_TYPE_MEDIUMBLOB:
|
||||||
uError("the column type %" PRIi16 " is defined but not implemented yet", pColInfoData->info.type);
|
uError("the column type %" PRIi16 " is defined but not implemented yet", pColInfoData->info.type);
|
||||||
ASSERT(0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) {
|
if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) {
|
||||||
|
@ -2176,7 +2167,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uError("the column type %" PRIi16 " is undefined\n", pColInfoData->info.type);
|
uError("the column type %" PRIi16 " is undefined\n", pColInfoData->info.type);
|
||||||
ASSERT(0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2222,7 +2212,10 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
|
||||||
}
|
}
|
||||||
|
|
||||||
char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
|
char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
|
||||||
ASSERT(stbFullName[0] != 0);
|
if (stbFullName[0] == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SArray* tags = taosArrayInit(0, sizeof(void*));
|
SArray* tags = taosArrayInit(0, sizeof(void*));
|
||||||
if (tags == NULL) {
|
if (tags == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2260,7 +2253,9 @@ char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
|
||||||
taosMemoryFree(pTag);
|
taosMemoryFree(pTag);
|
||||||
taosArrayDestroy(tags);
|
taosArrayDestroy(tags);
|
||||||
|
|
||||||
ASSERT(rname.ctbShortName && rname.ctbShortName[0]);
|
if ((rname.ctbShortName && rname.ctbShortName[0]) == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return rname.ctbShortName;
|
return rname.ctbShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,6 @@ SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tNameExtractFullName(const SName* name, char* dst) {
|
int32_t tNameExtractFullName(const SName* name, char* dst) {
|
||||||
assert(name != NULL && dst != NULL);
|
|
||||||
|
|
||||||
// invalid full name format, abort
|
// invalid full name format, abort
|
||||||
if (!tNameIsValid(name)) {
|
if (!tNameIsValid(name)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -109,7 +107,7 @@ int32_t tNameExtractFullName(const SName* name, char* dst) {
|
||||||
|
|
||||||
size_t tnameLen = strlen(name->tname);
|
size_t tnameLen = strlen(name->tname);
|
||||||
if (tnameLen > 0) {
|
if (tnameLen > 0) {
|
||||||
/*assert(name->type == TSDB_TABLE_NAME_T);*/
|
/*ASSERT(name->type == TSDB_TABLE_NAME_T);*/
|
||||||
dst[len] = TS_PATH_DELIMITER[0];
|
dst[len] = TS_PATH_DELIMITER[0];
|
||||||
|
|
||||||
memcpy(dst + len + 1, name->tname, tnameLen);
|
memcpy(dst + len + 1, name->tname, tnameLen);
|
||||||
|
@ -120,25 +118,21 @@ int32_t tNameExtractFullName(const SName* name, char* dst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tNameLen(const SName* name) {
|
int32_t tNameLen(const SName* name) {
|
||||||
assert(name != NULL);
|
|
||||||
|
|
||||||
char tmp[12] = {0};
|
char tmp[12] = {0};
|
||||||
int32_t len = sprintf(tmp, "%d", name->acctId);
|
int32_t len = sprintf(tmp, "%d", name->acctId);
|
||||||
int32_t len1 = (int32_t)strlen(name->dbname);
|
int32_t len1 = (int32_t)strlen(name->dbname);
|
||||||
int32_t len2 = (int32_t)strlen(name->tname);
|
int32_t len2 = (int32_t)strlen(name->tname);
|
||||||
|
|
||||||
if (name->type == TSDB_DB_NAME_T) {
|
if (name->type == TSDB_DB_NAME_T) {
|
||||||
assert(len2 == 0);
|
ASSERT(len2 == 0);
|
||||||
return len + len1 + TSDB_NAME_DELIMITER_LEN;
|
return len + len1 + TSDB_NAME_DELIMITER_LEN;
|
||||||
} else {
|
} else {
|
||||||
assert(len2 > 0);
|
ASSERT(len2 > 0);
|
||||||
return len + len1 + len2 + TSDB_NAME_DELIMITER_LEN * 2;
|
return len + len1 + len2 + TSDB_NAME_DELIMITER_LEN * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tNameIsValid(const SName* name) {
|
bool tNameIsValid(const SName* name) {
|
||||||
assert(name != NULL);
|
|
||||||
|
|
||||||
if (!VALID_NAME_TYPE(name->type)) {
|
if (!VALID_NAME_TYPE(name->type)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -151,15 +145,12 @@ bool tNameIsValid(const SName* name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SName* tNameDup(const SName* name) {
|
SName* tNameDup(const SName* name) {
|
||||||
assert(name != NULL);
|
|
||||||
|
|
||||||
SName* p = taosMemoryMalloc(sizeof(SName));
|
SName* p = taosMemoryMalloc(sizeof(SName));
|
||||||
memcpy(p, name, sizeof(SName));
|
memcpy(p, name, sizeof(SName));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tNameGetDbName(const SName* name, char* dst) {
|
int32_t tNameGetDbName(const SName* name, char* dst) {
|
||||||
assert(name != NULL && dst != NULL);
|
|
||||||
strncpy(dst, name->dbname, tListLen(name->dbname));
|
strncpy(dst, name->dbname, tListLen(name->dbname));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -167,28 +158,24 @@ int32_t tNameGetDbName(const SName* name, char* dst) {
|
||||||
const char* tNameGetDbNameP(const SName* name) { return &name->dbname[0]; }
|
const char* tNameGetDbNameP(const SName* name) { return &name->dbname[0]; }
|
||||||
|
|
||||||
int32_t tNameGetFullDbName(const SName* name, char* dst) {
|
int32_t tNameGetFullDbName(const SName* name, char* dst) {
|
||||||
assert(name != NULL && dst != NULL);
|
|
||||||
snprintf(dst, TSDB_DB_FNAME_LEN, "%d.%s", name->acctId, name->dbname);
|
snprintf(dst, TSDB_DB_FNAME_LEN, "%d.%s", name->acctId, name->dbname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tNameIsEmpty(const SName* name) {
|
bool tNameIsEmpty(const SName* name) {
|
||||||
assert(name != NULL);
|
|
||||||
return name->type == 0 || name->acctId == 0;
|
return name->type == 0 || name->acctId == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* tNameGetTableName(const SName* name) {
|
const char* tNameGetTableName(const SName* name) {
|
||||||
assert(name != NULL && name->type == TSDB_TABLE_NAME_T);
|
ASSERT(name != NULL && name->type == TSDB_TABLE_NAME_T);
|
||||||
return &name->tname[0];
|
return &name->tname[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void tNameAssign(SName* dst, const SName* src) { memcpy(dst, src, sizeof(SName)); }
|
void tNameAssign(SName* dst, const SName* src) { memcpy(dst, src, sizeof(SName)); }
|
||||||
|
|
||||||
int32_t tNameSetDbName(SName* dst, int32_t acct, const char* dbName, size_t nameLen) {
|
int32_t tNameSetDbName(SName* dst, int32_t acct, const char* dbName, size_t nameLen) {
|
||||||
assert(dst != NULL && dbName != NULL && nameLen > 0);
|
|
||||||
|
|
||||||
// too long account id or too long db name
|
// too long account id or too long db name
|
||||||
if (nameLen >= tListLen(dst->dbname)) {
|
if (nameLen <= 0 || nameLen >= tListLen(dst->dbname)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +186,6 @@ int32_t tNameSetDbName(SName* dst, int32_t acct, const char* dbName, size_t name
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tNameAddTbName(SName* dst, const char* tbName, size_t nameLen) {
|
int32_t tNameAddTbName(SName* dst, const char* tbName, size_t nameLen) {
|
||||||
assert(dst != NULL && tbName != NULL && nameLen > 0);
|
|
||||||
|
|
||||||
// too long account id or too long db name
|
// too long account id or too long db name
|
||||||
if (nameLen >= tListLen(dst->tname) || nameLen <= 0) {
|
if (nameLen >= tListLen(dst->tname) || nameLen <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -212,7 +197,6 @@ int32_t tNameAddTbName(SName* dst, const char* tbName, size_t nameLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tNameSetAcctId(SName* dst, int32_t acctId) {
|
int32_t tNameSetAcctId(SName* dst, int32_t acctId) {
|
||||||
assert(dst != NULL);
|
|
||||||
dst->acctId = acctId;
|
dst->acctId = acctId;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +231,9 @@ bool tNameTbNameEqual(SName* left, SName* right) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
|
int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
|
||||||
assert(dst != NULL && str != NULL && strlen(str) > 0);
|
if (strlen(str) == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
char* p = NULL;
|
char* p = NULL;
|
||||||
if ((type & T_NAME_ACCT) == T_NAME_ACCT) {
|
if ((type & T_NAME_ACCT) == T_NAME_ACCT) {
|
||||||
|
|
|
@ -76,7 +76,6 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!pVal->val) {
|
if (!pVal->val) {
|
||||||
ASSERT(0);
|
|
||||||
printf("BadVal ");
|
printf("BadVal ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -490,7 +489,6 @@ bool tdSTSRowGetVal(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCell
|
||||||
|
|
||||||
int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||||
if (!pBitmap || colIdx < 0) {
|
if (!pBitmap || colIdx < 0) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -512,7 +510,6 @@ int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pVa
|
||||||
*pValType = ((*pDestByte) & 0x03);
|
*pValType = ((*pDestByte) & 0x03);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -521,7 +518,6 @@ int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pVa
|
||||||
|
|
||||||
int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||||
if (!pBitmap || colIdx < 0) {
|
if (!pBitmap || colIdx < 0) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -555,7 +551,6 @@ int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pVal
|
||||||
*pValType = ((*pDestByte) & 0x01);
|
*pValType = ((*pDestByte) & 0x01);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -564,7 +559,6 @@ int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pVal
|
||||||
|
|
||||||
int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||||
if (!pBitmap || colIdx < 0) {
|
if (!pBitmap || colIdx < 0) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -607,7 +601,6 @@ int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||||
// *pDestByte |= (valType);
|
// *pDestByte |= (valType);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -630,7 +623,6 @@ int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, void *pBitmap, int32_
|
||||||
output->val = POINTER_SHIFT(pRow, offset);
|
output->val = POINTER_SHIFT(pRow, offset);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ASSERT(0);
|
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
output->valType = TD_VTYPE_NONE;
|
output->valType = TD_VTYPE_NONE;
|
||||||
|
@ -680,7 +672,6 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
#endif
|
#endif
|
||||||
|
@ -707,8 +698,8 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp
|
||||||
if (!pBuilder->hasNone) pBuilder->hasNone = true;
|
if (!pBuilder->hasNone) pBuilder->hasNone = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
break;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TD_IS_TP_ROW(pRow)) {
|
if (TD_IS_TP_ROW(pRow)) {
|
||||||
|
@ -722,7 +713,6 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp
|
||||||
int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowValT valType, const void *val, bool isCopyVarData,
|
int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowValT valType, const void *val, bool isCopyVarData,
|
||||||
int8_t colType, int16_t colIdx, int32_t offset, col_id_t colId) {
|
int8_t colType, int16_t colIdx, int32_t offset, col_id_t colId) {
|
||||||
if ((offset < (int32_t)sizeof(SKvRowIdx)) || (colIdx < 1)) {
|
if ((offset < (int32_t)sizeof(SKvRowIdx)) || (colIdx < 1)) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -810,7 +800,6 @@ int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBou
|
||||||
pBuilder->nCols = nCols;
|
pBuilder->nCols = nCols;
|
||||||
pBuilder->nBoundCols = nBoundCols;
|
pBuilder->nBoundCols = nBoundCols;
|
||||||
if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) {
|
if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -832,7 +821,6 @@ int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBou
|
||||||
int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
||||||
pBuilder->pBuf = (STSRow *)pBuf;
|
pBuilder->pBuf = (STSRow *)pBuf;
|
||||||
if (!pBuilder->pBuf) {
|
if (!pBuilder->pBuf) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -869,7 +857,6 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
||||||
TD_ROW_SET_NCOLS(pBuilder->pBuf, pBuilder->nBoundCols);
|
TD_ROW_SET_NCOLS(pBuilder->pBuf, pBuilder->nBoundCols);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -880,7 +867,6 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
||||||
int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
||||||
pBuilder->pBuf = (STSRow *)pBuf;
|
pBuilder->pBuf = (STSRow *)pBuf;
|
||||||
if (!pBuilder->pBuf) {
|
if (!pBuilder->pBuf) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -900,7 +886,6 @@ int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -920,7 +905,6 @@ int32_t tdSRowSetTpInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t flen) {
|
||||||
pBuilder->flen = flen;
|
pBuilder->flen = flen;
|
||||||
pBuilder->nCols = nCols;
|
pBuilder->nCols = nCols;
|
||||||
if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) {
|
if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -939,7 +923,6 @@ int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols,
|
||||||
pBuilder->nCols = nCols;
|
pBuilder->nCols = nCols;
|
||||||
pBuilder->nBoundCols = nBoundCols;
|
pBuilder->nBoundCols = nBoundCols;
|
||||||
if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) {
|
if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -968,7 +951,6 @@ int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValT
|
||||||
tdGetBitmapValTypeI(pBitmap, colIdx, pValType);
|
tdGetBitmapValTypeI(pBitmap, colIdx, pValType);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -987,7 +969,6 @@ bool tdIsBitmapValTypeNorm(const void *pBitmap, int16_t idx, int8_t bitmapMode)
|
||||||
|
|
||||||
int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||||
if (!pBitmap || colIdx < 0) {
|
if (!pBitmap || colIdx < 0) {
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -1014,7 +995,6 @@ int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||||
// *pDestByte |= (valType);
|
// *pDestByte |= (valType);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -1031,7 +1011,6 @@ int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int
|
||||||
tdSetBitmapValTypeI(pBitmap, colIdx, valType);
|
tdSetBitmapValTypeI(pBitmap, colIdx, valType);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,12 +168,13 @@ int64_t parseFraction(char* str, char** end, int32_t timePrec) {
|
||||||
i = MICRO_SEC_FRACTION_LEN;
|
i = MICRO_SEC_FRACTION_LEN;
|
||||||
}
|
}
|
||||||
times = MICRO_SEC_FRACTION_LEN - i;
|
times = MICRO_SEC_FRACTION_LEN - i;
|
||||||
} else {
|
} else if (timePrec == TSDB_TIME_PRECISION_NANO) {
|
||||||
assert(timePrec == TSDB_TIME_PRECISION_NANO);
|
|
||||||
if (i >= NANO_SEC_FRACTION_LEN) {
|
if (i >= NANO_SEC_FRACTION_LEN) {
|
||||||
i = NANO_SEC_FRACTION_LEN;
|
i = NANO_SEC_FRACTION_LEN;
|
||||||
}
|
}
|
||||||
times = NANO_SEC_FRACTION_LEN - i;
|
times = NANO_SEC_FRACTION_LEN - i;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fraction = strnatoi(str, i) * factor[times];
|
fraction = strnatoi(str, i) * factor[times];
|
||||||
|
@ -510,8 +511,11 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre
|
||||||
// !!!!notice: double lose precison if time is too large, for example: 1626006833631000000*1.0 = double =
|
// !!!!notice: double lose precison if time is too large, for example: 1626006833631000000*1.0 = double =
|
||||||
// 1626006833631000064
|
// 1626006833631000064
|
||||||
int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit) {
|
int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit) {
|
||||||
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
if (fromPrecision != TSDB_TIME_PRECISION_MILLI && fromPrecision != TSDB_TIME_PRECISION_MICRO &&
|
||||||
fromPrecision == TSDB_TIME_PRECISION_NANO);
|
fromPrecision != TSDB_TIME_PRECISION_NANO) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t factors[3] = {NANOSECOND_PER_MSEC, NANOSECOND_PER_USEC, 1};
|
int64_t factors[3] = {NANOSECOND_PER_MSEC, NANOSECOND_PER_USEC, 1};
|
||||||
double tmp = time;
|
double tmp = time;
|
||||||
switch (toUnit) {
|
switch (toUnit) {
|
||||||
|
@ -761,8 +765,7 @@ int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision) {
|
int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision) {
|
||||||
if (pInterval->sliding == 0) {
|
if (pInterval->sliding == 0 && pInterval->interval == 0) {
|
||||||
assert(pInterval->interval == 0);
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,7 +934,7 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fractionLen = 0;
|
fractionLen = 0;
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosLocalTime(", &ptm);
|
taosLocalTime(", &ptm);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "ttszip.h"
|
#include "ttszip.h"
|
||||||
#include "taoserror.h"
|
#include "taoserror.h"
|
||||||
#include "tcompression.h"
|
#include "tcompression.h"
|
||||||
|
#include "tlog.h"
|
||||||
|
|
||||||
static int32_t getDataStartOffset();
|
static int32_t getDataStartOffset();
|
||||||
static void TSBufUpdateGroupInfo(STSBuf* pTSBuf, int32_t index, STSGroupBlockInfo* pBlockInfo);
|
static void TSBufUpdateGroupInfo(STSBuf* pTSBuf, int32_t index, STSGroupBlockInfo* pBlockInfo);
|
||||||
|
@ -202,14 +203,14 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
|
||||||
static STSGroupBlockInfoEx* tsBufGetLastGroupInfo(STSBuf* pTSBuf) {
|
static STSGroupBlockInfoEx* tsBufGetLastGroupInfo(STSBuf* pTSBuf) {
|
||||||
int32_t last = pTSBuf->numOfGroups - 1;
|
int32_t last = pTSBuf->numOfGroups - 1;
|
||||||
|
|
||||||
assert(last >= 0);
|
ASSERT(last >= 0);
|
||||||
return &pTSBuf->pData[last];
|
return &pTSBuf->pData[last];
|
||||||
}
|
}
|
||||||
|
|
||||||
static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
|
static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
|
||||||
if (pTSBuf->numOfAlloc <= pTSBuf->numOfGroups) {
|
if (pTSBuf->numOfAlloc <= pTSBuf->numOfGroups) {
|
||||||
uint32_t newSize = (uint32_t)(pTSBuf->numOfAlloc * 1.5);
|
uint32_t newSize = (uint32_t)(pTSBuf->numOfAlloc * 1.5);
|
||||||
assert((int32_t)newSize > pTSBuf->numOfAlloc);
|
ASSERT((int32_t)newSize > pTSBuf->numOfAlloc);
|
||||||
|
|
||||||
STSGroupBlockInfoEx* tmp =
|
STSGroupBlockInfoEx* tmp =
|
||||||
(STSGroupBlockInfoEx*)taosMemoryRealloc(pTSBuf->pData, sizeof(STSGroupBlockInfoEx) * newSize);
|
(STSGroupBlockInfoEx*)taosMemoryRealloc(pTSBuf->pData, sizeof(STSGroupBlockInfoEx) * newSize);
|
||||||
|
@ -233,7 +234,7 @@ static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
|
||||||
STSGroupBlockInfo* pBlockInfo = &pTSBuf->pData[pTSBuf->numOfGroups].info;
|
STSGroupBlockInfo* pBlockInfo = &pTSBuf->pData[pTSBuf->numOfGroups].info;
|
||||||
pBlockInfo->id = id;
|
pBlockInfo->id = id;
|
||||||
pBlockInfo->offset = pTSBuf->fileSize;
|
pBlockInfo->offset = pTSBuf->fileSize;
|
||||||
assert(pBlockInfo->offset >= getDataStartOffset());
|
ASSERT(pBlockInfo->offset >= getDataStartOffset());
|
||||||
|
|
||||||
// update vnode info in file
|
// update vnode info in file
|
||||||
TSBufUpdateGroupInfo(pTSBuf, pTSBuf->numOfGroups, pBlockInfo);
|
TSBufUpdateGroupInfo(pTSBuf, pTSBuf->numOfGroups, pBlockInfo);
|
||||||
|
@ -282,7 +283,7 @@ static void writeDataToDisk(STSBuf* pTSBuf) {
|
||||||
pTsData->allocSize, TWO_STAGE_COMP, pTSBuf->assistBuf, pTSBuf->bufSize);
|
pTsData->allocSize, TWO_STAGE_COMP, pTSBuf->assistBuf, pTSBuf->bufSize);
|
||||||
|
|
||||||
int64_t r = taosLSeekFile(pTSBuf->pFile, pTSBuf->fileSize, SEEK_SET);
|
int64_t r = taosLSeekFile(pTSBuf->pFile, pTSBuf->fileSize, SEEK_SET);
|
||||||
assert(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* format for output data:
|
* format for output data:
|
||||||
|
@ -316,7 +317,7 @@ static void writeDataToDisk(STSBuf* pTSBuf) {
|
||||||
taosWriteFile(pTSBuf->pFile, &pBlock->compLen, sizeof(pBlock->compLen));
|
taosWriteFile(pTSBuf->pFile, &pBlock->compLen, sizeof(pBlock->compLen));
|
||||||
|
|
||||||
metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &trueLen, sizeof(pBlock->tag.nLen));
|
metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &trueLen, sizeof(pBlock->tag.nLen));
|
||||||
assert(metaLen == getTagAreaLength(&pBlock->tag));
|
ASSERT(metaLen == getTagAreaLength(&pBlock->tag));
|
||||||
|
|
||||||
int32_t blockSize = metaLen + sizeof(pBlock->numOfElem) + sizeof(pBlock->compLen) * 2 + pBlock->compLen;
|
int32_t blockSize = metaLen + sizeof(pBlock->numOfElem) + sizeof(pBlock->compLen) * 2 + pBlock->compLen;
|
||||||
pTSBuf->fileSize += blockSize;
|
pTSBuf->fileSize += blockSize;
|
||||||
|
@ -379,7 +380,7 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) {
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR) {
|
if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR) {
|
||||||
char* tp = taosMemoryRealloc(pBlock->tag.pz, pBlock->tag.nLen + 1);
|
char* tp = taosMemoryRealloc(pBlock->tag.pz, pBlock->tag.nLen + 1);
|
||||||
assert(tp != NULL);
|
ASSERT(tp != NULL);
|
||||||
|
|
||||||
memset(tp, 0, pBlock->tag.nLen + 1);
|
memset(tp, 0, pBlock->tag.nLen + 1);
|
||||||
pBlock->tag.pz = tp;
|
pBlock->tag.pz = tp;
|
||||||
|
@ -410,14 +411,14 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) {
|
||||||
|
|
||||||
// read the comp length at the length of comp block
|
// read the comp length at the length of comp block
|
||||||
sz = taosReadFile(pTSBuf->pFile, &pBlock->padding, sizeof(pBlock->padding));
|
sz = taosReadFile(pTSBuf->pFile, &pBlock->padding, sizeof(pBlock->padding));
|
||||||
assert(pBlock->padding == pBlock->compLen);
|
ASSERT(pBlock->padding == pBlock->compLen);
|
||||||
|
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
sz = taosReadFile(pTSBuf->pFile, &n, sizeof(pBlock->tag.nLen));
|
sz = taosReadFile(pTSBuf->pFile, &n, sizeof(pBlock->tag.nLen));
|
||||||
if (pBlock->tag.nType == TSDB_DATA_TYPE_NULL) {
|
if (pBlock->tag.nType == TSDB_DATA_TYPE_NULL) {
|
||||||
assert(n == 0);
|
ASSERT(n == 0);
|
||||||
} else {
|
} else {
|
||||||
assert(n == pBlock->tag.nLen);
|
ASSERT(n == pBlock->tag.nLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(sz);
|
UNUSED(sz);
|
||||||
|
@ -477,7 +478,7 @@ void tsBufAppend(STSBuf* pTSBuf, int32_t id, SVariant* tag, const char* pData, i
|
||||||
pBlockInfo = tsBufGetLastGroupInfo(pTSBuf);
|
pBlockInfo = tsBufGetLastGroupInfo(pTSBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pBlockInfo->info.id == id);
|
ASSERT(pBlockInfo->info.id == id);
|
||||||
|
|
||||||
if ((taosVariantCompare(&pTSBuf->block.tag, tag) != 0) && ptsData->len > 0) {
|
if ((taosVariantCompare(&pTSBuf->block.tag, tag) != 0) && ptsData->len > 0) {
|
||||||
// new arrived data with different tags value, save current value into disk first
|
// new arrived data with different tags value, save current value into disk first
|
||||||
|
@ -596,7 +597,7 @@ static int32_t tsBufFindBlockByTag(STSBuf* pTSBuf, STSGroupBlockInfo* pBlockInfo
|
||||||
static void tsBufGetBlock(STSBuf* pTSBuf, int32_t groupIndex, int32_t blockIndex) {
|
static void tsBufGetBlock(STSBuf* pTSBuf, int32_t groupIndex, int32_t blockIndex) {
|
||||||
STSGroupBlockInfo* pBlockInfo = &pTSBuf->pData[groupIndex].info;
|
STSGroupBlockInfo* pBlockInfo = &pTSBuf->pData[groupIndex].info;
|
||||||
if (pBlockInfo->numOfBlocks <= blockIndex) {
|
if (pBlockInfo->numOfBlocks <= blockIndex) {
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
STSCursor* pCur = &pTSBuf->cur;
|
STSCursor* pCur = &pTSBuf->cur;
|
||||||
|
@ -613,7 +614,7 @@ static void tsBufGetBlock(STSBuf* pTSBuf, int32_t groupIndex, int32_t blockIndex
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (tsBufFindBlock(pTSBuf, pBlockInfo, blockIndex) == -1) {
|
if (tsBufFindBlock(pTSBuf, pBlockInfo, blockIndex) == -1) {
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,7 +634,7 @@ static void tsBufGetBlock(STSBuf* pTSBuf, int32_t groupIndex, int32_t blockIndex
|
||||||
tsDecompressTimestamp(pBlock->payload, pBlock->compLen, pBlock->numOfElem, pTSBuf->tsData.rawBuf,
|
tsDecompressTimestamp(pBlock->payload, pBlock->compLen, pBlock->numOfElem, pTSBuf->tsData.rawBuf,
|
||||||
pTSBuf->tsData.allocSize, TWO_STAGE_COMP, pTSBuf->assistBuf, pTSBuf->bufSize);
|
pTSBuf->tsData.allocSize, TWO_STAGE_COMP, pTSBuf->assistBuf, pTSBuf->bufSize);
|
||||||
|
|
||||||
assert((pTSBuf->tsData.len / TSDB_KEYSIZE == pBlock->numOfElem) && (pTSBuf->tsData.allocSize >= pTSBuf->tsData.len));
|
ASSERT((pTSBuf->tsData.len / TSDB_KEYSIZE == pBlock->numOfElem) && (pTSBuf->tsData.allocSize >= pTSBuf->tsData.len));
|
||||||
|
|
||||||
pCur->vgroupIndex = groupIndex;
|
pCur->vgroupIndex = groupIndex;
|
||||||
pCur->blockIndex = blockIndex;
|
pCur->blockIndex = blockIndex;
|
||||||
|
@ -668,7 +669,9 @@ int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pHeader->tsOrder == TSDB_ORDER_ASC || pHeader->tsOrder == TSDB_ORDER_DESC);
|
if (pHeader->tsOrder != TSDB_ORDER_ASC && pHeader->tsOrder != TSDB_ORDER_DESC) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t r = taosLSeekFile(pTSBuf->pFile, 0, SEEK_SET);
|
int32_t r = taosLSeekFile(pTSBuf->pFile, 0, SEEK_SET);
|
||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
|
@ -705,7 +708,7 @@ bool tsBufNextPos(STSBuf* pTSBuf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // get the last timestamp record in the last block of the last vnode
|
} else { // get the last timestamp record in the last block of the last vnode
|
||||||
assert(pTSBuf->numOfGroups > 0);
|
ASSERT(pTSBuf->numOfGroups > 0);
|
||||||
|
|
||||||
int32_t groupIndex = pTSBuf->numOfGroups - 1;
|
int32_t groupIndex = pTSBuf->numOfGroups - 1;
|
||||||
pCur->vgroupIndex = groupIndex;
|
pCur->vgroupIndex = groupIndex;
|
||||||
|
@ -729,7 +732,7 @@ bool tsBufNextPos(STSBuf* pTSBuf) {
|
||||||
int32_t step = pCur->order == TSDB_ORDER_ASC ? 1 : -1;
|
int32_t step = pCur->order == TSDB_ORDER_ASC ? 1 : -1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
assert(pTSBuf->tsData.len == pTSBuf->block.numOfElem * TSDB_KEYSIZE);
|
ASSERT(pTSBuf->tsData.len == pTSBuf->block.numOfElem * TSDB_KEYSIZE);
|
||||||
|
|
||||||
if ((pCur->order == TSDB_ORDER_ASC && pCur->tsIndex >= pTSBuf->block.numOfElem - 1) ||
|
if ((pCur->order == TSDB_ORDER_ASC && pCur->tsIndex >= pTSBuf->block.numOfElem - 1) ||
|
||||||
(pCur->order == TSDB_ORDER_DESC && pCur->tsIndex <= 0)) {
|
(pCur->order == TSDB_ORDER_DESC && pCur->tsIndex <= 0)) {
|
||||||
|
@ -810,7 +813,7 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// src can only have one vnode index
|
// src can only have one vnode index
|
||||||
assert(pSrcBuf->numOfGroups == 1);
|
ASSERT(pSrcBuf->numOfGroups == 1);
|
||||||
|
|
||||||
// there are data in buffer, flush to disk first
|
// there are data in buffer, flush to disk first
|
||||||
tsBufFlush(pDestBuf);
|
tsBufFlush(pDestBuf);
|
||||||
|
@ -853,7 +856,7 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t r = taosLSeekFile(pDestBuf->pFile, 0, SEEK_END);
|
int32_t r = taosLSeekFile(pDestBuf->pFile, 0, SEEK_END);
|
||||||
assert(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
int64_t offset = getDataStartOffset();
|
int64_t offset = getDataStartOffset();
|
||||||
int32_t size = (int32_t)pSrcBuf->fileSize - (int32_t)offset;
|
int32_t size = (int32_t)pSrcBuf->fileSize - (int32_t)offset;
|
||||||
|
@ -881,7 +884,7 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf) {
|
||||||
}
|
}
|
||||||
pDestBuf->fileSize = (uint32_t)file_size;
|
pDestBuf->fileSize = (uint32_t)file_size;
|
||||||
|
|
||||||
assert(pDestBuf->fileSize == oldSize + size);
|
ASSERT(pDestBuf->fileSize == oldSize + size);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -913,7 +916,10 @@ STSBuf* tsBufCreateFromCompBlocks(const char* pData, int32_t numOfBlocks, int32_
|
||||||
pTSBuf->fileSize += len;
|
pTSBuf->fileSize += len;
|
||||||
|
|
||||||
pTSBuf->tsOrder = order;
|
pTSBuf->tsOrder = order;
|
||||||
assert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC);
|
if (order != TSDB_ORDER_ASC && order != TSDB_ORDER_DESC) {
|
||||||
|
tsBufDestroy(pTSBuf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
STSBufFileHeader header = {
|
STSBufFileHeader header = {
|
||||||
.magic = TS_COMP_FILE_MAGIC, .numOfGroup = pTSBuf->numOfGroups, .tsOrder = pTSBuf->tsOrder};
|
.magic = TS_COMP_FILE_MAGIC, .numOfGroup = pTSBuf->numOfGroups, .tsOrder = pTSBuf->tsOrder};
|
||||||
|
@ -1095,7 +1101,7 @@ void tsBufGetGroupIdList(STSBuf* pTSBuf, int32_t* num, int32_t** id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dumpFileBlockByGroupId(STSBuf* pTSBuf, int32_t groupIndex, void* buf, int32_t* len, int32_t* numOfBlocks) {
|
int32_t dumpFileBlockByGroupId(STSBuf* pTSBuf, int32_t groupIndex, void* buf, int32_t* len, int32_t* numOfBlocks) {
|
||||||
assert(groupIndex >= 0 && groupIndex < pTSBuf->numOfGroups);
|
ASSERT(groupIndex >= 0 && groupIndex < pTSBuf->numOfGroups);
|
||||||
STSGroupBlockInfo* pBlockInfo = &pTSBuf->pData[groupIndex].info;
|
STSGroupBlockInfo* pBlockInfo = &pTSBuf->pData[groupIndex].info;
|
||||||
|
|
||||||
*len = 0;
|
*len = 0;
|
||||||
|
|
|
@ -137,7 +137,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type) {
|
int32_t operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type) {
|
||||||
if (optr == OP_TYPE_ADD) {
|
if (optr == OP_TYPE_ADD) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
|
@ -174,11 +174,12 @@ void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type) {
|
||||||
SET_DOUBLE_VAL(dst, GET_DOUBLE_VAL(s1) + GET_DOUBLE_VAL(s2));
|
SET_DOUBLE_VAL(dst, GET_DOUBLE_VAL(s1) + GET_DOUBLE_VAL(s2));
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
assert(0);
|
return -1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(0);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) {
|
||||||
pSrc->nType == TSDB_DATA_TYPE_JSON) {
|
pSrc->nType == TSDB_DATA_TYPE_JSON) {
|
||||||
int32_t len = pSrc->nLen + TSDB_NCHAR_SIZE;
|
int32_t len = pSrc->nLen + TSDB_NCHAR_SIZE;
|
||||||
char *p = taosMemoryRealloc(pDst->pz, len);
|
char *p = taosMemoryRealloc(pDst->pz, len);
|
||||||
assert(p);
|
ASSERT(p);
|
||||||
|
|
||||||
memset(p, 0, len);
|
memset(p, 0, len);
|
||||||
pDst->pz = p;
|
pDst->pz = p;
|
||||||
|
@ -192,7 +192,7 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) {
|
||||||
size_t num = taosArrayGetSize(pSrc->arr);
|
size_t num = taosArrayGetSize(pSrc->arr);
|
||||||
pDst->arr = taosArrayInit(num, sizeof(int64_t));
|
pDst->arr = taosArrayInit(num, sizeof(int64_t));
|
||||||
pDst->nLen = pSrc->nLen;
|
pDst->nLen = pSrc->nLen;
|
||||||
assert(pSrc->nLen == num);
|
ASSERT(pSrc->nLen == num);
|
||||||
for (size_t i = 0; i < num; i++) {
|
for (size_t i = 0; i < num; i++) {
|
||||||
int64_t *p = taosArrayGet(pSrc->arr, i);
|
int64_t *p = taosArrayGet(pSrc->arr, i);
|
||||||
taosArrayPush(pDst->arr, p);
|
taosArrayPush(pDst->arr, p);
|
||||||
|
|
|
@ -776,7 +776,10 @@ int32_t filterFinishRange(void *h) {
|
||||||
|
|
||||||
while (r && r->next) {
|
while (r && r->next) {
|
||||||
int64_t tmp = 1;
|
int64_t tmp = 1;
|
||||||
operateVal(&tmp, &r->ra.e, &tmp, OP_TYPE_ADD, ctx->type);
|
int32_t code = operateVal(&tmp, &r->ra.e, &tmp, OP_TYPE_ADD, ctx->type);
|
||||||
|
if (code != 0) {
|
||||||
|
return TSDB_CODE_APP_ERROR;
|
||||||
|
}
|
||||||
if (ctx->pCompareFunc(&tmp, &r->next->ra.s) == 0) {
|
if (ctx->pCompareFunc(&tmp, &r->next->ra.s) == 0) {
|
||||||
rn = r->next;
|
rn = r->next;
|
||||||
SIMPLE_COPY_VALUES((char *)&r->next->ra.s, (char *)&r->ra.s);
|
SIMPLE_COPY_VALUES((char *)&r->next->ra.s, (char *)&r->ra.s);
|
||||||
|
|
Loading…
Reference in New Issue