[to #46859072] fix serval complex type bugs
This commit is contained in:
parent
6c25f369ba
commit
2ee6c3352f
@ -4218,10 +4218,8 @@ int ObPLCodeGenerator::generate_get_collection_attr(ObLLVMValue ¶m_array,
|
||||
} else {
|
||||
if (current_access.var_type_.is_composite_type()) {
|
||||
OZ (helper_.get_int8(ObExtendType, type_value));
|
||||
} else {
|
||||
OZ (helper_.get_int8(current_access.var_type_.get_obj_type(), type_value));
|
||||
OZ (helper_.create_store(type_value, p_type_value));
|
||||
}
|
||||
OZ (helper_.create_store(type_value, p_type_value));
|
||||
OZ (helper_.create_br(after_delete_block));
|
||||
}
|
||||
OZ (helper_.set_insert_point(after_delete_block));
|
||||
|
@ -8641,22 +8641,37 @@ int ObPLResolver::resolve_inner_call(
|
||||
#if 1
|
||||
#define MOCK_SELF_PARAM(need_rotate) \
|
||||
do { \
|
||||
uint64_t acc_cnt = obj_access_idents.count(); \
|
||||
const ObUserDefinedType *user_type = NULL; \
|
||||
bool need_mock = true; \
|
||||
ObRawExpr *self_arg = NULL; \
|
||||
int64_t acc_cnt = obj_access_idents.count(); \
|
||||
OZ (make_var_from_access(self_access_idxs, \
|
||||
expr_factory_, \
|
||||
&resolve_ctx_.session_info_, \
|
||||
current_block_->get_namespace(), \
|
||||
self_arg), K(obj_access_idents), K(self_access_idxs)); \
|
||||
OZ (func.add_obj_access_expr(self_arg)); \
|
||||
OZ (func.add_expr(self_arg)); \
|
||||
OZ (obj_access_idents.at(acc_cnt - 1).params_.push_back( \
|
||||
std::make_pair(self_arg, 0))); \
|
||||
if (OB_SUCC(ret) && need_rotate) { \
|
||||
std::rotate(obj_access_idents.at(acc_cnt - 1).params_.begin(), \
|
||||
obj_access_idents.at(acc_cnt - 1).params_.begin() \
|
||||
+ obj_access_idents.at(acc_cnt - 1).params_.count() - 1, \
|
||||
obj_access_idents.at(acc_cnt - 1).params_.end()); \
|
||||
if (OB_SUCC(ret) && acc_cnt > 1) { \
|
||||
OZ (current_block_->get_namespace().get_pl_data_type_by_name(resolve_ctx_, \
|
||||
acc_cnt > 2 ? obj_access_idents.at(acc_cnt - 3).access_name_ : ObString(""), \
|
||||
ObString(""), \
|
||||
obj_access_idents.at(acc_cnt - 2).access_name_, \
|
||||
user_type), ret, obj_access_idents); \
|
||||
if (OB_SUCC(ret) && OB_NOT_NULL(user_type)) { \
|
||||
need_mock = false; \
|
||||
} \
|
||||
ret = OB_SUCCESS; \
|
||||
} \
|
||||
if (need_mock) { \
|
||||
OZ (make_var_from_access(self_access_idxs, \
|
||||
expr_factory_, \
|
||||
&resolve_ctx_.session_info_, \
|
||||
current_block_->get_namespace(), \
|
||||
self_arg), K(obj_access_idents), K(self_access_idxs)); \
|
||||
OZ (func.add_obj_access_expr(self_arg)); \
|
||||
OZ (func.add_expr(self_arg)); \
|
||||
OZ (obj_access_idents.at(acc_cnt - 1).params_.push_back( \
|
||||
std::make_pair(self_arg, 0))); \
|
||||
if (OB_SUCC(ret) && need_rotate) { \
|
||||
std::rotate(obj_access_idents.at(acc_cnt - 1).params_.begin(), \
|
||||
obj_access_idents.at(acc_cnt - 1).params_.begin() \
|
||||
+ obj_access_idents.at(acc_cnt - 1).params_.count() - 1, \
|
||||
obj_access_idents.at(acc_cnt - 1).params_.end()); \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
@ -10935,7 +10950,7 @@ int ObPLResolver::build_obj_access_func_name(const ObIArray<ObObjAccessIdx> &acc
|
||||
//函数名称格式为get_attr_idx_a
|
||||
ObSqlString buf;
|
||||
OZ (buf.append_fmt("%s", "get_attr"));
|
||||
if (for_write && ObObjAccessIdx::is_contain_object_type(access_idxs)) {
|
||||
if (for_write /*&& ObObjAccessIdx::is_contain_object_type(access_idxs)*/) {
|
||||
OZ (buf.append_fmt("%s", "for_write"));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < access_idxs.count(); ++i) {
|
||||
|
@ -4091,8 +4091,13 @@ int ObSPIService::spi_extend_collection(pl::ObPLExecCtx *ctx,
|
||||
ObObj *data = reinterpret_cast<ObObj*>(table->get_data());
|
||||
if (i > 0 && i <= org_elem_cnt) {
|
||||
ObObj &ith_elem = data[i - 1];
|
||||
for (int64_t j = coll_cnt - n; j < coll_cnt; ++j) {
|
||||
new (&(data[j]))ObObj(ith_elem);
|
||||
for (int64_t j = coll_cnt - n; OB_SUCC(ret) && j < coll_cnt; ++j) {
|
||||
if (ith_elem.is_pl_extend()) {
|
||||
CK (OB_NOT_NULL(table->get_allocator()));
|
||||
OZ (ObUserDefinedType::deep_copy_obj(*(table->get_allocator()), ith_elem, data[j]));
|
||||
} else {
|
||||
new (&(data[j]))ObObj(ith_elem);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_SUBSCRIPT_BEYOND_COUNT;
|
||||
@ -5124,7 +5129,7 @@ int ObSPIService::inner_fetch_with_retry(ObPLExecCtx *ctx,
|
||||
ObObj *values = NULL; \
|
||||
CK (OB_NOT_NULL(record)); \
|
||||
CK (OB_NOT_NULL(values = record->get_element())); \
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < type_count; ++i) { \
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < record->get_count(); ++i) { \
|
||||
ObObj deep_copy; \
|
||||
/*may element of record also complex value*/ \
|
||||
if (values[i].is_pl_extend()) { \
|
||||
@ -5910,6 +5915,7 @@ int ObSPIService::store_datums(ObObj &dest_addr, const ObIArray<ObObj> &obj_arra
|
||||
} else {
|
||||
ObPLRecord *record = static_cast<ObPLRecord*>(composite);
|
||||
current_datum = reinterpret_cast<int64_t>(record) + ObRecordType::get_data_offset(record->get_count());
|
||||
record->set_is_null(false);
|
||||
}
|
||||
}
|
||||
} else { //must be a single Obj
|
||||
|
@ -6052,7 +6052,11 @@ int ObDMLResolver::resolve_function_table_column_item(const TableItem &table_ite
|
||||
CK (OB_NOT_NULL(record_type->get_record_member_name(i)));
|
||||
OZ (ob_write_string(*(params_.allocator_), *(record_type->get_record_member_name(i)), column_name));
|
||||
CK (OB_NOT_NULL(column_name));
|
||||
CK (pl_type->is_obj_type());
|
||||
if (OB_SUCC(ret) && !pl_type->is_obj_type()) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, "table(coll(object)) : object`s element is not basic type");
|
||||
LOG_WARN("table(coll(object)) : object`s element is not basic type not supported", K(ret), KPC(pl_type));
|
||||
}
|
||||
CK (OB_NOT_NULL(pl_type->get_data_type()));
|
||||
if (OB_FAIL(ret)) { // do nothing ...
|
||||
} else if (NULL != (col_item = stmt->get_column_item(table_item.table_id_, column_name))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user