Merge pull request #27887 from taosdata/fix/TD-32051-3.0

fix: (last) nextRowIterGet compare pk
This commit is contained in:
Hongze Cheng 2024-09-14 21:01:49 +08:00 committed by GitHub
commit e9a8975a0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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};
int iMax[4] = {-1, -1, -1, -1};
int nMax = 0;
TSKEY maxKey = TSKEY_MIN;
SRowKey maxKey = {.ts = TSKEY_MIN};
for (int i = 0; i < 3; ++i) {
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
if (maxKey <= key.ts) {
if (maxKey < key.ts) {
int c = tRowKeyCompare(&maxKey, &tsdbRowKey.key);
if (c <= 0) {
if (c < 0) {
nMax = 0;
maxKey = key.ts;
maxKey = tsdbRowKey.key;
}
iMax[nMax] = i;