From a61f62e1fd1a54aa7fb10eebe8fe81fe0c2a7af6 Mon Sep 17 00:00:00 2001 From: obdev Date: Thu, 24 Aug 2023 13:14:06 +0000 Subject: [PATCH] [to #51509957] fix associative array with init status --- src/pl/ob_pl.cpp | 7 ++++++- src/pl/ob_pl_user_type.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pl/ob_pl.cpp b/src/pl/ob_pl.cpp index 14e8f3405e..b4e225e258 100644 --- a/src/pl/ob_pl.cpp +++ b/src/pl/ob_pl.cpp @@ -4272,7 +4272,12 @@ int ObPLINS::init_complex_obj(ObIAllocator &allocator, const ObCollectionType *coll_type = static_cast(user_type); CK (OB_NOT_NULL(coll)); OX (set_allocator ? coll->set_allocator(&allocator) : coll->set_allocator(NULL)); - OX ((obj.is_ext() && obj.get_ext() != 0) ? (void)NULL : coll->set_inited()); + if (OB_FAIL(ret)) { + } else if (user_type->is_associative_array_type()) { + coll->set_inited(); + } else { + OX ((obj.is_ext() && obj.get_ext() != 0) ? (void)NULL : coll->set_inited()); + } OX (coll->set_type(pl_type.get_type())); OZ (get_element_data_type(pl_type, elem_desc, &allocator)); OZ (get_not_null(pl_type, not_null, &allocator)); diff --git a/src/pl/ob_pl_user_type.cpp b/src/pl/ob_pl_user_type.cpp index 261418d29a..a7a5bc47ea 100644 --- a/src/pl/ob_pl_user_type.cpp +++ b/src/pl/ob_pl_user_type.cpp @@ -1812,7 +1812,7 @@ int ObCollectionType::generate_construct(ObPLCodeGenerator &generator, OX (elem_desc.set_not_null(element_type_.get_not_null())); OZ (generator.store_elem_desc(elem_desc, element_type_ptr)); OZ (generator.extract_count_ptr_from_collection(value, count_ptr)); - OZ (generator.get_helper().create_istore(OB_INVALID_COUNT, count_ptr)); + OZ (generator.get_helper().create_istore(is_associative_array_type() ? 0 : OB_INVALID_COUNT, count_ptr)); OZ (generator.extract_first_ptr_from_collection(value, first_ptr)); OZ (generator.get_helper().create_istore(OB_INVALID_INDEX, first_ptr)); OZ (generator.extract_last_ptr_from_collection(value, last_ptr));