Merge pull request #22696 from taosdata/fix/m/TD-26096
fix: 1. select tag from meters partition by tag limit returned wrong …
This commit is contained in:
commit
8cbc49a083
|
@ -668,10 +668,15 @@ static void doGetSortedBlockData(SMultiwayMergeOperatorInfo* pInfo, SSortHandle*
|
||||||
appendOneRowToDataBlock(p, pTupleHandle);
|
appendOneRowToDataBlock(p, pTupleHandle);
|
||||||
p->info.id.groupId = tupleGroupId;
|
p->info.id.groupId = tupleGroupId;
|
||||||
pInfo->groupId = tupleGroupId;
|
pInfo->groupId = tupleGroupId;
|
||||||
|
} else {
|
||||||
|
if (p->info.rows == 0) {
|
||||||
|
appendOneRowToDataBlock(p, pTupleHandle);
|
||||||
|
p->info.id.groupId = pInfo->groupId = tupleGroupId;
|
||||||
} else {
|
} else {
|
||||||
pInfo->prefetchedTuple = pTupleHandle;
|
pInfo->prefetchedTuple = pTupleHandle;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
appendOneRowToDataBlock(p, pTupleHandle);
|
appendOneRowToDataBlock(p, pTupleHandle);
|
||||||
}
|
}
|
||||||
|
@ -715,14 +720,9 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
|
||||||
resetLimitInfoForNextGroup(&pInfo->limitInfo);
|
resetLimitInfoForNextGroup(&pInfo->limitInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool limitReached = applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo);
|
applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo);
|
||||||
// if limit is reached within a group, do not clear limiInfo otherwise the next block
|
|
||||||
// will be processed.
|
|
||||||
if (newgroup && limitReached) {
|
|
||||||
resetLimitInfoForNextGroup(&pInfo->limitInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p->info.rows > 0 || limitReached) {
|
if (p->info.rows > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,10 +251,19 @@ class TDTestCase:
|
||||||
tdSql.checkData(2, 4, 9)
|
tdSql.checkData(2, 4, 9)
|
||||||
tdSql.checkData(3, 4, 9)
|
tdSql.checkData(3, 4, 9)
|
||||||
|
|
||||||
|
def test_partition_by_limit_no_agg(self):
|
||||||
|
sql_template = 'select t1 from meters partition by t1 limit %d'
|
||||||
|
|
||||||
|
for i in range(1, 5000, 1000):
|
||||||
|
tdSql.query(sql_template % i)
|
||||||
|
tdSql.checkRows(5 * i)
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.prepareTestEnv()
|
self.prepareTestEnv()
|
||||||
self.test_interval_limit_offset()
|
self.test_interval_limit_offset()
|
||||||
self.test_interval_partition_by_slimit_limit()
|
self.test_interval_partition_by_slimit_limit()
|
||||||
|
self.test_partition_by_limit_no_agg()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
Loading…
Reference in New Issue