diff --git a/src/sql/code_generator/ob_static_engine_cg.cpp b/src/sql/code_generator/ob_static_engine_cg.cpp index 9697b3ec5e..352c6871ff 100644 --- a/src/sql/code_generator/ob_static_engine_cg.cpp +++ b/src/sql/code_generator/ob_static_engine_cg.cpp @@ -4154,6 +4154,10 @@ int ObStaticEngineCG::construct_hash_elements_for_connect_by(ObLogJoin &op, ObNL } else if (OB_ISNULL(left_op = op.get_child(0)) || OB_ISNULL(right_op = op.get_child(1))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("child op is null", K(ret)); + } else if (OB_FAIL(spec.hash_key_exprs_.init(op.get_other_join_conditions().count()))) { + LOG_WARN("failed to init hash key exprs", K(ret)); + } else if (OB_FAIL(spec.hash_probe_exprs_.init(op.get_other_join_conditions().count()))) { + LOG_WARN("failed to init hash probe exprs", K(ret)); } else { const ObRelIds &left_table_set = left_op->get_table_set(); const ObRelIds &right_table_set = right_op->get_table_set(); diff --git a/src/sql/engine/connect_by/ob_cnnt_by_pump.cpp b/src/sql/engine/connect_by/ob_cnnt_by_pump.cpp index 0e30128890..132f0fe569 100644 --- a/src/sql/engine/connect_by/ob_cnnt_by_pump.cpp +++ b/src/sql/engine/connect_by/ob_cnnt_by_pump.cpp @@ -602,17 +602,18 @@ void ObConnectByOpPump::ConnectByHashTable::reverse_bucket_cells() } } -int ObConnectByOpPump::calc_hash_value(const ObArray &hash_exprs, uint64_t &hash_value) +int ObConnectByOpPump::calc_hash_value(const ExprFixedArray &exprs, uint64_t &hash_value) { int ret = OB_SUCCESS; ObDatum *datum = NULL; hash_value = 0; - if (OB_ISNULL(eval_ctx_)) { + const ObIArray *hash_exprs = &exprs; + if (OB_ISNULL(hash_exprs) || OB_ISNULL(eval_ctx_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("eval ctx is null", K(ret)); } - for (int64_t i = 0; OB_SUCC(ret) && i < hash_exprs.count(); i++) { - ObExpr *hash_expr = hash_exprs.at(i); + for (int64_t i = 0; OB_SUCC(ret) && i < hash_exprs->count(); i++) { + ObExpr *hash_expr = hash_exprs->at(i); if (OB_ISNULL(hash_expr)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("hash probe expr is null", K(ret)); @@ -650,7 +651,7 @@ int ObConnectByOpPump::build_hash_table(ObIAllocator &alloc) hash_table_.all_cells_->reuse(); } HashTableCell **bucket_end_cell = NULL; - const ObArray &hash_key_exprs = + const ExprFixedArray &hash_key_exprs = (static_cast(connect_by_->get_spec())).hash_key_exprs_; if (OB_FAIL(ret)) { } else if (OB_UNLIKELY(0 == hash_key_exprs.count()) || OB_ISNULL(eval_ctx_)) { @@ -731,7 +732,7 @@ int ObConnectByOpPump::build_hash_table(ObIAllocator &alloc) } int ObConnectByOpPump::RowFetcher::init(ObConnectByOpPump &connect_by_pump, - const ObArray &hash_probe_exprs) + const ExprFixedArray &hash_probe_exprs) { int ret = OB_SUCCESS; use_hash_ = false; diff --git a/src/sql/engine/connect_by/ob_cnnt_by_pump.h b/src/sql/engine/connect_by/ob_cnnt_by_pump.h index e5580ed1c3..10a4021c28 100644 --- a/src/sql/engine/connect_by/ob_cnnt_by_pump.h +++ b/src/sql/engine/connect_by/ob_cnnt_by_pump.h @@ -165,7 +165,7 @@ private: ObChunkDatumStore::Iterator *iterator_; HashTableCell *tuple_; bool use_hash_; // tuple is valid if use_hash_ - int init(ObConnectByOpPump &connect_by_pump, const ObArray &hash_probe_exprs); + int init(ObConnectByOpPump &connect_by_pump, const ExprFixedArray &hash_probe_exprs); int get_next_row(const ObChunkDatumStore::StoredRow *&row); int get_next_row(const ObIArray &exprs, ObEvalCtx &eval_ctx); }; @@ -289,7 +289,7 @@ public: int get_top_pump_node(PumpNode *&node); int get_sys_path(uint64_t sys_connect_by_path_id, ObString &parent_path); int concat_sys_path(uint64_t sys_connect_by_path_id, const ObString &cur_path); - int calc_hash_value(const ObArray &hash_exprs, uint64_t &hash_value); + int calc_hash_value(const ExprFixedArray &exprs, uint64_t &hash_value); int build_hash_table(ObIAllocator &alloc); private: diff --git a/src/sql/engine/connect_by/ob_nl_cnnt_by_op.h b/src/sql/engine/connect_by/ob_nl_cnnt_by_op.h index 9a8e26c7d2..c123cc7fc5 100644 --- a/src/sql/engine/connect_by/ob_nl_cnnt_by_op.h +++ b/src/sql/engine/connect_by/ob_nl_cnnt_by_op.h @@ -121,10 +121,10 @@ class ObNLConnectBySpec : public ObNLConnectBySpecBase { OB_UNIS_VERSION_V(1); public: - common::ObArray hash_key_exprs_; - common::ObArray hash_probe_exprs_; + ExprFixedArray hash_key_exprs_; + ExprFixedArray hash_probe_exprs_; ObNLConnectBySpec(common::ObIAllocator &alloc, const ObPhyOperatorType type) - : ObNLConnectBySpecBase(alloc, type), hash_key_exprs_(), hash_probe_exprs_() + : ObNLConnectBySpecBase(alloc, type), hash_key_exprs_(alloc), hash_probe_exprs_(alloc) {} };