提交 48c1390c 编写于 作者: X Xiaoyu Wang

TD-12193 physical plan to json

上级 d889fe65
...@@ -128,6 +128,7 @@ typedef struct SSubplan { ...@@ -128,6 +128,7 @@ typedef struct SSubplan {
} SSubplan; } SSubplan;
typedef struct SQueryDag { typedef struct SQueryDag {
uint64_t queryId;
SArray *pSubplans; // Element is SArray*, and nested element is SSubplan. The execution level of subplan, starting from 0. SArray *pSubplans; // Element is SArray*, and nested element is SSubplan. The execution level of subplan, starting from 0.
} SQueryDag; } SQueryDag;
...@@ -136,7 +137,7 @@ typedef struct SQueryDag { ...@@ -136,7 +137,7 @@ typedef struct SQueryDag {
*/ */
int32_t qCreateQueryDag(const struct SQueryStmtInfo* pQueryInfo, struct SEpSet* pQnode, struct SQueryDag** pDag); int32_t qCreateQueryDag(const struct SQueryStmtInfo* pQueryInfo, struct SEpSet* pQnode, struct SQueryDag** pDag);
int32_t qSetSuplanExecutionNode(SSubplan* subplan, SArray* nodes); int32_t qSetSubplanExecutionNode(SSubplan* subplan, SArray* eps);
int32_t qExplainQuery(const struct SQueryStmtInfo* pQueryInfo, struct SEpSet* pQnode, char** str); int32_t qExplainQuery(const struct SQueryStmtInfo* pQueryInfo, struct SEpSet* pQnode, char** str);
...@@ -147,12 +148,14 @@ int32_t qSubPlanToString(const SSubplan* subplan, char** str); ...@@ -147,12 +148,14 @@ int32_t qSubPlanToString(const SSubplan* subplan, char** str);
int32_t qStringToSubplan(const char* str, SSubplan** subplan); int32_t qStringToSubplan(const char* str, SSubplan** subplan);
void qDestroySubplan(SSubplan* pSubplan);
/** /**
* Destroy the physical plan. * Destroy the physical plan.
* @param pQueryPhyNode * @param pQueryPhyNode
* @return * @return
*/ */
void qDestroyQueryDag(struct SQueryDag* pDag); void qDestroyQueryDag(SQueryDag* pDag);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -116,6 +116,8 @@ void destroyQueryPlan(struct SQueryPlanNode* pQueryNode); ...@@ -116,6 +116,8 @@ void destroyQueryPlan(struct SQueryPlanNode* pQueryNode);
*/ */
void* destroyQueryPhyPlan(struct SPhyNode* pQueryPhyNode); void* destroyQueryPhyPlan(struct SPhyNode* pQueryPhyNode);
int32_t opNameToOpType(const char* name);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -179,7 +179,7 @@ static SPhyNode* createPhyNode(SPlanContext* pCxt, SQueryPlanNode* pPlanNode) { ...@@ -179,7 +179,7 @@ static SPhyNode* createPhyNode(SPlanContext* pCxt, SQueryPlanNode* pPlanNode) {
assert(false); assert(false);
} }
if (pPlanNode->pChildren != NULL && taosArrayGetSize(pPlanNode->pChildren) > 0) { if (pPlanNode->pChildren != NULL && taosArrayGetSize(pPlanNode->pChildren) > 0) {
node->pChildren = taosArrayInit(4, POINTER_BYTES); node->pChildren = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
size_t size = taosArrayGetSize(pPlanNode->pChildren); size_t size = taosArrayGetSize(pPlanNode->pChildren);
for(int32_t i = 0; i < size; ++i) { for(int32_t i = 0; i < size; ++i) {
SPhyNode* child = createPhyNode(pCxt, taosArrayGet(pPlanNode->pChildren, i)); SPhyNode* child = createPhyNode(pCxt, taosArrayGet(pPlanNode->pChildren, i));
...@@ -215,3 +215,12 @@ int32_t createDag(SQueryPlanNode* pQueryNode, struct SCatalog* pCatalog, SQueryD ...@@ -215,3 +215,12 @@ int32_t createDag(SQueryPlanNode* pQueryNode, struct SCatalog* pCatalog, SQueryD
*pDag = context.pDag; *pDag = context.pDag;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t opNameToOpType(const char* name) {
for (int32_t i = 1; i < sizeof(gOpName) / sizeof(gOpName[0]); ++i) {
if (strcmp(name, gOpName[i])) {
return i;
}
}
return OP_Unknown;
}
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
#include "parser.h" #include "parser.h"
#include "plannerInt.h" #include "plannerInt.h"
void qDestroySubplan(SSubplan* pSubplan) {
// todo
}
void qDestroyQueryDag(struct SQueryDag* pDag) { void qDestroyQueryDag(struct SQueryDag* pDag) {
// todo // todo
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册