planner.c 1.9 KB
Newer Older
H
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 15
 */

X
Xiaoyu Wang 已提交
16
#include "planner.h"
17

X
Xiaoyu Wang 已提交
18 19 20 21 22
#include "plannerInt.h"

int32_t optimize(SPlanContext* pCxt, SLogicNode* pLogicNode) {
  return TSDB_CODE_SUCCESS;
}
23

24
int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNodeList) {
X
Xiaoyu Wang 已提交
25 26 27 28 29 30
  SLogicNode* pLogicNode = NULL;
  int32_t code = createLogicPlan(pCxt, &pLogicNode);
  if (TSDB_CODE_SUCCESS == code) {
    code = optimize(pCxt, pLogicNode);
  }
  if (TSDB_CODE_SUCCESS == code) {
31
    code = createPhysiPlan(pCxt, pLogicNode, pPlan, pExecNodeList);
X
Xiaoyu Wang 已提交
32 33
  }
  return code;
34 35
}

X
Xiaoyu Wang 已提交
36
void qSetSubplanExecutionNode(SSubplan* subplan, uint64_t templateId, SDownstreamSource* pSource) {
H
Haojun Liao 已提交
37

X
Xiaoyu Wang 已提交
38
}
H
Haojun Liao 已提交
39

X
Xiaoyu Wang 已提交
40
int32_t qSubPlanToString(const SSubplan* subplan, char** str, int32_t* len) {
41 42 43 44 45 46 47
  if (SUBPLAN_TYPE_MODIFY == subplan->subplanType) {
    SDataInserterNode* insert = (SDataInserterNode*)subplan->pDataSink;
    *len = insert->size;
    *str = insert->pData;
    insert->pData = NULL;
    return TSDB_CODE_SUCCESS;
  }
X
Xiaoyu Wang 已提交
48
  return nodesNodeToString((const SNode*)subplan, false, str, len);
X
Xiaoyu Wang 已提交
49
}
H
Haojun Liao 已提交
50

X
Xiaoyu Wang 已提交
51
int32_t qStringToSubplan(const char* str, SSubplan** subplan) {
X
Xiaoyu Wang 已提交
52
  return nodesStringToNode(str, (SNode**)subplan);
53
}
X
Xiaoyu Wang 已提交
54

X
Xiaoyu Wang 已提交
55
char* qQueryPlanToString(const SQueryPlan* pPlan) {
56 57 58

}

X
Xiaoyu Wang 已提交
59
SQueryPlan* qStringToQueryPlan(const char* pStr) {
60

X
Xiaoyu Wang 已提交
61 62
}

X
Xiaoyu Wang 已提交
63 64
void qDestroyQueryPlan(SQueryPlan* pPlan) {

X
Xiaoyu Wang 已提交
65
}