fix: (last) nextRowIterGet compare pk

This commit is contained in:
Shungang Li 2024-09-14 10:26:14 +08:00
parent 157a105bd1
commit 0ea38a15a8
1 changed files with 7 additions and 5 deletions

View File

@ -2939,17 +2939,19 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
TSDBROW *max[4] = {0}; TSDBROW *max[4] = {0};
int iMax[4] = {-1, -1, -1, -1}; int iMax[4] = {-1, -1, -1, -1};
int nMax = 0; int nMax = 0;
TSKEY maxKey = TSKEY_MIN; SRowKey maxKey = {.ts = TSKEY_MIN};
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
if (!pIter->input[i].stop && pIter->input[i].pRow != NULL) { if (!pIter->input[i].stop && pIter->input[i].pRow != NULL) {
TSDBKEY key = TSDBROW_KEY(pIter->input[i].pRow); STsdbRowKey tsdbRowKey = {0};
tsdbRowGetKey(pIter->input[i].pRow, &tsdbRowKey);
// merging & deduplicating on client side // merging & deduplicating on client side
if (maxKey <= key.ts) { int c = tRowKeyCompare(&maxKey, &tsdbRowKey.key);
if (maxKey < key.ts) { if (c <= 0) {
if (c < 0) {
nMax = 0; nMax = 0;
maxKey = key.ts; maxKey = tsdbRowKey.key;
} }
iMax[nMax] = i; iMax[nMax] = i;