[FEAT MERGE]4_2_sql_feature

Co-authored-by: yinyj17 <yinyijun92@gmail.com>
Co-authored-by: xianyu-w <707512433@qq.com>
Co-authored-by: jingtaoye35 <1255153887@qq.com>
This commit is contained in:
zzg19950727
2023-04-28 11:12:11 +00:00
committed by ob-robot
parent 3bf92459f1
commit 3cada22bdc
161 changed files with 16883 additions and 4730 deletions

View File

@ -3486,8 +3486,29 @@ int ObStaticEngineCG::set_rollup_adaptive_info(ObLogGroupBy &op, ObMergeGroupByS
}
if (OB_SUCC(ret) && 0 < op.get_inner_sort_keys().count()) {
ObIArray<OrderItem> &sork_keys = op.get_inner_sort_keys();
if (OB_FAIL(spec.sort_exprs_.init(sork_keys.count()))) {
LOG_WARN("failed to init all exprs", K(ret));
if (!op.has_encode_sort()) {
if (OB_FAIL(spec.sort_exprs_.init(sork_keys.count()))) {
LOG_WARN("failed to init all exprs", K(ret));
}
} else {
if (1 != op.get_inner_ecd_sort_keys().count()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: encode sortkey expr more than one", K(ret), K(op.get_inner_ecd_sort_keys().count()));
} else {
ObExpr *encode_expr = nullptr;
OrderItem order_item = op.get_inner_ecd_sort_keys().at(0);
if (OB_FAIL(spec.sort_exprs_.init(1 + sork_keys.count()))) {
LOG_WARN("failed to init all exprs", K(ret));
} else if (OB_FAIL(generate_rt_expr(*order_item.expr_, encode_expr))) {
LOG_WARN("failed to generate rt expr", K(ret));
} else if (OB_FAIL(spec.sort_exprs_.push_back(encode_expr))) {
LOG_WARN("failed to push back expr", K(ret));
}
}
}
if (OB_FAIL(ret)) {
// do nothing
} else if (OB_FAIL(fill_sort_info(sork_keys, spec.sort_collations_, spec.sort_exprs_))) {
LOG_WARN("failed to sort info", K(ret));
} else if (OB_FAIL(fill_sort_funcs(

View File

@ -233,7 +233,6 @@ int ObTscCgService::generate_agent_vt_access_meta(const ObLogTableScan &op, ObTa
ObArray<ObRawExpr*> tsc_columns; //these columns need by TSC operator
VTMapping *vt_mapping = nullptr;
const ObTableSchema *table_schema = nullptr;
agent_vt_meta.vt_table_id_ = op.get_ref_table_id();
spec.is_vt_mapping_ = true;
get_real_table_vt_mapping(op.get_ref_table_id(), vt_mapping);
@ -290,13 +289,11 @@ int ObTscCgService::generate_agent_vt_access_meta(const ObLogTableScan &op, ObTa
LOG_WARN("get table schema failed", K(agent_vt_meta.vt_table_id_), K(ret));
} else {
// set vt has tenant_id column
for (int64_t nth_col = 0; OB_SUCC(ret) && nth_col < table_schema->get_column_count(); ++nth_col) {
const ObColumnSchemaV2 *col_schema = table_schema->get_column_schema_by_idx(nth_col);
if (OB_ISNULL(col_schema)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("column schema is null", K(ret));
} else if (0 == col_schema->get_column_name_str().case_compare("TENANT_ID")) {
for (int64_t nth_col = 0; OB_SUCC(ret) && nth_col < range_columns.count(); ++nth_col) {
const ColumnItem &col_item = range_columns.at(nth_col);
if (0 == col_item.column_name_.case_compare("TENANT_ID")) {
spec.has_tenant_id_col_ = true;
spec.tenant_id_col_idx_ = nth_col;
break;
}
}
@ -307,10 +304,6 @@ int ObTscCgService::generate_agent_vt_access_meta(const ObLogTableScan &op, ObTa
if (OB_ISNULL(vt_col_schema)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: column schema is null", K(range_column_id), K(ret));
} else if (spec.has_tenant_id_col_ && 0 == k
&& 0 != vt_col_schema->get_column_name_str().case_compare("TENANT_ID")) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected status: the first key must be tenant id", K(range_column_id), K(ret));
}
for (int64_t nth_col = 0; nth_col < table_schema->get_column_count() && OB_SUCC(ret); ++nth_col) {
const ObColumnSchemaV2 *col_schema = table_schema->get_column_schema_by_idx(nth_col);
@ -892,7 +885,11 @@ int ObTscCgService::generate_table_loc_meta(uint64_t table_loc_id,
int ret = OB_SUCCESS;
loc_meta.reset();
loc_meta.table_loc_id_ = table_loc_id;
loc_meta.ref_table_id_ = table_schema.get_table_id();
ObTableID real_table_id =
share::is_oracle_mapping_real_virtual_table(table_schema.get_table_id()) ?
ObSchemaUtils::get_real_table_mappings_tid(table_schema.get_table_id())
: table_schema.get_table_id();
loc_meta.ref_table_id_ = real_table_id;
loc_meta.is_dup_table_ = table_schema.is_duplicate_table();
bool is_weak_read = false;
if (OB_ISNULL(cg_.opt_ctx_) || OB_ISNULL(cg_.opt_ctx_->get_exec_ctx())) {
@ -920,7 +917,7 @@ int ObTscCgService::generate_table_loc_meta(uint64_t table_loc_id,
TableLocRelInfo *rel_info = nullptr;
ObTableID data_table_id = table_schema.is_index_table() ?
table_schema.get_data_table_id() :
table_schema.get_table_id();
real_table_id;
rel_info = cg_.opt_ctx_->get_loc_rel_info_by_id(table_loc_id, data_table_id);
if (OB_ISNULL(rel_info)) {
ret = OB_ERR_UNEXPECTED;