fix compile issue on Windows
This commit is contained in:
parent
7f49ece341
commit
c28ac1665e
|
@ -1640,33 +1640,6 @@ int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, i
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// int tdInitMemRowBuilder(SMemRowBuilder* pBuilder) {
|
|
||||||
// pBuilder->pSchema = NULL;
|
|
||||||
// pBuilder->sversion = 0;
|
|
||||||
// pBuilder->tCols = 128;
|
|
||||||
// pBuilder->nCols = 0;
|
|
||||||
// pBuilder->pColIdx = (SColIdx*)malloc(sizeof(SColIdx) * pBuilder->tCols);
|
|
||||||
// if (pBuilder->pColIdx == NULL) return -1;
|
|
||||||
// pBuilder->alloc = 1024;
|
|
||||||
// pBuilder->size = 0;
|
|
||||||
// pBuilder->buf = malloc(pBuilder->alloc);
|
|
||||||
// if (pBuilder->buf == NULL) {
|
|
||||||
// free(pBuilder->pColIdx);
|
|
||||||
// return -1;
|
|
||||||
// }
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void tdDestroyMemRowBuilder(SMemRowBuilder* pBuilder) {
|
|
||||||
// tfree(pBuilder->pColIdx);
|
|
||||||
// tfree(pBuilder->buf);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void tdResetMemRowBuilder(SMemRowBuilder* pBuilder) {
|
|
||||||
// pBuilder->nCols = 0;
|
|
||||||
// pBuilder->size = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
#define KvRowNColsThresh 1 // default value: 1200 TODO: for test, restore to default value after test finished
|
#define KvRowNColsThresh 1 // default value: 1200 TODO: for test, restore to default value after test finished
|
||||||
|
|
||||||
static FORCE_INLINE uint8_t tdRowTypeJudger(SSchema* pSchema, void* pData, int32_t nCols, int32_t flen,
|
static FORCE_INLINE uint8_t tdRowTypeJudger(SSchema* pSchema, void* pData, int32_t nCols, int32_t flen,
|
||||||
|
@ -1700,7 +1673,7 @@ static FORCE_INLINE uint8_t tdRowTypeJudger(SSchema* pSchema, void* pData, int32
|
||||||
p += pSchema[i].bytes;
|
p += pSchema[i].bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
tscDebug("prop:nColsNull %d, nCols: %d, kvRowLen: %d, dataRowLen: %d", (int32_t)nColsNull, nCols, kvRowLength,
|
tscDebug("nColsNull %d, nCols: %d, kvRowLen: %d, dataRowLen: %d", (int32_t)nColsNull, nCols, kvRowLength,
|
||||||
dataRowLength);
|
dataRowLength);
|
||||||
|
|
||||||
if (kvRowLength < dataRowLength) {
|
if (kvRowLength < dataRowLength) {
|
||||||
|
|
|
@ -255,13 +255,12 @@ static FORCE_INLINE int tdAppendColVal(SDataRow row, const void *value, int8_t t
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: offset here including the header size
|
// NOTE: offset here including the header size
|
||||||
static FORCE_INLINE void *tdGetRowDataOfCol(SDataRow *row, int8_t type, int32_t offset) {
|
static FORCE_INLINE void *tdGetRowDataOfCol(SDataRow row, int8_t type, int32_t offset) {
|
||||||
if (IS_VAR_DATA_TYPE(type)) {
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
return POINTER_SHIFT(row, *(VarDataOffsetT *)POINTER_SHIFT(row, offset));
|
return POINTER_SHIFT(row, *(VarDataOffsetT *)POINTER_SHIFT(row, offset));
|
||||||
} else {
|
} else {
|
||||||
return POINTER_SHIFT(row, offset);
|
return POINTER_SHIFT(row, offset);
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------- Data column structure
|
// ----------------- Data column structure
|
||||||
|
@ -281,42 +280,12 @@ typedef struct SDataCol {
|
||||||
static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; }
|
static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; }
|
||||||
|
|
||||||
void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints);
|
void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints);
|
||||||
|
void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints);
|
||||||
void dataColSetOffset(SDataCol *pCol, int nEle);
|
void dataColSetOffset(SDataCol *pCol, int nEle);
|
||||||
|
|
||||||
bool isNEleNull(SDataCol *pCol, int nEle);
|
bool isNEleNull(SDataCol *pCol, int nEle);
|
||||||
void dataColSetNEleNull(SDataCol *pCol, int nEle, int maxPoints);
|
void dataColSetNEleNull(SDataCol *pCol, int nEle, int maxPoints);
|
||||||
|
|
||||||
FORCE_INLINE void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints);
|
|
||||||
// value from timestamp should be TKEY here instead of TSKEY
|
|
||||||
FORCE_INLINE void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints) {
|
|
||||||
ASSERT(pCol != NULL && value != NULL);
|
|
||||||
|
|
||||||
if (pCol->len == 0) {
|
|
||||||
if (isNull(value, pCol->type)) {
|
|
||||||
// all null value yet, just return
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numOfRows > 0) {
|
|
||||||
// Find the first not null value, fill all previous values as NULL
|
|
||||||
dataColSetNEleNull(pCol, numOfRows, maxPoints);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
|
||||||
// set offset
|
|
||||||
pCol->dataOff[numOfRows] = pCol->len;
|
|
||||||
// Copy data
|
|
||||||
memcpy(POINTER_SHIFT(pCol->pData, pCol->len), value, varDataTLen(value));
|
|
||||||
// Update the length
|
|
||||||
pCol->len += varDataTLen(value);
|
|
||||||
} else {
|
|
||||||
ASSERT(pCol->len == TYPE_BYTES[pCol->type] * numOfRows);
|
|
||||||
memcpy(POINTER_SHIFT(pCol->pData, pCol->len), value, pCol->bytes);
|
|
||||||
pCol->len += pCol->bytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE const void *tdGetNullVal(int8_t type) {
|
static FORCE_INLINE const void *tdGetNullVal(int8_t type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_BOOL:
|
case TSDB_DATA_TYPE_BOOL:
|
||||||
|
@ -456,7 +425,7 @@ typedef struct {
|
||||||
#define kvRowNCols(r) (*(int16_t *)POINTER_SHIFT(r, sizeof(uint16_t)))
|
#define kvRowNCols(r) (*(int16_t *)POINTER_SHIFT(r, sizeof(uint16_t)))
|
||||||
#define kvRowSetLen(r, len) kvRowLen(r) = (len)
|
#define kvRowSetLen(r, len) kvRowLen(r) = (len)
|
||||||
#define kvRowSetNCols(r, n) kvRowNCols(r) = (n)
|
#define kvRowSetNCols(r, n) kvRowNCols(r) = (n)
|
||||||
#define kvRowColIdx(r) ((SColIdx *)POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE))
|
#define kvRowColIdx(r) (SColIdx *)POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE)
|
||||||
#define kvRowValues(r) POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE + sizeof(SColIdx) * kvRowNCols(r))
|
#define kvRowValues(r) POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE + sizeof(SColIdx) * kvRowNCols(r))
|
||||||
#define kvRowCpy(dst, r) memcpy((dst), (r), kvRowLen(r))
|
#define kvRowCpy(dst, r) memcpy((dst), (r), kvRowLen(r))
|
||||||
#define kvRowColVal(r, colIdx) POINTER_SHIFT(kvRowValues(r), (colIdx)->offset)
|
#define kvRowColVal(r, colIdx) POINTER_SHIFT(kvRowValues(r), (colIdx)->offset)
|
||||||
|
@ -464,7 +433,6 @@ typedef struct {
|
||||||
#define kvRowFree(r) tfree(r)
|
#define kvRowFree(r) tfree(r)
|
||||||
#define kvRowEnd(r) POINTER_SHIFT(r, kvRowLen(r))
|
#define kvRowEnd(r) POINTER_SHIFT(r, kvRowLen(r))
|
||||||
#define kvRowVersion(r) (-1)
|
#define kvRowVersion(r) (-1)
|
||||||
|
|
||||||
#define kvRowTKey(r) (*(TKEY *)(kvRowValues(r)))
|
#define kvRowTKey(r) (*(TKEY *)(kvRowValues(r)))
|
||||||
#define kvRowKey(r) tdGetKey(kvRowTKey(r))
|
#define kvRowKey(r) tdGetKey(kvRowTKey(r))
|
||||||
#define kvRowDeleted(r) TKEY_IS_DELETED(kvRowTKey(r))
|
#define kvRowDeleted(r) TKEY_IS_DELETED(kvRowTKey(r))
|
||||||
|
|
|
@ -225,7 +225,7 @@ void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints)
|
||||||
pDataCol->type = colType(pCol);
|
pDataCol->type = colType(pCol);
|
||||||
pDataCol->colId = colColId(pCol);
|
pDataCol->colId = colColId(pCol);
|
||||||
pDataCol->bytes = colBytes(pCol);
|
pDataCol->bytes = colBytes(pCol);
|
||||||
pDataCol->offset = colOffset(pCol) + TD_MEM_ROW_HEAD_SIZE;
|
pDataCol->offset = colOffset(pCol) + TD_DATA_ROW_HEAD_SIZE;
|
||||||
|
|
||||||
pDataCol->len = 0;
|
pDataCol->len = 0;
|
||||||
if (IS_VAR_DATA_TYPE(pDataCol->type)) {
|
if (IS_VAR_DATA_TYPE(pDataCol->type)) {
|
||||||
|
@ -240,7 +240,6 @@ void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints)
|
||||||
*pBuf = POINTER_SHIFT(*pBuf, pDataCol->spaceSize);
|
*pBuf = POINTER_SHIFT(*pBuf, pDataCol->spaceSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
// value from timestamp should be TKEY here instead of TSKEY
|
// value from timestamp should be TKEY here instead of TSKEY
|
||||||
void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints) {
|
void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints) {
|
||||||
ASSERT(pCol != NULL && value != NULL);
|
ASSERT(pCol != NULL && value != NULL);
|
||||||
|
@ -270,7 +269,6 @@ void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxP
|
||||||
pCol->len += pCol->bytes;
|
pCol->len += pCol->bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool isNEleNull(SDataCol *pCol, int nEle) {
|
bool isNEleNull(SDataCol *pCol, int nEle) {
|
||||||
for (int i = 0; i < nEle; i++) {
|
for (int i = 0; i < nEle; i++) {
|
||||||
|
@ -648,7 +646,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
|
||||||
void * ptr = taosbsearch(&colId, kvRowColIdx(row), kvRowNCols(row), sizeof(SColIdx), comparTagId, TD_GE);
|
void * ptr = taosbsearch(&colId, kvRowColIdx(row), kvRowNCols(row), sizeof(SColIdx), comparTagId, TD_GE);
|
||||||
|
|
||||||
if (ptr == NULL || ((SColIdx *)ptr)->colId > colId) { // need to add a column value to the row
|
if (ptr == NULL || ((SColIdx *)ptr)->colId > colId) { // need to add a column value to the row
|
||||||
uint16_t diff = IS_VAR_DATA_TYPE(type) ? varDataTLen(value) : TYPE_BYTES[type];
|
int diff = IS_VAR_DATA_TYPE(type) ? varDataTLen(value) : TYPE_BYTES[type];
|
||||||
nrow = malloc(kvRowLen(row) + sizeof(SColIdx) + diff);
|
nrow = malloc(kvRowLen(row) + sizeof(SColIdx) + diff);
|
||||||
if (nrow == NULL) return -1;
|
if (nrow == NULL) return -1;
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ typedef struct tstr {
|
||||||
#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) < UINT32_MAX)
|
#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) < UINT32_MAX)
|
||||||
#define IS_VALID_UBIGINT(_t) ((_t) >= 0 && (_t) < UINT64_MAX)
|
#define IS_VALID_UBIGINT(_t) ((_t) >= 0 && (_t) < UINT64_MAX)
|
||||||
|
|
||||||
FORCE_INLINE bool isNull(const char *val, int32_t type) {
|
static FORCE_INLINE bool isNull(const char *val, int32_t type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_BOOL:
|
case TSDB_DATA_TYPE_BOOL:
|
||||||
return *(uint8_t *)val == TSDB_DATA_BOOL_NULL;
|
return *(uint8_t *)val == TSDB_DATA_BOOL_NULL;
|
||||||
|
|
Loading…
Reference in New Issue