提交 032c9d7b 编写于 作者: X Xiaoyu Wang

TD-12034 Define physical plan data structure.

上级 6031721f
...@@ -54,7 +54,7 @@ enum OPERATOR_TYPE_E { ...@@ -54,7 +54,7 @@ enum OPERATOR_TYPE_E {
struct SEpSet; struct SEpSet;
struct SQueryPlanNode; struct SQueryPlanNode;
struct SQueryDistPlanNode; struct SQueryPhyPlanNode;
struct SQueryStmtInfo; struct SQueryStmtInfo;
typedef struct SSubquery { typedef struct SSubquery {
...@@ -62,7 +62,7 @@ typedef struct SSubquery { ...@@ -62,7 +62,7 @@ typedef struct SSubquery {
int32_t type; // QUERY_TYPE_MERGE|QUERY_TYPE_PARTIAL int32_t type; // QUERY_TYPE_MERGE|QUERY_TYPE_PARTIAL
int32_t level; // the execution level of current subquery, starting from 0. int32_t level; // the execution level of current subquery, starting from 0.
SArray *pUpstream; // the upstream,from which to fetch the result SArray *pUpstream; // the upstream,from which to fetch the result
struct SQueryDistPlanNode *pNode; // physical plan of current subquery struct SQueryPhyPlanNode *pNode; // physical plan of current subquery
} SSubquery; } SSubquery;
typedef struct SQueryJob { typedef struct SQueryJob {
...@@ -108,7 +108,7 @@ int32_t qQueryPlanToSql(struct SQueryPlanNode* pQueryNode, char** sql); ...@@ -108,7 +108,7 @@ int32_t qQueryPlanToSql(struct SQueryPlanNode* pQueryNode, char** sql);
* @param pPhyNode * @param pPhyNode
* @return * @return
*/ */
int32_t qCreatePhysicalPlan(struct SQueryPlanNode* pQueryNode, struct SEpSet* pQnode, struct SQueryDistPlanNode *pPhyNode); int32_t qCreatePhysicalPlan(struct SQueryPlanNode* pQueryNode, struct SEpSet* pQnode, struct SQueryPhyPlanNode *pPhyNode);
/** /**
* Convert to physical plan to string to enable to print it out in the shell. * Convert to physical plan to string to enable to print it out in the shell.
...@@ -116,7 +116,7 @@ int32_t qCreatePhysicalPlan(struct SQueryPlanNode* pQueryNode, struct SEpSet* pQ ...@@ -116,7 +116,7 @@ int32_t qCreatePhysicalPlan(struct SQueryPlanNode* pQueryNode, struct SEpSet* pQ
* @param str * @param str
* @return * @return
*/ */
int32_t qPhyPlanToString(struct SQueryDistPlanNode *pPhyNode, char** str); int32_t qPhyPlanToString(struct SQueryPhyPlanNode *pPhyNode, char** str);
/** /**
* Destroy the query plan object. * Destroy the query plan object.
...@@ -129,7 +129,7 @@ void* qDestroyQueryPlan(struct SQueryPlanNode* pQueryNode); ...@@ -129,7 +129,7 @@ void* qDestroyQueryPlan(struct SQueryPlanNode* pQueryNode);
* @param pQueryPhyNode * @param pQueryPhyNode
* @return * @return
*/ */
void* qDestroyQueryPhyPlan(struct SQueryDistPlanNode* pQueryPhyNode); void* qDestroyQueryPhyPlan(struct SQueryPhyPlanNode* pQueryPhyNode);
/** /**
* Create the query job from the physical execution plan * Create the query job from the physical execution plan
...@@ -137,7 +137,7 @@ void* qDestroyQueryPhyPlan(struct SQueryDistPlanNode* pQueryPhyNode); ...@@ -137,7 +137,7 @@ void* qDestroyQueryPhyPlan(struct SQueryDistPlanNode* pQueryPhyNode);
* @param pJob * @param pJob
* @return * @return
*/ */
int32_t qCreateQueryJob(const struct SQueryDistPlanNode* pPhyNode, struct SQueryJob** pJob); int32_t qCreateQueryJob(const struct SQueryPhyPlanNode* pPhyNode, struct SQueryJob** pJob);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -57,20 +57,38 @@ typedef struct SQueryPlanNode { ...@@ -57,20 +57,38 @@ typedef struct SQueryPlanNode {
struct SQueryPlanNode *nextNode; struct SQueryPlanNode *nextNode;
} SQueryPlanNode; } SQueryPlanNode;
typedef struct SQueryDistPlanNode { typedef struct SDataBlockSchema {
SQueryNodeBasicInfo info; int32_t index;
SSchema *pSchema; // the schema of the input SSDatablock SSchema *pSchema; // the schema of the SSDatablock
int32_t numOfCols; // number of input columns int32_t numOfCols; // number of columns
SArray *pExpr; // the query functions or sql aggregations } SDataBlockSchema;
int32_t numOfExpr; // number of result columns, which is also the number of pExprs
void *pExtInfo; // additional information
// previous operator to generated result for current node to process typedef struct SQueryPhyPlanNode {
// in case of join, multiple prev nodes exist. SQueryNodeBasicInfo info;
SArray *pPrevNodes; // upstream nodes, or exchange operator to load data from multiple sources. SArray *pTarget; // target list to be computed at this node
} SQueryDistPlanNode; SArray *qual; // implicitly-ANDed qual conditions
SDataBlockSchema targetSchema;
typedef struct SQueryCostSummary { // children plan to generated result for current node to process
// in case of join, multiple plan nodes exist.
SArray *pChildren;
} SQueryPhyPlanNode;
typedef struct SQueryScanPhyNode {
SQueryPhyPlanNode node;
uint64_t uid;
} SQueryScanPhyNode;
typedef struct SQueryProjectPhyNode {
SQueryPhyPlanNode node;
} SQueryProjectPhyNode;
typedef struct SQueryAggPhyNode {
SQueryPhyPlanNode node;
SArray *pGroup;
// SInterval
} SQueryAggPhyNode;
typedef struct SQueryProfileSummary {
int64_t startTs; // Object created and added into the message queue int64_t startTs; // Object created and added into the message queue
int64_t endTs; // the timestamp when the task is completed int64_t endTs; // the timestamp when the task is completed
int64_t cputime; // total cpu cost, not execute elapsed time int64_t cputime; // total cpu cost, not execute elapsed time
...@@ -91,14 +109,14 @@ typedef struct SQueryCostSummary { ...@@ -91,14 +109,14 @@ typedef struct SQueryCostSummary {
uint32_t loadBlockAgg; uint32_t loadBlockAgg;
uint32_t skipBlocks; uint32_t skipBlocks;
uint64_t resultSize; // generated result size in Kb. uint64_t resultSize; // generated result size in Kb.
} SQueryCostSummary; } SQueryProfileSummary;
typedef struct SQueryTask { typedef struct SQueryTask {
uint64_t queryId; // query id uint64_t queryId; // query id
uint64_t taskId; // task id uint64_t taskId; // task id
SQueryDistPlanNode *pNode; // operator tree SQueryPhyPlanNode *pNode; // operator tree
uint64_t status; // task status uint64_t status; // task status
SQueryCostSummary summary; // task execution summary SQueryProfileSummary summary; // task execution summary
void *pOutputHandle; // result buffer handle, to temporarily keep the output result for next stage void *pOutputHandle; // result buffer handle, to temporarily keep the output result for next stage
} SQueryTask; } SQueryTask;
......
...@@ -66,11 +66,12 @@ int32_t qQueryPlanToSql(struct SQueryPlanNode* pQueryNode, char** sql) { ...@@ -66,11 +66,12 @@ int32_t qQueryPlanToSql(struct SQueryPlanNode* pQueryNode, char** sql) {
return 0; return 0;
} }
int32_t qCreatePhysicalPlan(struct SQueryPlanNode* pQueryNode, struct SEpSet* pQnode, struct SQueryDistPlanNode *pPhyNode) { int32_t qCreatePhysicalPlan(struct SQueryPlanNode* pQueryNode, struct SEpSet* pQnode, struct SQueryPhyPlanNode *pPhyNode) {
return 0; return 0;
} }
int32_t qPhyPlanToString(struct SQueryDistPlanNode *pPhyNode, char** str) { int32_t qPhyPlanToString(struct SQueryPhyPlanNode *pPhyNode, char** str) {
return 0; return 0;
} }
...@@ -83,11 +84,11 @@ void* qDestroyQueryPlan(SQueryPlanNode* pQueryNode) { ...@@ -83,11 +84,11 @@ void* qDestroyQueryPlan(SQueryPlanNode* pQueryNode) {
return NULL; return NULL;
} }
void* qDestroyQueryPhyPlan(struct SQueryDistPlanNode* pQueryPhyNode) { void* qDestroyQueryPhyPlan(struct SQueryPhyPlanNode* pQueryPhyNode) {
return NULL; return NULL;
} }
int32_t qCreateQueryJob(const struct SQueryDistPlanNode* pPhyNode, struct SQueryJob** pJob) { int32_t qCreateQueryJob(const struct SQueryPhyPlanNode* pPhyNode, struct SQueryJob** pJob) {
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册