From 2c524cad4a7003afd4508a62f98779421ccad5e5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 30 Oct 2022 03:08:33 +0800 Subject: [PATCH] refactor: do some internal refactor. --- source/libs/executor/src/executil.c | 7 ++++++- source/libs/executor/src/executorimpl.c | 6 +++--- source/libs/executor/src/scanoperator.c | 3 ++- tests/system-test/1-insert/create_retentions.py | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 5b417999b4..bb65a9f7f2 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1697,7 +1697,12 @@ int32_t getTablesOfGroup(const STableListInfo* pTableList, int32_t ordinalGroupI // 1. only one group exists, and 2. one table exists for each group. if (total == 1) { *size = getTotalTables(pTableList); - *pKeyInfo = taosArrayGet(pTableList->pTableList, 0); + if (*size > 0) { + *pKeyInfo = taosArrayGet(pTableList->pTableList, 0); + } else { + *pKeyInfo = NULL; + } + return TSDB_CODE_SUCCESS; } else if (total == getTotalTables(pTableList)) { *size = 1; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index e31a34e5ad..54c92c10bd 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3630,12 +3630,12 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo #ifndef NDEBUG int32_t sz = taosArrayGetSize(pTableListInfo->pTableList); + qDebug("create stream task, total:%d", sz); + for (int32_t i = 0; i < sz; i++) { STableKeyInfo* pKeyInfo = taosArrayGet(pTableListInfo->pTableList, i); - qDebug("creating stream task: add table uid:%" PRIu64, pKeyInfo->uid); + qDebug("add table uid:%" PRIu64", gid:%"PRIu64, pKeyInfo->uid, pKeyInfo->groupId); } - - qDebug("table in hashmap, %d", (int32_t) getTotalTables(pTableListInfo)); #endif } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 766d7ec18c..415fa60287 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -4225,6 +4225,8 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags return code; } + pTableListInfo->numOfOuputGroups = 1; + int64_t st1 = taosGetTimestampUs(); qDebug("generate queried table list completed, elapsed time:%.2f ms %s", (st1 - st) / 1000.0, idStr); @@ -4233,7 +4235,6 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags return TSDB_CODE_SUCCESS; } - pTableListInfo->numOfOuputGroups = 1; code = setGroupIdMapForAllTables(pTableListInfo, pHandle, pGroupTags, groupSort); if (code != TSDB_CODE_SUCCESS) { return code; diff --git a/tests/system-test/1-insert/create_retentions.py b/tests/system-test/1-insert/create_retentions.py index 54abcec391..47d53d5b34 100644 --- a/tests/system-test/1-insert/create_retentions.py +++ b/tests/system-test/1-insert/create_retentions.py @@ -46,7 +46,7 @@ class TDTestCase: def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") - tdSql.init(conn.cursor(), False) + tdSql.init(conn.cursor(), True) @property def create_databases_sql_err(self):