[TD-10529]Add APIs of parser/planner/scheduler.
This commit is contained in:
parent
d845a13c75
commit
a00f4d676c
|
@ -20,6 +20,51 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "catalog.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
struct SQueryStmtInfo;
|
||||||
|
struct SInsertStmtInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True will be returned if the input sql string is insert, false otherwise.
|
||||||
|
* @param pStr sql string
|
||||||
|
* @param length length of the sql string
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool qIsInsertSql(const char* pStr, size_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the sql statement and then return the SQueryStmtInfo as the result of bounded AST.
|
||||||
|
* @param pSql sql string
|
||||||
|
* @param length length of the sql string
|
||||||
|
* @param id operator id, generated by uuid generator
|
||||||
|
* @param msg extended error message if exists.
|
||||||
|
* @return error code
|
||||||
|
*/
|
||||||
|
int32_t qParseQuerySql(const char* pStr, size_t length, struct SQueryStmtInfo** pQueryInfo, int64_t id, char* msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the insert sql statement.
|
||||||
|
* @param pStr sql string
|
||||||
|
* @param length length of the sql string
|
||||||
|
* @param pInsertParam data in binary format to submit to vnode directly.
|
||||||
|
* @param id operator id, generated by uuid generator.
|
||||||
|
* @param msg extended error message if exists to help avoid the problem in sql statement.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qParseInsertSql(const char* pStr, size_t length, struct SInsertStmtInfo** pInsertInfo, int64_t id, char* msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a normal sql statement to only query tags information to enable that the subscribe client can be aware quickly of the true vgroup ids that
|
||||||
|
* involved in the subscribe procedure.
|
||||||
|
* @param pSql
|
||||||
|
* @param length
|
||||||
|
* @param pConvertSql
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qParserConvertSql(const char* pStr, size_t length, char** pConvertSql);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,6 +20,52 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optimize the query execution plan, currently not implement yet.
|
||||||
|
* @param pQueryNode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qOptimizeQueryPlan(SQueryNode* pQueryNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the query plan according to the bound AST, which is in the form of pQueryInfo
|
||||||
|
* @param pQueryInfo
|
||||||
|
* @param pQueryNode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qCreateQueryPlan(const SQueryInfo* pQueryInfo, SQueryNode* pQueryNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the query plan to string, in order to display it in the shell.
|
||||||
|
* @param pQueryNode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qQueryPlanToString(SQueryNode* pQueryNode, char** str);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore the SQL statement according to the logic query plan.
|
||||||
|
* @param pQueryNode
|
||||||
|
* @param sql
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qQueryPlanToSql(SQueryNode* pQueryNode, char** sql);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the physical plan for the query, according to the logic plan.
|
||||||
|
* @param pQueryNode
|
||||||
|
* @param pPhyNode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qCreatePhysicalPlan(SQueryNode* pQueryNode, SEpSet* pQnode, SQueryPhyNode *pPhyNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert to physical plan to string to enable to print it out in the shell.
|
||||||
|
* @param pPhyNode
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qPhyPlanToString(SQueryPhyNode *pPhyNode, char** str);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,6 +20,41 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define QUERY_TASK_MERGE 1
|
||||||
|
#define QUERY_TASK_PARTIAL 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create query job from the physical execution plan
|
||||||
|
* @param pPhyNode
|
||||||
|
* @param pJob
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qCreateQueryJob(const SQueryPhyNode* pPhyNode, SQueryJob* pJob);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process the query job, generated according to the query physical plan.
|
||||||
|
* This is a synchronized API, and is also thread-safety.
|
||||||
|
* @param pJob
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qProcessQueryJob(SQueryJob* pJob);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The SSqlObj should not be here????
|
||||||
|
* @param pSql
|
||||||
|
* @param pVgroupId
|
||||||
|
* @param pRetVgroupId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SArray* qGetInvolvedVgroupIdList(SSqlObj* pSql, SArray* pVgroupId, SArray* pRetVgroupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel query job
|
||||||
|
* @param pJob
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int32_t qKillQueryJob(SQueryJob* pJob);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue