Merge pull request #11649 from taosdata/feature/TD-14481-3.0
feat: SKVRow read logic
This commit is contained in:
commit
3747e6f440
|
@ -651,6 +651,8 @@ static int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
|
||||||
TD_ROW_SET_INFO(pBuilder->pBuf, 0);
|
TD_ROW_SET_INFO(pBuilder->pBuf, 0);
|
||||||
TD_ROW_SET_TYPE(pBuilder->pBuf, pBuilder->rowType);
|
TD_ROW_SET_TYPE(pBuilder->pBuf, pBuilder->rowType);
|
||||||
|
|
||||||
|
TASSERT(pBuilder->nBitmaps > 0 && pBuilder->flen > 0);
|
||||||
|
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
switch (pBuilder->rowType) {
|
switch (pBuilder->rowType) {
|
||||||
case TD_ROW_TP:
|
case TD_ROW_TP:
|
||||||
|
@ -1165,6 +1167,18 @@ static FORCE_INLINE int32_t tdGetColDataOfRow(SCellVal *pVal, SDataCol *pCol, in
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param pRow
|
||||||
|
* @param colId
|
||||||
|
* @param colType
|
||||||
|
* @param flen
|
||||||
|
* @param offset
|
||||||
|
* @param colIdx start from 0
|
||||||
|
* @param pVal
|
||||||
|
* @return FORCE_INLINE
|
||||||
|
*/
|
||||||
static FORCE_INLINE bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t flen, uint32_t offset,
|
static FORCE_INLINE 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) {
|
||||||
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
|
@ -1172,10 +1186,20 @@ static FORCE_INLINE bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void *pBitmap = tdGetBitmapAddrTp(pRow, flen);
|
void *pBitmap = tdGetBitmapAddrTp(pRow, flen);
|
||||||
tdGetTpRowValOfCol(pVal, pRow, pBitmap, colType, offset - sizeof(TSKEY), colIdx - 1);
|
tdGetTpRowValOfCol(pVal, pRow, pBitmap, colType, offset - sizeof(TSKEY), colIdx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param pRow
|
||||||
|
* @param colId
|
||||||
|
* @param offset
|
||||||
|
* @param colIdx start from 0
|
||||||
|
* @param pVal
|
||||||
|
* @return FORCE_INLINE
|
||||||
|
*/
|
||||||
static FORCE_INLINE bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, uint32_t offset, col_id_t colIdx,
|
static FORCE_INLINE bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, uint32_t offset, col_id_t colIdx,
|
||||||
SCellVal *pVal) {
|
SCellVal *pVal) {
|
||||||
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||||
|
@ -1183,7 +1207,7 @@ static FORCE_INLINE bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, uint32_t o
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void *pBitmap = tdGetBitmapAddrKv(pRow, tdRowGetNCols(pRow));
|
void *pBitmap = tdGetBitmapAddrKv(pRow, tdRowGetNCols(pRow));
|
||||||
tdGetKvRowValOfCol(pVal, pRow, pBitmap, offset, colIdx - 1);
|
tdGetKvRowValOfCol(pVal, pRow, pBitmap, offset, colIdx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1561,12 +1561,19 @@ static void mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capacit
|
||||||
if (isChosenRowDataRow) {
|
if (isChosenRowDataRow) {
|
||||||
colId = pSchema->columns[chosen_itr].colId;
|
colId = pSchema->columns[chosen_itr].colId;
|
||||||
offset = pSchema->columns[chosen_itr].offset;
|
offset = pSchema->columns[chosen_itr].offset;
|
||||||
tdSTpRowGetVal(row, colId, pSchema->columns[chosen_itr].type, pSchema->flen, offset, chosen_itr, &sVal);
|
// TODO: use STSRowIter
|
||||||
|
tdSTpRowGetVal(row, colId, pSchema->columns[chosen_itr].type, pSchema->flen, offset, chosen_itr - 1, &sVal);
|
||||||
} else {
|
} else {
|
||||||
SKvRowIdx* pColIdx = tdKvRowColIdxAt(row, chosen_itr);
|
// TODO: use STSRowIter
|
||||||
colId = pColIdx->colId;
|
if (chosen_itr == 0) {
|
||||||
offset = pColIdx->offset;
|
colId = PRIMARYKEY_TIMESTAMP_COL_ID;
|
||||||
tdSKvRowGetVal(row, colId, offset, chosen_itr, &sVal);
|
tdSKvRowGetVal(row, PRIMARYKEY_TIMESTAMP_COL_ID, -1, -1, &sVal);
|
||||||
|
} else {
|
||||||
|
SKvRowIdx* pColIdx = tdKvRowColIdxAt(row, chosen_itr - 1);
|
||||||
|
colId = pColIdx->colId;
|
||||||
|
offset = pColIdx->offset;
|
||||||
|
tdSKvRowGetVal(row, colId, offset, chosen_itr - 1, &sVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colId == pColInfo->info.colId) {
|
if (colId == pColInfo->info.colId) {
|
||||||
|
|
Loading…
Reference in New Issue