diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 5c470982bb4de7aff73a87aca9bf924fd2edfba6..71e260c00103c8a34c5f20a23ae19b1aa298d865 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -74,9 +74,7 @@ int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t nCols, STSchema * void tTSchemaDestroy(STSchema *pTSchema); // SValue ================================ -int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type); -int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type); -int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type); +static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type); // SColVal ================================ #define CV_FLAG_VALUE ((int8_t)0x0) @@ -283,6 +281,15 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version) int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, col_id_t colId, col_bytes_t bytes); STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder); +static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type) { + if (IS_VAR_DATA_TYPE(type)) { + return tGetBinary(p, &pValue->pData, pValue ? &pValue->nData : NULL); + } else { + memcpy(&pValue->val, p, tDataTypes[type].bytes); + return tDataTypes[type].bytes; + } +} + #endif #ifdef __cplusplus diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 8684426e5bec08d5b43c1a37514749630d3b5a37..8c003066dc95d2fc7bb95cd081debca7008e9e64 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -56,7 +56,7 @@ typedef struct { #define TSROW_IS_KV_ROW(r) ((r)->flags & TSROW_KV_ROW) // SValue -int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) { +static FORCE_INLINE int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) { if (IS_VAR_DATA_TYPE(type)) { return tPutBinary(p, pValue->pData, pValue->nData); } else { @@ -65,20 +65,6 @@ int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) { } } -int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type) { - if (IS_VAR_DATA_TYPE(type)) { - return tGetBinary(p, &pValue->pData, pValue ? &pValue->nData : NULL); - } else { - memcpy(&pValue->val, p, tDataTypes[type].bytes); - return tDataTypes[type].bytes; - } -} - -int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type) { - // TODO - return 0; -} - // STSRow2 ======================================================================== static void setBitMap(uint8_t *pb, uint8_t v, int32_t idx, uint8_t flags) { if (pb) { diff --git a/source/common/src/trow.c b/source/common/src/trow.c index ac4b5f86de7c4bb9b909b7098ba6da3d39801a52..d39d3c501a4c3df1afe4f1389865bd98906dacbd 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -73,8 +73,8 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) { } else if (tdValTypeIsNone(pVal->valType)) { printf("NONE "); return; - } - if(!pVal->val) { + } + if (!pVal->val) { ASSERT(0); printf("BadVal "); return; @@ -1083,13 +1083,15 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV } else if (tdValTypeIsNull(cv.valType)) { *pColVal = COL_VAL_NULL(pTColumn->colId, pTColumn->type); } else { + pColVal->cid = pTColumn->colId; + pColVal->type = pTColumn->type; + pColVal->flag = CV_FLAG_VALUE; + if (IS_VAR_DATA_TYPE(pTColumn->type)) { - value.nData = varDataLen(cv.val); - value.pData = varDataVal(cv.val); + pColVal->value.nData = varDataLen(cv.val); + pColVal->value.pData = varDataVal(cv.val); } else { - tGetValue(cv.val, &value, pTColumn->type); + memcpy(&pColVal->value.val, cv.val, tDataTypes[pTColumn->type].bytes); } - - *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, value); } } \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index a03c9ab525b532909eab2270fc54b7f1270244a8..52b74aea3f9d265bc791932f03adc31537bf1928 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -607,7 +607,7 @@ void tRowIterInit(SRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema) { SColVal *tRowIterNext(SRowIter *pIter) { if (pIter->pRow->type == 0) { if (pIter->i < pIter->pTSchema->numOfCols) { - tsdbRowGetColVal(pIter->pRow, pIter->pTSchema, pIter->i, &pIter->colVal); + tTSRowGetVal(pIter->pRow->pTSRow, pIter->pTSchema, pIter->i, &pIter->colVal); pIter->i++; return &pIter->colVal;