more code
This commit is contained in:
parent
8a4b9db172
commit
81d6a1479d
|
@ -28,23 +28,25 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct SSchema SSchema;
|
typedef struct SSchema SSchema;
|
||||||
typedef struct SSchema2 SSchema2;
|
typedef struct SSchema2 SSchema2;
|
||||||
typedef struct STColumn STColumn;
|
typedef struct STColumn STColumn;
|
||||||
typedef struct STSchema STSchema;
|
typedef struct STSchema STSchema;
|
||||||
typedef struct SValue SValue;
|
typedef struct SValue SValue;
|
||||||
typedef struct SColVal SColVal;
|
typedef struct SColVal SColVal;
|
||||||
typedef struct SRow SRow;
|
typedef struct SRow SRow;
|
||||||
typedef struct SRowIter SRowIter;
|
typedef struct SRowIter SRowIter;
|
||||||
typedef struct STagVal STagVal;
|
typedef struct STagVal STagVal;
|
||||||
typedef struct STag STag;
|
typedef struct STag STag;
|
||||||
typedef struct SColData SColData;
|
typedef struct SColData SColData;
|
||||||
|
|
||||||
typedef struct SRowKey SRowKey;
|
typedef struct SRowKey SRowKey;
|
||||||
typedef struct SValueColumn SValueColumn;
|
typedef struct SValueColumn SValueColumn;
|
||||||
|
|
||||||
#define HAS_NONE ((uint8_t)0x1)
|
#define HAS_NONE ((uint8_t)0x1)
|
||||||
#define HAS_NULL ((uint8_t)0x2)
|
#define HAS_NULL ((uint8_t)0x2)
|
||||||
#define HAS_VALUE ((uint8_t)0x4)
|
#define HAS_VALUE ((uint8_t)0x4)
|
||||||
|
|
||||||
#define HAS_MULTI_KEY ((uint8_t)0x8)
|
#define HAS_MULTI_KEY ((uint8_t)0x8)
|
||||||
|
|
||||||
// bitmap ================================
|
// bitmap ================================
|
||||||
|
@ -162,20 +164,22 @@ typedef struct {
|
||||||
} SColDataCompressInfo;
|
} SColDataCompressInfo;
|
||||||
|
|
||||||
typedef void *(*xMallocFn)(void *, int32_t);
|
typedef void *(*xMallocFn)(void *, int32_t);
|
||||||
void tColDataDestroy(void *ph);
|
|
||||||
void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t cflag);
|
void tColDataDestroy(void *ph);
|
||||||
void tColDataClear(SColData *pColData);
|
void tColDataInit(SColData *pColData, int16_t cid, int8_t type, int8_t cflag);
|
||||||
void tColDataDeepClear(SColData *pColData);
|
void tColDataClear(SColData *pColData);
|
||||||
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
|
void tColDataDeepClear(SColData *pColData);
|
||||||
int32_t tColDataUpdateValue(SColData *pColData, SColVal *pColVal, bool forward);
|
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
|
||||||
void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal);
|
int32_t tColDataUpdateValue(SColData *pColData, SColVal *pColVal, bool forward);
|
||||||
uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal);
|
void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal);
|
||||||
int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMalloc, void *arg);
|
uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal);
|
||||||
int32_t tColDataCompress(SColData *colData, SColDataCompressInfo *info, void *output, int32_t outputSize,
|
int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMalloc, void *arg);
|
||||||
SBuffer *buffer);
|
extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min, int16_t *numOfNull);
|
||||||
int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompressInfo *info, SColData *colData,
|
|
||||||
SBuffer *helperBuffer);
|
int32_t tColDataCompress(SColData *colData, SColDataCompressInfo *info, void *output, int32_t outputSize,
|
||||||
extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min, int16_t *numOfNull);
|
SBuffer *buffer);
|
||||||
|
int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompressInfo *info, SColData *colData,
|
||||||
|
SBuffer *helperBuffer);
|
||||||
|
|
||||||
// for stmt bind
|
// for stmt bind
|
||||||
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen);
|
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen);
|
||||||
|
@ -205,7 +209,7 @@ struct STSchema {
|
||||||
STColumn columns[];
|
STColumn columns[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/* TODO: here may change
|
||||||
* 1. Tuple format:
|
* 1. Tuple format:
|
||||||
* SRow + [bit map +] fix-length data + [var-length data +] [(type + offset) * numPrimaryKeyCols + fixedLen +
|
* SRow + [bit map +] fix-length data + [var-length data +] [(type + offset) * numPrimaryKeyCols + fixedLen +
|
||||||
* numOfCols + numPrimaryKeyCols]
|
* numOfCols + numPrimaryKeyCols]
|
||||||
|
@ -234,11 +238,11 @@ struct SValue {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TD_MAX_PRIMARY_KEY_COL 8
|
#define TD_MAX_PK_COLS 2
|
||||||
struct SRowKey {
|
struct SRowKey {
|
||||||
TSKEY ts;
|
TSKEY ts;
|
||||||
uint8_t numOfPKs;
|
uint8_t numOfPKs;
|
||||||
SValue pks[TD_MAX_PRIMARY_KEY_COL];
|
SValue pks[TD_MAX_PK_COLS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SColVal {
|
struct SColVal {
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include "trow.h"
|
#include "trow.h"
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
|
|
||||||
static bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal);
|
static bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal);
|
||||||
static bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal);
|
static bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal);
|
||||||
|
|
||||||
void tdSTSRowIterInit(STSRowIter *pIter, STSchema *pSchema) {
|
void tdSTSRowIterInit(STSRowIter *pIter, STSchema *pSchema) {
|
||||||
pIter->pSchema = pSchema;
|
pIter->pSchema = pSchema;
|
||||||
|
@ -416,6 +416,7 @@ bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t fl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) {
|
bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) {
|
||||||
if (pIter->colIdx >= pIter->pSchema->numOfCols) {
|
if (pIter->colIdx >= pIter->pSchema->numOfCols) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -480,8 +481,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
varDataLen += sizeof(VarDataLenT);
|
varDataLen += sizeof(VarDataLenT);
|
||||||
if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR || pTColumn->type == TSDB_DATA_TYPE_VARBINARY ||
|
if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR || pTColumn->type == TSDB_DATA_TYPE_VARBINARY || pTColumn->type == TSDB_DATA_TYPE_GEOMETRY) {
|
||||||
pTColumn->type == TSDB_DATA_TYPE_GEOMETRY) {
|
|
||||||
varDataLen += CHAR_BYTES;
|
varDataLen += CHAR_BYTES;
|
||||||
if (maxVarDataLen < CHAR_BYTES + sizeof(VarDataLenT)) {
|
if (maxVarDataLen < CHAR_BYTES + sizeof(VarDataLenT)) {
|
||||||
maxVarDataLen = CHAR_BYTES + sizeof(VarDataLenT);
|
maxVarDataLen = CHAR_BYTES + sizeof(VarDataLenT);
|
||||||
|
@ -494,7 +494,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pColVal && COL_VAL_IS_VALUE(pColVal)) {
|
if(pColVal && COL_VAL_IS_VALUE(pColVal)) {
|
||||||
nonVarDataLen += TYPE_BYTES[pTColumn->type];
|
nonVarDataLen += TYPE_BYTES[pTColumn->type];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1084,6 +1084,8 @@ int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColVal) {
|
void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColVal) {
|
||||||
STColumn *pTColumn = &pTSchema->columns[iCol];
|
STColumn *pTColumn = &pTSchema->columns[iCol];
|
||||||
SCellVal cv = {0};
|
SCellVal cv = {0};
|
||||||
|
@ -1104,9 +1106,9 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV
|
||||||
*pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
|
*pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type);
|
||||||
} else {
|
} else {
|
||||||
pColVal->cid = pTColumn->colId;
|
pColVal->cid = pTColumn->colId;
|
||||||
|
pColVal->value.type = pTColumn->type;
|
||||||
pColVal->flag = CV_FLAG_VALUE;
|
pColVal->flag = CV_FLAG_VALUE;
|
||||||
|
|
||||||
pColVal->value.type = pTColumn->type;
|
|
||||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||||
pColVal->value.nData = varDataLen(cv.val);
|
pColVal->value.nData = varDataLen(cv.val);
|
||||||
pColVal->value.pData = varDataVal(cv.val);
|
pColVal->value.pData = varDataVal(cv.val);
|
||||||
|
|
|
@ -268,7 +268,7 @@ int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRe
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
SDiskDataHdr hdr;
|
SDiskDataHdr hdr;
|
||||||
SBlockCol primaryKeyBlockCols[TD_MAX_PRIMARY_KEY_COL];
|
SBlockCol primaryKeyBlockCols[TD_MAX_PK_COLS];
|
||||||
|
|
||||||
// read key part
|
// read key part
|
||||||
code = tRealloc(&reader->config->bufArr[0], record->blockKeySize);
|
code = tRealloc(&reader->config->bufArr[0], record->blockKeySize);
|
||||||
|
|
|
@ -200,7 +200,7 @@ int32_t tsdbSttFileReadBlockDataByColumn(SSttFileReader *reader, const SSttBlk *
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
SDiskDataHdr hdr;
|
SDiskDataHdr hdr;
|
||||||
SBlockCol primaryKeyBlockCols[TD_MAX_PRIMARY_KEY_COL];
|
SBlockCol primaryKeyBlockCols[TD_MAX_PK_COLS];
|
||||||
|
|
||||||
// load key part
|
// load key part
|
||||||
code = tRealloc(&reader->config->bufArr[0], sttBlk->bInfo.szKey);
|
code = tRealloc(&reader->config->bufArr[0], sttBlk->bInfo.szKey);
|
||||||
|
@ -501,8 +501,8 @@ int32_t tsdbSttFileReadStatisBlock(SSttFileReader *reader, const SStatisBlk *sta
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statisBlk->numOfPKs > 0) {
|
if (statisBlk->numOfPKs > 0) {
|
||||||
SValueColumnCompressInfo firstKeyInfos[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumnCompressInfo firstKeyInfos[TD_MAX_PK_COLS];
|
||||||
SValueColumnCompressInfo lastKeyInfos[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumnCompressInfo lastKeyInfos[TD_MAX_PK_COLS];
|
||||||
SBufferReader bfReader;
|
SBufferReader bfReader;
|
||||||
|
|
||||||
tBufferReaderInit(&bfReader, true, size, &reader->buffers[0]);
|
tBufferReaderInit(&bfReader, true, size, &reader->buffers[0]);
|
||||||
|
|
|
@ -1384,7 +1384,7 @@ SColData *tBlockDataGetColData(SBlockData *pBlockData, int16_t cid) {
|
||||||
int32_t tCmprBlockData(SBlockData *pBlockData, int8_t cmprAlg, uint8_t **ppOut, int32_t *szOut, uint8_t *aBuf[],
|
int32_t tCmprBlockData(SBlockData *pBlockData, int8_t cmprAlg, uint8_t **ppOut, int32_t *szOut, uint8_t *aBuf[],
|
||||||
int32_t aBufSize[]) {
|
int32_t aBufSize[]) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SBlockCol primaryKeyBlockCols[TD_MAX_PRIMARY_KEY_COL];
|
SBlockCol primaryKeyBlockCols[TD_MAX_PK_COLS];
|
||||||
SDiskDataHdr hdr = {
|
SDiskDataHdr hdr = {
|
||||||
.delimiter = TSDB_FILE_DLMT,
|
.delimiter = TSDB_FILE_DLMT,
|
||||||
.fmtVer = 0,
|
.fmtVer = 0,
|
||||||
|
@ -1511,7 +1511,7 @@ int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uin
|
||||||
|
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
SDiskDataHdr hdr = {0};
|
SDiskDataHdr hdr = {0};
|
||||||
SBlockCol primaryKeyBlockCols[TD_MAX_PRIMARY_KEY_COL];
|
SBlockCol primaryKeyBlockCols[TD_MAX_PK_COLS];
|
||||||
|
|
||||||
// SDiskDataHdr
|
// SDiskDataHdr
|
||||||
n += tGetDiskDataHdr(pIn + n, &hdr);
|
n += tGetDiskDataHdr(pIn + n, &hdr);
|
||||||
|
|
|
@ -71,7 +71,7 @@ int32_t tStatisBlockInit(STbStatisBlock *statisBlock) {
|
||||||
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
|
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
|
||||||
tBufferInit(&statisBlock->buffers[i]);
|
tBufferInit(&statisBlock->buffers[i]);
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < TD_MAX_PRIMARY_KEY_COL; ++i) {
|
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||||
tValueColumnInit(&statisBlock->firstKeyPKs[i]);
|
tValueColumnInit(&statisBlock->firstKeyPKs[i]);
|
||||||
tValueColumnInit(&statisBlock->lastKeyPKs[i]);
|
tValueColumnInit(&statisBlock->lastKeyPKs[i]);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ int32_t tStatisBlockDestroy(STbStatisBlock *statisBlock) {
|
||||||
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
|
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
|
||||||
tBufferDestroy(&statisBlock->buffers[i]);
|
tBufferDestroy(&statisBlock->buffers[i]);
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < TD_MAX_PRIMARY_KEY_COL; ++i) {
|
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||||
tValueColumnDestroy(&statisBlock->firstKeyPKs[i]);
|
tValueColumnDestroy(&statisBlock->firstKeyPKs[i]);
|
||||||
tValueColumnDestroy(&statisBlock->lastKeyPKs[i]);
|
tValueColumnDestroy(&statisBlock->lastKeyPKs[i]);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ int32_t tStatisBlockClear(STbStatisBlock *statisBlock) {
|
||||||
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
|
for (int32_t i = 0; i < ARRAY_SIZE(statisBlock->buffers); ++i) {
|
||||||
tBufferClear(&statisBlock->buffers[i]);
|
tBufferClear(&statisBlock->buffers[i]);
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < TD_MAX_PRIMARY_KEY_COL; ++i) {
|
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||||
tValueColumnClear(&statisBlock->firstKeyPKs[i]);
|
tValueColumnClear(&statisBlock->firstKeyPKs[i]);
|
||||||
tValueColumnClear(&statisBlock->lastKeyPKs[i]);
|
tValueColumnClear(&statisBlock->lastKeyPKs[i]);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ int32_t tBrinBlockInit(SBrinBlock *brinBlock) {
|
||||||
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
|
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
|
||||||
tBufferInit(&brinBlock->buffers[i]);
|
tBufferInit(&brinBlock->buffers[i]);
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < TD_MAX_PRIMARY_KEY_COL; ++i) {
|
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||||
tValueColumnInit(&brinBlock->firstKeyPKs[i]);
|
tValueColumnInit(&brinBlock->firstKeyPKs[i]);
|
||||||
tValueColumnInit(&brinBlock->lastKeyPKs[i]);
|
tValueColumnInit(&brinBlock->lastKeyPKs[i]);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ int32_t tBrinBlockDestroy(SBrinBlock *brinBlock) {
|
||||||
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
|
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
|
||||||
tBufferDestroy(&brinBlock->buffers[i]);
|
tBufferDestroy(&brinBlock->buffers[i]);
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < TD_MAX_PRIMARY_KEY_COL; ++i) {
|
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||||
tValueColumnDestroy(&brinBlock->firstKeyPKs[i]);
|
tValueColumnDestroy(&brinBlock->firstKeyPKs[i]);
|
||||||
tValueColumnDestroy(&brinBlock->lastKeyPKs[i]);
|
tValueColumnDestroy(&brinBlock->lastKeyPKs[i]);
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ int32_t tBrinBlockClear(SBrinBlock *brinBlock) {
|
||||||
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
|
for (int32_t i = 0; i < ARRAY_SIZE(brinBlock->buffers); ++i) {
|
||||||
tBufferClear(&brinBlock->buffers[i]);
|
tBufferClear(&brinBlock->buffers[i]);
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < TD_MAX_PRIMARY_KEY_COL; ++i) {
|
for (int32_t i = 0; i < TD_MAX_PK_COLS; ++i) {
|
||||||
tValueColumnClear(&brinBlock->firstKeyPKs[i]);
|
tValueColumnClear(&brinBlock->firstKeyPKs[i]);
|
||||||
tValueColumnClear(&brinBlock->lastKeyPKs[i]);
|
tValueColumnClear(&brinBlock->lastKeyPKs[i]);
|
||||||
}
|
}
|
||||||
|
@ -364,8 +364,8 @@ int32_t tBrinBlockEncode(SBrinBlock *brinBlock, SBrinBlk *brinBlk, SBuffer *buff
|
||||||
}
|
}
|
||||||
|
|
||||||
// encode primary keys
|
// encode primary keys
|
||||||
SValueColumnCompressInfo firstKeyPKsInfos[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumnCompressInfo firstKeyPKsInfos[TD_MAX_PK_COLS];
|
||||||
SValueColumnCompressInfo lastKeyPKsInfos[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumnCompressInfo lastKeyPKsInfos[TD_MAX_PK_COLS];
|
||||||
|
|
||||||
for (int32_t i = 0; i < brinBlk->numOfPKs; ++i) {
|
for (int32_t i = 0; i < brinBlk->numOfPKs; ++i) {
|
||||||
SValueColumn *vc = &brinBlock->firstKeyPKs[i];
|
SValueColumn *vc = &brinBlock->firstKeyPKs[i];
|
||||||
|
|
|
@ -91,8 +91,8 @@ typedef struct {
|
||||||
SBuffer counts;
|
SBuffer counts;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
SValueColumn firstKeyPKs[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumn firstKeyPKs[TD_MAX_PK_COLS];
|
||||||
SValueColumn lastKeyPKs[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumn lastKeyPKs[TD_MAX_PK_COLS];
|
||||||
} STbStatisBlock;
|
} STbStatisBlock;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -154,8 +154,8 @@ typedef struct {
|
||||||
SBuffer counts;
|
SBuffer counts;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
SValueColumn firstKeyPKs[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumn firstKeyPKs[TD_MAX_PK_COLS];
|
||||||
SValueColumn lastKeyPKs[TD_MAX_PRIMARY_KEY_COL];
|
SValueColumn lastKeyPKs[TD_MAX_PK_COLS];
|
||||||
} SBrinBlock;
|
} SBrinBlock;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
#define _XOPEN_SOURCE
|
#define _XOPEN_SOURCE
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "tcompare.h"
|
#include "tcompare.h"
|
||||||
#include "osString.h"
|
|
||||||
#include "regex.h"
|
#include "regex.h"
|
||||||
#include "tdef.h"
|
#include "tdef.h"
|
||||||
#include "thash.h"
|
#include "thash.h"
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
#include "tutil.h"
|
#include "tutil.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "osString.h"
|
||||||
|
|
||||||
int32_t setChkInBytes1(const void *pLeft, const void *pRight) {
|
int32_t setChkInBytes1(const void *pLeft, const void *pRight) {
|
||||||
return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0;
|
return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0;
|
||||||
|
@ -209,11 +209,11 @@ int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight) {
|
||||||
int32_t len1 = varDataLen(pLeft);
|
int32_t len1 = varDataLen(pLeft);
|
||||||
int32_t len2 = varDataLen(pRight);
|
int32_t len2 = varDataLen(pRight);
|
||||||
|
|
||||||
int32_t ret = tasoUcs4Compare((TdUcs4 *)varDataVal(pLeft), (TdUcs4 *)varDataVal(pRight), len1 > len2 ? len2 : len1);
|
int32_t ret = tasoUcs4Compare((TdUcs4 *)varDataVal(pLeft), (TdUcs4 *)varDataVal(pRight), len1>len2 ? len2:len1);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
if (len1 > len2)
|
if (len1 > len2)
|
||||||
return 1;
|
return 1;
|
||||||
else if (len1 < len2)
|
else if(len1 < len2)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -242,7 +242,9 @@ int32_t compareLenBinaryVal(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareLenBinaryValDesc(const void *pLeft, const void *pRight) { return compareLenBinaryVal(pRight, pLeft); }
|
int32_t compareLenBinaryValDesc(const void *pLeft, const void *pRight) {
|
||||||
|
return compareLenBinaryVal(pRight, pLeft);
|
||||||
|
}
|
||||||
|
|
||||||
// string > number > bool > null
|
// string > number > bool > null
|
||||||
// ref: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-comparison
|
// ref: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-comparison
|
||||||
|
@ -326,7 +328,7 @@ int32_t compareInt8Uint16(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareInt8Uint32(const void *pLeft, const void *pRight) {
|
int32_t compareInt8Uint32(const void *pLeft, const void *pRight) {
|
||||||
int8_t left = GET_INT8_VAL(pLeft);
|
int8_t left = GET_INT8_VAL(pLeft);
|
||||||
if (left < 0) return -1;
|
if (left < 0) return -1;
|
||||||
uint32_t right = GET_UINT32_VAL(pRight);
|
uint32_t right = GET_UINT32_VAL(pRight);
|
||||||
if ((uint32_t)left > right) return 1;
|
if ((uint32_t)left > right) return 1;
|
||||||
|
@ -335,7 +337,7 @@ int32_t compareInt8Uint32(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareInt8Uint64(const void *pLeft, const void *pRight) {
|
int32_t compareInt8Uint64(const void *pLeft, const void *pRight) {
|
||||||
int8_t left = GET_INT8_VAL(pLeft);
|
int8_t left = GET_INT8_VAL(pLeft);
|
||||||
if (left < 0) return -1;
|
if (left < 0) return -1;
|
||||||
uint64_t right = GET_UINT64_VAL(pRight);
|
uint64_t right = GET_UINT64_VAL(pRight);
|
||||||
if ((uint64_t)left > right) return 1;
|
if ((uint64_t)left > right) return 1;
|
||||||
|
@ -400,7 +402,7 @@ int32_t compareInt16Uint16(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareInt16Uint32(const void *pLeft, const void *pRight) {
|
int32_t compareInt16Uint32(const void *pLeft, const void *pRight) {
|
||||||
int16_t left = GET_INT16_VAL(pLeft);
|
int16_t left = GET_INT16_VAL(pLeft);
|
||||||
if (left < 0) return -1;
|
if (left < 0) return -1;
|
||||||
uint32_t right = GET_UINT32_VAL(pRight);
|
uint32_t right = GET_UINT32_VAL(pRight);
|
||||||
if ((uint32_t)left > right) return 1;
|
if ((uint32_t)left > right) return 1;
|
||||||
|
@ -409,7 +411,7 @@ int32_t compareInt16Uint32(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareInt16Uint64(const void *pLeft, const void *pRight) {
|
int32_t compareInt16Uint64(const void *pLeft, const void *pRight) {
|
||||||
int16_t left = GET_INT16_VAL(pLeft);
|
int16_t left = GET_INT16_VAL(pLeft);
|
||||||
if (left < 0) return -1;
|
if (left < 0) return -1;
|
||||||
uint64_t right = GET_UINT64_VAL(pRight);
|
uint64_t right = GET_UINT64_VAL(pRight);
|
||||||
if ((uint64_t)left > right) return 1;
|
if ((uint64_t)left > right) return 1;
|
||||||
|
@ -474,7 +476,7 @@ int32_t compareInt32Uint16(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareInt32Uint32(const void *pLeft, const void *pRight) {
|
int32_t compareInt32Uint32(const void *pLeft, const void *pRight) {
|
||||||
int32_t left = GET_INT32_VAL(pLeft);
|
int32_t left = GET_INT32_VAL(pLeft);
|
||||||
if (left < 0) return -1;
|
if (left < 0) return -1;
|
||||||
uint32_t right = GET_UINT32_VAL(pRight);
|
uint32_t right = GET_UINT32_VAL(pRight);
|
||||||
if ((uint32_t)left > right) return 1;
|
if ((uint32_t)left > right) return 1;
|
||||||
|
@ -483,7 +485,7 @@ int32_t compareInt32Uint32(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareInt32Uint64(const void *pLeft, const void *pRight) {
|
int32_t compareInt32Uint64(const void *pLeft, const void *pRight) {
|
||||||
int32_t left = GET_INT32_VAL(pLeft);
|
int32_t left = GET_INT32_VAL(pLeft);
|
||||||
if (left < 0) return -1;
|
if (left < 0) return -1;
|
||||||
uint64_t right = GET_UINT64_VAL(pRight);
|
uint64_t right = GET_UINT64_VAL(pRight);
|
||||||
if ((uint64_t)left > right) return 1;
|
if ((uint64_t)left > right) return 1;
|
||||||
|
@ -556,7 +558,7 @@ int32_t compareInt64Uint32(const void *pLeft, const void *pRight) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t compareInt64Uint64(const void *pLeft, const void *pRight) {
|
int32_t compareInt64Uint64(const void *pLeft, const void *pRight) {
|
||||||
int64_t left = GET_INT64_VAL(pLeft);
|
int64_t left = GET_INT64_VAL(pLeft);
|
||||||
if (left < 0) return -1;
|
if (left < 0) return -1;
|
||||||
uint64_t right = GET_UINT64_VAL(pRight);
|
uint64_t right = GET_UINT64_VAL(pRight);
|
||||||
if ((uint64_t)left > right) return 1;
|
if ((uint64_t)left > right) return 1;
|
||||||
|
|
Loading…
Reference in New Issue