coverage: vnodeSrv.c tmsg.c trow.c
This commit is contained in:
parent
b0247f649b
commit
9d4a75b0be
|
@ -143,6 +143,7 @@ STSRow *tGetSubmitBlkNext(SSubmitBlkIter *pIter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BUILD_NO_CALL
|
||||||
int32_t tPrintFixedSchemaSubmitReq(SSubmitReq *pReq, STSchema *pTschema) {
|
int32_t tPrintFixedSchemaSubmitReq(SSubmitReq *pReq, STSchema *pTschema) {
|
||||||
SSubmitMsgIter msgIter = {0};
|
SSubmitMsgIter msgIter = {0};
|
||||||
if (tInitSubmitMsgIter(pReq, &msgIter) < 0) return -1;
|
if (tInitSubmitMsgIter(pReq, &msgIter) < 0) return -1;
|
||||||
|
@ -161,6 +162,7 @@ int32_t tPrintFixedSchemaSubmitReq(SSubmitReq *pReq, STSchema *pTschema) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int32_t tEncodeSEpSet(SEncoder *pEncoder, const SEpSet *pEp) {
|
int32_t tEncodeSEpSet(SEncoder *pEncoder, const SEpSet *pEp) {
|
||||||
if (tEncodeI8(pEncoder, pEp->inUse) < 0) return -1;
|
if (tEncodeI8(pEncoder, pEp->inUse) < 0) return -1;
|
||||||
|
|
|
@ -17,6 +17,220 @@
|
||||||
#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 tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal);
|
||||||
|
|
||||||
|
void tdSTSRowIterInit(STSRowIter *pIter, STSchema *pSchema) {
|
||||||
|
pIter->pSchema = pSchema;
|
||||||
|
pIter->maxColId = pSchema->columns[pSchema->numOfCols - 1].colId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *tdGetBitmapAddr(STSRow *pRow, uint8_t rowType, uint32_t flen, col_id_t nKvCols) {
|
||||||
|
#ifdef TD_SUPPORT_BITMAP
|
||||||
|
switch (rowType) {
|
||||||
|
case TD_ROW_TP:
|
||||||
|
return tdGetBitmapAddrTp(pRow, flen);
|
||||||
|
case TD_ROW_KV:
|
||||||
|
return tdGetBitmapAddrKv(pRow, nKvCols);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tdSTSRowIterReset(STSRowIter *pIter, STSRow *pRow) {
|
||||||
|
pIter->pRow = pRow;
|
||||||
|
pIter->pBitmap = tdGetBitmapAddr(pRow, pRow->type, pIter->pSchema->flen, tdRowGetNCols(pRow));
|
||||||
|
pIter->offset = 0;
|
||||||
|
pIter->colIdx = 0; // PRIMARYKEY_TIMESTAMP_COL_ID;
|
||||||
|
pIter->kvIdx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tdSTSRowIterFetch(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCellVal *pVal) {
|
||||||
|
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
|
pVal->val = &pIter->pRow->ts;
|
||||||
|
pVal->valType = TD_VTYPE_NORM;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TD_IS_TP_ROW(pIter->pRow)) {
|
||||||
|
STColumn *pCol = NULL;
|
||||||
|
STSchema *pSchema = pIter->pSchema;
|
||||||
|
while (pIter->colIdx < pSchema->numOfCols) {
|
||||||
|
pCol = &pSchema->columns[pIter->colIdx]; // 1st column of schema is primary TS key
|
||||||
|
if (colId == pCol->colId) {
|
||||||
|
break;
|
||||||
|
} else if (pCol->colId < colId) {
|
||||||
|
++pIter->colIdx;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
||||||
|
++pIter->colIdx;
|
||||||
|
} else if (TD_IS_KV_ROW(pIter->pRow)) {
|
||||||
|
return tdSTSRowIterGetKvVal(pIter, colId, &pIter->kvIdx, pVal);
|
||||||
|
} else {
|
||||||
|
pVal->valType = TD_VTYPE_NONE;
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
if (COL_REACH_END(colId, pIter->maxColId)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal) {
|
||||||
|
STSRow *pRow = pIter->pRow;
|
||||||
|
if (pRow->statis == 0) {
|
||||||
|
pVal->valType = TD_VTYPE_NORM;
|
||||||
|
if (IS_VAR_DATA_TYPE(colType)) {
|
||||||
|
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
||||||
|
} else {
|
||||||
|
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tdGetBitmapValType(pIter->pBitmap, pIter->colIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||||
|
pVal->valType = TD_VTYPE_NONE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pVal->valType == TD_VTYPE_NORM) {
|
||||||
|
if (IS_VAR_DATA_TYPE(colType)) {
|
||||||
|
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
||||||
|
} else {
|
||||||
|
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||||
|
if (!pBitmap || colIdx < 0) {
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
int16_t nBytes = colIdx / TD_VTYPE_PARTS;
|
||||||
|
int16_t nOffset = colIdx & TD_VTYPE_OPTR;
|
||||||
|
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||||
|
// use literal value directly and not use formula to simplify the codes
|
||||||
|
switch (nOffset) {
|
||||||
|
case 0:
|
||||||
|
*pValType = (((*pDestByte) & 0xC0) >> 6);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
*pValType = (((*pDestByte) & 0x30) >> 4);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
*pValType = (((*pDestByte) & 0x0C) >> 2);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
*pValType = ((*pDestByte) & 0x03);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||||
|
if (!pBitmap || colIdx < 0) {
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
int16_t nBytes = colIdx / TD_VTYPE_PARTS_I;
|
||||||
|
int16_t nOffset = colIdx & TD_VTYPE_OPTR_I;
|
||||||
|
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||||
|
// use literal value directly and not use formula to simplify the codes
|
||||||
|
switch (nOffset) {
|
||||||
|
case 0:
|
||||||
|
*pValType = (((*pDestByte) & 0x80) >> 7);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
*pValType = (((*pDestByte) & 0x40) >> 6);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
*pValType = (((*pDestByte) & 0x20) >> 5);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
*pValType = (((*pDestByte) & 0x10) >> 4);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
*pValType = (((*pDestByte) & 0x08) >> 3);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
*pValType = (((*pDestByte) & 0x04) >> 2);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
*pValType = (((*pDestByte) & 0x02) >> 1);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
*pValType = ((*pDestByte) & 0x01);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValType, int8_t bitmapMode) {
|
||||||
|
switch (bitmapMode) {
|
||||||
|
case 0:
|
||||||
|
tdGetBitmapValTypeII(pBitmap, colIdx, pValType);
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
case 1:
|
||||||
|
tdGetBitmapValTypeI(pBitmap, colIdx, pValType);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal) {
|
||||||
|
STSRow *pRow = pIter->pRow;
|
||||||
|
SKvRowIdx *pKvIdx = NULL;
|
||||||
|
bool colFound = false;
|
||||||
|
col_id_t kvNCols = tdRowGetNCols(pRow) - 1;
|
||||||
|
void *pColIdx = TD_ROW_COL_IDX(pRow);
|
||||||
|
while (*nIdx < kvNCols) {
|
||||||
|
pKvIdx = (SKvRowIdx *)POINTER_SHIFT(pColIdx, *nIdx * sizeof(SKvRowIdx));
|
||||||
|
if (pKvIdx->colId == colId) {
|
||||||
|
++(*nIdx);
|
||||||
|
pVal->val = POINTER_SHIFT(pRow, pKvIdx->offset);
|
||||||
|
colFound = true;
|
||||||
|
break;
|
||||||
|
} else if (pKvIdx->colId > colId) {
|
||||||
|
pVal->valType = TD_VTYPE_NONE;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
++(*nIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!colFound) {
|
||||||
|
if (colId <= pIter->maxColId) {
|
||||||
|
pVal->valType = TD_VTYPE_NONE;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tdGetBitmapValType(pIter->pBitmap, pIter->kvIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||||
|
pVal->valType = TD_VTYPE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef BUILD_NO_CALL
|
#ifdef BUILD_NO_CALL
|
||||||
const uint8_t tdVTypeByte[2][3] = {{
|
const uint8_t tdVTypeByte[2][3] = {{
|
||||||
// 2 bits
|
// 2 bits
|
||||||
|
@ -35,8 +249,6 @@ const uint8_t tdVTypeByte[2][3] = {{
|
||||||
|
|
||||||
// declaration
|
// declaration
|
||||||
static uint8_t tdGetBitmapByte(uint8_t byte);
|
static uint8_t tdGetBitmapByte(uint8_t byte);
|
||||||
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 tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t flen, uint32_t offset,
|
static bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t flen, uint32_t offset,
|
||||||
col_id_t colIdx, SCellVal *pVal);
|
col_id_t colIdx, SCellVal *pVal);
|
||||||
static bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, col_id_t colIdx, SCellVal *pVal);
|
static bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, col_id_t colIdx, SCellVal *pVal);
|
||||||
|
@ -200,38 +412,6 @@ bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t fl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tdSTSRowIterFetch(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCellVal *pVal) {
|
|
||||||
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
|
||||||
pVal->val = &pIter->pRow->ts;
|
|
||||||
pVal->valType = TD_VTYPE_NORM;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TD_IS_TP_ROW(pIter->pRow)) {
|
|
||||||
STColumn *pCol = NULL;
|
|
||||||
STSchema *pSchema = pIter->pSchema;
|
|
||||||
while (pIter->colIdx < pSchema->numOfCols) {
|
|
||||||
pCol = &pSchema->columns[pIter->colIdx]; // 1st column of schema is primary TS key
|
|
||||||
if (colId == pCol->colId) {
|
|
||||||
break;
|
|
||||||
} else if (pCol->colId < colId) {
|
|
||||||
++pIter->colIdx;
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
|
||||||
++pIter->colIdx;
|
|
||||||
} else if (TD_IS_KV_ROW(pIter->pRow)) {
|
|
||||||
return tdSTSRowIterGetKvVal(pIter, colId, &pIter->kvIdx, pVal);
|
|
||||||
} else {
|
|
||||||
pVal->valType = TD_VTYPE_NONE;
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
|
||||||
if (COL_REACH_END(colId, pIter->maxColId)) return false;
|
|
||||||
}
|
|
||||||
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) {
|
||||||
|
@ -259,71 +439,6 @@ bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal) {
|
|
||||||
STSRow *pRow = pIter->pRow;
|
|
||||||
if (pRow->statis == 0) {
|
|
||||||
pVal->valType = TD_VTYPE_NORM;
|
|
||||||
if (IS_VAR_DATA_TYPE(colType)) {
|
|
||||||
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
|
||||||
} else {
|
|
||||||
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->colIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
|
||||||
pVal->valType = TD_VTYPE_NONE;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pVal->valType == TD_VTYPE_NORM) {
|
|
||||||
if (IS_VAR_DATA_TYPE(colType)) {
|
|
||||||
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
|
||||||
} else {
|
|
||||||
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal) {
|
|
||||||
STSRow *pRow = pIter->pRow;
|
|
||||||
SKvRowIdx *pKvIdx = NULL;
|
|
||||||
bool colFound = false;
|
|
||||||
col_id_t kvNCols = tdRowGetNCols(pRow) - 1;
|
|
||||||
void *pColIdx = TD_ROW_COL_IDX(pRow);
|
|
||||||
while (*nIdx < kvNCols) {
|
|
||||||
pKvIdx = (SKvRowIdx *)POINTER_SHIFT(pColIdx, *nIdx * sizeof(SKvRowIdx));
|
|
||||||
if (pKvIdx->colId == colId) {
|
|
||||||
++(*nIdx);
|
|
||||||
pVal->val = POINTER_SHIFT(pRow, pKvIdx->offset);
|
|
||||||
colFound = true;
|
|
||||||
break;
|
|
||||||
} else if (pKvIdx->colId > colId) {
|
|
||||||
pVal->valType = TD_VTYPE_NONE;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
++(*nIdx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!colFound) {
|
|
||||||
if (colId <= pIter->maxColId) {
|
|
||||||
pVal->valType = TD_VTYPE_NONE;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->kvIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
|
||||||
pVal->valType = TD_VTYPE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
|
int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
|
||||||
STColumn *pTColumn;
|
STColumn *pTColumn;
|
||||||
SColVal *pColVal;
|
SColVal *pColVal;
|
||||||
|
@ -491,76 +606,6 @@ bool tdSTSRowGetVal(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCell
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
|
||||||
if (!pBitmap || colIdx < 0) {
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
|
||||||
return terrno;
|
|
||||||
}
|
|
||||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS;
|
|
||||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR;
|
|
||||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
|
||||||
// use literal value directly and not use formula to simplify the codes
|
|
||||||
switch (nOffset) {
|
|
||||||
case 0:
|
|
||||||
*pValType = (((*pDestByte) & 0xC0) >> 6);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
*pValType = (((*pDestByte) & 0x30) >> 4);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
*pValType = (((*pDestByte) & 0x0C) >> 2);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
*pValType = ((*pDestByte) & 0x03);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
|
||||||
return terrno;
|
|
||||||
}
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
|
||||||
if (!pBitmap || colIdx < 0) {
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
|
||||||
return terrno;
|
|
||||||
}
|
|
||||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS_I;
|
|
||||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR_I;
|
|
||||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
|
||||||
// use literal value directly and not use formula to simplify the codes
|
|
||||||
switch (nOffset) {
|
|
||||||
case 0:
|
|
||||||
*pValType = (((*pDestByte) & 0x80) >> 7);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
*pValType = (((*pDestByte) & 0x40) >> 6);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
*pValType = (((*pDestByte) & 0x20) >> 5);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
*pValType = (((*pDestByte) & 0x10) >> 4);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
*pValType = (((*pDestByte) & 0x08) >> 3);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
*pValType = (((*pDestByte) & 0x04) >> 2);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
*pValType = (((*pDestByte) & 0x02) >> 1);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
*pValType = ((*pDestByte) & 0x01);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
|
||||||
return terrno;
|
|
||||||
}
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
@ -945,21 +990,6 @@ int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols,
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValType, int8_t bitmapMode) {
|
|
||||||
switch (bitmapMode) {
|
|
||||||
case 0:
|
|
||||||
tdGetBitmapValTypeII(pBitmap, colIdx, pValType);
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
case 1:
|
|
||||||
tdGetBitmapValTypeI(pBitmap, colIdx, pValType);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
terrno = TSDB_CODE_INVALID_PARA;
|
|
||||||
return TSDB_CODE_FAILED;
|
|
||||||
}
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
#if 0
|
#if 0
|
||||||
bool tdIsBitmapValTypeNorm(const void *pBitmap, int16_t idx, int8_t bitmapMode) {
|
bool tdIsBitmapValTypeNorm(const void *pBitmap, int16_t idx, int8_t bitmapMode) {
|
||||||
TDRowValT valType = 0;
|
TDRowValT valType = 0;
|
||||||
|
@ -1021,32 +1051,7 @@ int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *tdGetBitmapAddr(STSRow *pRow, uint8_t rowType, uint32_t flen, col_id_t nKvCols) {
|
|
||||||
#ifdef TD_SUPPORT_BITMAP
|
|
||||||
switch (rowType) {
|
|
||||||
case TD_ROW_TP:
|
|
||||||
return tdGetBitmapAddrTp(pRow, flen);
|
|
||||||
case TD_ROW_KV:
|
|
||||||
return tdGetBitmapAddrKv(pRow, nKvCols);
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tdSTSRowIterReset(STSRowIter *pIter, STSRow *pRow) {
|
|
||||||
pIter->pRow = pRow;
|
|
||||||
pIter->pBitmap = tdGetBitmapAddr(pRow, pRow->type, pIter->pSchema->flen, tdRowGetNCols(pRow));
|
|
||||||
pIter->offset = 0;
|
|
||||||
pIter->colIdx = 0; // PRIMARYKEY_TIMESTAMP_COL_ID;
|
|
||||||
pIter->kvIdx = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tdSTSRowIterInit(STSRowIter *pIter, STSchema *pSchema) {
|
|
||||||
pIter->pSchema = pSchema;
|
|
||||||
pIter->maxColId = pSchema->columns[pSchema->numOfCols - 1].colId;
|
|
||||||
}
|
|
||||||
|
|
||||||
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];
|
||||||
|
|
|
@ -1266,6 +1266,7 @@ _exit:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BUILD_NO_CALL
|
||||||
static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock, SSubmitMsgIter *msgIter,
|
static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock, SSubmitMsgIter *msgIter,
|
||||||
const char *tags) {
|
const char *tags) {
|
||||||
SSubmitBlkIter blkIter = {0};
|
SSubmitBlkIter blkIter = {0};
|
||||||
|
@ -1296,7 +1297,7 @@ static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock,
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
typedef struct SSubmitReqConvertCxt {
|
typedef struct SSubmitReqConvertCxt {
|
||||||
SSubmitMsgIter msgIter;
|
SSubmitMsgIter msgIter;
|
||||||
SSubmitBlk *pBlock;
|
SSubmitBlk *pBlock;
|
||||||
|
|
Loading…
Reference in New Issue