[FEAT MERGE]4_1_sql_feature

Co-authored-by: leslieyuchen <leslieyuchen@gmail.com>
Co-authored-by: Charles0429 <xiezhenjiang@gmail.com>
Co-authored-by: raywill <hustos@gmail.com>
This commit is contained in:
obdev
2023-01-28 16:01:26 +08:00
committed by ob-robot
parent 3080f2b66f
commit 2d19a9d8f5
846 changed files with 161957 additions and 116661 deletions

View File

@ -28,15 +28,16 @@ int ObCodeGenerator::generate(const ObLogPlan &log_plan,
{
int ret = OB_SUCCESS;
int64_t batch_size = 0;
const uint64_t cur_cluster_version = CLUSTER_CURRENT_VERSION;
OZ(detect_batch_size(log_plan, batch_size));
if (OB_SUCC(ret) && batch_size > 0) {
log_plan.get_optimizer_context().set_batch_size(batch_size);
phy_plan.set_batch_size(batch_size);
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(generate_exprs(log_plan, phy_plan))) {
} else if (OB_FAIL(generate_exprs(log_plan, phy_plan, cur_cluster_version))) {
LOG_WARN("fail to get all raw exprs", K(ret));
} else if (OB_FAIL(generate_operators(log_plan, phy_plan))) {
} else if (OB_FAIL(generate_operators(log_plan, phy_plan, cur_cluster_version))) {
LOG_WARN("fail to generate plan", K(ret));
}
@ -48,7 +49,8 @@ int ObCodeGenerator::generate(const ObLogPlan &log_plan,
//2. 获取执行期需要使用到的所有表达式
//3. 生成所有物理表达式
int ObCodeGenerator::generate_exprs(const ObLogPlan &log_plan,
ObPhysicalPlan &phy_plan)
ObPhysicalPlan &phy_plan,
const uint64_t cur_cluster_version)
{
int ret = OB_SUCCESS;
ObExecContext *exec_ctx = log_plan.get_optimizer_context().get_exec_ctx();
@ -59,7 +61,8 @@ int ObCodeGenerator::generate_exprs(const ObLogPlan &log_plan,
log_plan.get_optimizer_context().get_session_info(),
exec_ctx->get_sql_ctx()->schema_guard_,
exec_ctx->get_physical_plan_ctx()->get_original_param_cnt(),
param_store_->count());
param_store_->count(),
cur_cluster_version);
// init ctx for operator cg
expr_cg.set_batch_size(phy_plan.get_batch_size());
if (OB_FAIL(expr_cg.generate(log_plan.get_optimizer_context().get_all_exprs(),
@ -74,17 +77,19 @@ int ObCodeGenerator::generate_exprs(const ObLogPlan &log_plan,
}
int ObCodeGenerator::generate_operators(const ObLogPlan &log_plan,
ObPhysicalPlan &phy_plan)
ObPhysicalPlan &phy_plan,
const uint64_t cur_cluster_version)
{
int ret = OB_SUCCESS;
ObStaticEngineCG static_engin_cg;
ObStaticEngineCG static_engin_cg(cur_cluster_version);
if (OB_FAIL(static_engin_cg.generate(log_plan, phy_plan))) {
LOG_WARN("fail to code generate", K(ret));
}
return ret;
}
int ObCodeGenerator::detect_batch_size(const ObLogPlan &log_plan, int64_t &batch_size)
int ObCodeGenerator::detect_batch_size(
const ObLogPlan &log_plan, int64_t &batch_size)
{
int ret = OB_SUCCESS;
bool vectorize = false;