enh(tsdb): read composed key in stt.

This commit is contained in:
Haojun Liao 2024-03-14 17:03:57 +08:00
parent 2910ae3afb
commit 34c849bdbe
2 changed files with 13 additions and 3 deletions

View File

@ -1462,8 +1462,18 @@ static bool tryCopyDistinctRowFromSttBlock(TSDBROW* fRow, SSttBlockReader* pSttB
bool hasVal = nextRowFromSttBlocks(pSttBlockReader, pScanInfo, &pReader->info.verRange);
doUnpinSttBlock(pSttBlockReader);
if (hasVal) {
int64_t next1 = getCurrentKeyInSttBlock(pSttBlockReader);
if (next1 != ts) {
STsdbRowKey key, nextKey;
tsdbRowGetKey(fRow, &key);
TSDBROW* pNextRow = tMergeTreeGetRow(&pSttBlockReader->mergeTree);
tsdbRowGetKey(pNextRow, &nextKey);
if (!pReader->pkChecked) {
pReader->pkComparFn = getComparFunc(key.key.pks[0].type, 0);
pReader->pkChecked = true;
}
if (nextKey.key.ts != ts || (pkComp(pReader, fRow, pNextRow) != 0)) {
code = doAppendRowFromFileBlock(pReader->resBlockInfo.pResBlock, pReader, fRow->pBlockData, fRow->iRow);
if (code) {
return code;

View File

@ -87,7 +87,7 @@ typedef struct SSttKeyInfo {
// 4. not overlap with data file blocks
typedef struct STableBlockScanInfo {
uint64_t uid;
TSKEY lastProcKey;
TSKEY lastProcKey; // todo: refactor: add primary key
SSttKeyInfo sttKeyInfo;
SArray* pBlockList; // block data index list, SArray<SBrinRecord>
SArray* pBlockIdxList; // SArray<STableDataBlockIndx>