未验证 提交 a199c1c2 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #15947 from taosdata/fix/TS-1740-V26

fix(query): subscribe all child tables skey calc error
......@@ -5320,15 +5320,17 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
}
static void doTableQueryInfoTimeWindowCheck(SQueryAttr* pQueryAttr, STableQueryInfo* pTableQueryInfo) {
//
// current subscribe can not ensure pTableQueryInfo->lastKey >= pTableQueryInfo->win.skey, so remove this condition check
// reason is subscribe calc query windows skey is all child table smallest skey, so bigest child table block->skey maybe large than this table's pTableQueryInfo->win.skey
//
if (QUERY_IS_ASC_QUERY(pQueryAttr)) {
assert(
(pTableQueryInfo->win.skey <= pTableQueryInfo->win.ekey) &&
(pTableQueryInfo->lastKey >= pTableQueryInfo->win.skey) &&
(pTableQueryInfo->win.skey >= pQueryAttr->window.skey && pTableQueryInfo->win.ekey <= pQueryAttr->window.ekey));
} else {
assert(
(pTableQueryInfo->win.skey >= pTableQueryInfo->win.ekey) &&
(pTableQueryInfo->lastKey <= pTableQueryInfo->win.skey) &&
(pTableQueryInfo->win.skey <= pQueryAttr->window.skey && pTableQueryInfo->win.ekey >= pQueryAttr->window.ekey));
}
}
......@@ -5430,6 +5432,28 @@ static SSDataBlock* doTableScanImpl(void* param, bool* newgroup) {
break;
}
// check windows condition
if (pBlock->info.window.skey != INT64_MIN && pBlock->info.window.skey != INT64_MAX &&
pBlock->info.window.ekey != INT64_MIN && pBlock->info.window.ekey != INT64_MAX) {
// normal block not specail block like last_row
int64_t skey = (*pTableQueryInfo)->win.skey;
if (QUERY_IS_ASC_QUERY(pQueryAttr)) {
// ASC
if ( skey > pBlock->info.window.ekey ) {
qWarn(" pTableQueryInfo skey(%" PRId64 ") > pBlock ekey(%" PRId64 "), so remove this block. pBlock skey=%" PRId64 " tid=%d",
skey, pBlock->info.window.ekey, pBlock->info.window.skey, pBlock->info.tid);
continue;
}
} else {
// DESC
if ( skey < pBlock->info.window.skey ) {
qWarn(" pTableQueryInfo skey(%" PRId64 ") < pBlock skey(%" PRId64 "), so remove this block. pBlock ekey=%" PRId64 "tid=%d",
skey, pBlock->info.window.skey, pBlock->info.window.ekey, pBlock->info.tid);
continue;
}
}
}
pRuntimeEnv->current = *pTableQueryInfo;
doTableQueryInfoTimeWindowCheck(pQueryAttr, *pTableQueryInfo);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册