提交 dbe026a8 编写于 作者: H Haojun Liao

[td-3299]

上级 c18dd031
...@@ -439,7 +439,6 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) { ...@@ -439,7 +439,6 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) {
pSupporter->f = NULL; pSupporter->f = NULL;
} }
if (pSupporter->pVgroupTables != NULL) { if (pSupporter->pVgroupTables != NULL) {
taosArrayDestroy(pSupporter->pVgroupTables); taosArrayDestroy(pSupporter->pVgroupTables);
pSupporter->pVgroupTables = NULL; pSupporter->pVgroupTables = NULL;
......
#include "os.h" #include "os.h"
#include "tschemautil.h"
#include "qPlan.h"
#include "qExecutor.h" #include "qExecutor.h"
#include "qUtil.h" #include "qUtil.h"
#include "texpr.h" #include "texpr.h"
#include "qPlan.h"
#include "tsclient.h"
#include "tscUtil.h" #include "tscUtil.h"
#include "tsclient.h"
#define QNODE_TAGSCAN 1 #define QNODE_TAGSCAN 1
#define QNODE_TABLESCAN 2 #define QNODE_TABLESCAN 2
...@@ -226,13 +227,31 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) { ...@@ -226,13 +227,31 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) {
exit(-1); exit(-1);
} }
SArray* tableColumnList = taosArrayInit(4, sizeof(SColumn));
tscColumnListCopy(tableColumnList, pQueryInfo->colList, uid);
// 2. create the query execution node // 2. create the query execution node
char name[TSDB_TABLE_FNAME_LEN] = {0}; char name[TSDB_TABLE_FNAME_LEN] = {0};
tNameExtractFullName(&pTableMetaInfo->name, name); tNameExtractFullName(&pTableMetaInfo->name, name);
SQueryTableInfo info = {.tableName = strdup(name), .id = pTableMetaInfo->pTableMeta->id,}; SQueryTableInfo info = {.tableName = strdup(name), .id = pTableMetaInfo->pTableMeta->id,};
// 3. add the join columns (the tags and the primary timestamp column)
tscInsertPrimaryTsSourceColumn(pQueryInfo, info.id.uid);
SArray* tableColumnList = taosArrayInit(4, sizeof(SColumn));
tscColumnListCopy(tableColumnList, pQueryInfo->colList, uid);
// TODO add the tag column into the required column list
if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
int16_t tagColId = tscGetJoinTagColIdByUid(&pQueryInfo->tagCond, info.id.uid);
SSchema* s = tscGetColumnSchemaById(pTableMetaInfo->pTableMeta, tagColId);
SColumn* col = calloc(1, sizeof(SColumn));
col->tableUid = info.id.uid;
col->info.colId = tagColId;
col->info.type = s->type;
col->info.bytes = s->bytes;
taosArrayPush(pQueryInfo->colList, &col);
}
// 4. add the projection query node
SQueryNode* pNode = doAddTableColumnNode(pQueryInfo, pTableMetaInfo, &info, exprList, tableColumnList); SQueryNode* pNode = doAddTableColumnNode(pQueryInfo, pTableMetaInfo, &info, exprList, tableColumnList);
taosArrayPush(upstream, &pNode); taosArrayPush(upstream, &pNode);
...@@ -315,9 +334,9 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int ...@@ -315,9 +334,9 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int
switch(pQueryNode->info.type) { switch(pQueryNode->info.type) {
case QNODE_TABLESCAN: { case QNODE_TABLESCAN: {
STimeWindow* win = (STimeWindow*) pQueryNode->pExtInfo; STimeWindow* win = (STimeWindow*)pQueryNode->pExtInfo;
len1 = sprintf(buf + len, "%s #0x%"PRIx64") time_range: %"PRId64" - %"PRId64"\n", pQueryNode->tableInfo.tableName, len1 = sprintf(buf + len, "%s #0x%" PRIx64 ") time_range: %" PRId64 " - %" PRId64 "\n",
pQueryNode->tableInfo.id.uid, win->skey, win->ekey); pQueryNode->tableInfo.tableName, pQueryNode->tableInfo.id.uid, win->skey, win->ekey);
len += len1; len += len1;
break; break;
} }
...@@ -387,8 +406,9 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int ...@@ -387,8 +406,9 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int
len += len1; len += len1;
SInterval* pInterval = pQueryNode->pExtInfo; SInterval* pInterval = pQueryNode->pExtInfo;
len1 = sprintf(buf + len, "interval:%"PRId64"(%c), sliding:%"PRId64"(%c), offset:%"PRId64"\n", pInterval->interval, len1 = sprintf(buf + len, "interval:%" PRId64 "(%c), sliding:%" PRId64 "(%c), offset:%" PRId64 "\n",
pInterval->intervalUnit, pInterval->sliding, pInterval->slidingUnit, pInterval->offset); pInterval->interval, pInterval->intervalUnit, pInterval->sliding, pInterval->slidingUnit,
pInterval->offset);
len += len1; len += len1;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册