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

TD-12034 Define physical plan data structure.

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