:Merge branch 'feature/TD-4666' of github.com:taosdata/TDengine into feature/TD-4666
This commit is contained in:
commit
4a26a26cfa
|
@ -1667,7 +1667,7 @@ int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, i
|
||||||
// pBuilder->size = 0;
|
// pBuilder->size = 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#define KvRowNColsThresh 1 // default value: 32 TODO: for test, restore to 32 after test finished
|
#define KvRowNColsThresh 1 // default value: 128 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,
|
||||||
uint16_t* nColsNotNull) {
|
uint16_t* nColsNotNull) {
|
||||||
|
@ -1724,7 +1724,6 @@ SMemRow tdGenMemRowFromBuilder(SMemRowBuilder* pBuilder) {
|
||||||
uint16_t nColsNotNull = 0;
|
uint16_t nColsNotNull = 0;
|
||||||
uint8_t memRowType = tdRowTypeJudger(pSchema, p, pBuilder->nCols, pBuilder->flen, &nColsNotNull);
|
uint8_t memRowType = tdRowTypeJudger(pSchema, p, pBuilder->nCols, pBuilder->flen, &nColsNotNull);
|
||||||
tscDebug("prop:memType is %d", memRowType);
|
tscDebug("prop:memType is %d", memRowType);
|
||||||
memRowType = SMEM_ROW_DATA;
|
|
||||||
|
|
||||||
SMemRow* memRow = (SMemRow)pBuilder->pDataBlock;
|
SMemRow* memRow = (SMemRow)pBuilder->pDataBlock;
|
||||||
memRowSetType(memRow, memRowType);
|
memRowSetType(memRow, memRowType);
|
||||||
|
@ -1744,12 +1743,10 @@ SMemRow tdGenMemRowFromBuilder(SMemRowBuilder* pBuilder) {
|
||||||
pBuilder->buf = p;
|
pBuilder->buf = p;
|
||||||
} else if (memRowType == SMEM_ROW_KV) {
|
} else if (memRowType == SMEM_ROW_KV) {
|
||||||
ASSERT(nColsNotNull < pBuilder->nCols);
|
ASSERT(nColsNotNull < pBuilder->nCols);
|
||||||
|
|
||||||
uint16_t tlen = TD_KV_ROW_HEAD_SIZE + sizeof(SColIdx) * nColsNotNull + pBuilder->size;
|
|
||||||
SKVRow kvRow = (SKVRow)memRowBody(memRow);
|
SKVRow kvRow = (SKVRow)memRowBody(memRow);
|
||||||
|
uint16_t tlen = TD_KV_ROW_HEAD_SIZE + sizeof(SColIdx) * nColsNotNull;
|
||||||
kvRowSetNCols(kvRow, nColsNotNull);
|
|
||||||
kvRowSetLen(kvRow, tlen);
|
kvRowSetLen(kvRow, tlen);
|
||||||
|
kvRowSetNCols(kvRow, nColsNotNull);
|
||||||
|
|
||||||
int toffset = 0;
|
int toffset = 0;
|
||||||
p = (char*)pBuilder->buf;
|
p = (char*)pBuilder->buf;
|
||||||
|
|
|
@ -214,7 +214,7 @@ typedef void *SMemRow;
|
||||||
#define TD_DATA_ROW_HEAD_SIZE (sizeof(uint16_t) + sizeof(int16_t))
|
#define TD_DATA_ROW_HEAD_SIZE (sizeof(uint16_t) + sizeof(int16_t))
|
||||||
|
|
||||||
#define dataRowLen(r) (*(uint16_t *)(r))
|
#define dataRowLen(r) (*(uint16_t *)(r))
|
||||||
#define dataRowVersion(r) *(int16_t *)POINTER_SHIFT(r, sizeof(int16_t))
|
#define dataRowVersion(r) (*(int16_t *)POINTER_SHIFT(r, sizeof(int16_t)))
|
||||||
#define dataRowTuple(r) POINTER_SHIFT(r, TD_DATA_ROW_HEAD_SIZE)
|
#define dataRowTuple(r) POINTER_SHIFT(r, TD_DATA_ROW_HEAD_SIZE)
|
||||||
#define dataRowTKey(r) (*(TKEY *)(dataRowTuple(r)))
|
#define dataRowTKey(r) (*(TKEY *)(dataRowTuple(r)))
|
||||||
#define dataRowKey(r) tdGetKey(dataRowTKey(r))
|
#define dataRowKey(r) tdGetKey(dataRowTKey(r))
|
||||||
|
@ -425,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)
|
||||||
|
@ -468,7 +468,7 @@ static FORCE_INLINE int tdAppendKvColVal(SKVRow row, const void *value, int16_t
|
||||||
char * ptr = (char *)POINTER_SHIFT(row, kvRowLen(row));
|
char * ptr = (char *)POINTER_SHIFT(row, kvRowLen(row));
|
||||||
|
|
||||||
pColIdx->colId = colId;
|
pColIdx->colId = colId;
|
||||||
pColIdx->offset = kvRowLen(row);
|
pColIdx->offset = kvRowLen(row); // offset of pColIdx including the TD_KV_ROW_HEAD_SIZE
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(type)) {
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
memcpy(ptr, value, varDataTLen(value));
|
memcpy(ptr, value, varDataTLen(value));
|
||||||
|
|
|
@ -527,7 +527,8 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
|
||||||
int nRowColsMatched = 0;
|
int nRowColsMatched = 0;
|
||||||
STColumn stColumn[nRowCols];
|
STColumn stColumn[nRowCols];
|
||||||
tdGetKVRowColInfo(pSchema, kvRowColIdx(row), nRowCols, stColumn, &nRowColsMatched);
|
tdGetKVRowColInfo(pSchema, kvRowColIdx(row), nRowCols, stColumn, &nRowColsMatched);
|
||||||
uDebug("kvRow: nRowCols=%d, nRowColsMatched=%d, nSchemaCols=%d", nRowCols, nRowColsMatched, schemaNCols(pSchema));
|
uDebug("prop:kvRow: nRowCols=%d, nRowColsMatched=%d, nSchemaCols=%d", nRowCols, nRowColsMatched,
|
||||||
|
schemaNCols(pSchema));
|
||||||
|
|
||||||
while (dcol < pCols->numOfCols) {
|
while (dcol < pCols->numOfCols) {
|
||||||
SDataCol *pDataCol = &(pCols->cols[dcol]);
|
SDataCol *pDataCol = &(pCols->cols[dcol]);
|
||||||
|
|
|
@ -1550,7 +1550,8 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
|
||||||
if (pColIdx->colId == pColInfo->info.colId) {
|
if (pColIdx->colId == pColInfo->info.colId) {
|
||||||
STColumn* pSTColumn = tdGetColOfID(pSchema, pColIdx->colId);
|
STColumn* pSTColumn = tdGetColOfID(pSchema, pColIdx->colId);
|
||||||
if (pSTColumn != NULL) {
|
if (pSTColumn != NULL) {
|
||||||
void* value = tdGetKvRowDataOfCol(row, pSTColumn->type, TD_MEM_ROW_HEAD_SIZE + pColIdx->offset);
|
// offset of pColIdx including the TD_KV_ROW_HEAD_SIZE
|
||||||
|
void* value = tdGetKvRowDataOfCol(kvRow, pSTColumn->type, pColIdx->offset);
|
||||||
switch (pColInfo->info.type) {
|
switch (pColInfo->info.type) {
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
case TSDB_DATA_TYPE_NCHAR:
|
case TSDB_DATA_TYPE_NCHAR:
|
||||||
|
|
Loading…
Reference in New Issue