[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:
@ -300,36 +300,44 @@ int ObLinkScanOp::inner_get_next_row()
|
||||
} else {
|
||||
const ObIArray<ObExpr *> &output = spec_.output_;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < output.count(); i++) {
|
||||
ObObj value;
|
||||
ObObj new_value;
|
||||
ObObj *res_obj = &value;
|
||||
ObExpr *expr = output.at(i);
|
||||
ObDatum &datum = expr->locate_datum_for_write(eval_ctx_);
|
||||
if (OB_FAIL(result_->get_obj(i, value, tz_info_, &row_allocator_))) {
|
||||
LOG_WARN("failed to get obj", K(ret), K(i));
|
||||
} else if (OB_UNLIKELY(ObNullType != value.get_type() && // use get_type(), do not use get_type_class() here.
|
||||
(value.get_type() != expr->obj_meta_.get_type() ||
|
||||
(ob_is_string_or_lob_type(value.get_type()) &&
|
||||
ob_is_string_or_lob_type(expr->obj_meta_.get_type()) &&
|
||||
value.get_type() == expr->obj_meta_.get_type() &&
|
||||
value.get_collation_type() != expr->obj_meta_.get_collation_type())))) {
|
||||
DEFINE_CAST_CTX(expr->datum_meta_.cs_type_);
|
||||
if (OB_FAIL(ObObjCaster::to_type(expr->obj_meta_.get_type(), cast_ctx, value, new_value))) {
|
||||
LOG_WARN("cast obj failed", K(ret), K(value), K(expr->obj_meta_));
|
||||
} else {
|
||||
res_obj = &new_value;
|
||||
if (!expr->is_const_expr()) {
|
||||
ObObj value;
|
||||
ObObj new_value;
|
||||
ObObj *res_obj = &value;
|
||||
ObDatum &datum = expr->locate_datum_for_write(eval_ctx_);
|
||||
if (OB_FAIL(result_->get_obj(i, value, tz_info_, &row_allocator_))) {
|
||||
LOG_WARN("failed to get obj", K(ret), K(i));
|
||||
} else if (OB_UNLIKELY(ObNullType != value.get_type() && // use get_type(), do not use get_type_class() here.
|
||||
(value.get_type() != expr->obj_meta_.get_type() ||
|
||||
(ob_is_string_or_lob_type(value.get_type()) &&
|
||||
ob_is_string_or_lob_type(expr->obj_meta_.get_type()) &&
|
||||
value.get_type() == expr->obj_meta_.get_type() &&
|
||||
value.get_collation_type() != expr->obj_meta_.get_collation_type())))) {
|
||||
DEFINE_CAST_CTX(expr->datum_meta_.cs_type_);
|
||||
if (OB_FAIL(ObObjCaster::to_type(expr->obj_meta_.get_type(), cast_ctx, value, new_value))) {
|
||||
LOG_WARN("cast obj failed", K(ret), K(value), K(expr->obj_meta_));
|
||||
} else {
|
||||
res_obj = &new_value;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(datum.from_obj(*res_obj))) {
|
||||
LOG_WARN("from obj failed", K(ret));
|
||||
} else if (is_lob_storage(res_obj->get_type()) &&
|
||||
OB_FAIL(ob_adjust_lob_datum(*res_obj, expr->obj_meta_,
|
||||
get_exec_ctx().get_allocator(), datum))) {
|
||||
LOG_WARN("adjust lob datum failed", K(ret), K(i), K(res_obj->get_meta()), K(expr->obj_meta_));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ObDatum *datum = NULL;
|
||||
if (OB_FAIL(expr->eval(eval_ctx_, datum))) {
|
||||
LOG_WARN("expr evaluate failed", K(ret), KPC(expr));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(datum.from_obj(*res_obj))) {
|
||||
LOG_WARN("from obj failed", K(ret));
|
||||
} else if (is_lob_storage(res_obj->get_type()) &&
|
||||
OB_FAIL(ob_adjust_lob_datum(*res_obj, expr->obj_meta_,
|
||||
get_exec_ctx().get_allocator(), datum))) {
|
||||
LOG_WARN("adjust lob datum failed", K(ret), K(i), K(res_obj->get_meta()), K(expr->obj_meta_));
|
||||
} else {
|
||||
expr->set_evaluated_projected(eval_ctx_);
|
||||
}
|
||||
expr->set_evaluated_projected(eval_ctx_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,7 +377,8 @@ ObTableScanSpec::ObTableScanSpec(ObIAllocator &alloc, const ObPhyOperatorType ty
|
||||
tsc_ctdef_(alloc),
|
||||
pdml_partition_id_(NULL),
|
||||
agent_vt_meta_(alloc),
|
||||
flags_(0)
|
||||
flags_(0),
|
||||
tenant_id_col_idx_(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -400,7 +401,8 @@ OB_SERIALIZE_MEMBER((ObTableScanSpec, ObOpSpec),
|
||||
tsc_ctdef_,
|
||||
pdml_partition_id_,
|
||||
agent_vt_meta_,
|
||||
ddl_output_cids_);
|
||||
ddl_output_cids_,
|
||||
tenant_id_col_idx_);
|
||||
|
||||
DEF_TO_STRING(ObTableScanSpec)
|
||||
{
|
||||
@ -424,7 +426,8 @@ DEF_TO_STRING(ObTableScanSpec)
|
||||
K(tsc_ctdef_),
|
||||
K(report_col_checksum_),
|
||||
K_(agent_vt_meta),
|
||||
K_(ddl_output_cids));
|
||||
K_(ddl_output_cids),
|
||||
K_(tenant_id_col_idx));
|
||||
J_OBJ_END();
|
||||
return pos;
|
||||
}
|
||||
@ -909,11 +912,6 @@ OB_INLINE int ObTableScanOp::init_das_scan_rtdef(const ObDASScanCtDef &das_ctdef
|
||||
LOG_WARN("failed to set flashback query snapshot version", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && is_lookup && MY_SPEC.is_vt_mapping_) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, "virtual table with index lookup");
|
||||
LOG_WARN("virtual table with index lookup not supported", K(das_ctdef.ref_table_id_), K(MY_SPEC.agent_vt_meta_));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
ObTableID table_loc_id = MY_SPEC.get_table_loc_id();
|
||||
das_rtdef.table_loc_ = DAS_CTX(ctx_).get_table_loc_by_id(table_loc_id, das_ctdef.ref_table_id_);
|
||||
@ -1157,7 +1155,7 @@ int ObTableScanOp::init_converter()
|
||||
int ret = OB_SUCCESS;
|
||||
if (MY_SPEC.is_vt_mapping_) {
|
||||
ObSqlCtx *sql_ctx = NULL;
|
||||
if (MY_SPEC.is_index_back()|| MY_SPEC.is_index_global_) {
|
||||
if (MY_SPEC.is_index_global_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table id is not match", K(ret), K(MY_CTDEF), K(MY_SPEC.is_index_global_));
|
||||
} else if (OB_ISNULL(sql_ctx = ctx_.get_sql_ctx())
|
||||
@ -1195,7 +1193,8 @@ int ObTableScanOp::init_converter()
|
||||
&ctx_.get_allocator(),
|
||||
org_table_schema,
|
||||
&agent_vt_meta.access_column_ids_,
|
||||
MY_SPEC.has_tenant_id_col_
|
||||
MY_SPEC.has_tenant_id_col_,
|
||||
MY_SPEC.tenant_id_col_idx_
|
||||
))) {
|
||||
LOG_WARN("failed to init converter", K(ret));
|
||||
}
|
||||
@ -2108,7 +2107,7 @@ int ObTableScanOp::cherry_pick_range_by_tablet_id(ObDASScanOp *scan_op)
|
||||
ObDASGroupScanOp *batch_op = DAS_GROUP_SCAN_OP(scan_op);
|
||||
bool add_all = false;
|
||||
bool prune_all = true;
|
||||
if (OB_UNLIKELY(input_ranges.count() != input_ss_ranges.count())) {
|
||||
if (!MY_SPEC.is_vt_mapping_ && OB_UNLIKELY(input_ranges.count() != input_ss_ranges.count())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("ranges and skip scan postfix ranges mismatch", K(ret), K(input_ranges.count()),
|
||||
K(input_ss_ranges.count()));
|
||||
|
||||
@ -353,6 +353,7 @@ public:
|
||||
uint64_t reserved_ : 54;
|
||||
};
|
||||
};
|
||||
int64_t tenant_id_col_idx_;
|
||||
};
|
||||
|
||||
class ObTableScanOp : public ObOperator
|
||||
|
||||
Reference in New Issue
Block a user