diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 0c5eac66e2260f584cafe3855e76418a4462f325..5e70c814133fd93b7619022a1d564050c3c0502a 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -266,12 +266,14 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { SSqlCmd* pCmd = &pSql->cmd; - TSDB_QUERY_CLEAR_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); + SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); + + TSDB_QUERY_CLEAR_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0); if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { STableMeta * pTableMeta = pTableMetaInfo->pTableMeta; - SSubscriptionProgress target = {.uid = pTableMeta->id.uid, .key = 0}; + SSubscriptionProgress target = {.uid = pTableMeta->id.uid, .key = pQueryInfo->window.skey}; SSubscriptionProgress* p = taosArraySearch(pSub->progress, &target, tscCompareSubscriptionProgress, TD_EQ); if (p == NULL) { taosArrayClear(pSub->progress); @@ -289,7 +291,6 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { } size_t numOfTables = taosArrayGetSize(tables); - SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); SArray* progress = taosArrayInit(numOfTables, sizeof(SSubscriptionProgress)); for( size_t i = 0; i < numOfTables; i++ ) { STidTags* tt = taosArrayGet( tables, i );