fix(tsdb): set pk column index.

This commit is contained in:
Haojun Liao 2024-03-21 09:37:46 +08:00
parent 1d77cde433
commit b12e65d144
5 changed files with 10 additions and 1 deletions

View File

@ -1037,6 +1037,7 @@ typedef struct {
uint8_t scale;
int32_t bytes;
int8_t type;
uint8_t pk;
} SColumnInfo;
typedef struct STimeWindow {

View File

@ -129,6 +129,10 @@ static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pC
} else {
pSupInfo->buildBuf[i] = NULL;
}
if (pCols[i].pk) {
pSupInfo->pkSlotId = pCols[i].slotId;
}
}
return TSDB_CODE_SUCCESS;

View File

@ -159,6 +159,7 @@ typedef struct SBlockLoadSuppInfo {
int16_t* slotId;
int32_t numOfCols;
char** buildBuf; // build string tmp buffer, todo remove it later after all string format being updated.
int16_t pkSlotId;
bool smaValid; // the sma on all queried columns are activated
} SBlockLoadSuppInfo;

View File

@ -370,7 +370,8 @@ static EDealRes getColumn(SNode** pNode, void* pContext) {
pSColumnNode->slotId = pData->index++;
SColumnInfo cInfo = {.colId = pSColumnNode->colId,
.type = pSColumnNode->node.resType.type,
.bytes = pSColumnNode->node.resType.bytes};
.bytes = pSColumnNode->node.resType.bytes,
.pk = pSColumnNode->isPk};
#if TAG_FILTER_DEBUG
qDebug("tagfilter build column info, slotId:%d, colId:%d, type:%d", pSColumnNode->slotId, cInfo.colId, cInfo.type);
#endif
@ -1763,6 +1764,7 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi
pCond->colList[j].type = pColNode->node.resType.type;
pCond->colList[j].bytes = pColNode->node.resType.bytes;
pCond->colList[j].colId = pColNode->colId;
pCond->colList[j].pk = pColNode->isPk;
pCond->pSlotList[j] = pNode->slotId;
j += 1;

View File

@ -2276,6 +2276,7 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC
pCond->colList->colId = 1;
pCond->colList->type = TSDB_DATA_TYPE_TIMESTAMP;
pCond->colList->bytes = sizeof(TSKEY);
pCond->colList->pk = 0;
pCond->pSlotList[0] = 0;